@pnp/cli-microsoft365 12.0.0-beta.0be7d8d → 12.0.0-beta.10c5833

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 (103) 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/spo/commands/file/file-archive.js +1 -1
  10. package/dist/m365/spo/commands/file/file-remove.js +5 -5
  11. package/dist/m365/spo/commands/file/file-unarchive.js +1 -1
  12. package/dist/m365/spo/commands/folder/folder-archive.js +1 -1
  13. package/dist/m365/spo/commands/folder/folder-remove.js +5 -5
  14. package/dist/m365/spo/commands/hidedefaultthemes/hidedefaultthemes-get.js +5 -0
  15. package/dist/m365/spo/commands/hidedefaultthemes/hidedefaultthemes-set.js +8 -26
  16. package/dist/m365/spo/commands/homesite/homesite-list.js +5 -0
  17. package/dist/m365/spo/commands/list/list-remove.js +4 -4
  18. package/dist/m365/spo/commands/listitem/listitem-batch-remove.js +5 -4
  19. package/dist/m365/spo/commands/listitem/listitem-remove.js +8 -5
  20. package/dist/m365/spo/commands/page/page-remove.js +7 -7
  21. package/dist/m365/spo/commands/site/site-list.js +60 -49
  22. package/dist/m365/spo/commands/site/site-remove.js +7 -7
  23. package/dist/m365/spo/commands/spo-get.js +5 -0
  24. package/dist/m365/spo/commands/spo-set.js +10 -21
  25. package/dist/m365/spo/commands/storageentity/storageentity-get.js +23 -17
  26. package/dist/m365/spo/commands/storageentity/storageentity-list.js +39 -36
  27. package/dist/m365/spo/commands/storageentity/storageentity-remove.js +26 -33
  28. package/dist/m365/spo/commands/storageentity/storageentity-set.js +26 -36
  29. package/dist/m365/spo/commands/tenant/tenant-appcatalog-add.js +1 -1
  30. package/dist/m365/spo/commands/user/user-ensure.js +24 -60
  31. package/dist/m365/spo/commands/user/user-get.js +25 -65
  32. package/dist/m365/spo/commands/user/user-list.js +10 -18
  33. package/dist/m365/spo/commands/user/user-remove.js +26 -68
  34. package/dist/m365/spo/commands/userprofile/userprofile-get.js +10 -23
  35. package/dist/m365/spo/commands/userprofile/userprofile-set.js +10 -19
  36. package/dist/m365/spo/commands/web/web-add.js +20 -55
  37. package/dist/m365/spo/commands/web/web-clientsidewebpart-list.js +10 -18
  38. package/dist/m365/spo/commands/web/web-get.js +12 -30
  39. package/dist/m365/spo/commands/web/web-installedlanguage-list.js +10 -18
  40. package/dist/m365/spo/commands/web/web-list.js +10 -18
  41. package/dist/m365/spo/commands/web/web-reindex.js +10 -18
  42. package/dist/m365/spo/commands/web/web-remove.js +11 -27
  43. package/dist/m365/spo/commands/web/web-retentionlabel-list.js +10 -18
  44. package/dist/m365/spo/commands/web/web-roleassignment-add.js +40 -64
  45. package/dist/m365/spo/commands/web/web-roleassignment-remove.js +31 -58
  46. package/dist/m365/spo/commands/web/web-roleinheritance-break.js +12 -36
  47. package/dist/m365/spo/commands/web/web-roleinheritance-reset.js +11 -29
  48. package/dist/m365/spo/commands/web/web-rule-get.js +47 -0
  49. package/dist/m365/spo/commands/web/web-rule-list.js +6 -4
  50. package/dist/m365/spo/commands/web/web-rule-remove.js +0 -3
  51. package/dist/m365/spo/commands/web/web-set.js +26 -96
  52. package/dist/m365/spo/commands.js +1 -2
  53. package/dist/m365/teams/commands/channel/channel-list.js +2 -6
  54. package/dist/m365/teams/commands/channel/channel-member-add.js +2 -6
  55. package/dist/m365/teams/commands/channel/channel-member-list.js +2 -6
  56. package/dist/m365/teams/commands/channel/channel-member-remove.js +2 -6
  57. package/dist/m365/teams/commands/channel/channel-member-set.js +2 -6
  58. package/dist/m365/teams/commands/channel/channel-remove.js +2 -8
  59. package/dist/m365/teams/commands/channel/channel-set.js +2 -8
  60. package/dist/m365/teams/commands/tab/tab-get.js +2 -6
  61. package/dist/m365/teams/commands/team/team-archive.js +2 -6
  62. package/dist/m365/teams/commands/team/team-remove.js +2 -6
  63. package/dist/m365/teams/commands/team/team-unarchive.js +2 -6
  64. package/docs/docs/cmd/entra/m365group/m365group-remove.mdx +4 -4
  65. package/docs/docs/cmd/spe/container/container-remove.mdx +5 -5
  66. package/docs/docs/cmd/spo/file/file-archive.mdx +8 -0
  67. package/docs/docs/cmd/spo/file/file-remove.mdx +4 -4
  68. package/docs/docs/cmd/spo/file/file-unarchive.mdx +8 -0
  69. package/docs/docs/cmd/spo/folder/folder-archive.mdx +6 -0
  70. package/docs/docs/cmd/spo/folder/folder-remove.mdx +4 -4
  71. package/docs/docs/cmd/spo/list/list-remove.mdx +4 -4
  72. package/docs/docs/cmd/spo/listitem/listitem-batch-remove.mdx +8 -2
  73. package/docs/docs/cmd/spo/listitem/listitem-remove.mdx +8 -2
  74. package/docs/docs/cmd/spo/page/page-remove.mdx +4 -4
  75. package/docs/docs/cmd/spo/site/site-apppermission-add.mdx +52 -21
  76. package/docs/docs/cmd/spo/site/site-list.mdx +22 -1
  77. package/docs/docs/cmd/spo/site/site-remove.mdx +3 -3
  78. package/docs/docs/cmd/spo/storageentity/storageentity-get.mdx +11 -2
  79. package/docs/docs/cmd/spo/storageentity/storageentity-list.mdx +9 -3
  80. package/docs/docs/cmd/spo/storageentity/storageentity-remove.mdx +6 -6
  81. package/docs/docs/cmd/spo/storageentity/storageentity-set.mdx +10 -4
  82. package/docs/docs/cmd/spo/web/web-rule-get.mdx +108 -0
  83. package/docs/docs/cmd/spo/web/web-rule-list.mdx +8 -12
  84. package/docs/docs/cmd/spo/web/web-rule-remove.mdx +0 -6
  85. package/docs/docs/cmd/teams/app/app-install.mdx +21 -0
  86. package/docs/docs/cmd/teams/app/app-list.mdx +19 -0
  87. package/docs/docs/cmd/teams/app/app-publish.mdx +17 -0
  88. package/docs/docs/cmd/teams/app/app-remove.mdx +19 -0
  89. package/docs/docs/cmd/teams/app/app-uninstall.mdx +21 -0
  90. package/docs/docs/cmd/teams/app/app-update.mdx +19 -0
  91. package/docs/docs/cmd/tenant/people/people-profilecardproperty-add.mdx +19 -0
  92. package/docs/docs/cmd/tenant/people/people-profilecardproperty-get.mdx +19 -0
  93. package/docs/docs/cmd/tenant/people/people-profilecardproperty-list.mdx +19 -0
  94. package/docs/docs/cmd/tenant/people/people-profilecardproperty-remove.mdx +19 -0
  95. package/docs/docs/cmd/tenant/people/people-profilecardproperty-set.mdx +19 -0
  96. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-health-get.mdx +19 -0
  97. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-health-list.mdx +19 -0
  98. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-healthissue-get.mdx +19 -0
  99. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-healthissue-list.mdx +19 -0
  100. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-message-get.mdx +19 -0
  101. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-message-list.mdx +19 -0
  102. package/npm-shrinkwrap.json +432 -0
  103. package/package.json +6 -1
