@pnp/cli-microsoft365 12.0.0-beta.c9bd7f3 → 12.0.0-beta.d0b29c1
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.
- package/.devproxy/generate-openapi-spec.json +1 -1
- package/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/googleAnalytics.js +96 -0
- package/dist/m365/entra/commands/m365group/m365group-remove.js +2 -8
- package/dist/m365/spfx/commands/SpfxCompatibilityMatrix.js +15 -0
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.24.0-rc.0.js +19 -0
- package/dist/m365/spfx/commands/project/project-doctor.js +2 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN012021_TSC_excludeDirectories.js +43 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN027002_OVERRIDES_qs.js +33 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN027003_OVERRIDES_uuid.js +33 -0
- package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.24.0-rc.0.js +77 -0
- package/dist/m365/spfx/commands/project/project-upgrade.js +12 -11
- package/dist/m365/spo/commands/app/app-add.js +35 -56
- package/dist/m365/spo/commands/app/app-deploy.js +41 -59
- package/dist/m365/spo/commands/app/app-get.js +40 -56
- package/dist/m365/spo/commands/app/app-install.js +20 -41
- package/dist/m365/spo/commands/app/app-instance-list.js +12 -24
- package/dist/m365/spo/commands/app/app-list.js +26 -44
- package/dist/m365/spo/commands/app/app-remove.js +32 -52
- package/dist/m365/spo/commands/app/app-retract.js +32 -51
- package/dist/m365/spo/commands/app/app-teamspackage-download.js +35 -54
- package/dist/m365/spo/commands/app/app-uninstall.js +21 -44
- package/dist/m365/spo/commands/app/app-upgrade.js +20 -41
- package/dist/m365/spo/commands/feature/feature-disable.js +20 -50
- package/dist/m365/spo/commands/feature/feature-enable.js +22 -50
- package/dist/m365/spo/commands/feature/feature-list.js +11 -36
- package/dist/m365/spo/commands/field/field-add.js +33 -62
- package/dist/m365/spo/commands/field/field-get.js +30 -57
- package/dist/m365/spo/commands/field/field-list.js +21 -46
- package/dist/m365/spo/commands/field/field-remove.js +32 -63
- package/dist/m365/spo/commands/field/field-set.js +34 -66
- package/dist/m365/spo/commands/file/file-get.js +4 -3
- package/dist/m365/spo/commands/folder/folder-unarchive.js +90 -0
- package/dist/m365/spo/commands/hubsite/hubsite-connect.js +38 -63
- package/dist/m365/spo/commands/hubsite/hubsite-data-get.js +11 -27
- package/dist/m365/spo/commands/hubsite/hubsite-disconnect.js +25 -47
- package/dist/m365/spo/commands/hubsite/hubsite-get.js +25 -37
- package/dist/m365/spo/commands/hubsite/hubsite-list.js +12 -24
- package/dist/m365/spo/commands/hubsite/hubsite-register.js +10 -18
- package/dist/m365/spo/commands/hubsite/hubsite-rights-grant.js +14 -32
- package/dist/m365/spo/commands/hubsite/hubsite-rights-revoke.js +12 -29
- package/dist/m365/spo/commands/hubsite/hubsite-set.js +19 -46
- package/dist/m365/spo/commands/hubsite/hubsite-unregister.js +11 -27
- package/dist/m365/spo/commands/listitem/listitem-get.js +1 -12
- package/dist/m365/spo/commands/navigation/navigation-node-add.js +74 -120
- package/dist/m365/spo/commands/navigation/navigation-node-get.js +4 -13
- package/dist/m365/spo/commands/navigation/navigation-node-list.js +6 -4
- package/dist/m365/spo/commands/navigation/navigation-node-set.js +53 -114
- package/dist/m365/spo/commands/page/page-unpublish.js +53 -0
- package/dist/m365/spo/commands/site/site-remove.js +3 -9
- package/dist/m365/spo/commands/tenant/tenant-appcatalog-add.js +1 -1
- package/dist/m365/spo/commands/web/web-rule-get.js +47 -0
- package/dist/m365/spo/commands/web/web-rule-list.js +113 -0
- package/dist/m365/spo/commands/web/web-rule-remove.js +54 -0
- package/dist/m365/spo/commands.js +6 -1
- package/dist/m365/teams/commands/channel/channel-add.js +46 -57
- package/dist/m365/teams/commands/channel/channel-get.js +41 -48
- package/dist/m365/teams/commands/channel/channel-list.js +28 -42
- package/dist/m365/teams/commands/channel/channel-member-add.js +53 -54
- package/dist/m365/teams/commands/channel/channel-member-list.js +47 -55
- package/dist/m365/teams/commands/channel/channel-member-remove.js +62 -62
- package/dist/m365/teams/commands/channel/channel-member-set.js +61 -65
- package/dist/m365/teams/commands/channel/channel-remove.js +47 -49
- package/dist/m365/teams/commands/channel/channel-set.js +47 -54
- package/dist/m365/teams/commands/chat/chat-get.js +30 -45
- package/dist/m365/teams/commands/chat/chat-list.js +22 -42
- package/dist/m365/teams/commands/chat/chat-member-add.js +43 -64
- package/dist/m365/teams/commands/chat/chat-member-list.js +10 -23
- package/dist/m365/teams/commands/chat/chat-member-remove.js +28 -50
- package/dist/m365/teams/commands/chat/chat-message-send.js +32 -55
- package/dist/m365/util/commands/accesstoken/accesstoken-get.js +10 -28
- package/dist/telemetry.js +7 -11
- package/dist/utils/spo.js +40 -3
- package/dist/utils/urlUtil.js +2 -2
- package/docs/docs/cmd/entra/m365group/m365group-remove.mdx +0 -3
- package/docs/docs/cmd/spo/file/file-archive.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-checkin.mdx +2 -2
- package/docs/docs/cmd/spo/file/file-checkout-undo.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-checkout.mdx +2 -2
- package/docs/docs/cmd/spo/file/file-copy.mdx +2 -2
- package/docs/docs/cmd/spo/file/file-get.mdx +6 -6
- package/docs/docs/cmd/spo/file/file-retentionlabel-ensure.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-retentionlabel-remove.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-roleassignment-add.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-roleassignment-remove.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-roleinheritance-break.mdx +3 -3
- package/docs/docs/cmd/spo/file/file-roleinheritance-reset.mdx +2 -2
- package/docs/docs/cmd/spo/file/file-sharinginfo-get.mdx +2 -2
- package/docs/docs/cmd/spo/file/file-sharinglink-add.mdx +22 -1
- package/docs/docs/cmd/spo/file/file-sharinglink-clear.mdx +24 -1
- package/docs/docs/cmd/spo/file/file-sharinglink-get.mdx +22 -1
- package/docs/docs/cmd/spo/file/file-sharinglink-list.mdx +22 -1
- package/docs/docs/cmd/spo/file/file-sharinglink-remove.mdx +24 -1
- package/docs/docs/cmd/spo/file/file-sharinglink-set.mdx +22 -1
- package/docs/docs/cmd/spo/file/file-unarchive.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-version-clear.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-version-get.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-version-keep.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-version-list.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-version-remove.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-version-restore.mdx +1 -1
- package/docs/docs/cmd/spo/folder/folder-archive.mdx +1 -1
- package/docs/docs/cmd/spo/folder/folder-copy.mdx +1 -1
- package/docs/docs/cmd/spo/folder/folder-get.mdx +2 -2
- package/docs/docs/cmd/spo/folder/folder-retentionlabel-ensure.mdx +1 -1
- package/docs/docs/cmd/spo/folder/folder-retentionlabel-remove.mdx +1 -1
- package/docs/docs/cmd/spo/folder/folder-sharinglink-add.mdx +22 -1
- package/docs/docs/cmd/spo/folder/folder-sharinglink-clear.mdx +23 -0
- package/docs/docs/cmd/spo/folder/folder-sharinglink-get.mdx +21 -0
- package/docs/docs/cmd/spo/folder/folder-sharinglink-list.mdx +22 -1
- package/docs/docs/cmd/spo/folder/folder-sharinglink-remove.mdx +24 -1
- package/docs/docs/cmd/spo/folder/folder-sharinglink-set.mdx +21 -0
- package/docs/docs/cmd/spo/folder/folder-unarchive.mdx +76 -0
- package/docs/docs/cmd/spo/listitem/listitem-get.mdx +0 -6
- package/docs/docs/cmd/spo/navigation/navigation-node-add.mdx +45 -30
- package/docs/docs/cmd/spo/navigation/navigation-node-get.mdx +64 -42
- package/docs/docs/cmd/spo/navigation/navigation-node-list.mdx +37 -27
- package/docs/docs/cmd/spo/navigation/navigation-node-set.mdx +10 -8
- package/docs/docs/cmd/spo/page/page-unpublish.mdx +63 -0
- package/docs/docs/cmd/spo/site/site-remove.mdx +0 -3
- package/docs/docs/cmd/spo/web/web-rule-get.mdx +108 -0
- package/docs/docs/cmd/spo/web/web-rule-list.mdx +189 -0
- package/docs/docs/cmd/spo/web/web-rule-remove.mdx +65 -0
- package/docs/docs/cmd/spp/model/model-get.mdx +1 -1
- package/docs/docs/cmd/spp/model/model-remove.mdx +1 -1
- package/docs/docs/cmd/teams/tab/tab-add.mdx +19 -0
- package/docs/docs/cmd/teams/tab/tab-get.mdx +19 -0
- package/docs/docs/cmd/teams/tab/tab-list.mdx +19 -0
- package/docs/docs/cmd/teams/tab/tab-remove.mdx +21 -0
- package/docs/docs/cmd/tenant/people/people-profilecardproperty-add.mdx +19 -0
- package/docs/docs/cmd/tenant/people/people-profilecardproperty-get.mdx +19 -0
- package/docs/docs/cmd/tenant/people/people-profilecardproperty-list.mdx +19 -0
- package/docs/docs/cmd/tenant/people/people-profilecardproperty-remove.mdx +19 -0
- package/docs/docs/cmd/tenant/people/people-profilecardproperty-set.mdx +19 -0
- package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-health-get.mdx +19 -0
- package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-health-list.mdx +19 -0
- package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-healthissue-get.mdx +19 -0
- package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-healthissue-list.mdx +19 -0
- package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-message-get.mdx +19 -0
- package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-message-list.mdx +19 -0
- package/docs/docs/cmd/viva/engage/engage-message-add.mdx +17 -0
- package/docs/docs/cmd/viva/engage/engage-message-get.mdx +17 -0
- package/docs/docs/cmd/viva/engage/engage-message-list.mdx +17 -0
- package/docs/docs/cmd/viva/engage/engage-message-remove.mdx +19 -0
- package/npm-shrinkwrap.json +702 -3230
- package/package.json +20 -38
- package/dist/appInsights.js +0 -43
|
@@ -1,139 +1,78 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 _SpoNavigationNodeSetCommand_instances, _SpoNavigationNodeSetCommand_initTelemetry, _SpoNavigationNodeSetCommand_initTypes, _SpoNavigationNodeSetCommand_initOptions, _SpoNavigationNodeSetCommand_initValidators;
|
|
7
|
-
import request from '../../../../request.js';
|
|
1
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
2
|
+
import { z } from 'zod';
|
|
8
3
|
import { spo } from '../../../../utils/spo.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
|
+
export const options = z.strictObject({
|
|
8
|
+
...globalOptionsZod.shape,
|
|
9
|
+
webUrl: z.string()
|
|
10
|
+
.refine(url => validation.isValidSharePointUrl(url) === true, {
|
|
11
|
+
error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
|
|
12
|
+
})
|
|
13
|
+
.alias('u'),
|
|
14
|
+
location: z.enum(['QuickLaunch', 'TopNavigationBar']).alias('l'),
|
|
15
|
+
id: z.int().positive(),
|
|
16
|
+
title: z.string().min(1, 'Cannot be empty.').optional(),
|
|
17
|
+
url: z.string().optional(),
|
|
18
|
+
audienceIds: z.string()
|
|
19
|
+
.refine(audienceIds => audienceIds === '' || audienceIds.split(',').length <= 10, {
|
|
20
|
+
error: 'The maximum amount of audienceIds per navigation node exceeded. The maximum amount of audienceIds is 10.'
|
|
21
|
+
})
|
|
22
|
+
.refine(audienceIds => audienceIds === '' || validation.isValidGuidArray(audienceIds) === true, {
|
|
23
|
+
error: e => `The following GUIDs are invalid for the option 'audienceIds': ${validation.isValidGuidArray(e.input)}.`
|
|
24
|
+
})
|
|
25
|
+
.optional(),
|
|
26
|
+
openInNewWindow: z.boolean().optional()
|
|
27
|
+
});
|
|
12
28
|
class SpoNavigationNodeSetCommand extends SpoCommand {
|
|
13
29
|
get name() {
|
|
14
30
|
return commands.NAVIGATION_NODE_SET;
|
|
15
31
|
}
|
|
16
32
|
get description() {
|
|
17
|
-
return '
|
|
33
|
+
return 'Updates a SharePoint navigation node';
|
|
18
34
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
35
|
+
get schema() {
|
|
36
|
+
return options;
|
|
37
|
+
}
|
|
38
|
+
getRefinedSchema(schema) {
|
|
39
|
+
return schema
|
|
40
|
+
.refine(options => [options.title, options.url, options.audienceIds, options.openInNewWindow].some(o => o !== undefined), {
|
|
41
|
+
error: 'Specify at least one property to update.',
|
|
42
|
+
params: {
|
|
43
|
+
customCode: 'optionSet',
|
|
44
|
+
options: ['title', 'url', 'audienceIds', 'openInNewWindow']
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
getExcludedOptionsWithUrls() {
|
|
49
|
+
return ['url'];
|
|
26
50
|
}
|
|
27
51
|
async commandAction(logger, args) {
|
|
52
|
+
const { webUrl, location, id, title, url, audienceIds, openInNewWindow } = args.options;
|
|
53
|
+
if (this.verbose) {
|
|
54
|
+
await logger.logToStderr(`Updating navigation node with id ${id}...`);
|
|
55
|
+
}
|
|
28
56
|
try {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
let url = args.options.url;
|
|
33
|
-
if (url === '') {
|
|
34
|
-
url = 'http://linkless.header/';
|
|
57
|
+
const { menuState, node } = await spo.getMenuStateNodeByKey(webUrl, id.toString(), location);
|
|
58
|
+
if (title !== undefined) {
|
|
59
|
+
node.Title = title;
|
|
35
60
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
IsExternal: args.options.isExternal,
|
|
39
|
-
Url: url
|
|
40
|
-
};
|
|
41
|
-
if (args.options.audienceIds !== undefined) {
|
|
42
|
-
requestBody.AudienceIds = args.options.audienceIds === '' ? [] : args.options.audienceIds.split(',');
|
|
61
|
+
if (url !== undefined) {
|
|
62
|
+
node.SimpleUrl = url;
|
|
43
63
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
headers: {
|
|
47
|
-
accept: 'application/json;odata=nometadata',
|
|
48
|
-
'content-type': 'application/json;odata=nometadata'
|
|
49
|
-
},
|
|
50
|
-
data: requestBody,
|
|
51
|
-
responseType: 'json'
|
|
52
|
-
};
|
|
53
|
-
const response = await request.patch(requestOptions);
|
|
54
|
-
if (response['odata.null'] === true) {
|
|
55
|
-
throw `Navigation node does not exist.`;
|
|
64
|
+
if (audienceIds !== undefined) {
|
|
65
|
+
node.AudienceIds = audienceIds === '' ? [] : audienceIds.split(',');
|
|
56
66
|
}
|
|
57
|
-
if (
|
|
58
|
-
|
|
59
|
-
await logger.logToStderr(`Making sure that the navigation node opens in a new window.`);
|
|
60
|
-
}
|
|
61
|
-
let menuState = await spo.getQuickLaunchMenuState(args.options.webUrl);
|
|
62
|
-
let menuStateItem = this.getMenuStateNode(menuState.Nodes, args.options.id);
|
|
63
|
-
if (!menuStateItem) {
|
|
64
|
-
menuState = await spo.getTopNavigationMenuState(args.options.webUrl);
|
|
65
|
-
menuStateItem = this.getMenuStateNode(menuState.Nodes, args.options.id);
|
|
66
|
-
}
|
|
67
|
-
menuStateItem.OpenInNewWindow = args.options.openInNewWindow;
|
|
68
|
-
await spo.saveMenuState(args.options.webUrl, menuState);
|
|
67
|
+
if (openInNewWindow !== undefined) {
|
|
68
|
+
node.OpenInNewWindow = openInNewWindow;
|
|
69
69
|
}
|
|
70
|
+
await spo.saveMenuState(webUrl, menuState);
|
|
70
71
|
}
|
|
71
72
|
catch (err) {
|
|
72
73
|
this.handleRejectedODataJsonPromise(err);
|
|
73
74
|
}
|
|
74
75
|
}
|
|
75
|
-
getMenuStateNode(nodes, id) {
|
|
76
|
-
let menuNode = nodes.find((node) => node.Key.toString() === id.toString());
|
|
77
|
-
if (menuNode === undefined) {
|
|
78
|
-
for (const node of nodes.filter(node => node.Nodes.length > 0)) {
|
|
79
|
-
menuNode = this.getMenuStateNode(node.Nodes, id);
|
|
80
|
-
if (menuNode) {
|
|
81
|
-
break;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return menuNode;
|
|
86
|
-
}
|
|
87
76
|
}
|
|
88
|
-
_SpoNavigationNodeSetCommand_instances = new WeakSet(), _SpoNavigationNodeSetCommand_initTelemetry = function _SpoNavigationNodeSetCommand_initTelemetry() {
|
|
89
|
-
this.telemetry.push((args) => {
|
|
90
|
-
Object.assign(this.telemetryProperties, {
|
|
91
|
-
title: typeof args.options.title !== 'undefined',
|
|
92
|
-
url: typeof args.options.url !== 'undefined',
|
|
93
|
-
isExternal: typeof args.options.isExternal !== 'undefined',
|
|
94
|
-
audienceIds: typeof args.options.audienceIds !== 'undefined',
|
|
95
|
-
openInNewWindow: typeof args.options.openInNewWindow !== 'undefined'
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
}, _SpoNavigationNodeSetCommand_initTypes = function _SpoNavigationNodeSetCommand_initTypes() {
|
|
99
|
-
this.types.boolean.push('isExternal');
|
|
100
|
-
}, _SpoNavigationNodeSetCommand_initOptions = function _SpoNavigationNodeSetCommand_initOptions() {
|
|
101
|
-
this.options.unshift({
|
|
102
|
-
option: '-u, --webUrl <webUrl>'
|
|
103
|
-
}, {
|
|
104
|
-
option: '--id <id>'
|
|
105
|
-
}, {
|
|
106
|
-
option: '--title [title]'
|
|
107
|
-
}, {
|
|
108
|
-
option: '--url [url]'
|
|
109
|
-
}, {
|
|
110
|
-
option: '--audienceIds [audienceIds]'
|
|
111
|
-
}, {
|
|
112
|
-
option: '--isExternal [isExternal]'
|
|
113
|
-
}, {
|
|
114
|
-
option: '--openInNewWindow [openInNewWindow]'
|
|
115
|
-
});
|
|
116
|
-
}, _SpoNavigationNodeSetCommand_initValidators = function _SpoNavigationNodeSetCommand_initValidators() {
|
|
117
|
-
this.validators.push(async (args) => {
|
|
118
|
-
const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.webUrl);
|
|
119
|
-
if (isValidSharePointUrl !== true) {
|
|
120
|
-
return isValidSharePointUrl;
|
|
121
|
-
}
|
|
122
|
-
if (args.options.audienceIds === undefined && args.options.url === undefined && args.options.isExternal === undefined && !args.options.title && args.options.openInNewWindow === undefined) {
|
|
123
|
-
return `Please specify at least one property to update.`;
|
|
124
|
-
}
|
|
125
|
-
if (args.options.audienceIds) {
|
|
126
|
-
const audienceIdsSplitted = args.options.audienceIds.split(',');
|
|
127
|
-
if (audienceIdsSplitted.length > 10) {
|
|
128
|
-
return 'The maximum amount of audienceIds per navigation node exceeded. The maximum amount of audienceIds is 10.';
|
|
129
|
-
}
|
|
130
|
-
const isValidGUIDArrayResult = validation.isValidGuidArray(args.options.audienceIds);
|
|
131
|
-
if (isValidGUIDArrayResult !== true) {
|
|
132
|
-
return `The following GUIDs are invalid for the option 'audienceIds': ${isValidGUIDArrayResult}.`;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
return true;
|
|
136
|
-
});
|
|
137
|
-
};
|
|
138
77
|
export default new SpoNavigationNodeSetCommand();
|
|
139
78
|
//# sourceMappingURL=navigation-node-set.js.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
3
|
+
import request from '../../../../request.js';
|
|
4
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
5
|
+
import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
6
|
+
import { validation } from '../../../../utils/validation.js';
|
|
7
|
+
import SpoCommand from '../../../base/SpoCommand.js';
|
|
8
|
+
import commands from '../../commands.js';
|
|
9
|
+
export const options = z.strictObject({
|
|
10
|
+
...globalOptionsZod.shape,
|
|
11
|
+
webUrl: z.string()
|
|
12
|
+
.refine(url => validation.isValidSharePointUrl(url) === true, {
|
|
13
|
+
error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
|
|
14
|
+
})
|
|
15
|
+
.alias('u'),
|
|
16
|
+
name: z.string().alias('n')
|
|
17
|
+
});
|
|
18
|
+
class SpoPageUnpublishCommand extends SpoCommand {
|
|
19
|
+
get name() {
|
|
20
|
+
return commands.PAGE_UNPUBLISH;
|
|
21
|
+
}
|
|
22
|
+
get description() {
|
|
23
|
+
return 'Unpublishes a modern page';
|
|
24
|
+
}
|
|
25
|
+
get schema() {
|
|
26
|
+
return options;
|
|
27
|
+
}
|
|
28
|
+
async commandAction(logger, args) {
|
|
29
|
+
try {
|
|
30
|
+
let pageName = urlUtil.removeLeadingSlashes(args.options.name);
|
|
31
|
+
if (!pageName.toLowerCase().endsWith('.aspx')) {
|
|
32
|
+
pageName += '.aspx';
|
|
33
|
+
}
|
|
34
|
+
if (this.verbose) {
|
|
35
|
+
await logger.logToStderr(`Unpublishing page ${pageName}...`);
|
|
36
|
+
}
|
|
37
|
+
const filePath = `${urlUtil.getServerRelativeSiteUrl(args.options.webUrl)}/SitePages/${pageName}`;
|
|
38
|
+
const requestOptions = {
|
|
39
|
+
url: `${args.options.webUrl}/_api/web/GetFileByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(filePath)}')/UnPublish`,
|
|
40
|
+
headers: {
|
|
41
|
+
accept: 'application/json;odata=nometadata'
|
|
42
|
+
},
|
|
43
|
+
responseType: 'json'
|
|
44
|
+
};
|
|
45
|
+
await request.post(requestOptions);
|
|
46
|
+
}
|
|
47
|
+
catch (err) {
|
|
48
|
+
this.handleRejectedODataJsonPromise(err);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
export default new SpoPageUnpublishCommand();
|
|
53
|
+
//# sourceMappingURL=page-unpublish.js.map
|
|
@@ -31,10 +31,6 @@ class SpoSiteRemoveCommand extends SpoCommand {
|
|
|
31
31
|
__classPrivateFieldGet(this, _SpoSiteRemoveCommand_instances, "m", _SpoSiteRemoveCommand_initTypes).call(this);
|
|
32
32
|
}
|
|
33
33
|
async commandAction(logger, args) {
|
|
34
|
-
if (args.options.skipRecycleBin) {
|
|
35
|
-
await this.warn(logger, `Option 'skipRecycleBin' is deprecated. Please use 'permanent' instead.`);
|
|
36
|
-
args.options.permanent = true;
|
|
37
|
-
}
|
|
38
34
|
if (args.options.force) {
|
|
39
35
|
await this.removeSite(logger, args.options);
|
|
40
36
|
}
|
|
@@ -195,7 +191,7 @@ class SpoSiteRemoveCommand extends SpoCommand {
|
|
|
195
191
|
_SpoSiteRemoveCommand_instances = new WeakSet(), _SpoSiteRemoveCommand_initTelemetry = function _SpoSiteRemoveCommand_initTelemetry() {
|
|
196
192
|
this.telemetry.push((args) => {
|
|
197
193
|
Object.assign(this.telemetryProperties, {
|
|
198
|
-
permanent: !!
|
|
194
|
+
permanent: !!args.options.permanent,
|
|
199
195
|
fromRecycleBin: !!args.options.fromRecycleBin,
|
|
200
196
|
force: !!args.options.force
|
|
201
197
|
});
|
|
@@ -205,8 +201,6 @@ _SpoSiteRemoveCommand_instances = new WeakSet(), _SpoSiteRemoveCommand_initTelem
|
|
|
205
201
|
option: '-u, --url <url>'
|
|
206
202
|
}, {
|
|
207
203
|
option: '--permanent'
|
|
208
|
-
}, {
|
|
209
|
-
option: '--skipRecycleBin'
|
|
210
204
|
}, {
|
|
211
205
|
option: '--fromRecycleBin'
|
|
212
206
|
}, {
|
|
@@ -223,14 +217,14 @@ _SpoSiteRemoveCommand_instances = new WeakSet(), _SpoSiteRemoveCommand_initTelem
|
|
|
223
217
|
if (rootUrl.toLowerCase() === urlUtil.removeTrailingSlashes(args.options.url.toLowerCase())) {
|
|
224
218
|
return `The root site cannot be deleted.`;
|
|
225
219
|
}
|
|
226
|
-
if (args.options.fromRecycleBin &&
|
|
220
|
+
if (args.options.fromRecycleBin && args.options.permanent) {
|
|
227
221
|
return 'Specify either fromRecycleBin or permanent, but not both.';
|
|
228
222
|
}
|
|
229
223
|
return true;
|
|
230
224
|
});
|
|
231
225
|
}, _SpoSiteRemoveCommand_initTypes = function _SpoSiteRemoveCommand_initTypes() {
|
|
232
226
|
this.types.string.push('url');
|
|
233
|
-
this.types.boolean.push('permanent', '
|
|
227
|
+
this.types.boolean.push('permanent', 'fromRecycleBin', 'force');
|
|
234
228
|
};
|
|
235
229
|
export default new SpoSiteRemoveCommand();
|
|
236
230
|
//# sourceMappingURL=site-remove.js.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
3
|
+
import request from '../../../../request.js';
|
|
4
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
5
|
+
import { validation } from '../../../../utils/validation.js';
|
|
6
|
+
import SpoCommand from '../../../base/SpoCommand.js';
|
|
7
|
+
import commands from '../../commands.js';
|
|
8
|
+
const options = z.strictObject({
|
|
9
|
+
...globalOptionsZod.shape,
|
|
10
|
+
webUrl: z.string().alias('u')
|
|
11
|
+
.refine(url => validation.isValidSharePointUrl(url) === true, {
|
|
12
|
+
error: e => `'${e.input}' is not a valid SharePoint URL.`
|
|
13
|
+
}),
|
|
14
|
+
id: z.uuid()
|
|
15
|
+
});
|
|
16
|
+
class SpoWebRuleGetCommand extends SpoCommand {
|
|
17
|
+
get name() {
|
|
18
|
+
return commands.WEB_RULE_GET;
|
|
19
|
+
}
|
|
20
|
+
get description() {
|
|
21
|
+
return 'Retrieves details of a specific rule from a SharePoint site list';
|
|
22
|
+
}
|
|
23
|
+
get schema() {
|
|
24
|
+
return options;
|
|
25
|
+
}
|
|
26
|
+
async commandAction(logger, args) {
|
|
27
|
+
try {
|
|
28
|
+
if (this.verbose) {
|
|
29
|
+
await logger.logToStderr(`Retrieving rule with id '${args.options.id}' from site '${args.options.webUrl}'...`);
|
|
30
|
+
}
|
|
31
|
+
const requestOptions = {
|
|
32
|
+
url: `${args.options.webUrl}/_api/web/alerts/GetById('${formatting.encodeQueryParameter(args.options.id)}')?$expand=List,User,List/Rootfolder&$select=*,List/Id,List/Title,List/Rootfolder/ServerRelativeUrl`,
|
|
33
|
+
headers: {
|
|
34
|
+
accept: 'application/json;odata=nometadata'
|
|
35
|
+
},
|
|
36
|
+
responseType: 'json'
|
|
37
|
+
};
|
|
38
|
+
const res = await request.get(requestOptions);
|
|
39
|
+
await logger.log(res);
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
this.handleRejectedODataJsonPromise(err);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export default new SpoWebRuleGetCommand();
|
|
47
|
+
//# sourceMappingURL=web-rule-get.js.map
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { cli } from '../../../../cli/cli.js';
|
|
3
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
4
|
+
import { entraUser } from '../../../../utils/entraUser.js';
|
|
5
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
6
|
+
import { odata } from '../../../../utils/odata.js';
|
|
7
|
+
import { spo } from '../../../../utils/spo.js';
|
|
8
|
+
import { validation } from '../../../../utils/validation.js';
|
|
9
|
+
import SpoCommand from '../../../base/SpoCommand.js';
|
|
10
|
+
import commands from '../../commands.js';
|
|
11
|
+
export const options = z.strictObject({
|
|
12
|
+
...globalOptionsZod.shape,
|
|
13
|
+
webUrl: z.string().alias('u')
|
|
14
|
+
.refine(url => validation.isValidSharePointUrl(url) === true, {
|
|
15
|
+
error: e => `'${e.input}' is not a valid SharePoint site URL.`
|
|
16
|
+
}),
|
|
17
|
+
listId: z.uuid().optional(),
|
|
18
|
+
listUrl: z.string().optional(),
|
|
19
|
+
listTitle: z.string().optional(),
|
|
20
|
+
userName: z.string().optional().refine(upn => typeof upn === 'undefined' || validation.isValidUserPrincipalName(upn), {
|
|
21
|
+
error: e => `'${e.input}' is not a valid UPN.`
|
|
22
|
+
}),
|
|
23
|
+
userId: z.uuid().optional()
|
|
24
|
+
});
|
|
25
|
+
class SpoWebRuleListCommand extends SpoCommand {
|
|
26
|
+
get name() {
|
|
27
|
+
return commands.WEB_RULE_LIST;
|
|
28
|
+
}
|
|
29
|
+
get description() {
|
|
30
|
+
return 'Lists all SharePoint list alerts';
|
|
31
|
+
}
|
|
32
|
+
defaultProperties() {
|
|
33
|
+
return ['ID', 'Title', 'UserPrincipalName'];
|
|
34
|
+
}
|
|
35
|
+
get schema() {
|
|
36
|
+
return options;
|
|
37
|
+
}
|
|
38
|
+
getRefinedSchema(schema) {
|
|
39
|
+
return schema
|
|
40
|
+
.refine(options => [options.listId, options.listUrl, options.listTitle].filter(x => x !== undefined).length <= 1, {
|
|
41
|
+
error: `Specify either listId, listUrl, or listTitle, but not more than one.`,
|
|
42
|
+
params: {
|
|
43
|
+
customCode: 'optionSet',
|
|
44
|
+
options: ['listId', 'listUrl', 'listTitle']
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
.refine(options => [options.userName, options.userId].filter(x => x !== undefined).length <= 1, {
|
|
48
|
+
error: `Specify either userName or userId, but not both.`,
|
|
49
|
+
params: {
|
|
50
|
+
customCode: 'optionSet',
|
|
51
|
+
options: ['userName', 'userId']
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
async commandAction(logger, args) {
|
|
56
|
+
if (this.verbose) {
|
|
57
|
+
const listParams = args.options.listId || args.options.listTitle || args.options.listUrl;
|
|
58
|
+
const userParams = args.options.userName || args.options.userId;
|
|
59
|
+
let message = `Retrieving alerts from site '${args.options.webUrl}'`;
|
|
60
|
+
if (listParams) {
|
|
61
|
+
message += ` for list '${listParams}'`;
|
|
62
|
+
}
|
|
63
|
+
if (userParams) {
|
|
64
|
+
message += `${listParams ? ' and' : ''} for user '${userParams}'`;
|
|
65
|
+
}
|
|
66
|
+
await logger.logToStderr(`${message}...`);
|
|
67
|
+
}
|
|
68
|
+
let requestUrl = `${args.options.webUrl}/_api/web/alerts?$expand=List,User,List/Rootfolder,Item&$select=*,List/Id,List/Title,List/Rootfolder/ServerRelativeUrl,Item/ID,Item/FileRef,Item/Guid`;
|
|
69
|
+
const filters = [];
|
|
70
|
+
let listId;
|
|
71
|
+
if (args.options.listId) {
|
|
72
|
+
listId = args.options.listId;
|
|
73
|
+
}
|
|
74
|
+
else if (args.options.listUrl || args.options.listTitle) {
|
|
75
|
+
try {
|
|
76
|
+
listId = await spo.getListId(args.options.webUrl, args.options.listTitle, args.options.listUrl, logger, this.verbose);
|
|
77
|
+
}
|
|
78
|
+
catch (err) {
|
|
79
|
+
this.handleRejectedODataJsonPromise(err);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (listId) {
|
|
83
|
+
filters.push(`List/Id eq guid'${formatting.encodeQueryParameter(listId)}'`);
|
|
84
|
+
}
|
|
85
|
+
if (args.options.userName) {
|
|
86
|
+
filters.push(`User/UserPrincipalName eq '${formatting.encodeQueryParameter(args.options.userName)}'`);
|
|
87
|
+
}
|
|
88
|
+
else if (args.options.userId) {
|
|
89
|
+
const userPrincipalName = await entraUser.getUpnByUserId(args.options.userId);
|
|
90
|
+
filters.push(`User/UserPrincipalName eq '${formatting.encodeQueryParameter(userPrincipalName)}'`);
|
|
91
|
+
}
|
|
92
|
+
if (filters.length > 0) {
|
|
93
|
+
requestUrl += `&$filter=${filters.join(' and ')}`;
|
|
94
|
+
}
|
|
95
|
+
try {
|
|
96
|
+
const res = await odata.getAllItems(requestUrl);
|
|
97
|
+
res.forEach(alert => {
|
|
98
|
+
if (alert.Item) {
|
|
99
|
+
delete alert.Item['ID'];
|
|
100
|
+
}
|
|
101
|
+
if (cli.shouldTrimOutput(args.options.output)) {
|
|
102
|
+
alert.UserPrincipalName = alert.User?.UserPrincipalName;
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
await logger.log(res);
|
|
106
|
+
}
|
|
107
|
+
catch (err) {
|
|
108
|
+
this.handleRejectedODataJsonPromise(err);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
export default new SpoWebRuleListCommand();
|
|
113
|
+
//# sourceMappingURL=web-rule-list.js.map
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { cli } from '../../../../cli/cli.js';
|
|
3
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
4
|
+
import request from '../../../../request.js';
|
|
5
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
6
|
+
import { validation } from '../../../../utils/validation.js';
|
|
7
|
+
import SpoCommand from '../../../base/SpoCommand.js';
|
|
8
|
+
import commands from '../../commands.js';
|
|
9
|
+
const options = z.strictObject({
|
|
10
|
+
...globalOptionsZod.shape,
|
|
11
|
+
webUrl: z.string().alias('u')
|
|
12
|
+
.refine(url => validation.isValidSharePointUrl(url) === true, {
|
|
13
|
+
error: e => `'${e.input}' is not a valid SharePoint URL.`
|
|
14
|
+
}),
|
|
15
|
+
id: z.uuid(),
|
|
16
|
+
force: z.boolean().optional().alias('f')
|
|
17
|
+
});
|
|
18
|
+
class SpoWebRuleRemoveCommand extends SpoCommand {
|
|
19
|
+
get name() {
|
|
20
|
+
return commands.WEB_RULE_REMOVE;
|
|
21
|
+
}
|
|
22
|
+
get description() {
|
|
23
|
+
return 'Removes an alert from a SharePoint list';
|
|
24
|
+
}
|
|
25
|
+
get schema() {
|
|
26
|
+
return options;
|
|
27
|
+
}
|
|
28
|
+
async commandAction(logger, args) {
|
|
29
|
+
if (!args.options.force) {
|
|
30
|
+
const result = await cli.promptForConfirmation({ message: `Are you sure you want to remove the alert with id '${args.options.id}' from site '${args.options.webUrl}'?` });
|
|
31
|
+
if (!result) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
try {
|
|
36
|
+
if (this.verbose) {
|
|
37
|
+
await logger.logToStderr(`Removing alert with ID '${args.options.id}' from site '${args.options.webUrl}'...`);
|
|
38
|
+
}
|
|
39
|
+
const requestOptions = {
|
|
40
|
+
url: `${args.options.webUrl}/_api/web/Alerts/DeleteAlert('${formatting.encodeQueryParameter(args.options.id)}')`,
|
|
41
|
+
headers: {
|
|
42
|
+
accept: 'application/json;odata=nometadata'
|
|
43
|
+
},
|
|
44
|
+
responseType: 'json'
|
|
45
|
+
};
|
|
46
|
+
await request.delete(requestOptions);
|
|
47
|
+
}
|
|
48
|
+
catch (err) {
|
|
49
|
+
this.handleRejectedODataJsonPromise(err);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
export default new SpoWebRuleRemoveCommand();
|
|
54
|
+
//# sourceMappingURL=web-rule-remove.js.map
|
|
@@ -72,6 +72,7 @@ export default {
|
|
|
72
72
|
FILE_MOVE: `${prefix} file move`,
|
|
73
73
|
FILE_REMOVE: `${prefix} file remove`,
|
|
74
74
|
FILE_RENAME: `${prefix} file rename`,
|
|
75
|
+
FILE_UNARCHIVE: `${prefix} file unarchive`,
|
|
75
76
|
FILE_RETENTIONLABEL_ENSURE: `${prefix} file retentionlabel ensure`,
|
|
76
77
|
FILE_RETENTIONLABEL_REMOVE: `${prefix} file retentionlabel remove`,
|
|
77
78
|
FILE_ROLEASSIGNMENT_ADD: `${prefix} file roleassignment add`,
|
|
@@ -85,7 +86,6 @@ export default {
|
|
|
85
86
|
FILE_SHARINGLINK_LIST: `${prefix} file sharinglink list`,
|
|
86
87
|
FILE_SHARINGLINK_REMOVE: `${prefix} file sharinglink remove`,
|
|
87
88
|
FILE_SHARINGLINK_SET: `${prefix} file sharinglink set`,
|
|
88
|
-
FILE_UNARCHIVE: `${prefix} file unarchive`,
|
|
89
89
|
FILE_VERSION_CLEAR: `${prefix} file version clear`,
|
|
90
90
|
FILE_VERSION_GET: `${prefix} file version get`,
|
|
91
91
|
FILE_VERSION_KEEP: `${prefix} file version keep`,
|
|
@@ -112,6 +112,7 @@ export default {
|
|
|
112
112
|
FOLDER_SHARINGLINK_LIST: `${prefix} folder sharinglink list`,
|
|
113
113
|
FOLDER_SHARINGLINK_REMOVE: `${prefix} folder sharinglink remove`,
|
|
114
114
|
FOLDER_SHARINGLINK_SET: `${prefix} folder sharinglink set`,
|
|
115
|
+
FOLDER_UNARCHIVE: `${prefix} folder unarchive`,
|
|
115
116
|
GET: `${prefix} get`,
|
|
116
117
|
GROUP_ADD: `${prefix} group add`,
|
|
117
118
|
GROUP_GET: `${prefix} group get`,
|
|
@@ -235,6 +236,7 @@ export default {
|
|
|
235
236
|
PAGE_TEMPLATE_LIST: `${prefix} page template list`,
|
|
236
237
|
PAGE_TEMPLATE_REMOVE: `${prefix} page template remove`,
|
|
237
238
|
PAGE_TEXT_ADD: `${prefix} page text add`,
|
|
239
|
+
PAGE_UNPUBLISH: `${prefix} page unpublish`,
|
|
238
240
|
PROPERTYBAG_GET: `${prefix} propertybag get`,
|
|
239
241
|
PROPERTYBAG_LIST: `${prefix} propertybag list`,
|
|
240
242
|
PROPERTYBAG_REMOVE: `${prefix} propertybag remove`,
|
|
@@ -377,6 +379,9 @@ export default {
|
|
|
377
379
|
WEB_ROLEASSIGNMENT_ADD: `${prefix} web roleassignment add`,
|
|
378
380
|
WEB_ROLEINHERITANCE_BREAK: `${prefix} web roleinheritance break`,
|
|
379
381
|
WEB_ROLEINHERITANCE_RESET: `${prefix} web roleinheritance reset`,
|
|
382
|
+
WEB_RULE_GET: `${prefix} web rule get`,
|
|
383
|
+
WEB_RULE_LIST: `${prefix} web rule list`,
|
|
384
|
+
WEB_RULE_REMOVE: `${prefix} web rule remove`,
|
|
380
385
|
WEB_SET: `${prefix} web set`
|
|
381
386
|
};
|
|
382
387
|
//# sourceMappingURL=commands.js.map
|