@pnp/cli-microsoft365 11.2.0-beta.0432e1f → 11.2.0-beta.e0616e6

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.
@@ -1,9 +1,11 @@
1
1
  import { cli } from '../../cli/cli.js';
2
+ import { globalOptionsZod } from '../../Command.js';
2
3
  import { settingsNames } from '../../settingsNames.js';
3
4
  import { app } from '../../utils/app.js';
4
5
  import { browserUtil } from '../../utils/browserUtil.js';
5
6
  import AnonymousCommand from '../base/AnonymousCommand.js';
6
7
  import commands from './commands.js';
8
+ const options = globalOptionsZod.strict();
7
9
  class DocsCommand extends AnonymousCommand {
8
10
  get name() {
9
11
  return commands.DOCS;
@@ -11,6 +13,9 @@ class DocsCommand extends AnonymousCommand {
11
13
  get description() {
12
14
  return 'Returns the CLI for Microsoft 365 docs webpage URL';
13
15
  }
16
+ get schema() {
17
+ return options;
18
+ }
14
19
  async commandAction(logger) {
15
20
  await logger.log(app.packageJson().homepage);
16
21
  if (cli.getSettingWithDefaultValue(settingsNames.autoOpenLinksInBrowser, false) === false) {
@@ -1,12 +1,14 @@
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 _EntraMultitenantAddCommand_instances, _EntraMultitenantAddCommand_initTelemetry, _EntraMultitenantAddCommand_initOptions, _EntraMultitenantAddCommand_initTypes;
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
7
3
  import request from '../../../../request.js';
8
4
  import GraphCommand from '../../../base/GraphCommand.js';
9
5
  import commands from '../../commands.js';
6
+ import { zod } from '../../../../utils/zod.js';
7
+ const options = globalOptionsZod
8
+ .extend({
9
+ displayName: zod.alias('n', z.string()),
10
+ description: zod.alias('d', z.string().optional())
11
+ }).strict();
10
12
  class EntraMultitenantAddCommand extends GraphCommand {
11
13
  get name() {
12
14
  return commands.MULTITENANT_ADD;
@@ -14,12 +16,8 @@ class EntraMultitenantAddCommand extends GraphCommand {
14
16
  get description() {
15
17
  return 'Creates a new multitenant organization';
16
18
  }
17
- constructor() {
18
- super();
19
- _EntraMultitenantAddCommand_instances.add(this);
20
- __classPrivateFieldGet(this, _EntraMultitenantAddCommand_instances, "m", _EntraMultitenantAddCommand_initTelemetry).call(this);
21
- __classPrivateFieldGet(this, _EntraMultitenantAddCommand_instances, "m", _EntraMultitenantAddCommand_initOptions).call(this);
22
- __classPrivateFieldGet(this, _EntraMultitenantAddCommand_instances, "m", _EntraMultitenantAddCommand_initTypes).call(this);
19
+ get schema() {
20
+ return options;
23
21
  }
24
22
  async commandAction(logger, args) {
25
23
  if (this.verbose) {
@@ -45,21 +43,5 @@ class EntraMultitenantAddCommand extends GraphCommand {
45
43
  }
46
44
  }
47
45
  }
48
- _EntraMultitenantAddCommand_instances = new WeakSet(), _EntraMultitenantAddCommand_initTelemetry = function _EntraMultitenantAddCommand_initTelemetry() {
49
- this.telemetry.push((args) => {
50
- Object.assign(this.telemetryProperties, {
51
- displayName: typeof args.options.displayName !== 'undefined',
52
- description: typeof args.options.description !== 'undefined'
53
- });
54
- });
55
- }, _EntraMultitenantAddCommand_initOptions = function _EntraMultitenantAddCommand_initOptions() {
56
- this.options.unshift({
57
- option: '-n, --displayName <displayName>'
58
- }, {
59
- option: '-d, --description [description]'
60
- });
61
- }, _EntraMultitenantAddCommand_initTypes = function _EntraMultitenantAddCommand_initTypes() {
62
- this.types.string.push('displayName', 'description');
63
- };
64
46
  export default new EntraMultitenantAddCommand();
65
47
  //# sourceMappingURL=multitenant-add.js.map
@@ -0,0 +1,69 @@
1
+ import commands from '../../commands.js';
2
+ import SpoCommand from '../../../base/SpoCommand.js';
3
+ import { globalOptionsZod } from '../../../../Command.js';
4
+ import { z } from 'zod';
5
+ import { zod } from '../../../../utils/zod.js';
6
+ import { validation } from '../../../../utils/validation.js';
7
+ import request from '../../../../request.js';
8
+ export const options = globalOptionsZod
9
+ .extend({
10
+ siteUrl: zod.alias('u', z.string()
11
+ .refine(url => validation.isValidSharePointUrl(url) === true, url => ({
12
+ message: `'${url}' is not a valid SharePoint Online site URL.`
13
+ })))
14
+ })
15
+ .strict();
16
+ class SpoSiteVersionpolicyGetCommand extends SpoCommand {
17
+ get name() {
18
+ return commands.SITE_VERSIONPOLICY_GET;
19
+ }
20
+ get description() {
21
+ return 'Retrieves the version policy settings of a specific site';
22
+ }
23
+ get schema() {
24
+ return options;
25
+ }
26
+ async commandAction(logger, args) {
27
+ if (this.verbose) {
28
+ await logger.logToStderr(`Retrieving version policy settings for site '${args.options.siteUrl}'...`);
29
+ }
30
+ try {
31
+ const requestOptions = {
32
+ url: `${args.options.siteUrl}/_api/site/VersionPolicyForNewLibrariesTemplate?$expand=VersionPolicies`,
33
+ headers: {
34
+ accept: 'application/json;odata=nometadata'
35
+ },
36
+ responseType: 'json'
37
+ };
38
+ const response = await request.get(requestOptions);
39
+ let defaultTrimMode = 'number';
40
+ if (response.MajorVersionLimit === -1) {
41
+ defaultTrimMode = 'inheritTenant';
42
+ }
43
+ else if (response.VersionPolicies) {
44
+ switch (response.VersionPolicies.DefaultTrimMode) {
45
+ case 1:
46
+ defaultTrimMode = 'age';
47
+ break;
48
+ case 2:
49
+ defaultTrimMode = 'automatic';
50
+ break;
51
+ case 0:
52
+ default:
53
+ defaultTrimMode = 'number';
54
+ }
55
+ }
56
+ const output = {
57
+ defaultTrimMode: defaultTrimMode,
58
+ defaultExpireAfterDays: response.VersionPolicies?.DefaultExpireAfterDays ?? null,
59
+ majorVersionLimit: response.MajorVersionLimit
60
+ };
61
+ await logger.log(output);
62
+ }
63
+ catch (err) {
64
+ this.handleRejectedODataJsonPromise(err);
65
+ }
66
+ }
67
+ }
68
+ export default new SpoSiteVersionpolicyGetCommand();
69
+ //# sourceMappingURL=site-versionpolicy-get.js.map
@@ -285,6 +285,7 @@ export default {
285
285
  SITE_RENAME: `${prefix} site rename`,
286
286
  SITE_SET: `${prefix} site set`,
287
287
  SITE_SHARINGPERMISSION_SET: `${prefix} site sharingpermission set`,
288
+ SITE_VERSIONPOLICY_GET: `${prefix} site versionpolicy get`,
288
289
  SITE_CHROME_SET: `${prefix} site chrome set`,
289
290
  SITE_UNARCHIVE: `${prefix} site unarchive`,
290
291
  SITEDESIGN_ADD: `${prefix} sitedesign add`,
@@ -0,0 +1,97 @@
1
+ import Global from '/docs/cmd/_global.mdx';
2
+ import Tabs from '@theme/Tabs';
3
+ import TabItem from '@theme/TabItem';
4
+
5
+ # spo site versionpolicy get
6
+
7
+ Retrieves the version policy settings of a specific site.
8
+
9
+ ## Usage
10
+
11
+ ```sh
12
+ m365 spo site versionpolicy get [options]
13
+ ```
14
+
15
+ ## Options
16
+
17
+ ```md definition-list
18
+ `-u, --siteUrl <siteUrl>`
19
+ : URL of the site.
20
+ ```
21
+
22
+ <Global />
23
+
24
+ ## Permissions
25
+
26
+ <Tabs>
27
+ <TabItem value="Delegated">
28
+
29
+ | Resource | Permissions |
30
+ |------------|---------------|
31
+ | SharePoint | AllSites.Read |
32
+
33
+ </TabItem>
34
+ <TabItem value="Application">
35
+
36
+ | Resource | Permissions |
37
+ |------------|----------------|
38
+ | SharePoint | Sites.Read.All |
39
+
40
+ </TabItem>
41
+ </Tabs>
42
+
43
+ ## Examples
44
+
45
+ Retrieve the version policy settings of a specific site.
46
+
47
+ ```sh
48
+ m365 spo site versionpolicy get --siteUrl "https://contoso.sharepoint.com/sites/Marketing"
49
+ ```
50
+
51
+ ## Response
52
+
53
+ <Tabs>
54
+ <TabItem value="JSON">
55
+
56
+ ```json
57
+ {
58
+ "defaultTrimMode": "automatic",
59
+ "defaultExpireAfterDays": 30,
60
+ "majorVersionLimit": 500
61
+ }
62
+ ```
63
+
64
+ </TabItem>
65
+ <TabItem value="Text">
66
+
67
+ ```text
68
+ defaultExpireAfterDays: 30
69
+ defaultTrimMode : automatic
70
+ majorVersionLimit : 500
71
+ ```
72
+
73
+ </TabItem>
74
+ <TabItem value="CSV">
75
+
76
+ ```csv
77
+ defaultTrimMode,defaultExpireAfterDays,majorVersionLimit
78
+ automatic,30,500
79
+ ```
80
+
81
+ </TabItem>
82
+ <TabItem value="Markdown">
83
+
84
+ ```md
85
+ # spo site versionpolicy get --debug "false" --verbose "false" --siteUrl "https://contoso.sharepoint.com/"
86
+
87
+ Date: 8/23/2025
88
+
89
+ Property | Value
90
+ ---------|-------
91
+ defaultTrimMode | automatic
92
+ defaultExpireAfterDays | 30
93
+ majorVersionLimit | 500
94
+ ```
95
+
96
+ </TabItem>
97
+ </Tabs>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnp/cli-microsoft365",
3
- "version": "11.2.0-beta.0432e1f",
3
+ "version": "11.2.0-beta.e0616e6",
4
4
  "description": "Manage Microsoft 365 and SharePoint Framework projects on any platform",
5
5
  "license": "MIT",
6
6
  "main": "./dist/api.js",