@@ -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
@@ -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
@@ -71,7 +71,7 @@ class SpoSiteRemoveCommand extends SpoCommand {
71
71
  }
72
72
  if (isGroupSite) {
73
73
  await this.deleteGroupifiedSite(logger, siteUrl);
74
- if (options.skipRecycleBin) {
74
+ if (options.permanent) {
75
75
  let isGroupInRecycleBin = await this.isGroupInEntraRecycleBin(logger, siteDetails.GroupId);
76
76
  let amountOfPolls = 0;
77
77
  while (!isGroupInRecycleBin && amountOfPolls < 20) {
@@ -87,7 +87,7 @@ class SpoSiteRemoveCommand extends SpoCommand {
87
87
  else {
88
88
  await this.deleteNonGroupSite(logger, siteUrl);
89
89
  }
90
- if (options.skipRecycleBin) {
90
+ if (options.permanent) {
91
91
  await this.deleteSiteFromSharePointRecycleBin(logger, siteUrl);
92
92
  }
93
93
  }
@@ -191,7 +191,7 @@ class SpoSiteRemoveCommand extends SpoCommand {
191
191
  _SpoSiteRemoveCommand_instances = new WeakSet(), _SpoSiteRemoveCommand_initTelemetry = function _SpoSiteRemoveCommand_initTelemetry() {
192
192
  this.telemetry.push((args) => {
193
193
  Object.assign(this.telemetryProperties, {
194
- skipRecycleBin: !!args.options.skipRecycleBin,
194
+ permanent: !!args.options.permanent,
195
195
  fromRecycleBin: !!args.options.fromRecycleBin,
196
196
  force: !!args.options.force
197
197
  });
@@ -200,7 +200,7 @@ _SpoSiteRemoveCommand_instances = new WeakSet(), _SpoSiteRemoveCommand_initTelem
200
200
  this.options.unshift({
201
201
  option: '-u, --url <url>'
202
202
  }, {
203
- option: '--skipRecycleBin'
203
+ option: '--permanent'
204
204
  }, {
205
205
  option: '--fromRecycleBin'
206
206
  }, {
@@ -217,14 +217,14 @@ _SpoSiteRemoveCommand_instances = new WeakSet(), _SpoSiteRemoveCommand_initTelem
217
217
  if (rootUrl.toLowerCase() === urlUtil.removeTrailingSlashes(args.options.url.toLowerCase())) {
218
218
  return `The root site cannot be deleted.`;
219
219
  }
220
- if (args.options.fromRecycleBin && args.options.skipRecycleBin) {
221
- return 'Specify either fromRecycleBin or skipRecycleBin, but not both.';
220
+ if (args.options.fromRecycleBin && args.options.permanent) {
221
+ return 'Specify either fromRecycleBin or permanent, but not both.';
222
222
  }
223
223
  return true;
224
224
  });
225
225
  }, _SpoSiteRemoveCommand_initTypes = function _SpoSiteRemoveCommand_initTypes() {
226
226
  this.types.string.push('url');
227
- this.types.boolean.push('skipRecycleBin', 'fromRecycleBin', 'force');
227
+ this.types.boolean.push('permanent', 'fromRecycleBin', 'force');
228
228
  };
229
229
  export default new SpoSiteRemoveCommand();
230
230
  //# sourceMappingURL=site-remove.js.map
@@ -1,6 +1,8 @@
1
1
  import auth from '../../../Auth.js';
2
+ import { globalOptionsZod } from '../../../Command.js';
2
3
  import SpoCommand from '../../base/SpoCommand.js';
3
4
  import commands from '../commands.js';
5
+ export const options = globalOptionsZod.strict();
4
6
  class SpoGetCommand extends SpoCommand {
5
7
  get name() {
6
8
  return commands.GET;
@@ -8,6 +10,9 @@ class SpoGetCommand extends SpoCommand {
8
10
  get description() {
9
11
  return 'Gets the context URL for the root SharePoint site collection and SharePoint tenant admin site';
10
12
  }
13
+ get schema() {
14
+ return options;
15
+ }
11
16
  async commandAction(logger) {
12
17
  const spoContext = {
13
18
  SpoUrl: auth.connection.spoUrl ? auth.connection.spoUrl : ''
@@ -1,14 +1,16 @@
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 _SpoSetCommand_instances, _SpoSetCommand_initOptions, _SpoSetCommand_initValidators, _SpoSetCommand_initTypes;
7
1
  import auth from '../../../Auth.js';
2
+ import { globalOptionsZod } from '../../../Command.js';
8
3
  import { urlUtil } from '../../../utils/urlUtil.js';
9
4
  import { validation } from '../../../utils/validation.js';
10
5
  import SpoCommand from '../../base/SpoCommand.js';
11
6
  import commands from '../commands.js';
7
+ import { z } from 'zod';
8
+ export const options = z.strictObject({
9
+ ...globalOptionsZod.shape,
10
+ url: z.string().alias('u').refine(url => validation.isValidSharePointUrl(url) === true, {
11
+ message: 'Specify a valid SharePoint URL'
12
+ })
13
+ });
12
14
  class SpoSetCommand extends SpoCommand {
13
15
  get name() {
14
16
  return commands.SET;
@@ -16,12 +18,8 @@ class SpoSetCommand extends SpoCommand {
16
18
  get description() {
17
19
  return 'Sets the URL of the root SharePoint site collection for use in SPO commands';
18
20
  }
19
- constructor() {
20
- super();
21
- _SpoSetCommand_instances.add(this);
22
- __classPrivateFieldGet(this, _SpoSetCommand_instances, "m", _SpoSetCommand_initOptions).call(this);
23
- __classPrivateFieldGet(this, _SpoSetCommand_instances, "m", _SpoSetCommand_initValidators).call(this);
24
- __classPrivateFieldGet(this, _SpoSetCommand_instances, "m", _SpoSetCommand_initTypes).call(this);
21
+ get schema() {
22
+ return options;
25
23
  }
26
24
  async commandAction(logger, args) {
27
25
  auth.connection.spoUrl = urlUtil.removeTrailingSlashes(args.options.url);
@@ -33,14 +31,5 @@ class SpoSetCommand extends SpoCommand {
33
31
  }
34
32
  }
35
33
  }
36
- _SpoSetCommand_instances = new WeakSet(), _SpoSetCommand_initOptions = function _SpoSetCommand_initOptions() {
37
- this.options.unshift({
38
- option: '-u, --url <url>'
39
- });
40
- }, _SpoSetCommand_initValidators = function _SpoSetCommand_initValidators() {
41
- this.validators.push(async (args) => validation.isValidSharePointUrl(args.options.url));
42
- }, _SpoSetCommand_initTypes = function _SpoSetCommand_initTypes() {
43
- this.types.string.push('url');
44
- };
45
34
  export default new SpoSetCommand();
46
35
  //# sourceMappingURL=spo-set.js.map
@@ -1,14 +1,21 @@
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 _SpoStorageEntityGetCommand_instances, _SpoStorageEntityGetCommand_initOptions;
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
7
3
  import request from '../../../../request.js';
8
4
  import { formatting } from '../../../../utils/formatting.js';
9
5
  import { spo } from '../../../../utils/spo.js';
6
+ import { validation } from '../../../../utils/validation.js';
10
7
  import SpoCommand from '../../../base/SpoCommand.js';
11
8
  import commands from '../../commands.js';
9
+ export const options = z.strictObject({
10
+ ...globalOptionsZod.shape,
11
+ key: z.string().alias('k'),
12
+ appCatalogUrl: z.string()
13
+ .refine(url => validation.isValidSharePointUrl(url) === true, {
14
+ error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
15
+ })
16
+ .optional()
17
+ .alias('u')
18
+ });
12
19
  class SpoStorageEntityGetCommand extends SpoCommand {
13
20
  get name() {
14
21
  return commands.STORAGEENTITY_GET;
@@ -16,16 +23,20 @@ class SpoStorageEntityGetCommand extends SpoCommand {
16
23
  get description() {
17
24
  return 'Gets details for the specified tenant property';
18
25
  }
19
- constructor() {
20
- super();
21
- _SpoStorageEntityGetCommand_instances.add(this);
22
- __classPrivateFieldGet(this, _SpoStorageEntityGetCommand_instances, "m", _SpoStorageEntityGetCommand_initOptions).call(this);
26
+ get schema() {
27
+ return options;
23
28
  }
24
29
  async commandAction(logger, args) {
25
30
  try {
26
- const spoUrl = await spo.getSpoUrl(logger, this.debug);
31
+ let appCatalogUrl = args.options.appCatalogUrl;
32
+ if (!appCatalogUrl) {
33
+ appCatalogUrl = await spo.getTenantAppCatalogUrl(logger, this.debug);
34
+ if (!appCatalogUrl) {
35
+ throw 'Tenant app catalog URL not found. Specify the URL of the app catalog site using the appCatalogUrl option.';
36
+ }
37
+ }
27
38
  const requestOptions = {
28
- url: `${spoUrl}/_api/web/GetStorageEntity('${formatting.encodeQueryParameter(args.options.key)}')`,
39
+ url: `${appCatalogUrl}/_api/web/GetStorageEntity('${formatting.encodeQueryParameter(args.options.key)}')`,
29
40
  headers: {
30
41
  accept: 'application/json;odata=nometadata'
31
42
  },
@@ -51,10 +62,5 @@ class SpoStorageEntityGetCommand extends SpoCommand {
51
62
  }
52
63
  }
53
64
  }
54
- _SpoStorageEntityGetCommand_instances = new WeakSet(), _SpoStorageEntityGetCommand_initOptions = function _SpoStorageEntityGetCommand_initOptions() {
55
- this.options.unshift({
56
- option: '-k, --key <key>'
57
- });
58
- };
59
65
  export default new SpoStorageEntityGetCommand();
60
66
  //# sourceMappingURL=storageentity-get.js.map
@@ -1,13 +1,19 @@
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 _SpoStorageEntityListCommand_instances, _SpoStorageEntityListCommand_initOptions, _SpoStorageEntityListCommand_initValidators;
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
7
3
  import request from '../../../../request.js';
4
+ import { spo } from '../../../../utils/spo.js';
8
5
  import { validation } from '../../../../utils/validation.js';
9
6
  import SpoCommand from '../../../base/SpoCommand.js';
10
7
  import commands from '../../commands.js';
8
+ export const options = z.strictObject({
9
+ ...globalOptionsZod.shape,
10
+ appCatalogUrl: z.string()
11
+ .refine(url => validation.isValidSharePointUrl(url) === true, {
12
+ error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
13
+ })
14
+ .optional()
15
+ .alias('u')
16
+ });
11
17
  class SpoStorageEntityListCommand extends SpoCommand {
12
18
  get name() {
13
19
  return commands.STORAGEENTITY_LIST;
@@ -15,30 +21,35 @@ class SpoStorageEntityListCommand extends SpoCommand {
15
21
  get description() {
16
22
  return 'Lists tenant properties stored on the specified SharePoint Online app catalog';
17
23
  }
18
- constructor() {
19
- super();
20
- _SpoStorageEntityListCommand_instances.add(this);
21
- __classPrivateFieldGet(this, _SpoStorageEntityListCommand_instances, "m", _SpoStorageEntityListCommand_initOptions).call(this);
22
- __classPrivateFieldGet(this, _SpoStorageEntityListCommand_instances, "m", _SpoStorageEntityListCommand_initValidators).call(this);
24
+ get schema() {
25
+ return options;
23
26
  }
24
27
  async commandAction(logger, args) {
25
- if (this.verbose) {
26
- await logger.logToStderr(`Retrieving details for all tenant properties in ${args.options.appCatalogUrl}...`);
27
- }
28
- const requestOptions = {
29
- url: `${args.options.appCatalogUrl}/_api/web/AllProperties?$select=storageentitiesindex`,
30
- headers: {
31
- accept: 'application/json;odata=nometadata'
32
- },
33
- responseType: 'json'
34
- };
35
28
  try {
29
+ let appCatalogUrl = args.options.appCatalogUrl;
30
+ if (!appCatalogUrl) {
31
+ appCatalogUrl = await spo.getTenantAppCatalogUrl(logger, this.debug);
32
+ if (!appCatalogUrl) {
33
+ throw 'Tenant app catalog URL not found. Specify the URL of the app catalog site using the appCatalogUrl option.';
34
+ }
35
+ }
36
+ if (this.verbose) {
37
+ await logger.logToStderr(`Retrieving details for all tenant properties in ${appCatalogUrl}...`);
38
+ }
39
+ const requestOptions = {
40
+ url: `${appCatalogUrl}/_api/web/AllProperties?$select=storageentitiesindex`,
41
+ headers: {
42
+ accept: 'application/json;odata=nometadata'
43
+ },
44
+ responseType: 'json'
45
+ };
36
46
  const web = await request.get(requestOptions);
37
47
  if (!web.storageentitiesindex ||
38
48
  web.storageentitiesindex.trim().length === 0) {
39
49
  if (this.verbose) {
40
50
  await logger.logToStderr('No tenant properties found');
41
51
  }
52
+ await logger.log([]);
42
53
  }
43
54
  else {
44
55
  const properties = JSON.parse(web.storageentitiesindex);
@@ -47,17 +58,16 @@ class SpoStorageEntityListCommand extends SpoCommand {
47
58
  if (this.verbose) {
48
59
  await logger.logToStderr('No tenant properties found');
49
60
  }
61
+ await logger.log([]);
50
62
  }
51
63
  else {
52
- await logger.log(keys.map((key) => {
53
- const property = properties[key];
54
- return {
55
- Key: key,
56
- Value: property.Value,
57
- Description: property.Description,
58
- Comment: property.Comment
59
- };
64
+ const result = keys.map(key => ({
65
+ Key: key,
66
+ Value: properties[key].Value,
67
+ Description: properties[key].Description,
68
+ Comment: properties[key].Comment
60
69
  }));
70
+ await logger.log(result);
61
71
  }
62
72
  }
63
73
  }
@@ -66,12 +76,5 @@ class SpoStorageEntityListCommand extends SpoCommand {
66
76
  }
67
77
  }
68
78
  }
69
- _SpoStorageEntityListCommand_instances = new WeakSet(), _SpoStorageEntityListCommand_initOptions = function _SpoStorageEntityListCommand_initOptions() {
70
- this.options.unshift({
71
- option: '-u, --appCatalogUrl <appCatalogUrl>'
72
- });
73
- }, _SpoStorageEntityListCommand_initValidators = function _SpoStorageEntityListCommand_initValidators() {
74
- this.validators.push(async (args) => validation.isValidSharePointUrl(args.options.appCatalogUrl));
75
- };
76
79
  export default new SpoStorageEntityListCommand();
77
80
  //# sourceMappingURL=storageentity-list.js.map