@pnp/cli-microsoft365 11.12.0-beta.8589b73 → 12.0.0-beta.8dff3ac

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 (167) hide show
  1. package/allCommands.json +1 -1
  2. package/allCommandsFull.json +1 -1
  3. package/dist/Auth.js +2 -6
  4. package/dist/auth/FileTokenStorage.js +0 -3
  5. package/dist/auth/msalCachePlugin.js +201 -12
  6. package/dist/m365/commands/logout.js +2 -4
  7. package/dist/m365/entra/commands/m365group/m365group-remove.js +4 -3
  8. package/dist/m365/spe/commands/container/container-remove.js +6 -7
  9. package/dist/m365/spfx/commands/project/DeployWorkflow.js +7 -15
  10. package/dist/m365/spfx/commands/project/project-azuredevops-pipeline-add.js +30 -2
  11. package/dist/m365/spfx/commands/project/project-github-workflow-add.js +12 -2
  12. package/dist/m365/spo/commands/cdn/cdn-get.js +8 -35
  13. package/dist/m365/spo/commands/cdn/cdn-origin-add.js +9 -36
  14. package/dist/m365/spo/commands/cdn/cdn-origin-list.js +8 -34
  15. package/dist/m365/spo/commands/cdn/cdn-origin-remove.js +10 -39
  16. package/dist/m365/spo/commands/cdn/cdn-policy-list.js +8 -34
  17. package/dist/m365/spo/commands/cdn/cdn-policy-set.js +10 -45
  18. package/dist/m365/spo/commands/cdn/cdn-set.js +10 -46
  19. package/dist/m365/spo/commands/contenttype/contenttype-sync.js +12 -24
  20. package/dist/m365/spo/commands/file/file-add.js +2 -6
  21. package/dist/m365/spo/commands/file/file-archive.js +1 -1
  22. package/dist/m365/spo/commands/file/file-remove.js +5 -5
  23. package/dist/m365/spo/commands/file/file-unarchive.js +1 -1
  24. package/dist/m365/spo/commands/folder/folder-archive.js +1 -1
  25. package/dist/m365/spo/commands/folder/folder-remove.js +5 -5
  26. package/dist/m365/spo/commands/hidedefaultthemes/hidedefaultthemes-get.js +5 -0
  27. package/dist/m365/spo/commands/hidedefaultthemes/hidedefaultthemes-set.js +8 -26
  28. package/dist/m365/spo/commands/homesite/homesite-list.js +5 -0
  29. package/dist/m365/spo/commands/list/list-remove.js +4 -4
  30. package/dist/m365/spo/commands/listitem/listitem-batch-remove.js +5 -4
  31. package/dist/m365/spo/commands/listitem/listitem-get.js +15 -7
  32. package/dist/m365/spo/commands/listitem/listitem-remove.js +8 -5
  33. package/dist/m365/spo/commands/page/page-header-set.js +123 -64
  34. package/dist/m365/spo/commands/page/page-remove.js +7 -7
  35. package/dist/m365/spo/commands/site/site-list.js +60 -49
  36. package/dist/m365/spo/commands/site/site-remove.js +7 -7
  37. package/dist/m365/spo/commands/spo-get.js +5 -0
  38. package/dist/m365/spo/commands/spo-set.js +10 -21
  39. package/dist/m365/spo/commands/storageentity/storageentity-get.js +23 -17
  40. package/dist/m365/spo/commands/storageentity/storageentity-list.js +39 -36
  41. package/dist/m365/spo/commands/storageentity/storageentity-remove.js +26 -33
  42. package/dist/m365/spo/commands/storageentity/storageentity-set.js +26 -36
  43. package/dist/m365/spo/commands/tenant/tenant-appcatalog-add.js +1 -1
  44. package/dist/m365/spo/commands/user/user-ensure.js +24 -60
  45. package/dist/m365/spo/commands/user/user-get.js +25 -65
  46. package/dist/m365/spo/commands/user/user-list.js +10 -18
  47. package/dist/m365/spo/commands/user/user-remove.js +26 -68
  48. package/dist/m365/spo/commands/userprofile/userprofile-get.js +10 -23
  49. package/dist/m365/spo/commands/userprofile/userprofile-set.js +10 -19
  50. package/dist/m365/spo/commands/web/web-add.js +20 -55
  51. package/dist/m365/spo/commands/web/web-clientsidewebpart-list.js +10 -18
  52. package/dist/m365/spo/commands/web/web-get.js +12 -30
  53. package/dist/m365/spo/commands/web/web-installedlanguage-list.js +10 -18
  54. package/dist/m365/spo/commands/web/web-list.js +10 -18
  55. package/dist/m365/spo/commands/web/web-reindex.js +10 -18
  56. package/dist/m365/spo/commands/web/web-remove.js +11 -27
  57. package/dist/m365/spo/commands/web/web-retentionlabel-list.js +10 -18
  58. package/dist/m365/spo/commands/web/web-roleassignment-add.js +40 -64
  59. package/dist/m365/spo/commands/web/web-roleassignment-remove.js +31 -58
  60. package/dist/m365/spo/commands/web/web-roleinheritance-break.js +12 -36
  61. package/dist/m365/spo/commands/web/web-roleinheritance-reset.js +11 -29
  62. package/dist/m365/spo/commands/web/web-rule-list.js +6 -4
  63. package/dist/m365/spo/commands/web/web-rule-remove.js +0 -3
  64. package/dist/m365/spo/commands/web/web-set.js +26 -96
  65. package/dist/m365/spo/commands.js +0 -2
  66. package/dist/m365/teams/commands/channel/channel-list.js +2 -6
  67. package/dist/m365/teams/commands/channel/channel-member-add.js +2 -6
  68. package/dist/m365/teams/commands/channel/channel-member-list.js +2 -6
  69. package/dist/m365/teams/commands/channel/channel-member-remove.js +2 -6
  70. package/dist/m365/teams/commands/channel/channel-member-set.js +2 -6
  71. package/dist/m365/teams/commands/channel/channel-remove.js +2 -8
  72. package/dist/m365/teams/commands/channel/channel-set.js +2 -8
  73. package/dist/m365/teams/commands/tab/tab-get.js +2 -6
  74. package/dist/m365/teams/commands/team/team-archive.js +2 -6
  75. package/dist/m365/teams/commands/team/team-remove.js +2 -6
  76. package/dist/m365/teams/commands/team/team-unarchive.js +2 -6
  77. package/docs/docs/cmd/entra/m365group/m365group-remove.mdx +4 -4
  78. package/docs/docs/cmd/spe/container/container-remove.mdx +5 -5
  79. package/docs/docs/cmd/spo/contenttype/contenttype-sync.mdx +4 -4
  80. package/docs/docs/cmd/spo/file/file-add.mdx +2 -2
  81. package/docs/docs/cmd/spo/file/file-archive.mdx +8 -0
  82. package/docs/docs/cmd/spo/file/file-checkin.mdx +21 -0
  83. package/docs/docs/cmd/spo/file/file-checkout.mdx +21 -0
  84. package/docs/docs/cmd/spo/file/file-copy.mdx +19 -0
  85. package/docs/docs/cmd/spo/file/file-get.mdx +19 -0
  86. package/docs/docs/cmd/spo/file/file-list.mdx +19 -0
  87. package/docs/docs/cmd/spo/file/file-move.mdx +19 -0
  88. package/docs/docs/cmd/spo/file/file-remove.mdx +25 -4
  89. package/docs/docs/cmd/spo/file/file-rename.mdx +19 -0
  90. package/docs/docs/cmd/spo/file/file-unarchive.mdx +8 -0
  91. package/docs/docs/cmd/spo/folder/folder-archive.mdx +6 -0
  92. package/docs/docs/cmd/spo/folder/folder-remove.mdx +4 -4
  93. package/docs/docs/cmd/spo/folder/folder-retentionlabel-ensure.mdx +21 -0
  94. package/docs/docs/cmd/spo/folder/folder-retentionlabel-remove.mdx +21 -0
  95. package/docs/docs/cmd/spo/folder/folder-roleassignment-add.mdx +21 -0
  96. package/docs/docs/cmd/spo/folder/folder-roleassignment-remove.mdx +21 -0
  97. package/docs/docs/cmd/spo/folder/folder-roleinheritance-break.mdx +21 -0
  98. package/docs/docs/cmd/spo/folder/folder-roleinheritance-reset.mdx +21 -0
  99. package/docs/docs/cmd/spo/list/list-add.mdx +19 -0
  100. package/docs/docs/cmd/spo/list/list-contenttype-add.mdx +19 -0
  101. package/docs/docs/cmd/spo/list/list-contenttype-default-set.mdx +21 -0
  102. package/docs/docs/cmd/spo/list/list-contenttype-list.mdx +19 -0
  103. package/docs/docs/cmd/spo/list/list-contenttype-remove.mdx +21 -0
  104. package/docs/docs/cmd/spo/list/list-defaultvalue-clear.mdx +21 -0
  105. package/docs/docs/cmd/spo/list/list-defaultvalue-list.mdx +19 -0
  106. package/docs/docs/cmd/spo/list/list-defaultvalue-remove.mdx +21 -0
  107. package/docs/docs/cmd/spo/list/list-defaultvalue-set.mdx +21 -0
  108. package/docs/docs/cmd/spo/list/list-get.mdx +19 -0
  109. package/docs/docs/cmd/spo/list/list-list.mdx +19 -0
  110. package/docs/docs/cmd/spo/list/list-remove.mdx +25 -4
  111. package/docs/docs/cmd/spo/list/list-retentionlabel-ensure.mdx +21 -0
  112. package/docs/docs/cmd/spo/list/list-retentionlabel-get.mdx +19 -0
  113. package/docs/docs/cmd/spo/list/list-retentionlabel-remove.mdx +21 -0
  114. package/docs/docs/cmd/spo/list/list-roleassignment-add.mdx +21 -0
  115. package/docs/docs/cmd/spo/list/list-roleassignment-remove.mdx +21 -0
  116. package/docs/docs/cmd/spo/list/list-roleinheritance-break.mdx +21 -0
  117. package/docs/docs/cmd/spo/list/list-roleinheritance-reset.mdx +21 -0
  118. package/docs/docs/cmd/spo/list/list-sensitivitylabel-ensure.mdx +23 -0
  119. package/docs/docs/cmd/spo/list/list-set.mdx +21 -0
  120. package/docs/docs/cmd/spo/list/list-sitescript-get.mdx +19 -0
  121. package/docs/docs/cmd/spo/list/list-view-add.mdx +19 -0
  122. package/docs/docs/cmd/spo/list/list-view-field-add.mdx +21 -0
  123. package/docs/docs/cmd/spo/list/list-view-field-remove.mdx +21 -0
  124. package/docs/docs/cmd/spo/list/list-view-field-set.mdx +21 -0
  125. package/docs/docs/cmd/spo/list/list-view-get.mdx +19 -0
  126. package/docs/docs/cmd/spo/list/list-view-list.mdx +19 -0
  127. package/docs/docs/cmd/spo/list/list-view-remove.mdx +21 -0
  128. package/docs/docs/cmd/spo/list/list-view-set.mdx +19 -0
  129. package/docs/docs/cmd/spo/list/list-webhook-add.mdx +19 -0
  130. package/docs/docs/cmd/spo/list/list-webhook-get.mdx +19 -0
  131. package/docs/docs/cmd/spo/list/list-webhook-list.mdx +19 -0
  132. package/docs/docs/cmd/spo/list/list-webhook-remove.mdx +21 -0
  133. package/docs/docs/cmd/spo/list/list-webhook-set.mdx +21 -0
  134. package/docs/docs/cmd/spo/listitem/listitem-attachment-add.mdx +19 -0
  135. package/docs/docs/cmd/spo/listitem/listitem-attachment-get.mdx +19 -0
  136. package/docs/docs/cmd/spo/listitem/listitem-attachment-list.mdx +19 -0
  137. package/docs/docs/cmd/spo/listitem/listitem-attachment-remove.mdx +19 -0
  138. package/docs/docs/cmd/spo/listitem/listitem-attachment-set.mdx +19 -0
  139. package/docs/docs/cmd/spo/listitem/listitem-batch-remove.mdx +8 -2
  140. package/docs/docs/cmd/spo/listitem/listitem-get.mdx +13 -7
  141. package/docs/docs/cmd/spo/listitem/listitem-remove.mdx +8 -2
  142. package/docs/docs/cmd/spo/page/page-header-set.mdx +9 -9
  143. package/docs/docs/cmd/spo/page/page-remove.mdx +4 -4
  144. package/docs/docs/cmd/spo/site/site-apppermission-add.mdx +52 -21
  145. package/docs/docs/cmd/spo/site/site-list.mdx +22 -1
  146. package/docs/docs/cmd/spo/site/site-remove.mdx +3 -3
  147. package/docs/docs/cmd/spo/storageentity/storageentity-get.mdx +11 -2
  148. package/docs/docs/cmd/spo/storageentity/storageentity-list.mdx +9 -3
  149. package/docs/docs/cmd/spo/storageentity/storageentity-remove.mdx +6 -6
  150. package/docs/docs/cmd/spo/storageentity/storageentity-set.mdx +10 -4
  151. package/docs/docs/cmd/spo/web/web-rule-list.mdx +8 -12
  152. package/docs/docs/cmd/spo/web/web-rule-remove.mdx +0 -6
  153. package/docs/docs/cmd/teams/app/app-install.mdx +21 -0
  154. package/docs/docs/cmd/teams/app/app-list.mdx +19 -0
  155. package/docs/docs/cmd/teams/app/app-publish.mdx +17 -0
  156. package/docs/docs/cmd/teams/app/app-remove.mdx +19 -0
  157. package/docs/docs/cmd/teams/app/app-uninstall.mdx +21 -0
  158. package/docs/docs/cmd/teams/app/app-update.mdx +19 -0
  159. package/docs/docs/cmd/tenant/id/id-get.mdx +15 -0
  160. package/docs/docs/cmd/tenant/info/info-get.mdx +19 -0
  161. package/docs/docs/cmd/tenant/people/people-pronouns-get.mdx +19 -0
  162. package/docs/docs/cmd/tenant/people/people-pronouns-set.mdx +19 -0
  163. package/docs/docs/cmd/tenant/report/report-settings-get.mdx +19 -0
  164. package/docs/docs/cmd/tenant/report/report-settings-set.mdx +21 -0
  165. package/docs/docs/cmd/tenant/security/security-alerts-list.mdx +19 -0
  166. package/npm-shrinkwrap.json +1541 -1163
  167. package/package.json +22 -17
