@pnp/cli-microsoft365 10.0.0-beta.fd332f4 → 10.1.0-beta.10765f6

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 (29) hide show
  1. package/allCommands.json +1 -1
  2. package/allCommandsFull.json +1 -1
  3. package/dist/m365/commands/login.js +3 -2
  4. package/dist/m365/spe/ContainerProperties.js +2 -0
  5. package/dist/m365/spe/commands/container/container-list.js +87 -0
  6. package/dist/m365/spe/commands/containertype/containertype-get.js +103 -0
  7. package/dist/m365/spe/commands/containertype/containertype-list.js +2 -22
  8. package/dist/m365/spe/commands.js +2 -0
  9. package/dist/m365/spo/commands/folder/folder-sharinglink-set.js +90 -0
  10. package/dist/m365/spo/commands/page/page-publish.js +54 -0
  11. package/dist/m365/spo/commands/tenant/SPOTenantSitePropertiesEnumerable.js +2 -0
  12. package/dist/m365/spo/commands/tenant/TenantSiteProperties.js +2 -0
  13. package/dist/m365/spo/commands/{site/site-list.js → tenant/tenant-site-list.js} +15 -12
  14. package/dist/m365/spo/commands.js +4 -1
  15. package/dist/m365/teams/commands/cache/cache-remove.js +74 -34
  16. package/dist/m365/viva/commands/engage/engage-community-user-list.js +98 -0
  17. package/dist/m365/viva/commands.js +1 -0
  18. package/dist/utils/spo.js +18 -0
  19. package/dist/utils/vivaEngage.js +61 -0
  20. package/docs/docs/cmd/spe/container/container-list.mdx +97 -0
  21. package/docs/docs/cmd/spe/containertype/containertype-get.mdx +114 -0
  22. package/docs/docs/cmd/spo/folder/folder-sharinglink-set.mdx +116 -0
  23. package/docs/docs/cmd/spo/page/page-publish.mdx +41 -0
  24. package/docs/docs/cmd/spo/{site/site-list.mdx → tenant/tenant-site-list.mdx} +13 -7
  25. package/docs/docs/cmd/teams/cache/cache-remove.mdx +10 -1
  26. package/docs/docs/cmd/viva/engage/engage-community-user-list.mdx +123 -0
  27. package/npm-shrinkwrap.json +2 -2
  28. package/package.json +1 -1
  29. package/dist/m365/spe/ContainerTypeProperties.js +0 -2
@@ -37,8 +37,9 @@ class LoginCommand extends Command {
37
37
  }
