@pnp/cli-microsoft365 6.11.0-beta.ee225fb → 6.11.0

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 (136) hide show
  1. package/dist/Auth.js +2 -1
  2. package/dist/Command.js +1 -1
  3. package/dist/m365/pa/commands/app/app-permission-ensure.js +177 -0
  4. package/dist/m365/pa/commands/app/app-permission-remove.js +170 -0
  5. package/dist/m365/pa/commands.js +2 -0
  6. package/dist/m365/planner/commands/task/task-add.js +17 -11
  7. package/dist/m365/planner/commands/task/task-get.js +35 -25
  8. package/dist/m365/planner/commands/task/task-list.js +26 -19
  9. package/dist/m365/planner/commands/task/task-remove.js +40 -35
  10. package/dist/m365/planner/commands/task/task-set.js +35 -23
  11. package/dist/m365/spfx/commands/project/DeployWorkflow.js +58 -0
  12. package/dist/m365/spfx/commands/project/project-doctor/{doctor-1.18.0-beta.1.js → doctor-1.18.0-beta.5.js} +1 -1
  13. package/dist/m365/spfx/commands/project/project-doctor.js +1 -1
  14. package/dist/m365/spfx/commands/project/project-externalize/rules/PnPJsRule.js +34 -23
  15. package/dist/m365/spfx/commands/project/project-github-workflow-add.js +171 -0
  16. package/dist/m365/spfx/commands/project/project-github-workflow-model.js +3 -0
  17. package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.15.2.js +1 -1
  18. package/dist/m365/spfx/commands/project/project-upgrade/{upgrade-1.18.0-beta.1.js → upgrade-1.18.0-beta.5.js} +26 -26
  19. package/dist/m365/spfx/commands/project/project-upgrade.js +1 -1
  20. package/dist/m365/spfx/commands/spfx-doctor.js +35 -51
  21. package/dist/m365/spfx/commands.js +1 -0
  22. package/dist/m365/spo/commands/app/SpoAppBaseCommand.js +26 -14
  23. package/dist/m365/spo/commands/app/app-add.js +9 -9
  24. package/dist/m365/spo/commands/file/file-add.js +13 -13
  25. package/dist/m365/spo/commands/file/file-checkin.js +1 -1
  26. package/dist/m365/spo/commands/file/file-checkout.js +1 -1
  27. package/dist/m365/spo/commands/file/file-copy.js +38 -4
  28. package/dist/m365/spo/commands/file/file-list.js +4 -4
  29. package/dist/m365/spo/commands/file/file-move.js +2 -2
  30. package/dist/m365/spo/commands/file/file-remove.js +6 -6
  31. package/dist/m365/spo/commands/file/file-rename.js +2 -2
  32. package/dist/m365/spo/commands/file/file-retentionlabel-ensure.js +1 -1
  33. package/dist/m365/spo/commands/file/file-retentionlabel-remove.js +1 -1
  34. package/dist/m365/spo/commands/file/file-roleassignment-add.js +1 -1
  35. package/dist/m365/spo/commands/file/file-roleassignment-remove.js +1 -1
  36. package/dist/m365/spo/commands/file/file-roleinheritance-break.js +1 -1
  37. package/dist/m365/spo/commands/file/file-roleinheritance-reset.js +1 -1
  38. package/dist/m365/spo/commands/file/file-version-clear.js +1 -1
  39. package/dist/m365/spo/commands/file/file-version-get.js +1 -1
  40. package/dist/m365/spo/commands/file/file-version-list.js +1 -1
  41. package/dist/m365/spo/commands/file/file-version-remove.js +1 -1
  42. package/dist/m365/spo/commands/file/file-version-restore.js +1 -1
  43. package/dist/m365/spo/commands/folder/folder-add.js +2 -4
  44. package/dist/m365/spo/commands/folder/folder-get.js +1 -1
  45. package/dist/m365/spo/commands/folder/folder-list.js +2 -2
  46. package/dist/m365/spo/commands/folder/folder-remove.js +7 -4
  47. package/dist/m365/spo/commands/folder/folder-rename.js +13 -17
  48. package/dist/m365/spo/commands/folder/folder-retentionlabel-ensure.js +1 -1
  49. package/dist/m365/spo/commands/folder/folder-retentionlabel-remove.js +1 -1
  50. package/dist/m365/spo/commands/folder/folder-roleassignment-add.js +1 -1
  51. package/dist/m365/spo/commands/folder/folder-roleassignment-remove.js +1 -1
  52. package/dist/m365/spo/commands/folder/folder-roleinheritance-break.js +1 -1
  53. package/dist/m365/spo/commands/folder/folder-roleinheritance-reset.js +1 -1
  54. package/dist/m365/spo/commands/group/group-list.js +0 -1
  55. package/dist/m365/spo/commands/orgassetslibrary/orgassetslibrary-add.js +32 -3
  56. package/dist/m365/spo/commands/page/Page.js +24 -32
  57. package/dist/m365/spo/commands/propertybag/propertybag-base.js +75 -54
  58. package/dist/m365/spo/commands/propertybag/propertybag-remove.js +41 -40
  59. package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-set.js +32 -32
  60. package/dist/m365/spo/commands/site/FlowsPolicy.js +10 -0
  61. package/dist/m365/spo/commands/site/site-add.js +113 -154
  62. package/dist/m365/spo/commands/site/site-apppermission-add.js +26 -27
  63. package/dist/m365/spo/commands/site/site-apppermission-remove.js +37 -37
  64. package/dist/m365/spo/commands/site/site-apppermission-set.js +15 -16
  65. package/dist/m365/spo/commands/site/site-ensure.js +19 -70
  66. package/dist/m365/spo/commands/site/site-hubsite-disconnect.js +24 -22
  67. package/dist/m365/spo/commands/site/site-list.js +28 -36
  68. package/dist/m365/spo/commands/site/site-remove.js +139 -171
  69. package/dist/m365/spo/commands/site/site-set.js +179 -178
  70. package/dist/m365/spo/commands/theme/theme-remove.js +26 -24
  71. package/dist/m365/spo/commands/theme/theme-set.js +0 -1
  72. package/dist/m365/spo/commands/user/user-remove.js +29 -27
  73. package/dist/m365/spo/commands/web/web-reindex.js +17 -20
  74. package/dist/m365/spo/commands/web/web-remove.js +23 -21
  75. package/dist/m365/spo/commands/web/web-roleassignment-add.js +45 -52
  76. package/dist/m365/spo/commands/web/web-roleassignment-remove.js +58 -61
  77. package/dist/m365/spo/commands/web/web-roleinheritance-break.js +20 -18
  78. package/dist/m365/spo/commands/web/web-roleinheritance-reset.js +21 -19
  79. package/dist/m365/yammer/commands/message/message-like-set.js +29 -28
  80. package/dist/m365/yammer/commands/message/message-list.js +9 -26
  81. package/dist/m365/yammer/commands/message/message-remove.js +20 -18
  82. package/dist/m365/yammer/commands/yammer-search.js +42 -56
  83. package/dist/utils/aadGroup.js +20 -0
  84. package/dist/utils/fsUtil.js +5 -0
  85. package/dist/utils/spo.js +601 -1
  86. package/docs/docs/cmd/pa/app/app-permission-ensure.mdx +85 -0
  87. package/docs/docs/cmd/pa/app/app-permission-remove.mdx +74 -0
  88. package/docs/docs/cmd/planner/task/task-add.mdx +22 -7
  89. package/docs/docs/cmd/planner/task/task-get.mdx +13 -4
  90. package/docs/docs/cmd/planner/task/task-list.mdx +22 -7
  91. package/docs/docs/cmd/planner/task/task-remove.mdx +25 -8
  92. package/docs/docs/cmd/planner/task/task-set.mdx +22 -7
  93. package/docs/docs/cmd/spfx/project/project-github-workflow-add.mdx +94 -0
  94. package/docs/docs/cmd/spo/file/file-add.mdx +1 -1
  95. package/docs/docs/cmd/spo/file/file-checkin.mdx +1 -1
  96. package/docs/docs/cmd/spo/file/file-checkout-undo.mdx +1 -9
  97. package/docs/docs/cmd/spo/file/file-checkout.mdx +1 -1
  98. package/docs/docs/cmd/spo/file/file-copy.mdx +20 -16
  99. package/docs/docs/cmd/spo/file/file-get.mdx +1 -1
  100. package/docs/docs/cmd/spo/file/file-list.mdx +2 -2
  101. package/docs/docs/cmd/spo/file/file-move.mdx +2 -2
  102. package/docs/docs/cmd/spo/file/file-remove.mdx +8 -8
  103. package/docs/docs/cmd/spo/file/file-rename.mdx +3 -3
  104. package/docs/docs/cmd/spo/file/file-retentionlabel-ensure.mdx +2 -2
  105. package/docs/docs/cmd/spo/file/file-retentionlabel-remove.mdx +3 -3
  106. package/docs/docs/cmd/spo/file/file-roleassignment-add.mdx +1 -1
  107. package/docs/docs/cmd/spo/file/file-roleassignment-remove.mdx +1 -1
  108. package/docs/docs/cmd/spo/file/file-roleinheritance-break.mdx +1 -1
  109. package/docs/docs/cmd/spo/file/file-roleinheritance-reset.mdx +1 -1
  110. package/docs/docs/cmd/spo/file/file-sharinginfo-get.mdx +1 -1
  111. package/docs/docs/cmd/spo/file/file-sharinglink-add.mdx +1 -1
  112. package/docs/docs/cmd/spo/file/file-sharinglink-clear.mdx +1 -1
  113. package/docs/docs/cmd/spo/file/file-sharinglink-get.mdx +1 -1
  114. package/docs/docs/cmd/spo/file/file-sharinglink-list.mdx +1 -1
  115. package/docs/docs/cmd/spo/file/file-sharinglink-remove.mdx +1 -1
  116. package/docs/docs/cmd/spo/file/file-sharinglink-set.mdx +1 -1
  117. package/docs/docs/cmd/spo/file/file-version-clear.mdx +1 -1
  118. package/docs/docs/cmd/spo/file/file-version-get.mdx +1 -1
  119. package/docs/docs/cmd/spo/file/file-version-list.mdx +1 -1
  120. package/docs/docs/cmd/spo/file/file-version-remove.mdx +1 -1
  121. package/docs/docs/cmd/spo/file/file-version-restore.mdx +1 -1
  122. package/docs/docs/cmd/spo/folder/folder-add.mdx +76 -1
  123. package/docs/docs/cmd/spo/folder/folder-get.mdx +1 -1
  124. package/docs/docs/cmd/spo/folder/folder-list.mdx +1 -1
  125. package/docs/docs/cmd/spo/folder/folder-remove.mdx +1 -1
  126. package/docs/docs/cmd/spo/folder/folder-rename.mdx +5 -1
  127. package/docs/docs/cmd/spo/folder/folder-retentionlabel-ensure.mdx +1 -1
  128. package/docs/docs/cmd/spo/folder/folder-retentionlabel-remove.mdx +1 -1
  129. package/docs/docs/cmd/spo/folder/folder-roleassignment-add.mdx +2 -2
  130. package/docs/docs/cmd/spo/folder/folder-roleassignment-remove.mdx +1 -1
  131. package/docs/docs/cmd/spo/folder/folder-roleinheritance-break.mdx +1 -1
  132. package/docs/docs/cmd/spo/folder/folder-roleinheritance-reset.mdx +1 -1
  133. package/docs/docs/cmd/spo/orgassetslibrary/orgassetslibrary-add.mdx +14 -1
  134. package/docs/docs/cmd/spo/site/site-ensure.mdx +1 -1
  135. package/npm-shrinkwrap.json +698 -345
  136. package/package.json +16 -15