@@ -1,7 +1,9 @@
1
+ import { globalOptionsZod } from '../../../../Command.js';
1
2
  import { odata } from '../../../../utils/odata.js';
2
3
  import { spo } from '../../../../utils/spo.js';
3
4
  import SpoCommand from '../../../base/SpoCommand.js';
4
5
  import commands from '../../commands.js';
6
+ export const options = globalOptionsZod.strict();
5
7
  class SpoHomeSiteListCommand extends SpoCommand {
6
8
  get name() {
7
9
  return commands.HOMESITE_LIST;
@@ -9,6 +11,9 @@ class SpoHomeSiteListCommand extends SpoCommand {
9
11
  get description() {
10
12
  return 'Lists all home sites';
11
13
  }
14
+ get schema() {
15
+ return options;
16
+ }
12
17
  defaultProperties() {
13
18
  return ['Url', 'Title'];
14
19
  }
@@ -38,7 +38,7 @@ class SpoListRemoveCommand extends SpoCommand {
38
38
  else {
39
39
  requestUrl = `${args.options.webUrl}/_api/web/lists/GetByTitle('${formatting.encodeQueryParameter(args.options.title)}')`;
40
40
  }
41
- if (args.options.recycle) {
41
+ if (!args.options.permanent) {
42
42
  requestUrl += `/recycle`;
43
43
  }
44
44
  const requestOptions = {
@@ -75,7 +75,7 @@ _SpoListRemoveCommand_instances = new WeakSet(), _SpoListRemoveCommand_initTelem
75
75
  id: typeof args.options.id !== 'undefined',
76
76
  title: typeof args.options.title !== 'undefined',
77
77
  force: !!args.options.force,
78
- recycle: !!args.options.recycle
78
+ permanent: !!args.options.permanent
79
79
  });
80
80
  });
81
81
  }, _SpoListRemoveCommand_initOptions = function _SpoListRemoveCommand_initOptions() {
@@ -86,7 +86,7 @@ _SpoListRemoveCommand_instances = new WeakSet(), _SpoListRemoveCommand_initTelem
86
86
  }, {
87
87
  option: '-t, --title [title]'
88
88
  }, {
89
- option: '--recycle'
89
+ option: '--permanent'
90
90
  }, {
91
91
  option: '-f, --force'
92
92
  });
