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

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 (131) hide show
  1. package/.eslintrc.cjs +1 -3
  2. package/dist/GlobalOptions.js +1 -7
  3. package/dist/cli/Cli.js +19 -2
  4. package/dist/m365/aad/commands/{o365group/o365group-add.js → m365group/m365group-add.js} +17 -17
  5. package/dist/m365/aad/commands/{o365group/o365group-conversation-list.js → m365group/m365group-conversation-list.js} +10 -10
  6. package/dist/m365/aad/commands/{o365group/o365group-conversation-post-list.js → m365group/m365group-conversation-post-list.js} +14 -14
  7. package/dist/m365/aad/commands/{o365group/o365group-get.js → m365group/m365group-get.js} +13 -10
  8. package/dist/m365/aad/commands/{o365group/o365group-list.js → m365group/m365group-list.js} +13 -28
  9. package/dist/m365/aad/commands/{o365group/o365group-recyclebinitem-clear.js → m365group/m365group-recyclebinitem-clear.js} +15 -15
  10. package/dist/m365/aad/commands/{o365group/o365group-recyclebinitem-list.js → m365group/m365group-recyclebinitem-list.js} +10 -10
  11. package/dist/m365/aad/commands/{o365group/o365group-recyclebinitem-remove.js → m365group/m365group-recyclebinitem-remove.js} +14 -14
  12. package/dist/m365/aad/commands/{o365group/o365group-recyclebinitem-restore.js → m365group/m365group-recyclebinitem-restore.js} +14 -14
  13. package/dist/m365/aad/commands/{o365group/o365group-remove.js → m365group/m365group-remove.js} +12 -12
  14. package/dist/m365/aad/commands/{o365group/o365group-renew.js → m365group/m365group-renew.js} +10 -10
  15. package/dist/m365/aad/commands/{o365group/o365group-report-activitycounts.js → m365group/m365group-report-activitycounts.js} +4 -4
  16. package/dist/m365/aad/commands/{o365group/o365group-report-activitydetail.js → m365group/m365group-report-activitydetail.js} +4 -4
  17. package/dist/m365/aad/commands/{o365group/o365group-report-activityfilecounts.js → m365group/m365group-report-activityfilecounts.js} +4 -4
  18. package/dist/m365/aad/commands/{o365group/o365group-report-activitygroupcounts.js → m365group/m365group-report-activitygroupcounts.js} +4 -4
  19. package/dist/m365/aad/commands/{o365group/o365group-report-activitystorage.js → m365group/m365group-report-activitystorage.js} +4 -4
  20. package/dist/m365/aad/commands/{o365group/o365group-set.js → m365group/m365group-set.js} +17 -17
  21. package/dist/m365/aad/commands/{o365group/o365group-teamify.js → m365group/m365group-teamify.js} +14 -14
  22. package/dist/m365/aad/commands/{o365group/o365group-user-add.js → m365group/m365group-user-add.js} +14 -14
  23. package/dist/m365/aad/commands/{o365group/o365group-user-list.js → m365group/m365group-user-list.js} +12 -12
  24. package/dist/m365/aad/commands/{o365group/o365group-user-remove.js → m365group/m365group-user-remove.js} +14 -14
  25. package/dist/m365/aad/commands/{o365group/o365group-user-set.js → m365group/m365group-user-set.js} +15 -15
  26. package/dist/m365/aad/commands.js +22 -22
  27. package/dist/m365/pa/commands/app/app-permission-list.js +2 -2
  28. package/dist/m365/pa/commands/app/app-permission-remove.js +3 -3
  29. package/dist/m365/pa/commands.js +1 -4
  30. package/dist/m365/spfx/commands/project/project-doctor/{doctor-1.18.0-beta.1.js → doctor-1.18.0-beta.5.js} +1 -1
  31. package/dist/m365/spfx/commands/project/project-doctor.js +1 -1
  32. package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.15.2.js +1 -1
  33. package/dist/m365/spfx/commands/project/project-upgrade/{upgrade-1.18.0-beta.1.js → upgrade-1.18.0-beta.5.js} +26 -26
  34. package/dist/m365/spfx/commands/project/project-upgrade.js +1 -1
  35. package/dist/m365/spfx/commands/spfx-doctor.js +3 -3
  36. package/dist/m365/spo/commands/app/SpoAppBaseCommand.js +27 -26
  37. package/dist/m365/spo/commands/app/app-add.js +9 -9
  38. package/dist/m365/spo/commands/file/file-copy.js +1 -1
  39. package/dist/m365/spo/commands/file/file-move.js +73 -97
  40. package/dist/m365/spo/commands/folder/folder-copy.js +89 -45
  41. package/dist/m365/spo/commands/folder/folder-move.js +89 -47
  42. package/dist/m365/spo/commands/orgassetslibrary/orgassetslibrary-add.js +32 -3
  43. package/dist/m365/spo/commands/page/clientsidepages.js +1 -81
  44. package/dist/m365/spo/commands/propertybag/propertybag-base.js +63 -59
  45. package/dist/m365/spo/commands/propertybag/propertybag-remove.js +28 -31
  46. package/dist/m365/spo/commands/site/FlowsPolicy.js +7 -0
  47. package/dist/m365/spo/commands/site/site-ensure.js +3 -3
  48. package/dist/m365/spo/commands/site/site-hubsite-disconnect.js +22 -22
  49. package/dist/m365/spo/commands/site/site-list.js +27 -43
  50. package/dist/m365/spo/commands/site/site-set.js +60 -49
  51. package/dist/m365/spo/commands/theme/theme-list.js +1 -9
  52. package/dist/m365/spo/commands/theme/theme-remove.js +24 -24
  53. package/dist/m365/spo/commands/theme/theme-set.js +0 -1
  54. package/dist/m365/spo/commands/user/user-remove.js +27 -27
  55. package/dist/m365/spo/commands/web/web-reindex.js +35 -42
  56. package/dist/m365/spo/commands/web/web-remove.js +21 -21
  57. package/dist/m365/spo/commands/web/web-roleassignment-add.js +16 -31
  58. package/dist/m365/spo/commands/web/web-roleassignment-remove.js +33 -44
  59. package/dist/m365/spo/commands/web/web-roleinheritance-break.js +18 -18
  60. package/dist/m365/spo/commands/web/web-roleinheritance-reset.js +19 -19
  61. package/dist/m365/yammer/commands/message/message-like-set.js +27 -28
  62. package/dist/m365/yammer/commands/message/message-list.js +62 -81
  63. package/dist/m365/yammer/commands/message/message-remove.js +18 -18
  64. package/dist/m365/yammer/commands/yammer-search.js +53 -69
  65. package/dist/utils/spo.js +12 -53
  66. package/dist/utils/validation.js +0 -3
  67. package/docs/docs/cmd/aad/{o365group/o365group-add.mdx → m365group/m365group-add.mdx} +13 -13
  68. package/docs/docs/cmd/aad/{o365group/o365group-conversation-list.mdx → m365group/m365group-conversation-list.mdx} +4 -4
  69. package/docs/docs/cmd/aad/{o365group/o365group-conversation-post-list.mdx → m365group/m365group-conversation-post-list.mdx} +8 -8
  70. package/docs/docs/cmd/aad/{o365group/o365group-get.mdx → m365group/m365group-get.mdx} +6 -6
  71. package/docs/docs/cmd/aad/{o365group/o365group-list.mdx → m365group/m365group-list.mdx} +12 -29
  72. package/docs/docs/cmd/aad/{o365group/o365group-recyclebinitem-clear.mdx → m365group/m365group-recyclebinitem-clear.mdx} +5 -5
  73. package/docs/docs/cmd/aad/{o365group/o365group-recyclebinitem-list.mdx → m365group/m365group-recyclebinitem-list.mdx} +8 -8
  74. package/docs/docs/cmd/aad/{o365group/o365group-recyclebinitem-remove.mdx → m365group/m365group-recyclebinitem-remove.mdx} +6 -6
  75. package/docs/docs/cmd/aad/{o365group/o365group-recyclebinitem-restore.mdx → m365group/m365group-recyclebinitem-restore.mdx} +6 -6
  76. package/docs/docs/cmd/aad/{o365group/o365group-remove.mdx → m365group/m365group-remove.mdx} +6 -6
  77. package/docs/docs/cmd/aad/{o365group/o365group-renew.mdx → m365group/m365group-renew.mdx} +4 -4
  78. package/docs/docs/cmd/aad/{o365group/o365group-report-activitycounts.mdx → m365group/m365group-report-activitycounts.mdx} +6 -6
  79. package/docs/docs/cmd/aad/{o365group/o365group-report-activitydetail.mdx → m365group/m365group-report-activitydetail.mdx} +7 -7
  80. package/docs/docs/cmd/aad/{o365group/o365group-report-activityfilecounts.mdx → m365group/m365group-report-activityfilecounts.mdx} +6 -6
  81. package/docs/docs/cmd/aad/{o365group/o365group-report-activitygroupcounts.mdx → m365group/m365group-report-activitygroupcounts.mdx} +6 -6
  82. package/docs/docs/cmd/aad/{o365group/o365group-report-activitystorage.mdx → m365group/m365group-report-activitystorage.mdx} +6 -6
  83. package/docs/docs/cmd/aad/{o365group/o365group-set.mdx → m365group/m365group-set.mdx} +8 -8
  84. package/docs/docs/cmd/aad/{o365group/o365group-teamify.mdx → m365group/m365group-teamify.mdx} +5 -5
  85. package/docs/docs/cmd/aad/{o365group/o365group-user-add.mdx → m365group/m365group-user-add.mdx} +5 -5
  86. package/docs/docs/cmd/aad/{o365group/o365group-user-list.mdx → m365group/m365group-user-list.mdx} +7 -7
  87. package/docs/docs/cmd/aad/{o365group/o365group-user-remove.mdx → m365group/m365group-user-remove.mdx} +5 -5
  88. package/docs/docs/cmd/aad/{o365group/o365group-user-set.mdx → m365group/m365group-user-set.mdx} +5 -5
  89. package/docs/docs/cmd/pa/app/app-permission-remove.mdx +1 -1
  90. package/docs/docs/cmd/planner/plan/plan-add.mdx +1 -1
  91. package/docs/docs/cmd/spo/file/file-move.mdx +36 -18
  92. package/docs/docs/cmd/spo/folder/folder-copy.mdx +39 -12
  93. package/docs/docs/cmd/spo/folder/folder-move.mdx +40 -13
  94. package/docs/docs/cmd/spo/orgassetslibrary/orgassetslibrary-add.mdx +14 -1
  95. package/docs/docs/cmd/spo/site/site-add.mdx +1 -1
  96. package/docs/docs/cmd/spo/site/site-ensure.mdx +1 -1
  97. package/docs/docs/cmd/spo/site/site-list.mdx +3 -78
  98. package/docs/docs/cmd/teams/team/team-add.mdx +1 -1
  99. package/npm-shrinkwrap.json +178 -1304
  100. package/package.json +5 -7
  101. package/dist/m365/pa/cds-project-mutator.js +0 -91
  102. package/dist/m365/pa/commands/pcf/pcf-init/assets/control/dataset-template/generated/ManifestTypes.d.ts +0 -11
  103. package/dist/m365/pa/commands/pcf/pcf-init/assets/control/dataset-template/template_ControlManifest.Input.xml +0 -31
  104. package/dist/m365/pa/commands/pcf/pcf-init/assets/control/dataset-template/template_index.ts +0 -51
  105. package/dist/m365/pa/commands/pcf/pcf-init/assets/control/field-template/generated/ManifestTypes.d.ts +0 -12
  106. package/dist/m365/pa/commands/pcf/pcf-init/assets/control/field-template/template_ControlManifest.Input.xml +0 -37
  107. package/dist/m365/pa/commands/pcf/pcf-init/assets/control/field-template/template_index.ts +0 -48
  108. package/dist/m365/pa/commands/pcf/pcf-init/assets/control/index.ts +0 -0
  109. package/dist/m365/pa/commands/pcf/pcf-init/assets/control/virtual-dataset-template/template_ControlManifest.Input.xml +0 -31
  110. package/dist/m365/pa/commands/pcf/pcf-init/assets/control/virtual-dataset-template/template_index.tsx +0 -58
  111. package/dist/m365/pa/commands/pcf/pcf-init/assets/control/virtual-field-template/template_ControlManifest.Input.xml +0 -37
  112. package/dist/m365/pa/commands/pcf/pcf-init/assets/control/virtual-field-template/template_index.tsx +0 -55
  113. package/dist/m365/pa/commands/pcf/pcf-init/assets/package.json +0 -19
  114. package/dist/m365/pa/commands/pcf/pcf-init/assets/pcfconfig.json +0 -3
  115. package/dist/m365/pa/commands/pcf/pcf-init/assets/template_.gitignore +0 -14
  116. package/dist/m365/pa/commands/pcf/pcf-init/assets/template_pcfprojecttype.pcfproj +0 -45
  117. package/dist/m365/pa/commands/pcf/pcf-init/pcf-init-variables.js +0 -2
  118. package/dist/m365/pa/commands/pcf/pcf-init.js +0 -120
  119. package/dist/m365/pa/commands/solution/solution-init/assets/Other/Customizations.xml +0 -18
  120. package/dist/m365/pa/commands/solution/solution-init/assets/Other/Relationships.xml +0 -2
  121. package/dist/m365/pa/commands/solution/solution-init/assets/Other/template_Solution.xml +0 -94
  122. package/dist/m365/pa/commands/solution/solution-init/assets/template_.gitignore +0 -2
  123. package/dist/m365/pa/commands/solution/solution-init/assets/template_solutionprojecttype.cdsproj +0 -44
  124. package/dist/m365/pa/commands/solution/solution-init/solution-init-variables.js +0 -2
  125. package/dist/m365/pa/commands/solution/solution-init.js +0 -126
  126. package/dist/m365/pa/commands/solution/solution-reference-add.js +0 -88
  127. package/dist/m365/pa/template-instantiator.js +0 -57
  128. package/docs/docs/cmd/pa/pcf/pcf-init.mdx +0 -56
  129. package/docs/docs/cmd/pa/solution/solution-init.mdx +0 -46
  130. package/docs/docs/cmd/pa/solution/solution-reference-add.mdx +0 -42
  131. /package/dist/m365/aad/commands/{o365group → m365group}/GroupExtended.js +0 -0