@@ -535,14 +535,14 @@ class SpfxDoctorCommand extends base_project_command_1.BaseProjectCommand {
535
535
  fix: 'npm i -g yo@4'
536
536
  }
537
537
  },
538
- '1.18.0-beta.1': {
538
+ '1.18.0-beta.5': {
539
539
  gulpCli: {
540
540
  range: '^1 || ^2',
541
541
  fix: 'npm i -g gulp-cli@2'
542
542
  },
543
543
  node: {
544
- range: '>=16.13.0 <17.0.0',
545
- fix: 'Install Node.js >=16.13.0 <17.0.0'
544
+ range: '>=16.14.0 <17.0.0',
545
+ fix: 'Install Node.js >=16.14.0 <17.0.0'
546
546
  },
547
547
  sp: SharePointVersion.SPO,
548
548
  yo: {
@@ -614,28 +614,22 @@ class SpfxDoctorCommand extends base_project_command_1.BaseProjectCommand {
614
614
  });
615
615
  }
616
616
  checkSharePointCompatibility(spfxVersion, prerequisites, args, fixes, logger) {
617
- return new Promise((resolve, reject) => {
617
+ return __awaiter(this, void 0, void 0, function* () {
618
618
  if (args.options.env) {
619
619
  const sp = this.spVersionStringToEnum(args.options.env);
620
620
  if ((prerequisites.sp & sp) === sp) {
621
621
  logger.log(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Success, `Supported in ${SharePointVersion[sp]}`));
622
- resolve();
623
- }
624
- else {
625
- logger.log(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Failure, `Not supported in ${SharePointVersion[sp]}`));
626
- fixes.push(`Use SharePoint Framework v${(sp === SharePointVersion.SP2016 ? '1.1' : '1.4.1')}`);
627
- reject(`SharePoint Framework v${spfxVersion} is not supported in ${SharePointVersion[sp]}`);
622
+ return;
628
623
  }
629
- }
630
- else {
631
- resolve();
624
+ logger.log(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Failure, `Not supported in ${SharePointVersion[sp]}`));
625
+ fixes.push(`Use SharePoint Framework v${(sp === SharePointVersion.SP2016 ? '1.1' : '1.4.1')}`);
626
+ throw `SharePoint Framework v${spfxVersion} is not supported in ${SharePointVersion[sp]}`;
632
627
  }
633
628
  });
634
629
  }