@@ -106,7 +106,7 @@ _SpoListRemoveCommand_instances = new WeakSet(), _SpoListRemoveCommand_initTelem
106
106
  this.optionSets.push({ options: ['id', 'title'] });
107
107
  }, _SpoListRemoveCommand_initTypes = function _SpoListRemoveCommand_initTypes() {
108
108
  this.types.string.push('id', 'title', 'webUrl');
109
- this.types.boolean.push('force', 'recycle');
109
+ this.types.boolean.push('force', 'permanent');
110
110
  };
111
111
  export default new SpoListRemoveCommand();
112
112
  //# sourceMappingURL=list-remove.js.map
@@ -56,7 +56,7 @@ class SpoListItemBatchRemoveCommand extends SpoCommand {
56
56
  await removeListItems();
57
57
  }
58
58
  else {
59
- const result = await cli.promptForConfirmation({ message: `Are you sure you want to ${args.options.recycle ? "recycle" : "remove"} the list items from list ${args.options.listId || args.options.listTitle || args.options.listUrl} located in site ${args.options.webUrl}?` });
59
+ const result = await cli.promptForConfirmation({ message: `Are you sure you want to ${args.options.permanent ? 'permanently remove' : 'recycle'} the list items from list ${args.options.listId || args.options.listTitle || args.options.listUrl} located in site ${args.options.webUrl}?` });
60
60
  if (result) {
61
61
  await removeListItems();
62
62
  }
@@ -142,7 +142,7 @@ class SpoListItemBatchRemoveCommand extends SpoCommand {
142
142
  requestUrl += `GetList('${formatting.encodeQueryParameter(listServerRelativeUrl)}')`;
143
143
  }
144
144
  requestUrl += `/items(${item})`;
145
- if (options.recycle) {
145
+ if (!options.permanent) {
146
146
  requestUrl += '/recycle()';
147
147
  }
148
148
  return requestUrl;
@@ -156,7 +156,7 @@ _SpoListItemBatchRemoveCommand_instances = new WeakSet(), _SpoListItemBatchRemov
156
156
  listId: typeof args.options.listId !== 'undefined',
157
157
  listTitle: typeof args.options.listTitle !== 'undefined',
158
158
  listUrl: typeof args.options.listUrl !== 'undefined',
159
- recycle: !!args.options.recycle,
159
+ permanent: !!args.options.permanent,
160
160
  force: !!args.options.force
161
161
  });