@@ -10,6 +10,12 @@ import { spo } from '../../../../utils/spo.js';
10
10
  import { validation } from '../../../../utils/validation.js';
11
11
  import SpoCommand from '../../../base/SpoCommand.js';
12
12
  import commands from '../../commands.js';
13
+ var OrgAssetType;
14
+ (function (OrgAssetType) {
15
+ OrgAssetType[OrgAssetType["ImageDocumentLibrary"] = 1] = "ImageDocumentLibrary";
16
+ OrgAssetType[OrgAssetType["OfficeTemplateLibrary"] = 2] = "OfficeTemplateLibrary";
17
+ OrgAssetType[OrgAssetType["OfficeFontLibrary"] = 4] = "OfficeFontLibrary";
18
+ })(OrgAssetType || (OrgAssetType = {}));
13
19
  class SpoOrgAssetsLibraryAddCommand extends SpoCommand {
14
20
  get name() {
15
21
  return commands.ORGASSETSLIBRARY_ADD;
@@ -30,6 +36,7 @@ class SpoOrgAssetsLibraryAddCommand extends SpoCommand {
30
36
  const cdnType = cdnTypeString === 'Private' ? 1 : 0;
31
37
  const thumbnailSchema = typeof args.options.thumbnailUrl === 'undefined' ? `<Parameter Type="Null" />` : `<Parameter Type="String">${args.options.thumbnailUrl}</Parameter>`;
32
38
  try {
39
+ const orgAssetType = this.getOrgAssetType(args.options.orgAssetType);
33
40
  spoAdminUrl = await spo.getSpoAdminUrl(logger, this.debug);
34
41
  const reqDigest = await spo.getRequestDigest(spoAdminUrl);
35
42
  const requestOptions = {
@@ -37,7 +44,7 @@ class SpoOrgAssetsLibraryAddCommand extends SpoCommand {
37
44
  headers: {
38
45
  'X-RequestDigest': reqDigest.FormDigestValue
39
46
  },
40
- data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><Method Name="AddToOrgAssetsLibAndCdnWithType" Id="11" ObjectPathId="8"><Parameters><Parameter Type="Enum">${cdnType}</Parameter><Parameter Type="String">${args.options.libraryUrl}</Parameter>${thumbnailSchema}<Parameter Type="Enum">1</Parameter></Parameters></Method></Actions><ObjectPaths><Constructor Id="8" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /></ObjectPaths></Request>`
47
+ data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><Method Name="AddToOrgAssetsLibAndCdnWithType" Id="11" ObjectPathId="8"><Parameters><Parameter Type="Enum">${cdnType}</Parameter><Parameter Type="String">${args.options.libraryUrl}</Parameter>${thumbnailSchema}<Parameter Type="Enum">${orgAssetType}</Parameter></Parameters></Method></Actions><ObjectPaths><Constructor Id="8" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /></ObjectPaths></Request>`
41
48
  };
42
49
  const res = await request.post(requestOptions);
43
50
  const json = JSON.parse(res);
@@ -50,12 +57,23 @@ class SpoOrgAssetsLibraryAddCommand extends SpoCommand {
50
57
  this.handleRejectedPromise(err);
51
58
  }
52
59
  }
60
+ getOrgAssetType(orgAssetType) {
61
+ switch (orgAssetType) {
62
+ case 'OfficeTemplateLibrary':
63
+ return OrgAssetType.OfficeTemplateLibrary;
64
+ case 'OfficeFontLibrary':
65
+ return OrgAssetType.OfficeFontLibrary;
66
+ default:
67
+ return OrgAssetType.ImageDocumentLibrary;
68
+ }
69
+ }
53
70
  }
54
71
  _SpoOrgAssetsLibraryAddCommand_instances = new WeakSet(), _SpoOrgAssetsLibraryAddCommand_initTelemetry = function _SpoOrgAssetsLibraryAddCommand_initTelemetry() {
55
72
  this.telemetry.push((args) => {
56
73
  Object.assign(this.telemetryProperties, {
57
74
  cdnType: args.options.cdnType || 'Private',
58
- thumbnailUrl: typeof args.options.thumbnailUrl !== 'undefined'
75
+ thumbnailUrl: typeof args.options.thumbnailUrl !== 'undefined',
76
+ orgAssetType: args.options.orgAssetType
59
77
  });
60
78
  });
61
79
  }, _SpoOrgAssetsLibraryAddCommand_initOptions = function _SpoOrgAssetsLibraryAddCommand_initOptions() {
@@ -65,7 +83,10 @@ _SpoOrgAssetsLibraryAddCommand_instances = new WeakSet(), _SpoOrgAssetsLibraryAd
65
83
  option: '--thumbnailUrl [thumbnailUrl]'
66
84
  }, {
67
85
  option: '--cdnType [cdnType]',
68
- autocomplete: ['Public', 'Private']
86
+ autocomplete: SpoOrgAssetsLibraryAddCommand.cdnTypes
87
+ }, {
88
+ option: '--orgAssetType [orgAssetType]',
89
+ autocomplete: SpoOrgAssetsLibraryAddCommand.orgAssetTypes
69
90
  });
70
91
  }, _SpoOrgAssetsLibraryAddCommand_initValidators = function _SpoOrgAssetsLibraryAddCommand_initValidators() {
71
92
  this.validators.push(async (args) => {
@@ -73,8 +94,16 @@ _SpoOrgAssetsLibraryAddCommand_instances = new WeakSet(), _SpoOrgAssetsLibraryAd
73
94
  if (typeof args.options.thumbnailUrl !== 'undefined' && isValidThumbnailUrl !== true) {
74
95
  return isValidThumbnailUrl;
75
96
  }
97
+ if (args.options.cdnType && SpoOrgAssetsLibraryAddCommand.cdnTypes.indexOf(args.options.cdnType) < 0) {
98
+ return `${args.options.cdnType} is not a valid value for cdnType. Valid values are ${SpoOrgAssetsLibraryAddCommand.cdnTypes.join(', ')}`;
99
+ }
100
+ if (args.options.orgAssetType && SpoOrgAssetsLibraryAddCommand.orgAssetTypes.indexOf(args.options.orgAssetType) < 0) {
101
+ return `${args.options.orgAssetType} is not a valid value for orgAssetType. Valid values are ${SpoOrgAssetsLibraryAddCommand.orgAssetTypes.join(', ')}`;
102
+ }
76
103
  return validation.isValidSharePointUrl(args.options.libraryUrl);
77
104
  });
78
105
  };
106
+ SpoOrgAssetsLibraryAddCommand.orgAssetTypes = ['ImageDocumentLibrary', 'OfficeTemplateLibrary', 'OfficeFontLibrary'];
107
+ SpoOrgAssetsLibraryAddCommand.cdnTypes = ['Public', 'Private'];
79
108
  export default new SpoOrgAssetsLibraryAddCommand();
80
109
  //# sourceMappingURL=orgassetslibrary-add.js.map
@@ -204,7 +204,6 @@ function reindex(collection) {
204
204
  export class ClientSidePage {
205
205
  constructor() {
206
206
  this.sections = [];
207
- this.commentsDisabled = false;
208
207
  }
209
208
  /**
210
209
  * Converts a json object to an escaped string appropriate for use in attributes when storing client-side controls
@@ -243,49 +242,6 @@ export class ClientSidePage {
243
242
  };
244
243
  return JSON.parse(unespace(escapedString));
245
244
  }
246
- /**
247
- * Add a section to this page
248
- */
249
- addSection(sectionTemplate, order) {
250
- var sectionOrder = typeof order !== 'undefined' ? order : getNextOrder(this.sections);
251
- var section = new CanvasSection(this, sectionOrder);
252
- if (sectionTemplate) {
253
- switch (CanvasSectionTemplate[sectionTemplate].toString()) {
254
- case CanvasSectionTemplate.OneColumnFullWidth.toString():
255
- section.addColumn(0);
256
- break;
257
- case CanvasSectionTemplate.TwoColumn.toString():
258
- section.addColumn(6);
259
- section.addColumn(6);
260
- break;
261
- case CanvasSectionTemplate.ThreeColumn.toString():
262
- section.addColumn(4);
263
- section.addColumn(4);
264
- section.addColumn(4);
265
- break;
266
- case CanvasSectionTemplate.TwoColumnLeft.toString():
267
- section.addColumn(8);
268
- section.addColumn(4);
269
- break;
270
- case CanvasSectionTemplate.TwoColumnRight.toString():
271
- section.addColumn(4);
272
- section.addColumn(8);
273
- break;
274
- case CanvasSectionTemplate.OneColumn.toString():
275
- default:
276
- section.addColumn(12);
277
- break;
278
- }
279
- }
280
- if (typeof order !== undefined) {
281
- // Insert the sections at the specified order.
282
- this.sections.splice(sectionOrder - 1, 0, section);
283
- }
284
- else {
285
- this.sections.push(section);
286
- }
287
- return section;
288
- }
289
245
  /**
290
246
  * Converts this page's content to html markup
291
247
  */
@@ -341,14 +297,6 @@ export class ClientSidePage {
341
297
  reindex(page.sections);
342
298
  return page;
343
299
  }
344
- /**
345
- * Finds a control by the specified instance id
346
- *
347
- * @param id Instance id of the control to find
348
- */
349
- findControlById(id) {
350
- return this.findControl((c) => c.id === id);
351
- }
352
300
  /**
353
301
  * Finds a control within this page's control tree using the supplied predicate
354
302
  *
@@ -441,7 +389,6 @@ export class CanvasSection {
441
389
  this.page = page;
442
390
  this.order = order;
443
391
  this.columns = columns;
444
- this._memId = getGUID();
445
392
  }
446
393
  /**
447
394
  * Default column (this.columns[0]) for this section
@@ -460,15 +407,6 @@ export class CanvasSection {
460
407
  this.columns.push(column);
461
408
  return column;
462
409
  }
463
- /**
464
- * Adds a control to the default column for this section
465
- *
466
- * @param control Control to add to the default column
467
- */
468
- addControl(control) {
469
- this.defaultColumn.addControl(control);
470
- return this;
471
- }
472
410
  toHtml() {
473
411
  const html = [];
474
412
  for (let i = 0; i < this.columns.length; i++) {
@@ -476,15 +414,8 @@ export class CanvasSection {
476
414
  }
477
415
  return html.join("");
478
416
  }
479
- /**
480
- * Removes this section and all contained columns and controls from the collection
481
- */
482
- remove() {
483
- this.page.sections = this.page.sections.filter(section => section._memId !== this._memId);
484
- reindex(this.page.sections);
485
- }
486
417
  }
487
- export class CanvasControl {
418
+ class CanvasControl {
488
419
  constructor(controlType, dataVersion, column = undefined, order = 1, id = getGUID(), controlData = null, dynamicDataPaths = null, dynamicDataValues = null) {
489
420
  this.controlType = controlType;
490
421
  this.dataVersion = dataVersion;
@@ -534,9 +465,6 @@ export class CanvasColumn extends CanvasControl {
534
465
  }
535
466
  return this;
536
467
  }
537
- getControl(index) {
538
- return this.controls[index];
539
- }
540
468
  toHtml() {
541
469
  const html = [];
542
470
  if (this.controls.length < 1) {
@@ -662,11 +590,6 @@ export class ClientSideWebpart extends ClientSidePart {
662
590
  this.dynamicDataPaths = dynamicDataPaths;
663
591
  this.dynamicDataValues = dynamicDataValues;
664
592
  }
665
- static fromComponentDef(definition) {
666
- const part = new ClientSideWebpart("");
667
- part.import(definition);
668
- return part;
669
- }
670
593
  import(component) {
671
594
  this.webPartId = component.Id.replace(/^\{|\}$/g, "").toLowerCase();
672
595
  const manifest = JSON.parse(component.Manifest);
@@ -679,9 +602,6 @@ export class ClientSideWebpart extends ClientSidePart {
679
602
  this.propertieJson = extend(this.propertieJson, properties);
680
603
  return this;
681
604
  }
682
- getProperties() {
683
- return this.propertieJson;
684
- }
685
605
  toHtml(index) {
686
606
  // set our order to the value passed in
687
607
  this.order = index;
@@ -13,7 +13,7 @@ export class SpoPropertyBagBaseCommand extends SpoCommand {
13
13
  * Gets property bag for a folder or site rootFolder of a site where return type is "_ObjectType_\":\"SP.Folder\".
14
14
  * This method is executed when folder option is specified. PnP PowerShell behaves the same way.
15
15
  */
16
- getFolderPropertyBag(identityResp, webUrl, folder, logger) {
16
+ async getFolderPropertyBag(identityResp, webUrl, folder, logger) {
17
17
  let serverRelativeUrl = folder;
18
18
  if (identityResp.serverRelativeUrl !== '/') {
19
19
  serverRelativeUrl = `${identityResp.serverRelativeUrl}${serverRelativeUrl}`;
@@ -25,31 +25,31 @@ export class SpoPropertyBagBaseCommand extends SpoCommand {
25
25
  },
26
26
  data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="10" ObjectPathId="9" /><ObjectIdentityQuery Id="11" ObjectPathId="9" /><Query Id="12" ObjectPathId="9"><Query SelectAllProperties="false"><Properties><Property Name="Properties" SelectAll="true"><Query SelectAllProperties="false"><Properties /></Query></Property></Properties></Query></Query></Actions><ObjectPaths><Method Id="9" ParentId="5" Name="GetFolderByServerRelativeUrl"><Parameters><Parameter Type="String">${serverRelativeUrl}</Parameter></Parameters></Method><Identity Id="5" Name="${identityResp.objectIdentity}" /></ObjectPaths></Request>`
27
27
  };
28
- return new Promise((resolve, reject) => {
29
- return request
30
- .post(requestOptions)
31
- .then(async (res) => {
32
- if (this.debug) {
33
- await logger.logToStderr('Attempt to get Properties key values');
34
- }
35
- const json = JSON.parse(res);
36
- const contents = json.find(x => { return x['ErrorInfo']; });
37
- if (contents && contents.ErrorInfo) {
38
- return reject(contents.ErrorInfo.ErrorMessage || 'ClientSvc unknown error');
39
- }
40
- const propertiesObj = json.find(x => { return x['Properties']; });
41
- if (propertiesObj) {
42
- return resolve(propertiesObj['Properties']);
43
- }
44
- reject('Cannot proceed. Properties not found'); // this is not suppose to happen
45
- }, (err) => { reject(err); });
46
- });
28
+ try {
29
+ const res = await request.post(requestOptions);
30
+ if (this.debug) {
31
+ await logger.logToStderr('Attempt to get Properties key values');
32
+ }
33
+ const json = JSON.parse(res);
34
+ const contents = json.find(x => { return x['ErrorInfo']; });
35
+ if (contents && contents.ErrorInfo) {
36
+ throw contents.ErrorInfo.ErrorMessage || 'ClientSvc unknown error';
37
+ }
38
+ const propertiesObj = json.find(x => { return x['Properties']; });
39
+ if (propertiesObj) {
40
+ return propertiesObj['Properties'];
41
+ }
42
+ throw 'Cannot proceed. Properties not found'; // this is not suppose to happen
43
+ }
44
+ catch (err) {
45
+ throw err;
46
+ }
47
47
  }
48
48
  /**
49
49
  * Gets property bag for site or sitecollection where return type is "_ObjectType_\":\"SP.Web\".
50
50
  * This method is executed when no folder specified. PnP PowerShell behaves the same way.
51
51
  */
52
- getWebPropertyBag(identityResp, webUrl, logger) {
52
+ async getWebPropertyBag(identityResp, webUrl, logger) {
53
53
  const requestOptions = {
54
54
  url: `${webUrl}/_vti_bin/client.svc/ProcessQuery`,
55
55
  headers: {
@@ -57,23 +57,25 @@ export class SpoPropertyBagBaseCommand extends SpoCommand {
57
57
  },
58
58
  data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><Query Id="97" ObjectPathId="5"><Query SelectAllProperties="false"><Properties><Property Name="ServerRelativeUrl" ScalarProperty="true" /><Property Name="AllProperties" SelectAll="true"><Query SelectAllProperties="false"><Properties /></Query></Property></Properties></Query></Query></Actions><ObjectPaths><Identity Id="5" Name="${identityResp.objectIdentity}" /></ObjectPaths></Request>`
59
59
  };
60
- return new Promise((resolve, reject) => {
61
- request.post(requestOptions).then(async (res) => {
62
- if (this.debug) {
63
- await logger.logToStderr('Attempt to get AllProperties key values');
64
- }
65
- const json = JSON.parse(res);
66
- const contents = json.find(x => { return x['ErrorInfo']; });
67
- if (contents && contents.ErrorInfo) {
68
- return reject(contents.ErrorInfo.ErrorMessage || 'ClientSvc unknown error');
69
- }
70
- const allPropertiesObj = json.find(x => { return x['AllProperties']; });
71
- if (allPropertiesObj) {
72
- return resolve(allPropertiesObj['AllProperties']);
73
- }
74
- reject('Cannot proceed. AllProperties not found'); // this is not supposed to happen
75
- }, (err) => { reject(err); });
76
- });
60
+ try {
61
+ const res = await request.post(requestOptions);
62
+ if (this.debug) {
63
+ await logger.logToStderr('Attempt to get AllProperties key values');
64
+ }
65
+ const json = JSON.parse(res);
66
+ const contents = json.find(x => { return x['ErrorInfo']; });
67
+ if (contents && contents.ErrorInfo) {
68
+ throw contents.ErrorInfo.ErrorMessage || 'ClientSvc unknown error';
69
+ }
70
+ const allPropertiesObj = json.find(x => { return x['AllProperties']; });
71
+ if (allPropertiesObj) {
72
+ return allPropertiesObj['AllProperties'];
73
+ }
74
+ throw 'Cannot proceed. AllProperties not found'; // this is not supposed to happen
75
+ }
76
+ catch (err) {
77
+ throw err;
78
+ }
77
79
  }
78
80
  /**
79
81
  * The property bag item data returned from the client.svc/ProcessQuery response
@@ -108,7 +110,7 @@ export class SpoPropertyBagBaseCommand extends SpoCommand {
108
110
  }
109
111
  return { key: objKey, value: objValue };
110
112
  }
111
- static setProperty(name, value, webUrl, formDigest, identityResp, logger, debug, folder) {
113
+ static async setProperty(name, value, webUrl, formDigest, identityResp, logger, debug, folder) {
112
114
  let objectType = 'AllProperties';
113
115
  if (folder) {
114
116
  objectType = 'Properties';
@@ -120,18 +122,20 @@ export class SpoPropertyBagBaseCommand extends SpoCommand {
120
122
  },
121
123
  data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><Method Name="SetFieldValue" Id="206" ObjectPathId="205"><Parameters><Parameter Type="String">${formatting.escapeXml(name)}</Parameter><Parameter Type="String">${formatting.escapeXml(value)}</Parameter></Parameters></Method><Method Name="Update" Id="207" ObjectPathId="198" /></Actions><ObjectPaths><Property Id="205" ParentId="198" Name="${objectType}" /><Identity Id="198" Name="${identityResp.objectIdentity}" /></ObjectPaths></Request>`
122
124
  };
123
- return new Promise((resolve, reject) => {
124
- request.post(requestOptions).then((res) => {
125
- const json = JSON.parse(res);
126
- const contents = json.find(x => { return x['ErrorInfo']; });
127
- if (contents && contents.ErrorInfo) {
128
- reject(contents.ErrorInfo.ErrorMessage || 'ClientSvc unknown error');
129
- }
130
- else {
131
- resolve(res);
132
- }
133
- }, (err) => { reject(err); });
134
- });
125
+ try {
126
+ const res = await request.post(requestOptions);
127
+ const json = JSON.parse(res);
128
+ const contents = json.find(x => { return x['ErrorInfo']; });
129
+ if (contents && contents.ErrorInfo) {
130
+ throw contents.ErrorInfo.ErrorMessage || 'ClientSvc unknown error';
131
+ }
132
+ else {
133
+ return res;
134
+ }
135
+ }
136
+ catch (err) {
137
+ throw err;
138
+ }
135
139
  }
136
140
  /**
137
141
  * Detects if the site in question has no script enabled or not. Detection is done
@@ -141,14 +145,14 @@ export class SpoPropertyBagBaseCommand extends SpoCommand {
141
145
  * @param options command options
142
146
  * @param cmd command instance
143
147
  */
144
- static isNoScriptSite(webUrl, formDigest, webIdentityResp, logger, debug) {
145
- return new Promise((resolve, reject) => {
146
- spo.getEffectiveBasePermissions(webIdentityResp.objectIdentity, webUrl, formDigest, logger, debug)
147
- .then((basePermissionsResp) => {
148
- resolve(basePermissionsResp.has(PermissionKind.AddAndCustomizePages) === false);
149
- })
150
- .catch(err => reject(err));
151
- });
148
+ static async isNoScriptSite(webUrl, formDigest, webIdentityResp, logger, debug) {
149
+ try {
150
+ const basePermissionsResp = await spo.getEffectiveBasePermissions(webIdentityResp.objectIdentity, webUrl, formDigest, logger, debug);
151
+ return basePermissionsResp.has(PermissionKind.AddAndCustomizePages) === false;
152
+ }
153
+ catch (err) {
154
+ throw err;
155
+ }
152
156
  }
153
157
  }
154
158
  //# sourceMappingURL=propertybag-base.js.map
@@ -27,24 +27,8 @@ class SpoPropertyBagRemoveCommand extends SpoPropertyBagBaseCommand {
27
27
  __classPrivateFieldGet(this, _SpoPropertyBagRemoveCommand_instances, "m", _SpoPropertyBagRemoveCommand_initValidators).call(this);
28
28
  }
29
29
  async commandAction(logger, args) {
30
- const removeProperty = async () => {
31
- try {
32
- const contextResponse = await spo.getRequestDigest(args.options.webUrl);
33
- this.formDigestValue = contextResponse.FormDigestValue;
34
- let identityResp = await spo.getCurrentWebIdentity(args.options.webUrl, this.formDigestValue);
35
- const opts = args.options;
36
- if (opts.folder) {
37
- // get the folder guid instead of the web guid
38
- identityResp = await spo.getFolderIdentity(identityResp.objectIdentity, opts.webUrl, opts.folder, this.formDigestValue);
39
- }
40
- await this.removeProperty(identityResp, args.options);
41
- }
42
- catch (err) {
43
- this.handleRejectedPromise(err);
44
- }
45
- };
46
30
  if (args.options.force) {
47
- await removeProperty();
31
+ await this.removeProperty(args);
48
32
  }
49
33
  else {
50
34
  const result = await Cli.prompt({
@@ -54,11 +38,27 @@ class SpoPropertyBagRemoveCommand extends SpoPropertyBagBaseCommand {
54
38
  message: `Are you sure you want to remove the ${args.options.key} property?`
55
39
  });
56
40
  if (result.continue) {
57
- await removeProperty();
41
+ await this.removeProperty(args);
58
42
  }
59
43
  }
60
44
  }
61
- removeProperty(identityResp, options) {
45
+ async removeProperty(args) {
46
+ try {
47
+ const contextResponse = await spo.getRequestDigest(args.options.webUrl);
48
+ this.formDigestValue = contextResponse.FormDigestValue;
49
+ let identityResp = await spo.getCurrentWebIdentity(args.options.webUrl, this.formDigestValue);
50
+ const opts = args.options;
51
+ if (opts.folder) {
52
+ // get the folder guid instead of the web guid
53
+ identityResp = await spo.getFolderIdentity(identityResp.objectIdentity, opts.webUrl, opts.folder, this.formDigestValue);
54
+ }
55
+ await this.removePropertyWithIdentityResp(identityResp, args.options);
56
+ }
57
+ catch (err) {
58
+ this.handleRejectedPromise(err);
59
+ }
60
+ }
61
+ async removePropertyWithIdentityResp(identityResp, options) {
62
62
  let objectType = 'AllProperties';
63
63
  if (options.folder) {
64
64
  objectType = 'Properties';
@@ -70,18 +70,15 @@ class SpoPropertyBagRemoveCommand extends SpoPropertyBagBaseCommand {
70
70
  },
71
71
  data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><Method Name="SetFieldValue" Id="206" ObjectPathId="205"><Parameters><Parameter Type="String">${formatting.escapeXml(options.key)}</Parameter><Parameter Type="Null" /></Parameters></Method><Method Name="Update" Id="207" ObjectPathId="198" /></Actions><ObjectPaths><Property Id="205" ParentId="198" Name="${objectType}" /><Identity Id="198" Name="${identityResp.objectIdentity}" /></ObjectPaths></Request>`
72
72
  };
73
- return new Promise((resolve, reject) => {
74
- request.post(requestOptions).then((res) => {
75
- const json = JSON.parse(res);
76
- const contents = json.find(x => { return x['ErrorInfo']; });
77
- if (contents && contents.ErrorInfo) {
78
- reject(contents.ErrorInfo.ErrorMessage || 'ClientSvc unknown error');
79
- }
80
- else {
81
- resolve(res);
82
- }
83
- }, (err) => { reject(err); });
84
- });
73
+ const res = await request.post(requestOptions);
74
+ const json = JSON.parse(res);
75
+ const contents = json.find(x => { return x['ErrorInfo']; });
76
+ if (contents && contents.ErrorInfo) {
77
+ throw contents.ErrorInfo.ErrorMessage || 'ClientSvc unknown error';
78
+ }
79
+ else {
80
+ return res;
81
+ }
85
82
  }
86
83
  }
87
84
  _SpoPropertyBagRemoveCommand_instances = new WeakSet(), _SpoPropertyBagRemoveCommand_initTelemetry = function _SpoPropertyBagRemoveCommand_initTelemetry() {
@@ -0,0 +1,7 @@
1
+ export var FlowsPolicy;
2
+ (function (FlowsPolicy) {
3
+ FlowsPolicy[FlowsPolicy["Unknown"] = 0] = "Unknown";
4
+ FlowsPolicy[FlowsPolicy["Disabled"] = 1] = "Disabled";
5
+ FlowsPolicy[FlowsPolicy["Enabled"] = 2] = "Enabled";
6
+ })(FlowsPolicy || (FlowsPolicy = {}));
7
+ //# sourceMappingURL=FlowsPolicy.js.map
@@ -79,7 +79,7 @@ class SpoSiteEnsureCommand extends SpoCommand {
79
79
  expectedWebTemplate = 'SITEPAGEPUBLISHING#0';
80
80
  break;
81
81
  case 'ClassicSite':
82
- expectedWebTemplate = args.options.webTemplate;
82
+ expectedWebTemplate = args.options.webTemplate || 'STS#0';
83
83
  break;
84
84
  default:
85
85
  throw `${args.options.type} is not a valid site type. Allowed types are TeamSite,CommunicationSite,ClassicSite`;
@@ -138,7 +138,7 @@ class SpoSiteEnsureCommand extends SpoCommand {
138
138
  };
139
139
  const validationResult = await spoSiteAddCommand.validate({ options: options }, Cli.getCommandInfo(spoSiteAddCommand));
140
140
  if (validationResult !== true) {
141
- return Promise.reject(validationResult);
141
+ throw validationResult;
142
142
  }
143
143
  return Cli.executeCommandWithOutput(spoSiteAddCommand, { options: { ...options, _: [] } });
144
144
  }
@@ -161,7 +161,7 @@ class SpoSiteEnsureCommand extends SpoCommand {
161
161
  };
162
162
  const validationResult = await spoSiteSetCommand.validate({ options: options }, Cli.getCommandInfo(spoSiteSetCommand));
163
163
  if (validationResult !== true) {
164
- return Promise.reject(validationResult);
164
+ throw validationResult;
165
165
  }
166
166
  return Cli.executeCommandWithOutput(spoSiteSetCommand, { options: { ...options, _: [] } });
167
167
  }
@@ -25,28 +25,8 @@ class SpoSiteHubSiteDisconnectCommand extends SpoCommand {
25
25
  __classPrivateFieldGet(this, _SpoSiteHubSiteDisconnectCommand_instances, "m", _SpoSiteHubSiteDisconnectCommand_initValidators).call(this);
26
26
  }
27
27
  async commandAction(logger, args) {
28
- const disconnectHubSite = async () => {
29
- try {
30
- const res = await spo.getRequestDigest(args.options.siteUrl);
31
- if (this.verbose) {
32
- await logger.logToStderr(`Disconnecting site collection ${args.options.siteUrl} from its hubsite...`);
33
- }
34
- const requestOptions = {
35
- url: `${args.options.siteUrl}/_api/site/JoinHubSite('00000000-0000-0000-0000-000000000000')`,
36
- headers: {
37
- 'X-RequestDigest': res.FormDigestValue,
38
- accept: 'application/json;odata=nometadata'
39
- },
40
- responseType: 'json'
41
- };
42
- await request.post(requestOptions);
43
- }
44
- catch (err) {
45
- this.handleRejectedODataJsonPromise(err);
46
- }
47
- };
48
28
  if (args.options.force) {
49
- await disconnectHubSite();
29
+ await this.disconnectHubSite(logger, args);
50
30
  }
51
31
  else {
52
32
  const result = await Cli.prompt({
@@ -56,8 +36,28 @@ class SpoSiteHubSiteDisconnectCommand extends SpoCommand {
56
36
  message: `Are you sure you want to disconnect the site collection ${args.options.siteUrl} from its hub site?`
57
37
  });
58
38
  if (result.continue) {
59
- await disconnectHubSite();
39
+ await this.disconnectHubSite(logger, args);
40
+ }
41
+ }
42
+ }
43
+ async disconnectHubSite(logger, args) {
44
+ try {
45
+ const res = await spo.getRequestDigest(args.options.siteUrl);
46
+ if (this.verbose) {
47
+ await logger.logToStderr(`Disconnecting site collection ${args.options.siteUrl} from its hubsite...`);
60
48
  }
49
+ const requestOptions = {
50
+ url: `${args.options.siteUrl}/_api/site/JoinHubSite('00000000-0000-0000-0000-000000000000')`,
51
+ headers: {
52
+ 'X-RequestDigest': res.FormDigestValue,
53
+ accept: 'application/json;odata=nometadata'
54
+ },
55
+ responseType: 'json'
56
+ };
57
+ await request.post(requestOptions);
58
+ }
59
+ catch (err) {
60
+ this.handleRejectedODataJsonPromise(err);
61
61
  }
62
62
  }
63
63
  }