635
630
  checkNodeVersion(prerequisites, fixes, logger) {
636
- return Promise
637
- .resolve(this.getNodeVersion())
638
- .then((nodeVersion) => {
631
+ return __awaiter(this, void 0, void 0, function* () {
632
+ const nodeVersion = this.getNodeVersion();
639
633
  this.checkStatus('Node', nodeVersion, prerequisites.node, OptionalOrRequired.Required, fixes, logger);
640
634
  });
641
635
  }
@@ -659,9 +653,8 @@ class SpfxDoctorCommand extends base_project_command_1.BaseProjectCommand {
659
653
  });
660
654
  }
661
655
  checkYo(prerequisites, fixes, logger) {
662
- return this
663
- .getPackageVersion('yo', PackageSearchMode.GlobalOnly, HandlePromise.Continue, logger)
664
- .then((yoVersion) => {
656
+ return __awaiter(this, void 0, void 0, function* () {
657
+ const yoVersion = yield this.getPackageVersion('yo', PackageSearchMode.GlobalOnly, HandlePromise.Continue, logger);
665
658
  if (yoVersion) {
666
659
  this.checkStatus('yo', yoVersion, prerequisites.yo, OptionalOrRequired.Required, fixes, logger);
667
660
  }
@@ -672,9 +665,8 @@ class SpfxDoctorCommand extends base_project_command_1.BaseProjectCommand {
672
665
  });
673
666
  }
674
667
  checkGulpCli(prerequisites, fixes, logger) {
675
- return this
676
- .getPackageVersion('gulp-cli', PackageSearchMode.GlobalOnly, HandlePromise.Continue, logger)
677
- .then((gulpCliVersion) => {
668
+ return __awaiter(this, void 0, void 0, function* () {
669
+ const gulpCliVersion = yield this.getPackageVersion('gulp-cli', PackageSearchMode.GlobalOnly, HandlePromise.Continue, logger);
678
670
  if (gulpCliVersion) {
679
671
  this.checkStatus('gulp-cli', gulpCliVersion, prerequisites.gulpCli, OptionalOrRequired.Required, fixes, logger);
680
672
  }
@@ -685,9 +677,8 @@ class SpfxDoctorCommand extends base_project_command_1.BaseProjectCommand {
685
677
  });
686
678
  }
687
679
  checkGulp(fixes, logger) {
688
- return this
689
- .getPackageVersion('gulp', PackageSearchMode.GlobalOnly, HandlePromise.Continue, logger)
690
- .then((gulpVersion) => {
680
+ return __awaiter(this, void 0, void 0, function* () {
681
+ const gulpVersion = yield this.getPackageVersion('gulp', PackageSearchMode.GlobalOnly, HandlePromise.Continue, logger);
691
682
  if (gulpVersion) {
692
683
  logger.log(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Failure, `gulp should be removed`));
693
684
  fixes.push('npm un -g gulp');
@@ -695,9 +686,8 @@ class SpfxDoctorCommand extends base_project_command_1.BaseProjectCommand {
695
686
  });
696
687
  }
697
688
  checkTypeScript(fixes, logger) {
698
- return this
699
- .getPackageVersion('typescript', PackageSearchMode.LocalOnly, HandlePromise.Continue, logger)
700
- .then((typeScriptVersion) => {
689
+ return __awaiter(this, void 0, void 0, function* () {
690
+ const typeScriptVersion = yield this.getPackageVersion('typescript', PackageSearchMode.LocalOnly, HandlePromise.Continue, logger);
701
691
  if (typeScriptVersion) {
702
692
  logger.log(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Failure, `typescript v${typeScriptVersion} installed in the project`));
703
693
  fixes.push('npm un typescript');
@@ -757,41 +747,35 @@ class SpfxDoctorCommand extends base_project_command_1.BaseProjectCommand {
757
747
  });
758
748
  }
759
749
  getPackageVersion(packageName, searchMode, handlePromise, logger) {
760
- return new Promise((resolve, reject) => {
750
+ return __awaiter(this, void 0, void 0, function* () {
761
751
  const args = ['ls', packageName, '--depth=0', '--json'];
762
752
  if (searchMode === PackageSearchMode.GlobalOnly) {
763
753
  args.push('-g');
764
754
  }
765
- this
766
- .getPackageVersionFromNpm(args, logger)
767
- .then((version) => {
768
- return Promise.resolve(version);
769
- })
770
- .catch(() => {
755
+ let version;
756
+ try {
757
+ version = yield this.getPackageVersionFromNpm(args, logger);
758
+ }
759
+ catch (_a) {
771
760
  if (searchMode === PackageSearchMode.LocalAndGlobal) {
772
761
  args.push('-g');
773
- return this.getPackageVersionFromNpm(args, logger);
762
+ version = yield this.getPackageVersionFromNpm(args, logger);
774
763
  }
775
764
  else {
776
- return Promise.resolve('');
765
+ version = '';
777
766
  }
778
- })
779
- .then((version) => {
780
- if (version) {
781
- resolve(version);
767
+ }
768
+ if (version) {
769
+ return version;
770
+ }
771
+ else {
772
+ if (handlePromise === HandlePromise.Continue) {
773
+ return '';
782
774
  }
783
775
  else {
784
- if (handlePromise === HandlePromise.Continue) {
785
- resolve('');
786
- }
787
- else {
788
- reject();
789
- }
776
+ throw new Error();
790
777
  }
791
- })
792
- .catch((err) => {
793
- reject(err);
794
- });
778
+ }
795
779
  });
796
780
  }
797
781
  getPackageVersionFromNpm(args, logger) {
@@ -6,6 +6,7 @@ exports.default = {
6
6
  PACKAGE_GENERATE: `${prefix} package generate`,
7
7
  PROJECT_DOCTOR: `${prefix} project doctor`,
8
8
  PROJECT_EXTERNALIZE: `${prefix} project externalize`,
9
+ PROJECT_GITHUB_WORKFLOW_ADD: `${prefix} project github workflow add`,
9
10
  PROJECT_PERMISSIONS_GRANT: `${prefix} project permissions grant`,
10
11
  PROJECT_RENAME: `${prefix} project rename`,
11
12
  PROJECT_UPGRADE: `${prefix} project upgrade`
@@ -1,16 +1,34 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  exports.SpoAppBaseCommand = void 0;
4
13
  const request_1 = require("../../../../request");
5
14
  const SpoCommand_1 = require("../../../base/SpoCommand");
6
15
  class SpoAppBaseCommand extends SpoCommand_1.default {
7
16
  getAppCatalogSiteUrl(logger, authSiteUrl, args) {
8
- return new Promise((resolve, reject) => {
17
+ return __awaiter(this, void 0, void 0, function* () {
9
18
  if (args.options.appCatalogScope === 'sitecollection') {
10
- return resolve(args.options.appCatalogUrl.toLowerCase().replace('/appcatalog', ''));
19
+ // trim trailing slashes if there are any
20
+ const appCatalogUrl = args.options.appCatalogUrl.replace(/\/$/, '');
21
+ const appCatalogUrlChunks = appCatalogUrl.split('/');
22
+ // Trim the last part of the URL if it ends on '/appcatalog', but don't trim it if the site URL is called like that (/sites/appcatalog).
23
+ if (appCatalogUrl.toLowerCase().endsWith('/appcatalog') && appCatalogUrlChunks.length !== 5) {
24
+ return appCatalogUrl.substring(0, appCatalogUrl.lastIndexOf('/'));
25
+ }
11
26
  }
12
27
  if (args.options.appCatalogUrl) {
13
- return resolve(args.options.appCatalogUrl);
28
+ return args.options.appCatalogUrl.replace(/\/$/, '');
29
+ }
30
+ if (this.verbose) {
31
+ logger.logToStderr('Getting tenant app catalog url...');
14
32
  }
15
33
  const requestOptions = {
16
34
  url: `${authSiteUrl}/_api/SP_TenantSettings_Current`,
@@ -19,17 +37,11 @@ class SpoAppBaseCommand extends SpoCommand_1.default {
19
37
  },
20
38
  responseType: 'json'
21
39
  };
22
- request_1.default
23
- .get(requestOptions)
24
- .then((res) => {
25
- if (res.CorporateCatalogUrl) {
26
- return resolve(res.CorporateCatalogUrl);
27
- }
28
- reject('Tenant app catalog is not configured.');
29
- })
30
- .catch((err) => {
31
- reject(err);
32
- });
40
+ const response = yield request_1.default.get(requestOptions);
41
+ if (response.CorporateCatalogUrl) {
42
+ return response.CorporateCatalogUrl;
43
+ }
44
+ throw new Error('Tenant app catalog is not configured.');
33
45
  });
34
46
  }
35
47
  }
@@ -33,6 +33,7 @@ class SpoAppAddCommand extends SpoAppBaseCommand_1.SpoAppBaseCommand {
33
33
  constructor() {
34
34
  super();
35
35
  _SpoAppAddCommand_instances.add(this);
36
+ this.appCatalogScopeOptions = ['tenant', 'sitecollection'];
36
37
  __classPrivateFieldGet(this, _SpoAppAddCommand_instances, "m", _SpoAppAddCommand_initTelemetry).call(this);
37
38
  __classPrivateFieldGet(this, _SpoAppAddCommand_instances, "m", _SpoAppAddCommand_initOptions).call(this);
38
39
  __classPrivateFieldGet(this, _SpoAppAddCommand_instances, "m", _SpoAppAddCommand_initValidators).call(this);
@@ -75,9 +76,9 @@ class SpoAppAddCommand extends SpoAppBaseCommand_1.SpoAppBaseCommand {
75
76
  _SpoAppAddCommand_instances = new WeakSet(), _SpoAppAddCommand_initTelemetry = function _SpoAppAddCommand_initTelemetry() {
76
77
  this.telemetry.push((args) => {
77
78
  Object.assign(this.telemetryProperties, {
78
- overwrite: (!(!args.options.overwrite)).toString(),
79
+ overwrite: !!args.options.overwrite,
79
80
  appCatalogScope: args.options.appCatalogScope || 'tenant',
80
- appCatalogUrl: (!(!args.options.appCatalogUrl)).toString()
81
+ appCatalogUrl: typeof args.options.appCatalogUrl !== 'undefined'
81
82
  });
82
83
  });
83
84
  }, _SpoAppAddCommand_initOptions = function _SpoAppAddCommand_initOptions() {
@@ -85,7 +86,7 @@ _SpoAppAddCommand_instances = new WeakSet(), _SpoAppAddCommand_initTelemetry = f
85
86
  option: '-p, --filePath <filePath>'
86
87
  }, {
87
88
  option: '-s, --appCatalogScope [appCatalogScope]',
88
- autocomplete: ['tenant', 'sitecollection']
89
+ autocomplete: this.appCatalogScopeOptions
89
90
  }, {
90
91
  option: '-u, --appCatalogUrl [appCatalogUrl]'
91
92
  }, {
@@ -93,14 +94,13 @@ _SpoAppAddCommand_instances = new WeakSet(), _SpoAppAddCommand_initTelemetry = f
93
94
  });
94
95
  }, _SpoAppAddCommand_initValidators = function _SpoAppAddCommand_initValidators() {
95
96
  this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
96
- // verify either 'tenant' or 'sitecollection' specified if scope provided
97
97
  if (args.options.appCatalogScope) {
98
- const testScope = args.options.appCatalogScope.toLowerCase();
99
- if (!(testScope === 'tenant' || testScope === 'sitecollection')) {
100
- return `appCatalogScope must be either 'tenant' or 'sitecollection'`;
98
+ const appCatalogScope = args.options.appCatalogScope.toLowerCase();
99
+ if (this.appCatalogScopeOptions.indexOf(appCatalogScope) === -1) {
100
+ return `${args.options.appCatalogScope} is not a valid appCatalogScope. Allowed values are: ${this.appCatalogScopeOptions.join(', ')}`;
101
101
  }
102
- if (testScope === 'sitecollection' && !args.options.appCatalogUrl) {
103
- return `You must specify appCatalogUrl when the appCatalogScope is sitecollection`;
102
+ if (appCatalogScope === 'sitecollection' && !args.options.appCatalogUrl) {
103
+ return `You must specify appCatalogUrl when appCatalogScope is sitecollection`;
104
104
  }
105
105
  }
106
106
  const fullPath = path.resolve(args.options.filePath);
@@ -66,7 +66,7 @@ class SpoFileAddCommand extends SpoCommand_1.default {
66
66
  try {
67
67
  try {
68
68
  const requestOptions = {
69
- url: `${args.options.webUrl}/_api/web/GetFolderByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(folderPath)}')`,
69
+ url: `${args.options.webUrl}/_api/web/GetFolderByServerRelativePath(DecodedUrl='${formatting_1.formatting.encodeQueryParameter(folderPath)}')`,
70
70
  headers: {
71
71
  'accept': 'application/json;odata=nometadata'
72
72
  }
@@ -100,7 +100,7 @@ class SpoFileAddCommand extends SpoCommand_1.default {
100
100
  // initiate chunked upload session
101
101
  const uploadId = (0, uuid_1.v4)();
102
102
  const requestOptions = {
103
- url: `${args.options.webUrl}/_api/web/GetFolderByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(folderPath)}')/Files/GetByPathOrAddStub(DecodedUrl='${formatting_1.formatting.encodeQueryParameter(fileName)}')/StartUpload(uploadId=guid'${uploadId}')`,
103
+ url: `${args.options.webUrl}/_api/web/GetFolderByServerRelativePath(DecodedUrl='${formatting_1.formatting.encodeQueryParameter(folderPath)}')/Files/GetByPathOrAddStub(DecodedUrl='${formatting_1.formatting.encodeQueryParameter(fileName)}')/StartUpload(uploadId=guid'${uploadId}')`,
104
104
  headers: {
105
105
  'accept': 'application/json;odata=nometadata'
106
106
  }
@@ -128,7 +128,7 @@ class SpoFileAddCommand extends SpoCommand_1.default {
128
128
  logger.logToStderr('Cancelling upload session due to error...');
129
129
  }
130
130
  const requestOptions = {
131
- url: `${args.options.webUrl}/_api/web/GetFolderByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(folderPath)}')/Files('${formatting_1.formatting.encodeQueryParameter(fileName)}')/cancelupload(uploadId=guid'${uploadId}')`,
131
+ url: `${args.options.webUrl}/_api/web/GetFolderByServerRelativePath(DecodedUrl='${formatting_1.formatting.encodeQueryParameter(folderPath)}')/Files('${formatting_1.formatting.encodeQueryParameter(fileName)}')/cancelupload(uploadId=guid'${uploadId}')`,
132
132
  headers: {
133
133
  'accept': 'application/json;odata=nometadata'
134
134
  }
@@ -150,7 +150,7 @@ class SpoFileAddCommand extends SpoCommand_1.default {
150
150
  const fileBody = fs.readFileSync(fullPath);
151
151
  const bodyLength = fileBody.byteLength;
152
152
  const requestOptions = {
153
- url: `${args.options.webUrl}/_api/web/GetFolderByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(folderPath)}')/Files/Add(url='${formatting_1.formatting.encodeQueryParameter(fileName)}', overwrite=true)`,
153
+ url: `${args.options.webUrl}/_api/web/GetFolderByServerRelativePath(DecodedUrl='${formatting_1.formatting.encodeQueryParameter(folderPath)}')/Files/Add(url='${formatting_1.formatting.encodeQueryParameter(fileName)}', overwrite=true)`,
154
154
  data: fileBody,
155
155
  headers: {
156
156
  'accept': 'application/json;odata=nometadata',
@@ -192,7 +192,7 @@ class SpoFileAddCommand extends SpoCommand_1.default {
192
192
  }
193
193
  // approve the existing file with given comment
194
194
  const requestOptions = {
195
- url: `${args.options.webUrl}/_api/web/GetFolderByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(folderPath)}')/Files('${formatting_1.formatting.encodeQueryParameter(fileName)}')/approve(comment='${formatting_1.formatting.encodeQueryParameter(args.options.approveComment || '')}')`,
195
+ url: `${args.options.webUrl}/_api/web/GetFolderByServerRelativePath(DecodedUrl='${formatting_1.formatting.encodeQueryParameter(folderPath)}')/Files('${formatting_1.formatting.encodeQueryParameter(fileName)}')/approve(comment='${formatting_1.formatting.encodeQueryParameter(args.options.approveComment || '')}')`,
196
196
  headers: {
197
197
  'accept': 'application/json;odata=nometadata'
198
198
  },
@@ -209,7 +209,7 @@ class SpoFileAddCommand extends SpoCommand_1.default {
209
209
  }
210
210
  // publish the existing file with given comment
211
211
  const requestOptions = {
212
- url: `${args.options.webUrl}/_api/web/GetFolderByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(folderPath)}')/Files('${formatting_1.formatting.encodeQueryParameter(fileName)}')/publish(comment='${formatting_1.formatting.encodeQueryParameter(args.options.publishComment || '')}')`,
212
+ url: `${args.options.webUrl}/_api/web/GetFolderByServerRelativePath(DecodedUrl='${formatting_1.formatting.encodeQueryParameter(folderPath)}')/Files('${formatting_1.formatting.encodeQueryParameter(fileName)}')/publish(comment='${formatting_1.formatting.encodeQueryParameter(args.options.publishComment || '')}')`,
213
213
  headers: {
214
214
  'accept': 'application/json;odata=nometadata'
215
215
  },
@@ -223,7 +223,7 @@ class SpoFileAddCommand extends SpoCommand_1.default {
223
223
  // in a case the command has done checkout
224
224
  // then have to rollback the checkout
225
225
  const requestOptions = {
226
- url: `${args.options.webUrl}/_api/web/GetFolderByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(folderPath)}')/Files('${formatting_1.formatting.encodeQueryParameter(fileName)}')/UndoCheckOut()`
226
+ url: `${args.options.webUrl}/_api/web/GetFolderByServerRelativePath(DecodedUrl='${formatting_1.formatting.encodeQueryParameter(folderPath)}')/Files('${formatting_1.formatting.encodeQueryParameter(fileName)}')/UndoCheckOut()`
227
227
  };
228
228
  try {
229
229
  yield request_1.default.post(requestOptions);
@@ -266,14 +266,14 @@ class SpoFileAddCommand extends SpoCommand_1.default {
266
266
  return __awaiter(this, void 0, void 0, function* () {
267
267
  // check if file already exists, otherwise it can't be checked out
268
268
  const requestOptionsGetFile = {
269
- url: `${webUrl}/_api/web/GetFolderByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(folder)}')/Files('${formatting_1.formatting.encodeQueryParameter(fileName)}')`,
269
+ url: `${webUrl}/_api/web/GetFolderByServerRelativePath(DecodedUrl='${formatting_1.formatting.encodeQueryParameter(folder)}')/Files('${formatting_1.formatting.encodeQueryParameter(fileName)}')`,
270
270
  headers: {
271
271
  'accept': 'application/json;odata=nometadata'
272
272
  }
273
273
  };
274
274
  yield request_1.default.get(requestOptionsGetFile);
275
275
  const requestOptionsCheckOut = {
276
- url: `${webUrl}/_api/web/GetFolderByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(folder)}')/Files('${formatting_1.formatting.encodeQueryParameter(fileName)}')/CheckOut()`,
276
+ url: `${webUrl}/_api/web/GetFolderByServerRelativePath(DecodedUrl='${formatting_1.formatting.encodeQueryParameter(folder)}')/Files('${formatting_1.formatting.encodeQueryParameter(fileName)}')/CheckOut()`,
277
277
  headers: {
278
278
  'accept': 'application/json;odata=nometadata'
279
279
  },
@@ -299,7 +299,7 @@ class SpoFileAddCommand extends SpoCommand_1.default {
299
299
  fileBuffer = fileBuffer.slice(0, readCount);
300
300
  }
301
301
  const requestOptions = {
302
- url: `${info.WebUrl}/_api/web/GetFolderByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(info.FolderPath)}')/Files('${formatting_1.formatting.encodeQueryParameter(info.Name)}')/${isLastChunk ? 'Finish' : 'Continue'}Upload(uploadId=guid'${info.Id}',fileOffset=${offset})`,
302
+ url: `${info.WebUrl}/_api/web/GetFolderByServerRelativePath(DecodedUrl='${formatting_1.formatting.encodeQueryParameter(info.FolderPath)}')/Files('${formatting_1.formatting.encodeQueryParameter(info.Name)}')/${isLastChunk ? 'Finish' : 'Continue'}Upload(uploadId=guid'${info.Id}',fileOffset=${offset})`,
303
303
  data: fileBuffer,
304
304
  headers: {
305
305
  'accept': 'application/json;odata=nometadata',
@@ -358,7 +358,7 @@ class SpoFileAddCommand extends SpoCommand_1.default {
358
358
  logger.logToStderr(`Getting list details in order to get its available content types afterwards...`);
359
359
  }
360
360
  const requestOptions = {
361
- url: `${webUrl}/_api/web/GetFolderByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(folder)}')/Files('${formatting_1.formatting.encodeQueryParameter(fileName)}')/ListItemAllFields/ParentList?$Select=Id,EnableModeration,EnableVersioning,EnableMinorVersions`,
361
+ url: `${webUrl}/_api/web/GetFolderByServerRelativePath(DecodedUrl='${formatting_1.formatting.encodeQueryParameter(folder)}')/Files('${formatting_1.formatting.encodeQueryParameter(fileName)}')/ListItemAllFields/ParentList?$Select=Id,EnableModeration,EnableVersioning,EnableMinorVersions`,
362
362
  headers: {
363
363
  'accept': 'application/json;odata=nometadata'
364
364
  },
@@ -383,7 +383,7 @@ class SpoFileAddCommand extends SpoCommand_1.default {
383
383
  }
384
384
  // update the existing file list item fields
385
385
  const requestOptions = {
386
- url: `${webUrl}/_api/web/GetFolderByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(folderPath)}')/Files('${formatting_1.formatting.encodeQueryParameter(fileName)}')/ListItemAllFields/ValidateUpdateListItem()`,
386
+ url: `${webUrl}/_api/web/GetFolderByServerRelativePath(DecodedUrl='${formatting_1.formatting.encodeQueryParameter(folderPath)}')/Files('${formatting_1.formatting.encodeQueryParameter(fileName)}')/ListItemAllFields/ValidateUpdateListItem()`,
387
387
  headers: {
388
388
  'accept': 'application/json;odata=nometadata'
389
389
  },
@@ -404,7 +404,7 @@ class SpoFileAddCommand extends SpoCommand_1.default {
404
404
  fileCheckIn(args, fileName) {
405
405
  return __awaiter(this, void 0, void 0, function* () {
406
406
  const requestOptions = {
407
- url: `${args.options.webUrl}/_api/web/GetFolderByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(args.options.folder)}')/Files('${formatting_1.formatting.encodeQueryParameter(fileName)}')/CheckIn(comment='${formatting_1.formatting.encodeQueryParameter(args.options.checkInComment || '')}',checkintype=0)`,
407
+ url: `${args.options.webUrl}/_api/web/GetFolderByServerRelativePath(DecodedUrl='${formatting_1.formatting.encodeQueryParameter(args.options.folder)}')/Files('${formatting_1.formatting.encodeQueryParameter(fileName)}')/CheckIn(comment='${formatting_1.formatting.encodeQueryParameter(args.options.checkInComment || '')}',checkintype=0)`,
408
408
  headers: {
409
409
  'accept': 'application/json;odata=nometadata'
410
410
  },
@@ -67,7 +67,7 @@ class SpoFileCheckinCommand extends SpoCommand_1.default {
67
67
  }
68
68
  if (args.options.url) {
69
69
  const serverRelativePath = urlUtil_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.url);
70
- requestUrl = `${args.options.webUrl}/_api/web/GetFileByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(serverRelativePath)}')/checkin(comment='${comment}',checkintype=${type})`;
70
+ requestUrl = `${args.options.webUrl}/_api/web/GetFileByServerRelativePath(DecodedUrl='${formatting_1.formatting.encodeQueryParameter(serverRelativePath)}')/checkin(comment='${comment}',checkintype=${type})`;
71
71
  }
72
72
  const requestOptions = {
73
73
  url: requestUrl,
@@ -47,7 +47,7 @@ class SpoFileCheckoutCommand extends SpoCommand_1.default {
47
47
  }
48
48
  if (args.options.url) {
49
49
  const serverRelativePath = urlUtil_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.url);
50
- requestUrl = `${args.options.webUrl}/_api/web/GetFileByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(serverRelativePath)}')/checkout`;
50
+ requestUrl = `${args.options.webUrl}/_api/web/GetFileByServerRelativePath(DecodedUrl='${formatting_1.formatting.encodeQueryParameter(serverRelativePath)}')/checkout`;
51
51
  }
52
52
  const requestOptions = {
53
53
  url: requestUrl,
@@ -13,7 +13,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
13
13
  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");
14
14
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
15
15
  };
16
- var _SpoFileCopyCommand_instances, _SpoFileCopyCommand_initTelemetry, _SpoFileCopyCommand_initOptions, _SpoFileCopyCommand_initValidators;
16
+ var _SpoFileCopyCommand_instances, _SpoFileCopyCommand_initTelemetry, _SpoFileCopyCommand_initOptions, _SpoFileCopyCommand_initValidators, _SpoFileCopyCommand_initOptionSets;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  const request_1 = require("../../../../request");
19
19
  const urlUtil_1 = require("../../../../utils/urlUtil");
@@ -34,11 +34,13 @@ class SpoFileCopyCommand extends SpoCommand_1.default {
34
34
  __classPrivateFieldGet(this, _SpoFileCopyCommand_instances, "m", _SpoFileCopyCommand_initTelemetry).call(this);
35
35
  __classPrivateFieldGet(this, _SpoFileCopyCommand_instances, "m", _SpoFileCopyCommand_initOptions).call(this);
36
36
  __classPrivateFieldGet(this, _SpoFileCopyCommand_instances, "m", _SpoFileCopyCommand_initValidators).call(this);
37
+ __classPrivateFieldGet(this, _SpoFileCopyCommand_instances, "m", _SpoFileCopyCommand_initOptionSets).call(this);
37
38
  }
38
39
  commandAction(logger, args) {
39
40
  return __awaiter(this, void 0, void 0, function* () {
40
41
  try {
41
- const sourcePath = this.getAbsoluteUrl(args.options.webUrl, urlUtil_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.sourceUrl));
42
+ const sourceServerRelativePath = yield this.getSourcePath(logger, args.options);
43
+ const sourcePath = this.getAbsoluteUrl(args.options.webUrl, sourceServerRelativePath);
42
44
  let destinationPath = this.getAbsoluteUrl(args.options.webUrl, args.options.targetUrl) + '/';
43
45
  if (args.options.newName) {
44
46
  destinationPath += args.options.newName;
@@ -66,6 +68,7 @@ class SpoFileCopyCommand extends SpoCommand_1.default {
66
68
  overwrite: args.options.nameConflictBehavior === 'replace',
67
69
  options: {
68
70
  KeepBoth: args.options.nameConflictBehavior === 'rename',
71
+ ResetAuthorAndCreatedOnCopy: !!args.options.resetAuthorAndCreated,
69
72
  ShouldBypassSharedLocks: !!args.options.bypassSharedLock
70
73
  }
71
74
  }
@@ -77,6 +80,25 @@ class SpoFileCopyCommand extends SpoCommand_1.default {
77
80
  }
78
81
  });
79
82
  }
83
+ getSourcePath(logger, options) {
84
+ return __awaiter(this, void 0, void 0, function* () {
85
+ if (options.sourceUrl) {
86
+ return urlUtil_1.urlUtil.getServerRelativePath(options.webUrl, options.sourceUrl);
87
+ }
88
+ if (this.verbose) {
89
+ logger.logToStderr(`Retrieving server-relative path for file with ID '${options.sourceId}'...`);
90
+ }
91
+ const requestOptions = {
92
+ url: `${options.webUrl}/_api/Web/GetFileById('${options.sourceId}')?$select=ServerRelativePath`,
93
+ headers: {
94
+ accept: 'application/json;odata=nometadata'
95
+ },
96
+ responseType: 'json'
97
+ };
98
+ const file = yield request_1.default.get(requestOptions);
99
+ return file.ServerRelativePath.DecodedUrl;
100
+ });
101
+ }
80
102
  getAbsoluteUrl(webUrl, url) {
81
103
  return url.startsWith('https://') ? url : urlUtil_1.urlUtil.getAbsoluteUrl(webUrl, url);
82
104
  }
@@ -84,8 +106,11 @@ class SpoFileCopyCommand extends SpoCommand_1.default {
84
106
  _SpoFileCopyCommand_instances = new WeakSet(), _SpoFileCopyCommand_initTelemetry = function _SpoFileCopyCommand_initTelemetry() {
85
107
  this.telemetry.push((args) => {
86
108
  Object.assign(this.telemetryProperties, {
109
+ sourceUrl: typeof args.options.sourceUrl !== 'undefined',
110
+ sourceId: typeof args.options.sourceId !== 'undefined',
87
111
  newName: typeof args.options.newName !== 'undefined',
88
112
  nameConflictBehavior: args.options.nameConflictBehavior || false,
113
+ resetAuthorAndCreated: !!args.options.resetAuthorAndCreated,
89
114
  bypassSharedLock: !!args.options.bypassSharedLock
90
115
  });
91
116
  });
@@ -93,7 +118,9 @@ _SpoFileCopyCommand_instances = new WeakSet(), _SpoFileCopyCommand_initTelemetry
93
118
  this.options.unshift({
94
119
  option: '-u, --webUrl <webUrl>'
95
120
  }, {
96
- option: '-s, --sourceUrl <sourceUrl>'
121
+ option: '-s, --sourceUrl [sourceUrl]'
122
+ }, {
123
+ option: '-i, --sourceId [sourceId]'
97
124
  }, {
98
125
  option: '-t, --targetUrl <targetUrl>'
99
126
  }, {
@@ -101,6 +128,8 @@ _SpoFileCopyCommand_instances = new WeakSet(), _SpoFileCopyCommand_initTelemetry
101
128
  }, {
102
129
  option: '--nameConflictBehavior [nameConflictBehavior]',
103
130
  autocomplete: this.nameConflictBehaviorOptions
131
+ }, {
132
+ option: '--resetAuthorAndCreated'
104
133
  }, {
105
134
  option: '--bypassSharedLock'
106
135
  });
@@ -110,11 +139,16 @@ _SpoFileCopyCommand_instances = new WeakSet(), _SpoFileCopyCommand_initTelemetry
110
139
  if (isValidSharePointUrl !== true) {
111
140
  return isValidSharePointUrl;
112
141
  }
142
+ if (args.options.sourceId && !validation_1.validation.isValidGuid(args.options.sourceId)) {
143
+ return `${args.options.sourceId} is not a valid GUID for sourceId.`;
144
+ }
113
145
  if (args.options.nameConflictBehavior && this.nameConflictBehaviorOptions.indexOf(args.options.nameConflictBehavior) === -1) {
114
- return `${args.options.nameConflictBehavior} is not a valid nameConflictBehavior value. Allowed values: ${this.nameConflictBehaviorOptions.join(', ')}`;
146
+ return `${args.options.nameConflictBehavior} is not a valid nameConflictBehavior value. Allowed values: ${this.nameConflictBehaviorOptions.join(', ')}.`;
115
147
  }
116
148
  return true;
117
149
  }));
150
+ }, _SpoFileCopyCommand_initOptionSets = function _SpoFileCopyCommand_initOptionSets() {
151
+ this.optionSets.push({ options: ['sourceUrl', 'sourceId'] });
118
152
  };
119
153
  module.exports = new SpoFileCopyCommand();
120
154
  //# sourceMappingURL=file-copy.js.map
@@ -75,7 +75,7 @@ class SpoFileListCommand extends SpoCommand_1.default {
75
75
  }
76
76
  const allFiles = [];
77
77
  const serverRelativePath = urlUtil_1.urlUtil.getServerRelativePath(args.options.webUrl, folderUrl);
78
- const requestUrl = `${args.options.webUrl}/_api/web/GetFolderByServerRelativeUrl(@url)/Files?@url='${formatting_1.formatting.encodeQueryParameter(serverRelativePath)}'`;
78
+ const requestUrl = `${args.options.webUrl}/_api/web/GetFolderByServerRelativePath(DecodedUrl='${formatting_1.formatting.encodeQueryParameter(serverRelativePath)}')/Files`;
79
79
  const queryParams = [`$skip=${skip}`, `$top=${SpoFileListCommand.pageSize}`];
80
80
  if (fieldProperties.expandProperties.length > 0) {
81
81
  queryParams.push(`$expand=${fieldProperties.expandProperties.join(',')}`);
@@ -87,7 +87,7 @@ class SpoFileListCommand extends SpoCommand_1.default {
87
87
  queryParams.push(`$filter=${args.options.filter}`);
88
88
  }
89
89
  const requestOptions = {
90
- url: `${requestUrl}&${queryParams.join('&')}`,
90
+ url: `${requestUrl}?${queryParams.join('&')}`,
91
91
  method: 'GET',
92
92
  headers: {
93
93
  'accept': 'application/json;odata=nometadata'
@@ -111,9 +111,9 @@ class SpoFileListCommand extends SpoCommand_1.default {
111
111
  }
112
112
  const allFolders = [];
113
113
  const serverRelativeUrl = urlUtil_1.urlUtil.getServerRelativePath(args.options.webUrl, folderUrl);
114
- const requestUrl = `${args.options.webUrl}/_api/web/GetFolderByServerRelativeUrl(@url)/Folders?@url='${formatting_1.formatting.encodeQueryParameter(serverRelativeUrl)}'`;
114
+ const requestUrl = `${args.options.webUrl}/_api/web/GetFolderByServerRelativePath(DecodedUrl='${formatting_1.formatting.encodeQueryParameter(serverRelativeUrl)}')/Folders`;
115
115
  const requestOptions = {
116
- url: `${requestUrl}&$skip=${skip}&$top=${SpoFileListCommand.pageSize}&$select=ServerRelativeUrl`,
116
+ url: `${requestUrl}?$skip=${skip}&$top=${SpoFileListCommand.pageSize}&$select=ServerRelativeUrl`,
117
117
  method: 'GET',
118
118
  headers: {
119
119
  'accept': 'application/json;odata=nometadata'
@@ -69,7 +69,7 @@ class SpoFileMoveCommand extends SpoCommand_1.default {
69
69
  const requestOptions = {
70
70
  url: requestUrl,
71
71
  headers: {
72
- 'accept': 'application/json;odata=nometadata'
72
+ accept: 'application/json;odata=nometadata'
73
73
  },
74
74
  data: {
75
75
  exportObjectUris: [sourceAbsoluteUrl],
@@ -109,7 +109,7 @@ class SpoFileMoveCommand extends SpoCommand_1.default {
109
109
  * Checks if a file exists on the server relative url
110
110
  */
111
111
  fileExists(webUrl, sourceUrl) {
112
- const requestUrl = `${webUrl}/_api/web/GetFileByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(sourceUrl)}')/`;
112
+ const requestUrl = `${webUrl}/_api/web/GetFileByServerRelativePath(DecodedUrl='${formatting_1.formatting.encodeQueryParameter(sourceUrl)}')/`;
113
113
  const requestOptions = {
114
114
  url: requestUrl,
115
115
  method: 'GET',
@@ -55,7 +55,7 @@ class SpoFileRemoveCommand extends SpoCommand_1.default {
55
55
  }
56
56
  else {
57
57
  const serverRelativePath = urlUtil_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.url);
58
- requestUrl = `${args.options.webUrl}/_api/web/GetFileByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(serverRelativePath)}')`;
58
+ requestUrl = `${args.options.webUrl}/_api/web/GetFileByServerRelativePath(DecodedUrl='${formatting_1.formatting.encodeQueryParameter(serverRelativePath)}')`;
59
59
  }
60
60
  if (args.options.recycle) {
61
61
  requestUrl += `/recycle()`;
@@ -85,7 +85,7 @@ class SpoFileRemoveCommand extends SpoCommand_1.default {
85
85
  type: 'confirm',
86
86
  name: 'continue',
87
87
  default: false,
88
- message: `Are you sure you want to ${args.options.recycle ? "recycle" : "remove"} the file ${args.options.id || args.options.url} located in site ${args.options.webUrl}?`
88
+ message: `Are you sure you want to ${args.options.recycle ? 'recycle' : 'remove'} the file ${args.options.id || args.options.url} located in site ${args.options.webUrl}?`
89
89
  });
90
90
  if (result.continue) {
91
91
  yield removeFile();
@@ -97,10 +97,10 @@ class SpoFileRemoveCommand extends SpoCommand_1.default {
97
97
  _SpoFileRemoveCommand_instances = new WeakSet(), _SpoFileRemoveCommand_initTelemetry = function _SpoFileRemoveCommand_initTelemetry() {
98
98
  this.telemetry.push((args) => {
99
99
  Object.assign(this.telemetryProperties, {
100
- id: (!(!args.options.id)).toString(),
101
- url: (!(!args.options.url)).toString(),
102
- recycle: (!(!args.options.recycle)).toString(),
103
- confirm: (!(!args.options.confirm)).toString()
100
+ id: typeof args.options.id !== 'undefined',
101
+ url: typeof args.options.url !== 'undefined',
102
+ recycle: !!args.options.recycle,
103
+ confirm: !!args.options.confirm
104
104
  });
105
105
  });
106
106
  }, _SpoFileRemoveCommand_initOptions = function _SpoFileRemoveCommand_initOptions() {
@@ -53,7 +53,7 @@ class SpoFileRenameCommand extends SpoCommand_1.default {
53
53
  }]
54
54
  };
55
55
  const requestOptions = {
56
- url: `${webUrl}/_api/web/GetFileByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(originalFileServerRelativePath)}')/ListItemAllFields/ValidateUpdateListItem()`,
56
+ url: `${webUrl}/_api/web/GetFileByServerRelativePath(DecodedUrl='${formatting_1.formatting.encodeQueryParameter(originalFileServerRelativePath)}')/ListItemAllFields/ValidateUpdateListItem()`,
57
57
  headers: {
58
58
  'accept': 'application/json;odata=nometadata'
59
59
  },
@@ -70,7 +70,7 @@ class SpoFileRenameCommand extends SpoCommand_1.default {
70
70
  }
71
71
  getFile(originalFileServerRelativeUrl, webUrl) {
72
72
  return __awaiter(this, void 0, void 0, function* () {
73
- const requestUrl = `${webUrl}/_api/web/GetFileByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(originalFileServerRelativeUrl)}')?$select=UniqueId`;
73
+ const requestUrl = `${webUrl}/_api/web/GetFileByServerRelativePath(DecodedUrl='${formatting_1.formatting.encodeQueryParameter(originalFileServerRelativeUrl)}')?$select=UniqueId`;
74
74
  const requestOptions = {
75
75
  url: requestUrl,
76
76
  headers: {