162
162
  });
@@ -174,7 +174,7 @@ _SpoListItemBatchRemoveCommand_instances = new WeakSet(), _SpoListItemBatchRemov
174
174
  }, {
175
175
  option: '-i, --ids [ids]'
176
176
  }, {
177
- option: '-r, --recycle'
177
+ option: '--permanent'
178
178
  }, {
179
179
  option: '-f, --force'
180
180
  });
@@ -213,6 +213,7 @@ _SpoListItemBatchRemoveCommand_instances = new WeakSet(), _SpoListItemBatchRemov
213
213
  });
214
214
  }, _SpoListItemBatchRemoveCommand_initTypes = function _SpoListItemBatchRemoveCommand_initTypes() {
215
215
  this.types.string.push('webUrl', 'listId', 'listTitle', 'listUrl', 'ids', 'filePath');
216
+ this.types.boolean.push('permanent', 'force');
216
217
  }, _SpoListItemBatchRemoveCommand_initOptionSets = function _SpoListItemBatchRemoveCommand_initOptionSets() {
217
218
  this.optionSets.push({
218
219
  options: ['listId', 'listTitle', 'listUrl']
@@ -30,6 +30,12 @@ class SpoListItemGetCommand extends SpoCommand {
30
30
  __classPrivateFieldGet(this, _SpoListItemGetCommand_instances, "m", _SpoListItemGetCommand_initOptionSets).call(this);
31
31
  }
32
32
  async commandAction(logger, args) {
33
+ if (args.options.properties) {
34
+ await this.warn(logger, `Option 'properties' is deprecated. Please use 'fields' instead.`);
35
+ if (!args.options.fields) {
36
+ args.options.fields = args.options.properties;
37
+ }
38
+ }
33
39
  let requestUrl = `${args.options.webUrl}/_api/web`;
34
40
  if (args.options.listId) {
35
41
  requestUrl += `/lists(guid'${formatting.encodeQueryParameter(args.options.listId)}')`;
@@ -41,11 +47,11 @@ class SpoListItemGetCommand extends SpoCommand {
41
47
  const listServerRelativeUrl = urlUtil.getServerRelativePath(args.options.webUrl, args.options.listUrl);
42
48
  requestUrl += `/GetList('${formatting.encodeQueryParameter(listServerRelativeUrl)}')`;
43
49
  }
44
- const propertiesSelect = args.options.properties ? args.options.properties.split(',') : [];
45
- const propertiesWithSlash = propertiesSelect.filter(item => item.includes('/'));
46
- const propertiesToExpand = propertiesWithSlash.map(e => e.split('/')[0]);
47
- const expandPropertiesArray = propertiesToExpand.filter((item, pos) => propertiesToExpand.indexOf(item) === pos);
48
- const fieldExpand = expandPropertiesArray.length > 0 ? `&$expand=${expandPropertiesArray.join(",")}` : ``;
50
+ const fieldsSelect = args.options.fields ? args.options.fields.split(',') : [];
51
+ const fieldsWithSlash = fieldsSelect.filter(item => item.includes('/'));
52
+ const fieldsToExpand = fieldsWithSlash.map(e => e.split('/')[0]);
53
+ const expandFieldsArray = fieldsToExpand.filter((item, pos) => fieldsToExpand.indexOf(item) === pos);
54
+ const fieldExpand = expandFieldsArray.length > 0 ? `&$expand=${expandFieldsArray.join(",")}` : ``;
49
55
  if (args.options.id) {
50
56
  requestUrl += `/items(${args.options.id})`;
51
57
  }
@@ -53,7 +59,7 @@ class SpoListItemGetCommand extends SpoCommand {
53
59
  requestUrl += `/GetItemByUniqueId(guid'${args.options.uniqueId}')`;
54
60
  }
55
61
  const requestOptions = {
56
- url: `${requestUrl}?$select=${formatting.encodeQueryParameter(propertiesSelect.join(","))}${fieldExpand}`,
62
+ url: `${requestUrl}?$select=${formatting.encodeQueryParameter(fieldsSelect.join(","))}${fieldExpand}`,
57
63
  headers: {
58
64
  'accept': 'application/json;odata=nometadata'
59
65
  },
@@ -101,6 +107,8 @@ _SpoListItemGetCommand_instances = new WeakSet(), _SpoListItemGetCommand_initTel
101
107
  option: '-t, --listTitle [listTitle]'
102
108
  }, {
103
109
  option: '--listUrl [listUrl]'
110
+ }, {
111
+ option: '--fields [fields]'
104
112
  }, {
105
113
  option: '-p, --properties [properties]'
106
114
  }, {
@@ -127,7 +135,7 @@ _SpoListItemGetCommand_instances = new WeakSet(), _SpoListItemGetCommand_initTel
127
135
  return true;
128
136
  });
129
137
  }, _SpoListItemGetCommand_initTypes = function _SpoListItemGetCommand_initTypes() {
130
- this.types.string.push('webUrl', 'listId', 'listTitle', 'id', 'uniqueId', 'properties');
138
+ this.types.string.push('webUrl', 'listId', 'listTitle', 'id', 'uniqueId', 'fields', 'properties');
131
139
  }, _SpoListItemGetCommand_initOptionSets = function _SpoListItemGetCommand_initOptionSets() {
132
140
  this.optionSets.push({ options: ['listId', 'listTitle', 'listUrl'] }, { options: ['id', 'uniqueId'] });
133
141
  };
@@ -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 _SpoListItemRemoveCommand_instances, _SpoListItemRemoveCommand_initTelemetry, _SpoListItemRemoveCommand_initOptions, _SpoListItemRemoveCommand_initValidators, _SpoListItemRemoveCommand_initOptionSets;
6
+ var _SpoListItemRemoveCommand_instances, _SpoListItemRemoveCommand_initTelemetry, _SpoListItemRemoveCommand_initOptions, _SpoListItemRemoveCommand_initValidators, _SpoListItemRemoveCommand_initOptionSets, _SpoListItemRemoveCommand_initTypes;
7
7
  import { cli } from '../../../../cli/cli.js';
8
8
  import request from '../../../../request.js';
9
9
  import { formatting } from '../../../../utils/formatting.js';
@@ -25,6 +25,7 @@ class SpoListItemRemoveCommand extends SpoCommand {
25
25
  __classPrivateFieldGet(this, _SpoListItemRemoveCommand_instances, "m", _SpoListItemRemoveCommand_initOptions).call(this);
26
26
  __classPrivateFieldGet(this, _SpoListItemRemoveCommand_instances, "m", _SpoListItemRemoveCommand_initValidators).call(this);
27
27
  __classPrivateFieldGet(this, _SpoListItemRemoveCommand_instances, "m", _SpoListItemRemoveCommand_initOptionSets).call(this);
28
+ __classPrivateFieldGet(this, _SpoListItemRemoveCommand_instances, "m", _SpoListItemRemoveCommand_initTypes).call(this);
28
29
  }
29
30
  async commandAction(logger, args) {
30
31
  const removeListItem = async () => {
@@ -43,7 +44,7 @@ class SpoListItemRemoveCommand extends SpoCommand {
43
44
  requestUrl += `/GetList('${formatting.encodeQueryParameter(listServerRelativeUrl)}')`;
44
45
  }
45
46
  requestUrl += `/items(${args.options.id})`;
46
- if (args.options.recycle) {
47
+ if (!args.options.permanent) {
47
48
  requestUrl += `/recycle()`;
48
49
  }
49
50
  const requestOptions = {
@@ -68,7 +69,7 @@ class SpoListItemRemoveCommand extends SpoCommand {
68
69
  await removeListItem();
69
70
  }
70
71
  else {
71
- const result = await cli.promptForConfirmation({ message: `Are you sure you want to ${args.options.recycle ? "recycle" : "remove"} the list item ${args.options.id} from list ${args.options.listId || args.options.listTitle || args.options.listUrl} located in site ${args.options.webUrl}?` });
72
+ const result = await cli.promptForConfirmation({ message: `Are you sure you want to ${args.options.permanent ? 'permanently remove' : 'recycle'} the list item ${args.options.id} from list ${args.options.listId || args.options.listTitle || args.options.listUrl} located in site ${args.options.webUrl}?` });
72
73
  if (result) {
73
74
  await removeListItem();
74
75
  }
@@ -81,7 +82,7 @@ _SpoListItemRemoveCommand_instances = new WeakSet(), _SpoListItemRemoveCommand_i
81
82
  listId: typeof args.options.listId !== 'undefined',
82
83
  listTitle: typeof args.options.listTitle !== 'undefined',
83
84
  listUrl: typeof args.options.listUrl !== 'undefined',
84
- recycle: !!args.options.recycle,
85
+ permanent: !!args.options.permanent,
85
86
  force: !!args.options.force
86
87
  });
87
88
  });
@@ -97,7 +98,7 @@ _SpoListItemRemoveCommand_instances = new WeakSet(), _SpoListItemRemoveCommand_i
97
98
  }, {
98
99
  option: '--listUrl [listUrl]'
99
100
  }, {
100
- option: '--recycle'
101
+ option: '--permanent'
101
102
  }, {
102
103
  option: '-f, --force'
103
104
  });
@@ -119,6 +120,8 @@ _SpoListItemRemoveCommand_instances = new WeakSet(), _SpoListItemRemoveCommand_i
119
120
  });
