@pnp/cli-microsoft365 9.0.0-beta.d6b190a → 9.0.0-beta.e69e8d0

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 (95) hide show
  1. package/allCommands.json +1 -1
  2. package/allCommandsFull.json +1 -1
  3. package/dist/Auth.js +1 -1
  4. package/dist/config.js +1 -1
  5. package/dist/m365/app/commands/permission/permission-add.js +9 -9
  6. package/dist/m365/commands/status.js +2 -2
  7. package/dist/m365/connection/commands/connection-remove.js +6 -2
  8. package/dist/m365/connection/commands/connection-set.js +4 -1
  9. package/dist/m365/connection/commands/connection-use.js +25 -4
  10. package/dist/m365/entra/commands/enterpriseapp/enterpriseapp-add.js +13 -13
  11. package/dist/m365/entra/commands/enterpriseapp/enterpriseapp-get.js +18 -18
  12. package/dist/m365/entra/commands/enterpriseapp/enterpriseapp-list.js +1 -1
  13. package/dist/m365/entra/commands/group/group-user-list.js +4 -4
  14. package/dist/m365/entra/commands/m365group/m365group-conversation-post-list.js +4 -4
  15. package/dist/m365/entra/commands/m365group/m365group-recyclebinitem-list.js +3 -3
  16. package/dist/m365/entra/commands/m365group/m365group-user-add.js +109 -32
  17. package/dist/m365/entra/commands/m365group/m365group-user-list.js +6 -9
  18. package/dist/m365/entra/commands/m365group/m365group-user-set.js +159 -84
  19. package/dist/m365/entra/commands/multitenant/multitenant-add.js +65 -0
  20. package/dist/m365/entra/commands/multitenant/multitenant-remove.js +118 -0
  21. package/dist/m365/entra/commands/multitenant/multitenant-set.js +72 -0
  22. package/dist/m365/entra/commands.js +3 -0
  23. package/dist/m365/flow/commands/flow-get.js +1 -1
  24. package/dist/m365/outlook/commands/message/message-get.js +11 -11
  25. package/dist/m365/pa/commands/app/app-export.js +13 -7
  26. package/dist/m365/spfx/commands/project/DeployWorkflow.js +1 -1
  27. package/dist/m365/spfx/commands/project/project-github-workflow-add.js +1 -10
  28. package/dist/m365/spo/commands/file/file-copy.js +55 -34
  29. package/dist/m365/spo/commands/file/file-roleassignment-add.js +1 -1
  30. package/dist/m365/spo/commands/file/file-roleinheritance-break.js +1 -1
  31. package/dist/m365/spo/commands/file/file-roleinheritance-reset.js +1 -1
  32. package/dist/m365/spo/commands/folder/folder-retentionlabel-ensure.js +1 -1
  33. package/dist/m365/spo/commands/folder/folder-set.js +0 -4
  34. package/dist/m365/spo/commands/folder/folder-sharinglink-get.js +86 -0
  35. package/dist/m365/spo/commands/folder/folder-sharinglink-list.js +110 -0
  36. package/dist/m365/spo/commands/list/ListInstance.js +6 -1
  37. package/dist/m365/spo/commands/list/list-get.js +9 -3
  38. package/dist/m365/spo/commands/list/list-list.js +1 -4
  39. package/dist/m365/spo/commands/list/list-roleassignment-add.js +46 -21
  40. package/dist/m365/spo/commands/list/list-roleassignment-remove.js +48 -46
  41. package/dist/m365/spo/commands/site/site-appcatalog-remove.js +48 -24
  42. package/dist/m365/spo/commands/site/site-remove.js +1 -7
  43. package/dist/m365/spo/commands/tenant/tenant-recyclebinitem-restore.js +2 -22
  44. package/dist/m365/spo/commands.js +2 -1
  45. package/dist/utils/drive.js +61 -0
  46. package/dist/utils/spo.js +143 -6
  47. package/docs/docs/cmd/app/permission/permission-add.mdx +5 -5
  48. package/docs/docs/cmd/connection/connection-use.mdx +8 -2
  49. package/docs/docs/cmd/entra/enterpriseapp/enterpriseapp-add.mdx +12 -12
  50. package/docs/docs/cmd/entra/enterpriseapp/enterpriseapp-get.mdx +14 -14
  51. package/docs/docs/cmd/entra/enterpriseapp/enterpriseapp-list.mdx +5 -5
  52. package/docs/docs/cmd/entra/group/group-user-list.mdx +7 -7
  53. package/docs/docs/cmd/entra/m365group/m365group-conversation-post-list.mdx +5 -5
  54. package/docs/docs/cmd/entra/m365group/m365group-recyclebinitem-list.mdx +3 -3
  55. package/docs/docs/cmd/entra/m365group/m365group-user-add.mdx +28 -10
  56. package/docs/docs/cmd/entra/m365group/m365group-user-list.mdx +1 -1
  57. package/docs/docs/cmd/entra/m365group/m365group-user-set.mdx +35 -11
  58. package/docs/docs/cmd/entra/multitenant/multitenant-add.mdx +107 -0
  59. package/docs/docs/cmd/entra/multitenant/multitenant-remove.mdx +58 -0
  60. package/docs/docs/cmd/entra/multitenant/multitenant-set.mdx +53 -0
  61. package/docs/docs/cmd/flow/flow-get.mdx +149 -283
  62. package/docs/docs/cmd/outlook/message/message-get.mdx +5 -5
  63. package/docs/docs/cmd/pa/app/app-export.mdx +15 -9
  64. package/docs/docs/cmd/planner/plan/plan-remove.mdx +1 -1
  65. package/docs/docs/cmd/spe/containertype/containertype-list.mdx +24 -53
  66. package/docs/docs/cmd/spfx/project/project-github-workflow-add.mdx +11 -12
  67. package/docs/docs/cmd/spo/app/app-uninstall.mdx +1 -1
  68. package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-get.mdx +4 -4
  69. package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-list.mdx +4 -4
  70. package/docs/docs/cmd/spo/file/file-copy.mdx +119 -12
  71. package/docs/docs/cmd/spo/file/file-retentionlabel-ensure.mdx +1 -1
  72. package/docs/docs/cmd/spo/file/file-roleassignment-add.mdx +2 -2
  73. package/docs/docs/cmd/spo/file/file-roleassignment-remove.mdx +1 -1
  74. package/docs/docs/cmd/spo/file/file-roleinheritance-break.mdx +1 -1
  75. package/docs/docs/cmd/spo/file/file-roleinheritance-reset.mdx +1 -1
  76. package/docs/docs/cmd/spo/folder/folder-retentionlabel-ensure.mdx +2 -2
  77. package/docs/docs/cmd/spo/folder/folder-set.mdx +0 -6
  78. package/docs/docs/cmd/spo/folder/folder-sharinglink-get.mdx +110 -0
  79. package/docs/docs/cmd/spo/folder/folder-sharinglink-list.mdx +114 -0
  80. package/docs/docs/cmd/spo/list/list-get.mdx +6 -0
  81. package/docs/docs/cmd/spo/list/list-list.mdx +5 -7
  82. package/docs/docs/cmd/spo/list/list-roleassignment-add.mdx +15 -3
  83. package/docs/docs/cmd/spo/list/list-roleassignment-remove.mdx +15 -3
  84. package/docs/docs/cmd/spo/listitem/listitem-retentionlabel-ensure.mdx +4 -4
  85. package/docs/docs/cmd/spo/listitem/listitem-retentionlabel-remove.mdx +1 -1
  86. package/docs/docs/cmd/spo/listitem/listitem-roleassignment-add.mdx +9 -9
  87. package/docs/docs/cmd/spo/listitem/listitem-roleassignment-remove.mdx +7 -7
  88. package/docs/docs/cmd/spo/site/site-appcatalog-remove.mdx +11 -2
  89. package/docs/docs/cmd/spo/site/site-recyclebinitem-list.mdx +1 -1
  90. package/docs/docs/cmd/spo/site/site-remove.mdx +0 -3
  91. package/docs/docs/cmd/spo/tenant/tenant-recyclebinitem-restore.mdx +2 -49
  92. package/docs/docs/cmd/spo/web/web-roleassignment-add.mdx +1 -1
  93. package/docs/docs/cmd/spo/web/web-roleassignment-remove.mdx +1 -1
  94. package/npm-shrinkwrap.json +572 -477
  95. package/package.json +22 -22