38
38
  getRefinedSchema(schema) {
39
39
  return schema
40
- .refine(options => typeof options.appId !== 'undefined' || cli.getConfig().get(settingsNames.clientId), {
41
- message: `appId is required. TIP: use the "m365 setup" command to configure the default appId`
40
+ .refine(options => typeof options.appId !== 'undefined' || cli.getClientId(), {
41
+ message: `appId is required. TIP: use the "m365 setup" command to configure the default appId`,
42
+ path: ['appId']
42
43
  })
43
44
  .refine(options => options.authType !== 'password' || options.userName, {
44
45
  message: 'Username is required when using password authentication',
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ContainerProperties.js.map
@@ -0,0 +1,87 @@
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 _SpeContainerListCommand_instances, _SpeContainerListCommand_initTelemetry, _SpeContainerListCommand_initOptions, _SpeContainerListCommand_initValidators, _SpeContainerListCommand_initOptionSets, _SpeContainerListCommand_initTypes;
7
+ import { formatting } from '../../../../utils/formatting.js';
8
+ import { odata } from '../../../../utils/odata.js';
9
+ import { validation } from '../../../../utils/validation.js';
10
+ import GraphCommand from '../../../base/GraphCommand.js';
11
+ import commands from '../../commands.js';
12
+ import { spo } from '../../../../utils/spo.js';
13
+ class SpeContainerListCommand extends GraphCommand {
14
+ get name() {
15
+ return commands.CONTAINER_LIST;
16
+ }
17
+ get description() {
18
+ return 'Lists all Container Types';
19
+ }
20
+ defaultProperties() {
21
+ return ['id', 'displayName', 'containerTypeId', 'createdDateTime'];
22
+ }
23
+ constructor() {
24
+ super();
25
+ _SpeContainerListCommand_instances.add(this);
26
+ __classPrivateFieldGet(this, _SpeContainerListCommand_instances, "m", _SpeContainerListCommand_initTelemetry).call(this);
27
+ __classPrivateFieldGet(this, _SpeContainerListCommand_instances, "m", _SpeContainerListCommand_initOptions).call(this);
28
+ __classPrivateFieldGet(this, _SpeContainerListCommand_instances, "m", _SpeContainerListCommand_initValidators).call(this);
29
+ __classPrivateFieldGet(this, _SpeContainerListCommand_instances, "m", _SpeContainerListCommand_initOptionSets).call(this);
30
+ __classPrivateFieldGet(this, _SpeContainerListCommand_instances, "m", _SpeContainerListCommand_initTypes).call(this);
31
+ }
32
+ async commandAction(logger, args) {
33
+ try {
34
+ if (this.verbose) {
35
+ await logger.logToStderr(`Retrieving list of Containers...`);
36
+ }
37
+ const containerTypeId = await this.getContainerTypeId(logger, args.options);
38
+ const allContainers = await odata.getAllItems(`${this.resource}/v1.0/storage/fileStorage/containers?$filter=containerTypeId eq ${formatting.encodeQueryParameter(containerTypeId)}`);
39
+ await logger.log(allContainers);
40
+ }
41
+ catch (err) {
42
+ this.handleRejectedPromise(err);
43
+ }
44
+ }
45
+ async getContainerTypeId(logger, options) {
46
+ if (options.containerTypeId) {
47
+ return options.containerTypeId;
48
+ }
49
+ const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.debug);
50
+ const containerTypes = await spo.getAllContainerTypes(spoAdminUrl, logger, this.debug);
51
+ // Get id of the container type by name
52
+ const containerType = containerTypes.find(c => c.DisplayName === options.containerTypeName);
53
+ if (!containerType) {
54
+ throw new Error(`Container type with name ${options.containerTypeName} not found`);
55
+ }
56
+ // The value is returned as "/Guid(073269af-f1d2-042d-2ef5-5bdd6ac83115)/". We need to extract the GUID from it.
57
+ const containerTypeValue = containerType.ContainerTypeId.toString();
58
+ return containerTypeValue.substring(containerTypeValue.indexOf('(') + 1, containerTypeValue.lastIndexOf(')'));
59
+ }
60
+ }
61
+ _SpeContainerListCommand_instances = new WeakSet(), _SpeContainerListCommand_initTelemetry = function _SpeContainerListCommand_initTelemetry() {
62
+ this.telemetry.push((args) => {
63
+ Object.assign(this.telemetryProperties, {
64
+ containerTypeId: typeof args.options.containerTypeId !== 'undefined',
65
+ containerTypeName: typeof args.options.containerTypeName !== 'undefined'
66
+ });
67
+ });
68
+ }, _SpeContainerListCommand_initOptions = function _SpeContainerListCommand_initOptions() {
69
+ this.options.unshift({
70
+ option: '--containerTypeId [containerTypeId]'
71
+ }, {
72
+ option: '--containerTypeName [containerTypeName]'
73
+ });
74
+ }, _SpeContainerListCommand_initValidators = function _SpeContainerListCommand_initValidators() {
75
+ this.validators.push(async (args) => {
76
+ if (args.options.containerTypeId && !validation.isValidGuid(args.options.containerTypeId)) {
77
+ return `${args.options.containerTypeId} is not a valid GUID`;
78
+ }
79
+ return true;
80
+ });
81
+ }, _SpeContainerListCommand_initOptionSets = function _SpeContainerListCommand_initOptionSets() {
82
+ this.optionSets.push({ options: ['containerTypeId', 'containerTypeName'] });
83
+ }, _SpeContainerListCommand_initTypes = function _SpeContainerListCommand_initTypes() {
84
+ this.types.string.push('containerTypeId', 'containerTypeName');
85
+ };
86
+ export default new SpeContainerListCommand();
87
+ //# sourceMappingURL=container-list.js.map
@@ -0,0 +1,103 @@
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 _SpeContainertypeGetCommand_instances, _SpeContainertypeGetCommand_initTelemetry, _SpeContainertypeGetCommand_initOptions, _SpeContainertypeGetCommand_initOptionSets, _SpeContainertypeGetCommand_initValidators, _SpeContainertypeGetCommand_initTypes;
7
+ import config from '../../../../config.js';
8
+ import request from '../../../../request.js';
9
+ import { spo } from '../../../../utils/spo.js';
10
+ import { validation } from '../../../../utils/validation.js';
11
+ import SpoCommand from '../../../base/SpoCommand.js';
12
+ import commands from '../../commands.js';
13
+ class SpeContainertypeGetCommand extends SpoCommand {
14
+ get name() {
15
+ return commands.CONTAINERTYPE_GET;
16
+ }
17
+ get description() {
18
+ return 'Get a Container Type';
19
+ }
20
+ constructor() {
21
+ super();
22
+ _SpeContainertypeGetCommand_instances.add(this);
23
+ __classPrivateFieldGet(this, _SpeContainertypeGetCommand_instances, "m", _SpeContainertypeGetCommand_initTelemetry).call(this);
24
+ __classPrivateFieldGet(this, _SpeContainertypeGetCommand_instances, "m", _SpeContainertypeGetCommand_initOptions).call(this);
25
+ __classPrivateFieldGet(this, _SpeContainertypeGetCommand_instances, "m", _SpeContainertypeGetCommand_initValidators).call(this);
26
+ __classPrivateFieldGet(this, _SpeContainertypeGetCommand_instances, "m", _SpeContainertypeGetCommand_initOptionSets).call(this);
27
+ __classPrivateFieldGet(this, _SpeContainertypeGetCommand_instances, "m", _SpeContainertypeGetCommand_initTypes).call(this);
28
+ }
29
+ async commandAction(logger, args) {
30
+ try {
31
+ const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.debug);
32
+ if (this.verbose) {
33
+ await logger.logToStderr(`Getting the Container type...`);
34
+ }
35
+ const containerTypeId = await this.getContainerTypeId(args.options, spoAdminUrl, logger);
36
+ const allContainerTypes = await this.getContainerTypeById(containerTypeId, spoAdminUrl, logger);
37
+ await logger.log(allContainerTypes);
38
+ }
39
+ catch (err) {
40
+ this.handleRejectedPromise(err);
41
+ }
42
+ }
43
+ async getContainerTypeById(containerTypeId, spoAdminUrl, logger) {
44
+ const formDigestInfo = await spo.ensureFormDigest(spoAdminUrl, logger, undefined, this.debug);
45
+ const requestOptions = {
46
+ url: `${spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
47
+ headers: {
48
+ 'X-RequestDigest': formDigestInfo.FormDigestValue
49
+ },
50
+ 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="49" ObjectPathId="48" /><Method Name="GetSPOContainerTypeById" Id="50" ObjectPathId="48"><Parameters><Parameter Type="Guid">{${containerTypeId}}</Parameter><Parameter Type="Enum">1</Parameter></Parameters></Method></Actions><ObjectPaths><Constructor Id="48" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /></ObjectPaths></Request>`
51
+ };
52
+ const res = await request.post(requestOptions);
53
+ const json = JSON.parse(res);
54
+ const response = json[0];
55
+ if (response.ErrorInfo) {
56
+ throw response.ErrorInfo.ErrorMessage;
57
+ }
58
+ const containerTypes = json[json.length - 1];
59
+ return containerTypes;
60
+ }
61
+ async getContainerTypeId(options, spoAdminUrl, logger) {
62
+ if (options.id) {
63
+ return options.id;
64
+ }
65
+ const containerTypes = await spo.getAllContainerTypes(spoAdminUrl, logger, this.debug);
66
+ // Get id of the container type by name
67
+ const containerType = containerTypes.find(c => c.DisplayName === options.name);
68
+ if (!containerType) {
69
+ throw new Error(`Container type with name ${options.name} not found`);
70
+ }
71
+ const match = containerType.ContainerTypeId.match(/\/Guid\(([^)]+)\)\//);
72
+ return match[1];
73
+ }
74
+ }
75
+ _SpeContainertypeGetCommand_instances = new WeakSet(), _SpeContainertypeGetCommand_initTelemetry = function _SpeContainertypeGetCommand_initTelemetry() {
76
+ this.telemetry.push((args) => {
77
+ Object.assign(this.telemetryProperties, {
78
+ id: typeof args.options.id !== 'undefined',
79
+ name: typeof args.options.name !== 'undefined'
80
+ });
81
+ });
82
+ }, _SpeContainertypeGetCommand_initOptions = function _SpeContainertypeGetCommand_initOptions() {
83
+ this.options.unshift({
84
+ option: '-i, --id [id]'
85
+ }, {
86
+ option: '-n, --name [name]'
87
+ });
88
+ }, _SpeContainertypeGetCommand_initOptionSets = function _SpeContainertypeGetCommand_initOptionSets() {
89
+ this.optionSets.push({
90
+ options: ['id', 'name']
91
+ });
92
+ }, _SpeContainertypeGetCommand_initValidators = function _SpeContainertypeGetCommand_initValidators() {
93
+ this.validators.push(async (args) => {
94
+ if (args.options.id && !validation.isValidGuid(args.options.id)) {
95
+ return `${args.options.id} is not a valid GUID`;
96
+ }
97
+ return true;
98
+ });
99
+ }, _SpeContainertypeGetCommand_initTypes = function _SpeContainertypeGetCommand_initTypes() {
100
+ this.types.string.push('id', 'name');
101
+ };
102
+ export default new SpeContainertypeGetCommand();
103
+ //# sourceMappingURL=containertype-get.js.map
@@ -1,8 +1,6 @@
1
- import config from '../../../../config.js';
2
- import request from '../../../../request.js';
3
- import { spo } from '../../../../utils/spo.js';
4
1
  import SpoCommand from '../../../base/SpoCommand.js';
5
2
  import commands from '../../commands.js';
3
+ import { spo } from '../../../../utils/spo.js';
6
4
  class SpeContainertypeListCommand extends SpoCommand {
7
5
  get name() {
8
6
  return commands.CONTAINERTYPE_LIST;
@@ -19,31 +17,13 @@ class SpeContainertypeListCommand extends SpoCommand {
19
17
  if (this.verbose) {
20
18
  await logger.logToStderr(`Retrieving list of Container types...`);
21
19
  }
22
- const allContainerTypes = await this.getAllContainerTypes(spoAdminUrl, logger);
20
+ const allContainerTypes = await spo.getAllContainerTypes(spoAdminUrl, logger, this.debug);
23
21
  await logger.log(allContainerTypes);
24
22
  }
25
23
  catch (err) {
26
24
  this.handleRejectedPromise(err);
27
25
  }
28
26
  }
29
- async getAllContainerTypes(spoAdminUrl, logger) {
30
- const formDigestInfo = await spo.ensureFormDigest(spoAdminUrl, logger, undefined, this.debug);
31
- const requestOptions = {
32
- url: `${spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
33
- headers: {
34
- 'X-RequestDigest': formDigestInfo.FormDigestValue
35
- },
36
- 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="46" ObjectPathId="45" /><Method Name="GetSPOContainerTypes" Id="47" ObjectPathId="45"><Parameters><Parameter Type="Enum">1</Parameter></Parameters></Method></Actions><ObjectPaths><Constructor Id="45" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /></ObjectPaths></Request>`
37
- };
38
- const res = await request.post(requestOptions);
39
- const json = JSON.parse(res);
40
- const response = json[0];
41
- if (response.ErrorInfo) {
42
- throw response.ErrorInfo.ErrorMessage;
43
- }
44
- const containerTypes = json[json.length - 1];
45
- return containerTypes;
46
- }
47
27
  }
48
28
  export default new SpeContainertypeListCommand();
49
29
  //# sourceMappingURL=containertype-list.js.map
@@ -1,6 +1,8 @@
1
1
  const prefix = 'spe';
2
2
  export default {
3
+ CONTAINER_LIST: `${prefix} container list`,
3
4
  CONTAINERTYPE_ADD: `${prefix} containertype add`,
5
+ CONTAINERTYPE_GET: `${prefix} containertype get`,
4
6
  CONTAINERTYPE_LIST: `${prefix} containertype list`
5
7
  };
6
8
  //# sourceMappingURL=commands.js.map
@@ -0,0 +1,90 @@
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 _SpoFolderSharingLinkSetCommand_instances, _SpoFolderSharingLinkSetCommand_initTelemetry, _SpoFolderSharingLinkSetCommand_initOptions, _SpoFolderSharingLinkSetCommand_initValidators, _SpoFolderSharingLinkSetCommand_initOptionSets, _SpoFolderSharingLinkSetCommand_initTypes;
7
+ import request from '../../../../request.js';
8
+ import { spo } from '../../../../utils/spo.js';
9
+ import { urlUtil } from '../../../../utils/urlUtil.js';
10
+ import { drive } from '../../../../utils/drive.js';
11
+ import { validation } from '../../../../utils/validation.js';
12
+ import SpoCommand from '../../../base/SpoCommand.js';
13
+ import commands from '../../commands.js';
14
+ class SpoFolderSharingLinkSetCommand extends SpoCommand {
15
+ get name() {
16
+ return commands.FOLDER_SHARINGLINK_SET;
17
+ }
18
+ get description() {
19
+ return 'Updates a specific sharing link to a folder';
20
+ }
21
+ constructor() {
22
+ super();
23
+ _SpoFolderSharingLinkSetCommand_instances.add(this);
24
+ __classPrivateFieldGet(this, _SpoFolderSharingLinkSetCommand_instances, "m", _SpoFolderSharingLinkSetCommand_initTelemetry).call(this);
25
+ __classPrivateFieldGet(this, _SpoFolderSharingLinkSetCommand_instances, "m", _SpoFolderSharingLinkSetCommand_initOptions).call(this);
26
+ __classPrivateFieldGet(this, _SpoFolderSharingLinkSetCommand_instances, "m", _SpoFolderSharingLinkSetCommand_initValidators).call(this);
27
+ __classPrivateFieldGet(this, _SpoFolderSharingLinkSetCommand_instances, "m", _SpoFolderSharingLinkSetCommand_initOptionSets).call(this);
28
+ __classPrivateFieldGet(this, _SpoFolderSharingLinkSetCommand_instances, "m", _SpoFolderSharingLinkSetCommand_initTypes).call(this);
29
+ }
30
+ async commandAction(logger, args) {
31
+ if (this.verbose) {
32
+ await logger.logToStderr(`Updating sharing link to a folder ${args.options.folderId || args.options.folderUrl}...`);
33
+ }
34
+ try {
35
+ const relFolderUrl = await spo.getFolderServerRelativeUrl(args.options.webUrl, args.options.folderUrl, args.options.folderId, logger, args.options.verbose);
36
+ const absoluteFolderUrl = urlUtil.getAbsoluteUrl(args.options.webUrl, relFolderUrl);
37
+ const folderUrl = new URL(absoluteFolderUrl);
38
+ const siteId = await spo.getSiteId(args.options.webUrl);
39
+ const driveDetails = await drive.getDriveByUrl(siteId, folderUrl, logger, args.options.verbose);
40
+ const itemId = await drive.getDriveItemId(driveDetails, folderUrl, logger, args.options.verbose);
41
+ const requestOptions = {
42
+ url: `https://graph.microsoft.com/v1.0/drives/${driveDetails.id}/items/${itemId}/permissions/${args.options.id}`,
43
+ headers: {
44
+ accept: 'application/json;odata.metadata=none',
45
+ 'content-type': 'application/json'
46
+ },
47
+ responseType: 'json',
48
+ data: {
49
+ expirationDateTime: args.options.expirationDateTime
50
+ }
51
+ };
52
+ const sharingLink = await request.patch(requestOptions);
53
+ await logger.log(sharingLink);
54
+ }
55
+ catch (err) {
56
+ this.handleRejectedODataJsonPromise(err);
57
+ }
58
+ }
59
+ }
60
+ _SpoFolderSharingLinkSetCommand_instances = new WeakSet(), _SpoFolderSharingLinkSetCommand_initTelemetry = function _SpoFolderSharingLinkSetCommand_initTelemetry() {
61
+ this.telemetry.push((args) => {
62
+ Object.assign(this.telemetryProperties, {
63
+ folderUrl: typeof args.options.folderUrl !== 'undefined',
64
+ folderId: typeof args.options.folderId !== 'undefined',
65
+ expirationDateTime: typeof args.options.expirationDateTime !== 'undefined'
66
+ });
67
+ });
68
+ }, _SpoFolderSharingLinkSetCommand_initOptions = function _SpoFolderSharingLinkSetCommand_initOptions() {
69
+ this.options.unshift({ option: '-u, --webUrl <webUrl>' }, { option: '--folderUrl [folderUrl]' }, { option: '--folderId [folderId]' }, { option: '-i, --id <id>' }, { option: '--expirationDateTime [expirationDateTime]' });
70
+ }, _SpoFolderSharingLinkSetCommand_initValidators = function _SpoFolderSharingLinkSetCommand_initValidators() {
71
+ this.validators.push(async (args) => {
72
+ const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.webUrl);
73
+ if (isValidSharePointUrl !== true) {
74
+ return isValidSharePointUrl;
75
+ }
76
+ if (args.options.folderId && !validation.isValidGuid(args.options.folderId)) {
77
+ return `${args.options.folderId} is not a valid GUID`;
78
+ }
79
+ if (args.options.expirationDateTime && !validation.isValidISODateTime(args.options.expirationDateTime)) {
80
+ return `${args.options.expirationDateTime} is not a valid ISO date string.`;
81
+ }
82
+ return true;
83
+ });
84
+ }, _SpoFolderSharingLinkSetCommand_initOptionSets = function _SpoFolderSharingLinkSetCommand_initOptionSets() {
85
+ this.optionSets.push({ options: ['folderId', 'folderUrl'] });
86
+ }, _SpoFolderSharingLinkSetCommand_initTypes = function _SpoFolderSharingLinkSetCommand_initTypes() {
87
+ this.types.string.push('webUrl', 'folderId', 'folderUrl', 'id', 'expirationDateTime');
88
+ };
89
+ export default new SpoFolderSharingLinkSetCommand();
90
+ //# sourceMappingURL=folder-sharinglink-set.js.map
@@ -0,0 +1,54 @@
1
+ import { z } from 'zod';
2
+ import { zod } from '../../../../utils/zod.js';
3
+ import { globalOptionsZod } from '../../../../Command.js';
4
+ import request from '../../../../request.js';
5
+ import { formatting } from '../../../../utils/formatting.js';
6
+ import { urlUtil } from '../../../../utils/urlUtil.js';
7
+ import { validation } from '../../../../utils/validation.js';
8
+ import SpoCommand from '../../../base/SpoCommand.js';
9
+ import commands from '../../commands.js';
10
+ const options = globalOptionsZod
11
+ .extend({
12
+ webUrl: zod.alias('u', z.string()
13
+ .refine(url => validation.isValidSharePointUrl(url) === true, url => ({
14
+ message: `'${url}' is not a valid SharePoint Online site URL.`
15
+ }))),
16
+ name: zod.alias('n', z.string())
17
+ })
18
+ .strict();
19
+ class SpoPagePublishCommand extends SpoCommand {
20
+ get name() {
21
+ return commands.PAGE_PUBLISH;
22
+ }
23
+ get description() {
24
+ return 'Publishes a modern page';
25
+ }
26
+ get schema() {
27
+ return options;
28
+ }
29
+ async commandAction(logger, args) {
30
+ try {
31
+ // Remove leading slashes from the page name (page can be nested in folders)
32
+ let pageName = urlUtil.removeLeadingSlashes(args.options.name);
33
+ if (!pageName.toLowerCase().endsWith('.aspx')) {
34
+ pageName += '.aspx';
35
+ }
36
+ if (this.verbose) {
37
+ await logger.logToStderr(`Publishing page ${pageName}...`);
38
+ }
39
+ const filePath = `${urlUtil.getServerRelativeSiteUrl(args.options.webUrl)}/SitePages/${pageName}`;
40
+ const requestOptions = {
41
+ url: `${args.options.webUrl}/_api/web/GetFileByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(filePath)}')/Publish()`,
42
+ headers: {
43
+ accept: 'application/json;odata=nometadata'
44
+ }
45
+ };
46
+ await request.post(requestOptions);
47
+ }
48
+ catch (err) {
49
+ this.handleRejectedODataJsonPromise(err);
50
+ }
51
+ }
52
+ }
53
+ export default new SpoPagePublishCommand();
54
+ //# sourceMappingURL=page-publish.js.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=SPOTenantSitePropertiesEnumerable.js.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=TenantSiteProperties.js.map
@@ -3,16 +3,16 @@ 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 _SpoSiteListCommand_instances, _SpoSiteListCommand_initTelemetry, _SpoSiteListCommand_initOptions, _SpoSiteListCommand_initValidators;
6
+ var _SpoTenantSiteListCommand_instances, _SpoTenantSiteListCommand_initTelemetry, _SpoTenantSiteListCommand_initOptions, _SpoTenantSiteListCommand_initValidators;
7
7
  import config from '../../../../config.js';
8
8
  import request from '../../../../request.js';
9
9
  import { formatting } from '../../../../utils/formatting.js';
10
10
  import { spo } from '../../../../utils/spo.js';
11
11
  import SpoCommand from '../../../base/SpoCommand.js';
12
12
  import commands from '../../commands.js';
13
- class SpoSiteListCommand extends SpoCommand {
13
+ class SpoTenantSiteListCommand extends SpoCommand {
14
14
  get name() {
15
- return commands.SITE_LIST;
15
+ return commands.TENANT_SITE_LIST;
16
16
  }
17
17
  get description() {
18
18
  return 'Lists sites of the given type';
@@ -22,10 +22,13 @@ class SpoSiteListCommand extends SpoCommand {
22
22
  }
23
23
  constructor() {
24
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);
25
+ _SpoTenantSiteListCommand_instances.add(this);
26
+ __classPrivateFieldGet(this, _SpoTenantSiteListCommand_instances, "m", _SpoTenantSiteListCommand_initTelemetry).call(this);
27
+ __classPrivateFieldGet(this, _SpoTenantSiteListCommand_instances, "m", _SpoTenantSiteListCommand_initOptions).call(this);
28
+ __classPrivateFieldGet(this, _SpoTenantSiteListCommand_instances, "m", _SpoTenantSiteListCommand_initValidators).call(this);
29
+ }
30
+ alias() {
31
+ return [commands.SITE_LIST];
29
32
  }
30
33
  async commandAction(logger, args) {
31
34
  const webTemplate = this.getWebTemplateId(args.options);
@@ -86,7 +89,7 @@ class SpoSiteListCommand extends SpoCommand {
86
89
  }
87
90
  }
88
91
  }
89
- _SpoSiteListCommand_instances = new WeakSet(), _SpoSiteListCommand_initTelemetry = function _SpoSiteListCommand_initTelemetry() {
92
+ _SpoTenantSiteListCommand_instances = new WeakSet(), _SpoTenantSiteListCommand_initTelemetry = function _SpoTenantSiteListCommand_initTelemetry() {
90
93
  this.telemetry.push((args) => {
91
94
  Object.assign(this.telemetryProperties, {
92
95
  webTemplate: args.options.webTemplate,
@@ -95,7 +98,7 @@ _SpoSiteListCommand_instances = new WeakSet(), _SpoSiteListCommand_initTelemetry
95
98
  includeOneDriveSites: typeof args.options.includeOneDriveSites !== 'undefined'
96
99
  });
97
100
  });
98
- }, _SpoSiteListCommand_initOptions = function _SpoSiteListCommand_initOptions() {
101
+ }, _SpoTenantSiteListCommand_initOptions = function _SpoTenantSiteListCommand_initOptions() {
99
102
  this.options.unshift({
100
103
  option: '-t, --type [type]',
101
104
  autocomplete: ['TeamSite', 'CommunicationSite']
@@ -106,7 +109,7 @@ _SpoSiteListCommand_instances = new WeakSet(), _SpoSiteListCommand_initTelemetry
106
109
  }, {
107
110
  option: '--includeOneDriveSites'
108
111
  });
109
- }, _SpoSiteListCommand_initValidators = function _SpoSiteListCommand_initValidators() {
112
+ }, _SpoTenantSiteListCommand_initValidators = function _SpoTenantSiteListCommand_initValidators() {
110
113
  this.validators.push(async (args) => {
111
114
  if (args.options.type && args.options.webTemplate) {
112
115
  return 'Specify either type or webTemplate, but not both';
@@ -123,5 +126,5 @@ _SpoSiteListCommand_instances = new WeakSet(), _SpoSiteListCommand_initTelemetry
123
126
  return true;
124
127
  });
125
128
  };
126
- export default new SpoSiteListCommand();
127
- //# sourceMappingURL=site-list.js.map
129
+ export default new SpoTenantSiteListCommand();
130
+ //# sourceMappingURL=tenant-site-list.js.map
@@ -104,6 +104,7 @@ export default {
104
104
  FOLDER_SHARINGLINK_GET: `${prefix} folder sharinglink get`,
105
105
  FOLDER_SHARINGLINK_LIST: `${prefix} folder sharinglink list`,
106
106
  FOLDER_SHARINGLINK_REMOVE: `${prefix} folder sharinglink remove`,
107
+ FOLDER_SHARINGLINK_SET: `${prefix} folder sharinglink set`,
107
108
  GET: `${prefix} get`,
108
109
  GROUP_ADD: `${prefix} group add`,
109
110
  GROUP_GET: `${prefix} group get`,
@@ -202,6 +203,7 @@ export default {
202
203
  PAGE_COPY: `${prefix} page copy`,
203
204
  PAGE_GET: `${prefix} page get`,
204
205
  PAGE_LIST: `${prefix} page list`,
206
+ PAGE_PUBLISH: `${prefix} page publish`,
205
207
  PAGE_REMOVE: `${prefix} page remove`,
206
208
  PAGE_SET: `${prefix} page set`,
207
209
  PAGE_CLIENTSIDEWEBPART_ADD: `${prefix} page clientsidewebpart add`,
@@ -321,8 +323,9 @@ export default {
321
323
  TENANT_SETTINGS_LIST: `${prefix} tenant settings list`,
322
324
  TENANT_SETTINGS_SET: `${prefix} tenant settings set`,
323
325
  TENANT_SITE_ARCHIVE: `${prefix} tenant site archive`,
324
- TENANT_SITE_MEMBERSHIP_LIST: `${prefix} tenant site membership list`,
326
+ TENANT_SITE_LIST: `${prefix} tenant site list`,
325
327
  TENANT_SITE_RENAME: `${prefix} tenant site rename`,
328
+ TENANT_SITE_MEMBERSHIP_LIST: `${prefix} tenant site membership list`,
326
329
  TENANT_SITE_UNARCHIVE: `${prefix} tenant site unarchive`,
327
330
  TERM_ADD: `${prefix} term add`,
328
331
  TERM_GET: `${prefix} term get`,