120
121
  }, _SpoListItemRemoveCommand_initOptionSets = function _SpoListItemRemoveCommand_initOptionSets() {
121
122
  this.optionSets.push({ options: ['listId', 'listTitle', 'listUrl'] });
123
+ }, _SpoListItemRemoveCommand_initTypes = function _SpoListItemRemoveCommand_initTypes() {
124
+ this.types.boolean.push('permanent', 'force');
122
125
  };
123
126
  export default new SpoListItemRemoveCommand();
124
127
  //# sourceMappingURL=listitem-remove.js.map
@@ -155,19 +155,6 @@ class SpoPageHeaderSetCommand extends SpoCommand {
155
155
  else {
156
156
  pageData = await Page.checkout(pageFullName, args.options.webUrl, logger, this.verbose);
157
157
  }
158
- let header;
159
- switch (args.options.type) {
160
- case 'None':
161
- header = noPageHeader;
162
- break;
163
- case 'Custom':
164
- header = customPageHeader;
165
- break;
166
- case 'Default':
167
- default:
168
- header = defaultPageHeader;
169
- break;
170
- }
171
158
  if (pageData) {
172
159
  canvasContent = pageData.CanvasContent1;
173
160
  authorByline = authorByline.length > 0 ? authorByline : pageData.AuthorByline;
@@ -180,63 +167,135 @@ class SpoPageHeaderSetCommand extends SpoCommand {
180
167
  //In the new design page header is is a configurable Banner webpart in the first full-width section
181
168
  const headerControl = pageControls.find(control => control?.position?.zoneIndex === 1 && control?.position?.sectionFactor === 0 && control?.webPartId === BannerWebPartId);
182
169
  const isStandardPageHeader = pageData.LayoutWebpartsContent !== '[]';
183
- //LayoutWebpartsContent represents standard page header
184
- if (!isStandardPageHeader) {
185
- header = headerControl?.webPartData || header;
170
+ const existingHeader = isStandardPageHeader && typeof pageData.LayoutWebpartsContent === 'string'
171
+ ? JSON.parse(pageData.LayoutWebpartsContent)[0]
172
+ : headerControl?.webPartData;
173
+ let header;
174
+ switch (args.options.type) {
175
+ case 'None':
176
+ header = noPageHeader;
177
+ break;
178
+ case 'Custom':
179
+ header = customPageHeader;
180
+ break;
181
+ case 'Default':
182
+ header = defaultPageHeader;
183
+ break;
184
+ default:
185
+ header = existingHeader || defaultPageHeader;
186
+ break;
187
+ }
188
+ if (existingHeader && args.options.type !== 'None') {
189
+ if (typeof args.options.textAlignment === 'undefined') {
190
+ header.properties.textAlignment = existingHeader.properties.textAlignment;
191
+ }
192
+ if (typeof args.options.showTopicHeader === 'undefined') {
193
+ header.properties.showTopicHeader = existingHeader.properties.showTopicHeader;
194
+ }
195
+ if (typeof args.options.topicHeader === 'undefined') {
196
+ header.properties.topicHeader = existingHeader.properties.topicHeader;
197
+ }
198
+ if (typeof args.options.showPublishDate === 'undefined') {
199
+ header.properties.showPublishDate = existingHeader.properties.showPublishDate;
200
+ }
201
+ if (typeof args.options.showTimeToRead === 'undefined') {
202
+ header.properties.showTimeToRead = existingHeader.properties.showTimeToRead;
203
+ }
204
+ if (typeof args.options.layout === 'undefined') {
205
+ header.properties.layoutType = existingHeader.properties.layoutType;
206
+ }
207
+ if (header.properties.imageSourceType === 2 && existingHeader.properties.imageSourceType === 2) {
208
+ const properties = header.properties;
209
+ const existingProperties = existingHeader.properties;
210
+ if (typeof args.options.altText === 'undefined') {
211
+ properties.altText = existingProperties.altText;
212
+ }
213
+ if (typeof args.options.translateX === 'undefined') {
214
+ properties.translateX = existingProperties.translateX;
215
+ }
216
+ if (typeof args.options.translateY === 'undefined') {
217
+ properties.translateY = existingProperties.translateY;
218
+ }
219
+ if (typeof args.options.imageUrl === 'undefined') {
220
+ properties.listId = existingProperties.listId;
221
+ properties.siteId = existingProperties.siteId;
222
+ properties.uniqueId = existingProperties.uniqueId;
223
+ properties.webId = existingProperties.webId;
224
+ header.serverProcessedContent = existingHeader.serverProcessedContent;
225
+ }
226
+ }
186
227
  }
187
228
  header.properties.title = title;
188
- header.properties.textAlignment = args.options.textAlignment || 'Left';
189
- header.properties.showTopicHeader = args.options.showTopicHeader || false;
190
- header.properties.topicHeader = args.options.topicHeader || '';
191
- header.properties.showPublishDate = args.options.showPublishDate || false;
192
- header.properties.showTimeToRead = args.options.showTimeToRead || false;
193
- if (args.options.type !== 'None') {
194
- header.properties.layoutType = args.options.layout || 'FullWidthImage';
229
+ if (typeof args.options.textAlignment !== 'undefined') {
230
+ header.properties.textAlignment = args.options.textAlignment;
195
231
  }
196
- if (args.options.type === 'Custom') {
197
- header.serverProcessedContent.imageSources = {
198
- imageSource: args.options.imageUrl || ''
199
- };
232
+ if (typeof args.options.showTopicHeader !== 'undefined') {
233
+ header.properties.showTopicHeader = args.options.showTopicHeader;
234
+ }
235
+ if (typeof args.options.topicHeader !== 'undefined') {
236
+ header.properties.topicHeader = args.options.topicHeader;
237
+ }
238
+ if (typeof args.options.showPublishDate !== 'undefined') {
239
+ header.properties.showPublishDate = args.options.showPublishDate;
240
+ }
241
+ if (typeof args.options.showTimeToRead !== 'undefined') {
242
+ header.properties.showTimeToRead = args.options.showTimeToRead;
243
+ }
244
+ if (args.options.type !== 'None' && typeof args.options.layout !== 'undefined') {
245
+ header.properties.layoutType = args.options.layout;
246
+ }
247
+ if (header.properties.imageSourceType === 2) {
200
248
  const properties = header.properties;
201
- properties.altText = args.options.altText || '';
202
- properties.translateX = args.options.translateX || 0;
203
- properties.translateY = args.options.translateY || 0;
204
- header.properties = properties;
205
- if (!args.options.imageUrl) {
206
- header.serverProcessedContent.customMetadata = {
207
- imageSource: {
208
- siteId: '',
209
- webId: '',
210
- listId: '',
211
- uniqueId: ''
212
- }
213
- };
214
- properties.listId = '';
215
- properties.siteId = '';
216
- properties.uniqueId = '';
217
- properties.webId = '';
218
- header.properties = properties;
249
+ if (typeof args.options.altText !== 'undefined') {
250
+ properties.altText = args.options.altText;
219
251
  }
220
- else {
221
- const res = await Promise.all([
222
- spo.getSiteIdBySPApi(args.options.webUrl, logger, this.verbose),
223
- spo.getWebId(args.options.webUrl, logger, this.verbose),
224
- this.getImageInfo(args.options.webUrl, args.options.imageUrl, this.verbose, logger)
225
- ]);
226
- header.serverProcessedContent.customMetadata = {
227
- imageSource: {
228
- siteId: res[0],
229
- webId: res[1],
230
- listId: res[2].ListId,
231
- uniqueId: res[2].UniqueId
232
- }
252
+ if (typeof args.options.translateX !== 'undefined') {
253
+ properties.translateX = args.options.translateX;
254
+ }
255
+ if (typeof args.options.translateY !== 'undefined') {
256
+ properties.translateY = args.options.translateY;
257
+ }
258
+ header.properties = properties;
259
+ if (typeof args.options.imageUrl !== 'undefined') {
260
+ header.serverProcessedContent.imageSources = {
261
+ imageSource: args.options.imageUrl
233
262
  };
234
- const properties = header.properties;
235
- properties.listId = res[2].ListId;
236
- properties.siteId = res[0];
237
- properties.uniqueId = res[2].UniqueId;
238
- properties.webId = res[1];
239
- header.properties = properties;
263
+ if (!args.options.imageUrl) {
264
+ header.serverProcessedContent.customMetadata = {
265
+ imageSource: {
266
+ siteId: '',
267
+ webId: '',
268
+ listId: '',
269
+ uniqueId: ''
270
+ }
271
+ };
272
+ properties.listId = '';
273
+ properties.siteId = '';
274
+ properties.uniqueId = '';
275
+ properties.webId = '';
276
+ header.properties = properties;
277
+ }
278
+ else {
279
+ const res = await Promise.all([
280
+ spo.getSiteIdBySPApi(args.options.webUrl, logger, this.verbose),
281
+ spo.getWebId(args.options.webUrl, logger, this.verbose),
282
+ this.getImageInfo(args.options.webUrl, args.options.imageUrl, this.verbose, logger)
283
+ ]);
284
+ header.serverProcessedContent.customMetadata = {
285
+ imageSource: {
286
+ siteId: res[0],
287
+ webId: res[1],
288
+ listId: res[2].ListId,
289
+ uniqueId: res[2].UniqueId
290
+ }
291
+ };
292
+ const properties = header.properties;
293
+ properties.listId = res[2].ListId;
294
+ properties.siteId = res[0];
295
+ properties.uniqueId = res[2].UniqueId;
296
+ properties.webId = res[1];
297
+ header.properties = properties;
298
+ }
240
299
  }
241
300
  }
242
301
  const requestBody = {
@@ -58,12 +58,12 @@ class SpoPageRemoveCommand extends SpoCommand {
58
58
  if (args.options.bypassSharedLock) {
59
59
  requestOptions.headers.Prefer = 'bypass-shared-lock';
60
60
  }
61
- if (args.options.recycle) {
62
- requestOptions.url += '/Recycle';
63
- await request.post(requestOptions);
61
+ if (args.options.permanent) {
62
+ await request.delete(requestOptions);
64
63
  }
65
64
  else {
66
- await request.delete(requestOptions);
65
+ requestOptions.url += '/Recycle';
66
+ await request.post(requestOptions);
67
67
  }
68
68
  }
69
69
  catch (err) {
@@ -75,7 +75,7 @@ _SpoPageRemoveCommand_instances = new WeakSet(), _SpoPageRemoveCommand_initTelem
75
75
  this.telemetry.push((args) => {
76
76
  Object.assign(this.telemetryProperties, {
77
77
  force: !!args.options.force,
78
- recycle: !!args.options.recycle,
78
+ permanent: !!args.options.permanent,
79
79
  bypassSharedLock: !!args.options.bypassSharedLock
80
80
  });
81
81
  });
@@ -85,7 +85,7 @@ _SpoPageRemoveCommand_instances = new WeakSet(), _SpoPageRemoveCommand_initTelem
85
85
  }, {
86
86
  option: '-n, --name <name>'
87
87
  }, {
88
- option: '--recycle'
88
+ option: '--permanent'
89
89
  }, {
90
90
  option: '--bypassSharedLock'
91
91
  }, {
@@ -95,7 +95,7 @@ _SpoPageRemoveCommand_instances = new WeakSet(), _SpoPageRemoveCommand_initTelem
95
95
  this.validators.push(async (args) => validation.isValidSharePointUrl(args.options.webUrl));
96
96
  }, _SpoPageRemoveCommand_initTypes = function _SpoPageRemoveCommand_initTypes() {
97
97
  this.types.string.push('name', 'webUrl');
98
- this.types.boolean.push('force', 'bypassSharedLock', 'recycle');
98
+ this.types.boolean.push('force', 'bypassSharedLock', 'permanent');
99
99
  };
100
100
  export default new SpoPageRemoveCommand();
101
101
  //# sourceMappingURL=page-remove.js.map
@@ -1,15 +1,32 @@
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 _SpoSiteListCommand_instances, _SpoSiteListCommand_initTelemetry, _SpoSiteListCommand_initOptions, _SpoSiteListCommand_initValidators;
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
7
3
  import config from '../../../../config.js';
8
4
  import request from '../../../../request.js';
9
5
  import { formatting } from '../../../../utils/formatting.js';
10
6
  import { spo } from '../../../../utils/spo.js';
7
+ import { zod } from '../../../../utils/zod.js';
11
8
  import SpoCommand from '../../../base/SpoCommand.js';
12
9
  import commands from '../../commands.js';
10
+ var SiteListType;
11
+ (function (SiteListType) {
12
+ SiteListType["TeamSite"] = "TeamSite";
13
+ SiteListType["CommunicationSite"] = "CommunicationSite";
14
+ })(SiteListType || (SiteListType = {}));
15
+ var SiteListState;
16
+ (function (SiteListState) {
17
+ SiteListState["active"] = "active";
18
+ SiteListState["fullyArchived"] = "fullyArchived";
19
+ SiteListState["recentlyArchived"] = "recentlyArchived";
20
+ SiteListState["archived"] = "archived";
21
+ })(SiteListState || (SiteListState = {}));
22
+ export const options = z.strictObject({
23
+ ...globalOptionsZod.shape,
24
+ type: zod.coercedEnum(SiteListType).optional().alias('t'),
25
+ state: zod.coercedEnum(SiteListState).optional(),
26
+ webTemplate: z.string().optional(),
27
+ filter: z.string().optional(),
28
+ withOneDriveSites: z.boolean().optional()
29
+ });
13
30
  class SpoSiteListCommand extends SpoCommand {
14
31
  get name() {
15
32
  return commands.SITE_LIST;
@@ -20,12 +37,20 @@ class SpoSiteListCommand extends SpoCommand {
20
37
  defaultProperties() {
21
38
  return ['Title', 'Url'];
22
39
  }
23
- constructor() {
24
- super();
25
- _SpoSiteListCommand_instances.add(this);
26
- __classPrivateFieldGet(this, _SpoSiteListCommand_instances, "m", _SpoSiteListCommand_initTelemetry).call(this);
27
- __classPrivateFieldGet(this, _SpoSiteListCommand_instances, "m", _SpoSiteListCommand_initOptions).call(this);
28
- __classPrivateFieldGet(this, _SpoSiteListCommand_instances, "m", _SpoSiteListCommand_initValidators).call(this);
40
+ get schema() {
41
+ return options;
42
+ }
43
+ getRefinedSchema(schema) {
44
+ return schema
45
+ .refine(o => !(o.type && o.webTemplate), {
46
+ message: 'Specify either type or webTemplate, but not both'
47
+ })
48
+ .refine(o => !(o.withOneDriveSites && (o.type !== undefined || o.webTemplate !== undefined)), {
49
+ message: `When using withOneDriveSites, don't specify the type or webTemplate options`
50
+ })
51
+ .refine(o => !(o.withOneDriveSites && o.state !== undefined), {
52
+ message: `When using withOneDriveSites, don't specify the state option`
53
+ });
29
54
  }
30
55
  alias() {
31
56
  return [commands.SITE_LIST];
@@ -34,13 +59,14 @@ class SpoSiteListCommand extends SpoCommand {
34
59
  const webTemplate = this.getWebTemplateId(args.options);
35
60
  const includeOneDriveSites = args.options.withOneDriveSites || false;
36
61
  const personalSite = includeOneDriveSites === false ? '0' : '1';
62
+ const effectiveFilter = this.buildFilter(args.options);
37
63
  try {
38
64
  const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.debug);
39
65
  if (this.verbose) {
40
66
  await logger.logToStderr(`Retrieving list of site collections...`);
41
67
  }
42
68
  this.allSites = [];
43
- await this.getAllSites(spoAdminUrl, formatting.escapeXml(args.options.filter || ''), '0', personalSite, webTemplate, undefined, logger);
69
+ await this.getAllSites(spoAdminUrl, formatting.escapeXml(effectiveFilter), '0', personalSite, webTemplate, undefined, logger);
44
70
  await logger.log(this.allSites);
45
71
  }
46
72
  catch (err) {
@@ -88,43 +114,28 @@ class SpoSiteListCommand extends SpoCommand {
88
114
  return '';
89
115
  }
90
116
  }
91
- }
92
- _SpoSiteListCommand_instances = new WeakSet(), _SpoSiteListCommand_initTelemetry = function _SpoSiteListCommand_initTelemetry() {
93
- this.telemetry.push((args) => {
94
- Object.assign(this.telemetryProperties, {
95
- webTemplate: args.options.webTemplate,
96
- type: args.options.type,
97
- filter: (!(!args.options.filter)).toString(),
98
- withOneDriveSites: typeof args.options.withOneDriveSites !== 'undefined'
99
- });
100
- });
101
- }, _SpoSiteListCommand_initOptions = function _SpoSiteListCommand_initOptions() {
102
- this.options.unshift({
103
- option: '-t, --type [type]',
104
- autocomplete: ['TeamSite', 'CommunicationSite']
105
- }, {
106
- option: '--webTemplate [webTemplate]'
107
- }, {
108
- option: '--filter [filter]'
109
- }, {
110
- option: '--withOneDriveSites'
111
- });
112
- }, _SpoSiteListCommand_initValidators = function _SpoSiteListCommand_initValidators() {
113
- this.validators.push(async (args) => {
114
- if (args.options.type && args.options.webTemplate) {
115
- return 'Specify either type or webTemplate, but not both';
117
+ buildFilter(options) {
118
+ const providedFilter = options.filter || '';
119
+ let stateFilter = '';
120
+ switch (options.state) {
121
+ case 'active':
122
+ stateFilter = `ArchiveStatus -eq 'NotArchived'`;
123
+ break;
124
+ case 'fullyArchived':
125
+ stateFilter = `ArchiveStatus -eq 'FullyArchived'`;
126
+ break;
127
+ case 'recentlyArchived':
128
+ stateFilter = `ArchiveStatus -eq 'RecentlyArchived'`;
129
+ break;
130
+ case 'archived':
131
+ stateFilter = `ArchiveStatus -ne 'NotArchived'`;
132
+ break;
116
133
  }
117
- const typeValues = ['TeamSite', 'CommunicationSite'];
118
- if (args.options.type &&
119
- typeValues.indexOf(args.options.type) < 0) {
120
- return `${args.options.type} is not a valid value for the type option. Allowed values are ${typeValues.join('|')}`;
134
+ if (stateFilter && providedFilter) {
135
+ return `${providedFilter} and ${stateFilter}`;
121
136
  }
122
- if (args.options.withOneDriveSites
123
- && (args.options.type || args.options.webTemplate)) {
124
- return 'When using withOneDriveSites, don\'t specify the type or webTemplate options';
125
- }
126
- return true;
127
- });
128
- };
137
+ return stateFilter || providedFilter;
138
+ }
139
+ }
129
140
  export default new SpoSiteListCommand();
130
141
  //# sourceMappingURL=site-list.js.map