@@ -0,0 +1,118 @@
1
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
+ };
6
+ var _EntraMultitenantRemoveCommand_instances, _EntraMultitenantRemoveCommand_initTelemetry, _EntraMultitenantRemoveCommand_initOptions;
7
+ import request from '../../../../request.js';
8
+ import GraphCommand from '../../../base/GraphCommand.js';
9
+ import commands from '../../commands.js';
10
+ import { odata } from '../../../../utils/odata.js';
11
+ import { cli } from '../../../../cli/cli.js';
12
+ class EntraMultitenantRemoveCommand extends GraphCommand {
13
+ get name() {
14
+ return commands.MULTITENANT_REMOVE;
15
+ }
16
+ get description() {
17
+ return 'Removes a multitenant organization';
18
+ }
19
+ constructor() {
20
+ super();
21
+ _EntraMultitenantRemoveCommand_instances.add(this);
22
+ __classPrivateFieldGet(this, _EntraMultitenantRemoveCommand_instances, "m", _EntraMultitenantRemoveCommand_initTelemetry).call(this);
23
+ __classPrivateFieldGet(this, _EntraMultitenantRemoveCommand_instances, "m", _EntraMultitenantRemoveCommand_initOptions).call(this);
24
+ }
25
+ async commandAction(logger, args) {
26
+ const removeMultitenantOrg = async () => {
27
+ try {
28
+ const tenantId = await this.getCurrentTenantId();
29
+ let tenantsId = await this.getAllTenantsIds();
30
+ const tenantsCount = tenantsId.length;
31
+ if (tenantsCount > 0) {
32
+ const tasks = tenantsId
33
+ .filter(x => x !== tenantId)
34
+ .map(t => this.removeTenant(logger, t));
35
+ await Promise.all(tasks);
36
+ do {
37
+ if (this.verbose) {
38
+ await logger.logToStderr(`Waiting 30 seconds...`);
39
+ }
40
+ await new Promise(resolve => setTimeout(resolve, 30000));
41
+ // from current behavior, removing tenant can take a few seconds
42
+ // current tenant must be removed once all previous ones were removed
43
+ if (this.verbose) {
44
+ await logger.logToStderr(`Checking all tenants were removed...`);
45
+ }
46
+ tenantsId = await this.getAllTenantsIds();
47
+ if (this.verbose) {
48
+ await logger.logToStderr(`Number of removed tenants: ${tenantsCount - tenantsId.length}`);
49
+ }
50
+ } while (tenantsId.length !== 1);
51
+ // current tenant must be removed as the last one
52
+ await this.removeTenant(logger, tenantId);
53
+ await logger.logToStderr('Your Multi-Tenant organization is being removed. This can take up to 2 hours.');
54
+ }
55
+ }
56
+ catch (err) {
57
+ this.handleRejectedODataJsonPromise(err);
58
+ }
59
+ };
60
+ if (args.options.force) {
61
+ await removeMultitenantOrg();
62
+ }
63
+ else {
64
+ const result = await cli.promptForConfirmation({ message: 'Are you sure you want to remove multitenant organization?' });
65
+ if (result) {
66
+ await removeMultitenantOrg();
67
+ }
68
+ }
69
+ }
70
+ async getAllTenantsIds() {
71
+ const requestOptions = {
72
+ url: `${this.resource}/v1.0/tenantRelationships/multiTenantOrganization/tenants?$select=tenantId`,
73
+ headers: {
74
+ accept: 'application/json;odata.metadata=none'
75
+ },
76
+ responseType: 'json'
77
+ };
78
+ const tenants = await odata.getAllItems(requestOptions);
79
+ return tenants.map(x => x.tenantId);
80
+ }
81
+ async getCurrentTenantId() {
82
+ const requestOptions = {
83
+ url: `${this.resource}/v1.0/organization?$select=id`,
84
+ headers: {
85
+ accept: 'application/json;odata.metadata=none'
86
+ },
87
+ responseType: 'json'
88
+ };
89
+ const organizations = await odata.getAllItems(requestOptions);
90
+ return organizations[0].id;
91
+ }
92
+ async removeTenant(logger, tenantId) {
93
+ if (this.verbose) {
94
+ await logger.logToStderr(`Removing tenant: ${tenantId}`);
95
+ }
96
+ const requestOptions = {
97
+ url: `${this.resource}/v1.0/tenantRelationships/multiTenantOrganization/tenants/${tenantId}`,
98
+ headers: {
99
+ accept: 'application/json;odata.metadata=none'
100
+ },
101
+ responseType: 'json'
102
+ };
103
+ await request.delete(requestOptions);
104
+ }
105
+ }
106
+ _EntraMultitenantRemoveCommand_instances = new WeakSet(), _EntraMultitenantRemoveCommand_initTelemetry = function _EntraMultitenantRemoveCommand_initTelemetry() {
107
+ this.telemetry.push((args) => {
108
+ Object.assign(this.telemetryProperties, {
109
+ force: !!args.options.force
110
+ });
111
+ });
112
+ }, _EntraMultitenantRemoveCommand_initOptions = function _EntraMultitenantRemoveCommand_initOptions() {
113
+ this.options.unshift({
114
+ option: '-f, --force'
115
+ });
116
+ };
117
+ export default new EntraMultitenantRemoveCommand();
118
+ //# sourceMappingURL=multitenant-remove.js.map
@@ -0,0 +1,72 @@
1
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
+ };
6
+ var _EntraMultitenantSetCommand_instances, _EntraMultitenantSetCommand_initTelemetry, _EntraMultitenantSetCommand_initOptions, _EntraMultitenantSetCommand_initValidators, _EntraMultitenantSetCommand_initTypes;
7
+ import request from '../../../../request.js';
8
+ import GraphCommand from '../../../base/GraphCommand.js';
9
+ import commands from '../../commands.js';
10
+ class EntraMultitenantSetCommand extends GraphCommand {
11
+ get name() {
12
+ return commands.MULTITENANT_SET;
13
+ }
14
+ get description() {
15
+ return 'Updates the properties of a multitenant organization';
16
+ }
17
+ constructor() {
18
+ super();
19
+ _EntraMultitenantSetCommand_instances.add(this);
20
+ __classPrivateFieldGet(this, _EntraMultitenantSetCommand_instances, "m", _EntraMultitenantSetCommand_initTelemetry).call(this);
21
+ __classPrivateFieldGet(this, _EntraMultitenantSetCommand_instances, "m", _EntraMultitenantSetCommand_initOptions).call(this);
22
+ __classPrivateFieldGet(this, _EntraMultitenantSetCommand_instances, "m", _EntraMultitenantSetCommand_initValidators).call(this);
23
+ __classPrivateFieldGet(this, _EntraMultitenantSetCommand_instances, "m", _EntraMultitenantSetCommand_initTypes).call(this);
24
+ }
25
+ async commandAction(logger, args) {
26
+ if (this.verbose) {
27
+ await logger.logToStderr('Updating multitenant organization...');
28
+ }
29
+ const requestOptions = {
30
+ url: `${this.resource}/v1.0/tenantRelationships/multiTenantOrganization`,
31
+ headers: {
32
+ accept: 'application/json;odata.metadata=none'
33
+ },
34
+ responseType: 'json',
35
+ data: {
36
+ description: args.options.description,
37
+ displayName: args.options.displayName
38
+ }
39
+ };
40
+ try {
41
+ await request.patch(requestOptions);
42
+ }
43
+ catch (err) {
44
+ this.handleRejectedODataJsonPromise(err);
45
+ }
46
+ }
47
+ }
48
+ _EntraMultitenantSetCommand_instances = new WeakSet(), _EntraMultitenantSetCommand_initTelemetry = function _EntraMultitenantSetCommand_initTelemetry() {
49
+ this.telemetry.push((args) => {
50
+ Object.assign(this.telemetryProperties, {
51
+ displayName: typeof args.options.displayName !== 'undefined',
52
+ description: typeof args.options.description !== 'undefined'
53
+ });
54
+ });
55
+ }, _EntraMultitenantSetCommand_initOptions = function _EntraMultitenantSetCommand_initOptions() {
56
+ this.options.unshift({
57
+ option: '-n, --displayName [displayName]'
58
+ }, {
59
+ option: '-d, --description [description]'
60
+ });
61
+ }, _EntraMultitenantSetCommand_initValidators = function _EntraMultitenantSetCommand_initValidators() {
62
+ this.validators.push(async (args) => {
63
+ if (!args.options.displayName && !args.options.description) {
64
+ return 'Specify either displayName or description or both.';
65
+ }
66
+ return true;
67
+ });
68
+ }, _EntraMultitenantSetCommand_initTypes = function _EntraMultitenantSetCommand_initTypes() {
69
+ this.types.string.push('displayName', 'description');
70
+ };
71
+ export default new EntraMultitenantSetCommand();
72
+ //# sourceMappingURL=multitenant-set.js.map
@@ -72,7 +72,10 @@ export default {
72
72
  M365GROUP_USER_LIST: `${prefix} m365group user list`,
73
73
  M365GROUP_USER_REMOVE: `${prefix} m365group user remove`,
74
74
  M365GROUP_USER_SET: `${prefix} m365group user set`,
75
+ MULTITENANT_ADD: `${prefix} multitenant add`,
75
76
  MULTITENANT_GET: `${prefix} multitenant get`,
77
+ MULTITENANT_REMOVE: `${prefix} multitenant remove`,
78
+ MULTITENANT_SET: `${prefix} multitenant set`,
76
79
  OAUTH2GRANT_ADD: `${prefix} oauth2grant add`,
77
80
  OAUTH2GRANT_LIST: `${prefix} oauth2grant list`,
78
81
  OAUTH2GRANT_REMOVE: `${prefix} oauth2grant remove`,
@@ -29,7 +29,7 @@ class FlowGetCommand extends PowerAutomateCommand {
29
29
  await logger.logToStderr(`Retrieving information about Microsoft Flow ${args.options.name}...`);
30
30
  }
31
31
  const requestOptions = {
32
- url: `${this.resource}/providers/Microsoft.ProcessSimple/${args.options.asAdmin ? 'scopes/admin/' : ''}environments/${formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting.encodeQueryParameter(args.options.name)}?api-version=2016-11-01`,
32
+ url: `${this.resource}/providers/Microsoft.ProcessSimple/${args.options.asAdmin ? 'scopes/admin/' : ''}environments/${formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting.encodeQueryParameter(args.options.name)}?api-version=2016-11-01&$expand=swagger,properties.connectionreferences.apidefinition,properties.definitionsummary.operations.apioperation,operationDefinition,plan,properties.throttleData,properties.estimatedsuspensiondata,properties.licenseData`,
33
33
  headers: {
34
34
  accept: 'application/json'
35
35
  },
@@ -30,20 +30,20 @@ class OutlookMessageGetCommand extends GraphCommand {
30
30
  }
31
31
  let requestUrl = '';
32
32
  if (isAppOnlyAccessToken) {
33
- if (!args.options.userId && !args.options.userPrincipalName) {
34
- throw `The option 'userId' or 'userPrincipalName' is required when retrieving an email using app only credentials`;
33
+ if (!args.options.userId && !args.options.userName) {
34
+ throw `The option 'userId' or 'userName' is required when retrieving an email using app only credentials`;
35
35
  }
36
- if (args.options.userId && args.options.userPrincipalName) {
37
- throw `Both options 'userId' and 'userPrincipalName' cannot be set when retrieving an email using app only credentials`;
36
+ if (args.options.userId && args.options.userName) {
37
+ throw `Both options 'userId' and 'userName' cannot be set when retrieving an email using app only credentials`;
38
38
  }
39
- requestUrl += `users/${args.options.userId ? args.options.userId : args.options.userPrincipalName}`;
39
+ requestUrl += `users/${args.options.userId ? args.options.userId : args.options.userName}`;
40
40
  }
41
41
  else {
42
- if (args.options.userId && args.options.userPrincipalName) {
43
- throw `Both options 'userId' and 'userPrincipalName' cannot be set when retrieving an email using delegated credentials`;
42
+ if (args.options.userId && args.options.userName) {
43
+ throw `Both options 'userId' and 'userName' cannot be set when retrieving an email using delegated credentials`;
44
44
  }
45
- if (args.options.userId || args.options.userPrincipalName) {
46
- requestUrl += `users/${args.options.userId ? args.options.userId : args.options.userPrincipalName}`;
45
+ if (args.options.userId || args.options.userName) {
46
+ requestUrl += `users/${args.options.userId ? args.options.userId : args.options.userName}`;
47
47
  }
48
48
  else {
49
49
  requestUrl += 'me';
@@ -69,7 +69,7 @@ _OutlookMessageGetCommand_instances = new WeakSet(), _OutlookMessageGetCommand_i
69
69
  this.telemetry.push((args) => {
70
70
  Object.assign(this.telemetryProperties, {
71
71
  userId: typeof args.options.userId !== 'undefined',
72
- userPrincipalName: typeof args.options.userPrincipalName !== 'undefined'
72
+ userName: typeof args.options.userName !== 'undefined'
73
73
  });
74
74
  });
75
75
  }, _OutlookMessageGetCommand_initOptions = function _OutlookMessageGetCommand_initOptions() {
@@ -78,7 +78,7 @@ _OutlookMessageGetCommand_instances = new WeakSet(), _OutlookMessageGetCommand_i
78
78
  }, {
79
79
  option: '--userId [userId]'
80
80
  }, {
81
- option: '--userPrincipalName [userPrincipalName]'
81
+ option: '--userName [userName]'
82
82
  });
83
83
  };
84
84
  export default new OutlookMessageGetCommand();
@@ -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 _PaAppExportCommand_instances, _PaAppExportCommand_initTelemetry, _PaAppExportCommand_initOptions, _PaAppExportCommand_initValidators;
6
+ var _PaAppExportCommand_instances, _PaAppExportCommand_initTelemetry, _PaAppExportCommand_initOptions, _PaAppExportCommand_initValidators, _PaAppExportCommand_initTypes;
7
7
  import fs from 'fs';
8
8
  import path from 'path';
9
9
  import { setTimeout } from 'timers/promises';
@@ -26,14 +26,18 @@ class PaAppExportCommand extends PowerPlatformCommand {
26
26
  __classPrivateFieldGet(this, _PaAppExportCommand_instances, "m", _PaAppExportCommand_initTelemetry).call(this);
27
27
  __classPrivateFieldGet(this, _PaAppExportCommand_instances, "m", _PaAppExportCommand_initOptions).call(this);
28
28
  __classPrivateFieldGet(this, _PaAppExportCommand_instances, "m", _PaAppExportCommand_initValidators).call(this);
29
+ __classPrivateFieldGet(this, _PaAppExportCommand_instances, "m", _PaAppExportCommand_initTypes).call(this);
29
30
  }
30
31
  async commandAction(logger, args) {
31
32
  try {
32
33
  const location = await this.exportPackage(args, logger);
33
- const packageLink = await this.getPackageLink(args, logger, location);
34
- //Replace all illegal characters from the file name
35
- const illegalCharsRegEx = /[\\\/:*?"<>|]/g;
36
- const filename = args.options.packageDisplayName.replace(illegalCharsRegEx, '_');
34
+ const packageLink = await this.getPackageLink(logger, location);
35
+ let filename = args.options.name;
36
+ if (args.options.packageDisplayName) {
37
+ //Replace all illegal characters from the file name
38
+ const illegalCharsRegEx = /[\\\/:*?"<>|]/g;
39
+ filename = args.options.packageDisplayName.replace(illegalCharsRegEx, '_');
40
+ }
37
41
  const requestOptions = {
38
42
  url: packageLink,
39
43
  // Set responseType to arraybuffer, otherwise binary data will be encoded
@@ -98,7 +102,7 @@ class PaAppExportCommand extends PowerPlatformCommand {
98
102
  details: {
99
103
  creator: args.options.packageCreatedBy,
100
104
  description: args.options.packageDescription,
101
- displayName: args.options.packageDisplayName,
105
+ displayName: args.options.packageDisplayName || args.options.name,
102
106
  sourceEnvironment: args.options.packageSourceEnvironment
103
107
  },
104
108
  resources: resources
@@ -108,7 +112,7 @@ class PaAppExportCommand extends PowerPlatformCommand {
108
112
  const response = await request.post(requestOptions);
109
113
  return response.headers.location;
110
114
  }
111
- async getPackageLink(args, logger, location) {
115
+ async getPackageLink(logger, location) {
112
116
  if (this.verbose) {
113
117
  await logger.logToStderr('Retrieving the package link and waiting on the exported package.');
114
118
  }
@@ -172,6 +176,8 @@ _PaAppExportCommand_instances = new WeakSet(), _PaAppExportCommand_initTelemetry
172
176
  }
173
177
  return true;
174
178
  });
179
+ }, _PaAppExportCommand_initTypes = function _PaAppExportCommand_initTypes() {
180
+ this.types.string.push('name', 'environmentName', 'packageDisplayName', 'packageDescription', 'packageCreatedBy', 'packageSourceEnvironment', 'path');
175
181
  };
176
182
  export default new PaAppExportCommand();
177
183
  //# sourceMappingURL=app-export.js.map
@@ -46,7 +46,7 @@ export const workflow = {
46
46
  with: {
47
47
  "APP_FILE_PATH": "sharepoint/solution/{{ solutionName }}.sppkg",
48
48
  "SKIP_FEATURE_DEPLOYMENT": false,
49
- "OVERWRITE": false
49
+ "OVERWRITE": true
50
50
  }
51
51
  }
52
52
  ]
@@ -33,9 +33,6 @@ class SpfxProjectGithubWorkflowAddCommand extends BaseProjectCommand {
33
33
  if (this.projectRootPath === null) {
34
34
  throw new CommandError(`Couldn't find project root folder`, _a.ERROR_NO_PROJECT_ROOT_FOLDER);
35
35
  }
36
- if (!args.options.overwrite) {
37
- await this.warn(logger, `We recommend always using the --overwrite option and it will become the default behavior in next major release. Overwriting your sppkg file on every deployment is required to make continuous delivery of the latest version of your app which is the aim of the continuous delivery pipeline.`);
38
- }
39
36
  const solutionPackageJsonFile = path.join(this.projectRootPath, 'package.json');
40
37
  const packageJson = fs.readFileSync(solutionPackageJsonFile, 'utf-8');
41
38
  const solutionName = JSON.parse(packageJson).name;
@@ -81,9 +78,6 @@ class SpfxProjectGithubWorkflowAddCommand extends BaseProjectCommand {
81
78
  if (options.skipFeatureDeployment) {
82
79
  this.getDeployAction(workflow).with.SKIP_FEATURE_DEPLOYMENT = true;
83
80
  }
84
- if (options.overwrite) {
85
- this.getDeployAction(workflow).with.OVERWRITE = true;
86
- }
87
81
  if (options.loginMethod === 'user') {
88
82
  const loginAction = this.getLoginAction(workflow);
89
83
  loginAction.with = {
@@ -125,8 +119,7 @@ _a = SpfxProjectGithubWorkflowAddCommand, _SpfxProjectGithubWorkflowAddCommand_i
125
119
  manuallyTrigger: !!args.options.manuallyTrigger,
126
120
  loginMethod: typeof args.options.loginMethod !== 'undefined',
127
121
  scope: typeof args.options.scope !== 'undefined',
128
- skipFeatureDeployment: !!args.options.skipFeatureDeployment,
129
- overwrite: !!args.options.overwrite
122
+ skipFeatureDeployment: !!args.options.skipFeatureDeployment
130
123
  });
131
124
  });
132
125
  }, _SpfxProjectGithubWorkflowAddCommand_initOptions = function _SpfxProjectGithubWorkflowAddCommand_initOptions() {
@@ -146,8 +139,6 @@ _a = SpfxProjectGithubWorkflowAddCommand, _SpfxProjectGithubWorkflowAddCommand_i
146
139
  option: '-u, --siteUrl [siteUrl]'
147
140
  }, {
148
141
  option: '--skipFeatureDeployment'
149
- }, {
150
- option: '--overwrite'
151
142
  });
152
143
  }, _SpfxProjectGithubWorkflowAddCommand_initValidators = function _SpfxProjectGithubWorkflowAddCommand_initValidators() {
153
144
  this.validators.push(async (args) => {
@@ -5,6 +5,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
5
5
  };
6
6
  var _SpoFileCopyCommand_instances, _SpoFileCopyCommand_initTelemetry, _SpoFileCopyCommand_initOptions, _SpoFileCopyCommand_initValidators, _SpoFileCopyCommand_initOptionSets, _SpoFileCopyCommand_initTypes;
7
7
  import request from '../../../../request.js';
8
+ import { CreateCopyJobsNameConflictBehavior, spo } from '../../../../utils/spo.js';
8
9
  import { urlUtil } from '../../../../utils/urlUtil.js';
9
10
  import { validation } from '../../../../utils/validation.js';
10
11
  import SpoCommand from '../../../base/SpoCommand.js';
@@ -30,39 +31,43 @@ class SpoFileCopyCommand extends SpoCommand {
30
31
  try {
31
32
  const sourceServerRelativePath = await this.getSourcePath(logger, args.options);
32
33
  const sourcePath = this.getAbsoluteUrl(args.options.webUrl, sourceServerRelativePath);
33
- let destinationPath = this.getAbsoluteUrl(args.options.webUrl, args.options.targetUrl) + '/';
34
- if (args.options.newName) {
35
- destinationPath += args.options.newName;
34
+ const destinationPath = this.getAbsoluteUrl(args.options.webUrl, args.options.targetUrl);
35
+ if (this.verbose) {
36
+ await logger.logToStderr(`Copying file '${sourceServerRelativePath}' to '${args.options.targetUrl}'...`);
37
+ }
38
+ let newName = args.options.newName;
39
+ // Add original file extension if not provided
40
+ if (newName && !newName.includes('.')) {
41
+ newName += sourceServerRelativePath.substring(sourceServerRelativePath.lastIndexOf('.'));
36
42
  }
37
- else {
38
- // Keep the original file name
39
- destinationPath += sourcePath.substring(sourcePath.lastIndexOf('/') + 1);
43
+ const copyJobResponse = await spo.createCopyJob(args.options.webUrl, sourcePath, destinationPath, {
44
+ nameConflictBehavior: this.getNameConflictBehaviorValue(args.options.nameConflictBehavior),
45
+ bypassSharedLock: !!args.options.bypassSharedLock,
46
+ ignoreVersionHistory: !!args.options.ignoreVersionHistory,
47
+ newName: newName
48
+ });
49
+ if (args.options.skipWait) {
50
+ return;
40
51
  }
41
52
  if (this.verbose) {
42
- await logger.logToStderr(`Copying file '${sourcePath}' to '${destinationPath}'...`);
53
+ await logger.logToStderr('Waiting for the copy job to complete...');
43
54
  }
55
+ const copyJobResult = await spo.getCopyJobResult(args.options.webUrl, copyJobResponse);
56
+ if (this.verbose) {
57
+ await logger.logToStderr('Getting information about the destination file...');
58
+ }
59
+ // Get destination file data
60
+ const siteRelativeDestinationFolder = '/' + copyJobResult.TargetObjectSiteRelativeUrl.substring(0, copyJobResult.TargetObjectSiteRelativeUrl.lastIndexOf('/'));
61
+ const absoluteWebUrl = destinationPath.substring(0, destinationPath.toLowerCase().lastIndexOf(siteRelativeDestinationFolder.toLowerCase()));
44
62
  const requestOptions = {
45
- url: `${args.options.webUrl}/_api/SP.MoveCopyUtil.CopyFileByPath`,
63
+ url: `${absoluteWebUrl}/_api/Web/GetFileById('${copyJobResult.TargetObjectUniqueId}')`,
46
64
  headers: {
47
65
  accept: 'application/json;odata=nometadata'
48
66
  },
49
- responseType: 'json',
50
- data: {
51
- srcPath: {
52
- DecodedUrl: sourcePath
53
- },
54
- destPath: {
55
- DecodedUrl: destinationPath
56
- },
57
- overwrite: args.options.nameConflictBehavior === 'replace',
58
- options: {
59
- KeepBoth: args.options.nameConflictBehavior === 'rename',
60
- ResetAuthorAndCreatedOnCopy: !!args.options.resetAuthorAndCreated,
61
- ShouldBypassSharedLocks: !!args.options.bypassSharedLock
62
- }
63
- }
67
+ responseType: 'json'
64
68
  };
65
- await request.post(requestOptions);
69
+ const destinationFile = await request.get(requestOptions);
70
+ await logger.log(destinationFile);
66
71
  }
67
72
  catch (err) {
68
73
  this.handleRejectedODataJsonPromise(err);
@@ -76,17 +81,30 @@ class SpoFileCopyCommand extends SpoCommand {
76
81
  await logger.logToStderr(`Retrieving server-relative path for file with ID '${options.sourceId}'...`);
77
82
  }
78
83
  const requestOptions = {
79
- url: `${options.webUrl}/_api/Web/GetFileById('${options.sourceId}')?$select=ServerRelativePath`,
84
+ url: `${options.webUrl}/_api/Web/GetFileById('${options.sourceId}')/ServerRelativePath`,
80
85
  headers: {
81
86
  accept: 'application/json;odata=nometadata'
82
87
  },
83
88
  responseType: 'json'
84
89
  };
85
90
  const file = await request.get(requestOptions);
86
- return file.ServerRelativePath.DecodedUrl;
91
+ return file.DecodedUrl;
92
+ }
93
+ getNameConflictBehaviorValue(nameConflictBehavior) {
94
+ switch (nameConflictBehavior?.toLowerCase()) {
95
+ case 'fail':
96
+ return CreateCopyJobsNameConflictBehavior.Fail;
97
+ case 'replace':
98
+ return CreateCopyJobsNameConflictBehavior.Replace;
99
+ case 'rename':
100
+ return CreateCopyJobsNameConflictBehavior.Rename;
101
+ default:
102
+ return CreateCopyJobsNameConflictBehavior.Fail;
103
+ }
87
104
  }
88
105
  getAbsoluteUrl(webUrl, url) {
89
- return url.startsWith('https://') ? url : urlUtil.getAbsoluteUrl(webUrl, url);
106
+ const result = url.startsWith('https://') ? url : urlUtil.getAbsoluteUrl(webUrl, url);
107
+ return urlUtil.removeTrailingSlashes(result);
90
108
  }
91
109
  }
92
110
  _SpoFileCopyCommand_instances = new WeakSet(), _SpoFileCopyCommand_initTelemetry = function _SpoFileCopyCommand_initTelemetry() {
@@ -95,9 +113,10 @@ _SpoFileCopyCommand_instances = new WeakSet(), _SpoFileCopyCommand_initTelemetry
95
113
  sourceUrl: typeof args.options.sourceUrl !== 'undefined',
96
114
  sourceId: typeof args.options.sourceId !== 'undefined',
97
115
  newName: typeof args.options.newName !== 'undefined',
98
- nameConflictBehavior: args.options.nameConflictBehavior || false,
99
- resetAuthorAndCreated: !!args.options.resetAuthorAndCreated,
100
- bypassSharedLock: !!args.options.bypassSharedLock
116
+ nameConflictBehavior: typeof args.options.nameConflictBehavior !== 'undefined',
117
+ ignoreVersionHistory: !!args.options.ignoreVersionHistory,
118
+ bypassSharedLock: !!args.options.bypassSharedLock,
119
+ skipWait: !!args.options.skipWait
101
120
  });
102
121
  });
103
122
  }, _SpoFileCopyCommand_initOptions = function _SpoFileCopyCommand_initOptions() {
@@ -114,10 +133,12 @@ _SpoFileCopyCommand_instances = new WeakSet(), _SpoFileCopyCommand_initTelemetry
114
133
  }, {
115
134
  option: '--nameConflictBehavior [nameConflictBehavior]',
116
135
  autocomplete: this.nameConflictBehaviorOptions
117
- }, {
118
- option: '--resetAuthorAndCreated'
119
136
  }, {
120
137
  option: '--bypassSharedLock'
138
+ }, {
139
+ option: '--ignoreVersionHistory'
140
+ }, {
141
+ option: '--skipWait'
121
142
  });
122
143
  }, _SpoFileCopyCommand_initValidators = function _SpoFileCopyCommand_initValidators() {
123
144
  this.validators.push(async (args) => {
@@ -128,7 +149,7 @@ _SpoFileCopyCommand_instances = new WeakSet(), _SpoFileCopyCommand_initTelemetry
128
149
  if (args.options.sourceId && !validation.isValidGuid(args.options.sourceId)) {
129
150
  return `${args.options.sourceId} is not a valid GUID for sourceId.`;
130
151
  }
131
- if (args.options.nameConflictBehavior && this.nameConflictBehaviorOptions.indexOf(args.options.nameConflictBehavior) === -1) {
152
+ if (args.options.nameConflictBehavior && !this.nameConflictBehaviorOptions.includes(args.options.nameConflictBehavior.toLowerCase())) {
132
153
  return `${args.options.nameConflictBehavior} is not a valid nameConflictBehavior value. Allowed values: ${this.nameConflictBehaviorOptions.join(', ')}.`;
133
154
  }
134
155
  return true;
@@ -137,7 +158,7 @@ _SpoFileCopyCommand_instances = new WeakSet(), _SpoFileCopyCommand_initTelemetry
137
158
  this.optionSets.push({ options: ['sourceUrl', 'sourceId'] });
138
159
  }, _SpoFileCopyCommand_initTypes = function _SpoFileCopyCommand_initTypes() {
139
160
  this.types.string.push('webUrl', 'sourceUrl', 'sourceId', 'targetUrl', 'newName', 'nameConflictBehavior');
140
- this.types.boolean.push('resetAuthorAndCreated', 'bypassSharedLock');
161
+ this.types.boolean.push('bypassSharedLock', 'ignoreVersionHistory', 'skipWait');
141
162
  };
142
163
  export default new SpoFileCopyCommand();
143
164
  //# sourceMappingURL=file-copy.js.map
@@ -140,7 +140,7 @@ _SpoFileRoleAssignmentAddCommand_instances = new WeakSet(), _SpoFileRoleAssignme
140
140
  }, {
141
141
  option: '--fileUrl [fileUrl]'
142
142
  }, {
143
- option: 'i, --fileId [fileId]'
143
+ option: '-i, --fileId [fileId]'
144
144
  }, {
145
145
  option: '--principalId [principalId]'
146
146
  }, {
@@ -90,7 +90,7 @@ _SpoFileRoleInheritanceBreakCommand_instances = new WeakSet(), _SpoFileRoleInher
90
90
  }, {
91
91
  option: '--fileUrl [fileUrl]'
92
92
  }, {
93
- option: 'i, --fileId [fileId]'
93
+ option: '-i, --fileId [fileId]'
94
94
  }, {
95
95
  option: '-c, --clearExistingPermissions'
96
96
  }, {
@@ -88,7 +88,7 @@ _SpoFileRoleInheritanceResetCommand_instances = new WeakSet(), _SpoFileRoleInher
88
88
  }, {
89
89
  option: '--fileUrl [fileUrl]'
90
90
  }, {
91
- option: 'i, --fileId [fileId]'
91
+ option: '-i, --fileId [fileId]'
92
92
  }, {
93
93
  option: '-f, --force'
94
94
  });
@@ -83,7 +83,7 @@ _SpoFolderRetentionLabelEnsureCommand_instances = new WeakSet(), _SpoFolderReten
83
83
  }, {
84
84
  option: '--folderUrl [folderUrl]'
85
85
  }, {
86
- option: 'i, --folderId [folderId]'
86
+ option: '-i, --folderId [folderId]'
87
87
  });
88
88
  }, _SpoFolderRetentionLabelEnsureCommand_initValidators = function _SpoFolderRetentionLabelEnsureCommand_initValidators() {
89
89
  this.validators.push(async (args) => {
@@ -18,9 +18,6 @@ class SpoFolderSetCommand extends SpoCommand {
18
18
  get description() {
19
19
  return 'Updates a folder';
20
20
  }
21
- alias() {
22
- return [commands.FOLDER_RENAME];
23
- }
24
21
  constructor() {
25
22
  super();
26
23
  _SpoFolderSetCommand_instances.add(this);
@@ -34,7 +31,6 @@ class SpoFolderSetCommand extends SpoCommand {
34
31
  }
35
32
  async commandAction(logger, args) {
36
33
  try {
37
- await this.showDeprecationWarning(logger, this.alias()[0], this.name);
38
34
  if (this.verbose) {
39
35
  await logger.logToStderr(`Updating folder '${args.options.name}'...`);
40
36
  }