@pnp/cli-microsoft365 12.0.0 → 12.1.0-beta.0c2915d
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/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/cli/cli.js +19 -18
- package/dist/m365/spo/commands/eventreceiver/eventreceiver-get.js +39 -65
- package/dist/m365/spo/commands/eventreceiver/eventreceiver-list.js +28 -56
- package/dist/m365/spo/commands/eventreceiver/eventreceiver-remove.js +40 -68
- package/dist/m365/spo/commands/externaluser/externaluser-list.js +24 -66
- package/dist/m365/spo/commands/file/file-add.js +51 -77
- package/dist/m365/spo/commands/file/file-archive.js +1 -1
- package/dist/m365/spo/commands/file/file-checkin.js +35 -64
- package/dist/m365/spo/commands/file/file-checkout-undo.js +25 -49
- package/dist/m365/spo/commands/file/file-checkout.js +24 -47
- package/dist/m365/spo/commands/file/file-copy.js +37 -68
- package/dist/m365/spo/commands/file/file-get.js +44 -79
- package/dist/m365/spo/commands/file/file-list.js +16 -39
- package/dist/m365/spo/commands/file/file-move.js +30 -68
- package/dist/m365/spo/commands/file/file-remove.js +27 -56
- package/dist/m365/spo/commands/file/file-rename.js +15 -36
- package/dist/m365/spo/commands/file/file-retentionlabel-ensure.js +26 -51
- package/dist/m365/spo/commands/file/file-retentionlabel-remove.js +25 -50
- package/dist/m365/spo/commands/file/file-roleassignment-add.js +47 -75
- package/dist/m365/spo/commands/file/file-roleassignment-remove.js +39 -70
- package/dist/m365/spo/commands/file/file-roleinheritance-break.js +26 -52
- package/dist/m365/spo/commands/file/file-roleinheritance-reset.js +25 -49
- package/dist/m365/spo/commands/file/file-sharinginfo-get.js +24 -47
- package/dist/m365/spo/commands/file/file-sharinglink-add.js +46 -70
- package/dist/m365/spo/commands/file/file-sharinglink-clear.js +33 -57
- package/dist/m365/spo/commands/file/file-sharinglink-get.js +25 -47
- package/dist/m365/spo/commands/file/file-sharinglink-list.js +32 -53
- package/dist/m365/spo/commands/file/file-sharinglink-remove.js +26 -51
- package/dist/m365/spo/commands/file/file-sharinglink-set.js +29 -55
- package/dist/m365/spo/commands/file/file-unarchive.js +1 -1
- package/dist/m365/spo/commands/file/file-version-clear.js +25 -45
- package/dist/m365/spo/commands/file/file-version-get.js +25 -43
- package/dist/m365/spo/commands/file/file-version-keep.js +1 -1
- package/dist/m365/spo/commands/file/file-version-list.js +24 -41
- package/dist/m365/spo/commands/file/file-version-remove.js +26 -47
- package/dist/m365/spo/commands/file/file-version-restore.js +26 -47
- package/dist/m365/spo/commands/folder/folder-add.js +19 -48
- package/dist/m365/spo/commands/folder/folder-copy.js +36 -62
- package/dist/m365/spo/commands/folder/folder-get.js +30 -51
- package/dist/m365/spo/commands/folder/folder-list.js +16 -39
- package/dist/m365/spo/commands/folder/folder-move.js +36 -62
- package/dist/m365/spo/commands/folder/folder-remove.js +15 -36
- package/dist/m365/spo/commands/folder/folder-retentionlabel-ensure.js +30 -48
- package/dist/m365/spo/commands/folder/folder-retentionlabel-remove.js +30 -50
- package/dist/m365/spo/commands/folder/folder-roleassignment-add.js +49 -79
- package/dist/m365/spo/commands/folder/folder-roleassignment-remove.js +37 -67
- package/dist/m365/spo/commands/folder/folder-roleinheritance-break.js +15 -36
- package/dist/m365/spo/commands/folder/folder-roleinheritance-reset.js +14 -33
- package/dist/m365/spo/commands/folder/folder-set.js +28 -48
- package/dist/m365/spo/commands/folder/folder-sharinglink-add.js +58 -86
- package/dist/m365/spo/commands/folder/folder-sharinglink-clear.js +33 -50
- package/dist/m365/spo/commands/folder/folder-sharinglink-get.js +33 -42
- package/dist/m365/spo/commands/folder/folder-sharinglink-list.js +32 -47
- package/dist/m365/spo/commands/folder/folder-sharinglink-remove.js +34 -41
- package/dist/m365/spo/commands/folder/folder-sharinglink-set.js +38 -43
- package/dist/m365/spo/commands/group/group-add.js +19 -60
- package/dist/m365/spo/commands/group/group-get.js +32 -45
- package/dist/m365/spo/commands/group/group-list.js +13 -27
- package/dist/m365/spo/commands/group/group-member-add.js +52 -84
- package/dist/m365/spo/commands/group/group-member-list.js +24 -38
- package/dist/m365/spo/commands/group/group-member-remove.js +49 -68
- package/dist/m365/spo/commands/group/group-remove.js +25 -45
- package/dist/m365/spo/commands/group/group-set.js +36 -79
- package/dist/m365/spo/commands/propertybag/propertybag-get.js +14 -29
- package/dist/m365/spo/commands/propertybag/propertybag-list.js +13 -27
- package/dist/m365/spo/commands/propertybag/propertybag-remove.js +15 -32
- package/dist/m365/spo/commands/propertybag/propertybag-set.js +15 -31
- package/dist/m365/spo/commands/roledefinition/roledefinition-add.js +45 -44
- package/dist/m365/spo/commands/roledefinition/roledefinition-get.js +14 -25
- package/dist/m365/spo/commands/roledefinition/roledefinition-list.js +12 -18
- package/dist/m365/spo/commands/roledefinition/roledefinition-remove.js +15 -35
- package/npm-shrinkwrap.json +57 -57
- package/package.json +2 -2
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
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 _SpoFileRetentionLabelRemoveCommand_instances, _SpoFileRetentionLabelRemoveCommand_initTelemetry, _SpoFileRetentionLabelRemoveCommand_initOptions, _SpoFileRetentionLabelRemoveCommand_initValidators, _SpoFileRetentionLabelRemoveCommand_initOptionSets, _SpoFileRetentionLabelRemoveCommand_initTypes;
|
|
1
|
+
import { z } from 'zod';
|
|
7
2
|
import { cli } from '../../../../cli/cli.js';
|
|
3
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
8
4
|
import request from '../../../../request.js';
|
|
9
5
|
import { formatting } from '../../../../utils/formatting.js';
|
|
10
6
|
import { spo } from '../../../../utils/spo.js';
|
|
@@ -12,6 +8,17 @@ import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
|
12
8
|
import { validation } from '../../../../utils/validation.js';
|
|
13
9
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
14
10
|
import commands from '../../commands.js';
|
|
11
|
+
export const options = z.strictObject({
|
|
12
|
+
...globalOptionsZod.shape,
|
|
13
|
+
webUrl: z.string()
|
|
14
|
+
.refine(url => validation.isValidSharePointUrl(url) === true, {
|
|
15
|
+
error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
|
|
16
|
+
})
|
|
17
|
+
.alias('u'),
|
|
18
|
+
fileUrl: z.string().optional(),
|
|
19
|
+
fileId: z.guid().optional().alias('i'),
|
|
20
|
+
force: z.boolean().optional().alias('f')
|
|
21
|
+
});
|
|
15
22
|
class SpoFileRetentionLabelRemoveCommand extends SpoCommand {
|
|
16
23
|
get name() {
|
|
17
24
|
return commands.FILE_RETENTIONLABEL_REMOVE;
|
|
@@ -19,14 +26,18 @@ class SpoFileRetentionLabelRemoveCommand extends SpoCommand {
|
|
|
19
26
|
get description() {
|
|
20
27
|
return 'Clears the retention label from a file';
|
|
21
28
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
get schema() {
|
|
30
|
+
return options;
|
|
31
|
+
}
|
|
32
|
+
getRefinedSchema(schema) {
|
|
33
|
+
return schema
|
|
34
|
+
.refine(opts => [opts.fileUrl, opts.fileId].filter(o => o !== undefined).length === 1, {
|
|
35
|
+
error: `Specify 'fileUrl' or 'fileId', but not both.`,
|
|
36
|
+
params: {
|
|
37
|
+
customCode: 'optionSet',
|
|
38
|
+
options: ['fileUrl', 'fileId']
|
|
39
|
+
}
|
|
40
|
+
});
|
|
30
41
|
}
|
|
31
42
|
async commandAction(logger, args) {
|
|
32
43
|
if (args.options.force) {
|
|
@@ -74,41 +85,5 @@ class SpoFileRetentionLabelRemoveCommand extends SpoCommand {
|
|
|
74
85
|
return { listItemId: response.ListItemAllFields.Id, listServerRelativeUrl: response.ListItemAllFields.ParentList.RootFolder.ServerRelativeUrl };
|
|
75
86
|
}
|
|
76
87
|
}
|
|
77
|
-
_SpoFileRetentionLabelRemoveCommand_instances = new WeakSet(), _SpoFileRetentionLabelRemoveCommand_initTelemetry = function _SpoFileRetentionLabelRemoveCommand_initTelemetry() {
|
|
78
|
-
this.telemetry.push((args) => {
|
|
79
|
-
Object.assign(this.telemetryProperties, {
|
|
80
|
-
fileUrl: typeof args.options.fileUrl !== 'undefined',
|
|
81
|
-
fileId: typeof args.options.fileId !== 'undefined',
|
|
82
|
-
force: !!args.options.force
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
}, _SpoFileRetentionLabelRemoveCommand_initOptions = function _SpoFileRetentionLabelRemoveCommand_initOptions() {
|
|
86
|
-
this.options.unshift({
|
|
87
|
-
option: '-u, --webUrl <webUrl>'
|
|
88
|
-
}, {
|
|
89
|
-
option: '--fileUrl [fileUrl]'
|
|
90
|
-
}, {
|
|
91
|
-
option: '-i, --fileId [fileId]'
|
|
92
|
-
}, {
|
|
93
|
-
option: '-f, --force'
|
|
94
|
-
});
|
|
95
|
-
}, _SpoFileRetentionLabelRemoveCommand_initValidators = function _SpoFileRetentionLabelRemoveCommand_initValidators() {
|
|
96
|
-
this.validators.push(async (args) => {
|
|
97
|
-
const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.webUrl);
|
|
98
|
-
if (isValidSharePointUrl !== true) {
|
|
99
|
-
return isValidSharePointUrl;
|
|
100
|
-
}
|
|
101
|
-
if (args.options.fileId &&
|
|
102
|
-
!validation.isValidGuid(args.options.fileId)) {
|
|
103
|
-
return `${args.options.fileId} is not a valid GUID`;
|
|
104
|
-
}
|
|
105
|
-
return true;
|
|
106
|
-
});
|
|
107
|
-
}, _SpoFileRetentionLabelRemoveCommand_initOptionSets = function _SpoFileRetentionLabelRemoveCommand_initOptionSets() {
|
|
108
|
-
this.optionSets.push({ options: ['fileUrl', 'fileId'] });
|
|
109
|
-
}, _SpoFileRetentionLabelRemoveCommand_initTypes = function _SpoFileRetentionLabelRemoveCommand_initTypes() {
|
|
110
|
-
this.types.string.push('webUrl', 'fileUrl', 'fileId');
|
|
111
|
-
this.types.boolean.push('force');
|
|
112
|
-
};
|
|
113
88
|
export default new SpoFileRetentionLabelRemoveCommand();
|
|
114
89
|
//# sourceMappingURL=file-retentionlabel-remove.js.map
|
|
@@ -1,9 +1,5 @@
|
|
|
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 _SpoFileRoleAssignmentAddCommand_instances, _SpoFileRoleAssignmentAddCommand_initTelemetry, _SpoFileRoleAssignmentAddCommand_initOptions, _SpoFileRoleAssignmentAddCommand_initValidators, _SpoFileRoleAssignmentAddCommand_initOptionSets, _SpoFileRoleAssignmentAddCommand_initTypes;
|
|
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';
|
|
@@ -12,6 +8,25 @@ import { validation } from '../../../../utils/validation.js';
|
|
|
12
8
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
13
9
|
import commands from '../../commands.js';
|
|
14
10
|
import { entraGroup } from '../../../../utils/entraGroup.js';
|
|
11
|
+
export const options = z.strictObject({
|
|
12
|
+
...globalOptionsZod.shape,
|
|
13
|
+
webUrl: z.string()
|
|
14
|
+
.refine(url => validation.isValidSharePointUrl(url) === true, {
|
|
15
|
+
error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
|
|
16
|
+
})
|
|
17
|
+
.alias('u'),
|
|
18
|
+
fileUrl: z.string().optional(),
|
|
19
|
+
fileId: z.guid().optional().alias('i'),
|
|
20
|
+
principalId: z.number().optional(),
|
|
21
|
+
upn: z.string().optional(),
|
|
22
|
+
groupName: z.string().optional(),
|
|
23
|
+
entraGroupId: z.string().refine(id => validation.isValidGuid(id), {
|
|
24
|
+
error: e => `'${e.input}' is not a valid GUID for option entraGroupId.`
|
|
25
|
+
}).optional(),
|
|
26
|
+
entraGroupName: z.string().optional(),
|
|
27
|
+
roleDefinitionId: z.number().optional(),
|
|
28
|
+
roleDefinitionName: z.string().optional()
|
|
29
|
+
});
|
|
15
30
|
class SpoFileRoleAssignmentAddCommand extends SpoCommand {
|
|
16
31
|
get name() {
|
|
17
32
|
return commands.FILE_ROLEASSIGNMENT_ADD;
|
|
@@ -19,14 +34,32 @@ class SpoFileRoleAssignmentAddCommand extends SpoCommand {
|
|
|
19
34
|
get description() {
|
|
20
35
|
return 'Adds a role assignment to the specified file.';
|
|
21
36
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
37
|
+
get schema() {
|
|
38
|
+
return options;
|
|
39
|
+
}
|
|
40
|
+
getRefinedSchema(schema) {
|
|
41
|
+
return schema
|
|
42
|
+
.refine(opts => [opts.fileId, opts.fileUrl].filter(o => o !== undefined).length === 1, {
|
|
43
|
+
error: `Specify 'fileId' or 'fileUrl', but not both.`,
|
|
44
|
+
params: {
|
|
45
|
+
customCode: 'optionSet',
|
|
46
|
+
options: ['fileId', 'fileUrl']
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
.refine(opts => [opts.principalId, opts.upn, opts.groupName, opts.entraGroupId, opts.entraGroupName].filter(o => o !== undefined).length === 1, {
|
|
50
|
+
error: `Specify either 'principalId', 'upn', 'groupName', 'entraGroupId', or 'entraGroupName'.`,
|
|
51
|
+
params: {
|
|
52
|
+
customCode: 'optionSet',
|
|
53
|
+
options: ['principalId', 'upn', 'groupName', 'entraGroupId', 'entraGroupName']
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
.refine(opts => [opts.roleDefinitionId, opts.roleDefinitionName].filter(o => o !== undefined).length === 1, {
|
|
57
|
+
error: `Specify either 'roleDefinitionId' or 'roleDefinitionName'.`,
|
|
58
|
+
params: {
|
|
59
|
+
customCode: 'optionSet',
|
|
60
|
+
options: ['roleDefinitionId', 'roleDefinitionName']
|
|
61
|
+
}
|
|
62
|
+
});
|
|
30
63
|
}
|
|
31
64
|
async commandAction(logger, args) {
|
|
32
65
|
if (this.verbose) {
|
|
@@ -100,66 +133,5 @@ class SpoFileRoleAssignmentAddCommand extends SpoCommand {
|
|
|
100
133
|
return file.ServerRelativeUrl;
|
|
101
134
|
}
|
|
102
135
|
}
|
|
103
|
-
_SpoFileRoleAssignmentAddCommand_instances = new WeakSet(), _SpoFileRoleAssignmentAddCommand_initTelemetry = function _SpoFileRoleAssignmentAddCommand_initTelemetry() {
|
|
104
|
-
this.telemetry.push((args) => {
|
|
105
|
-
Object.assign(this.telemetryProperties, {
|
|
106
|
-
fileUrl: typeof args.options.fileUrl !== 'undefined',
|
|
107
|
-
fileId: typeof args.options.fileId !== 'undefined',
|
|
108
|
-
principalId: typeof args.options.principalId !== 'undefined',
|
|
109
|
-
upn: typeof args.options.upn !== 'undefined',
|
|
110
|
-
groupName: typeof args.options.groupName !== 'undefined',
|
|
111
|
-
entraGroupId: typeof args.options.entraGroupId !== 'undefined',
|
|
112
|
-
entraGroupName: typeof args.options.entraGroupName !== 'undefined',
|
|
113
|
-
roleDefinitionId: typeof args.options.roleDefinitionId !== 'undefined',
|
|
114
|
-
roleDefinitionName: typeof args.options.roleDefinitionName !== 'undefined'
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
}, _SpoFileRoleAssignmentAddCommand_initOptions = function _SpoFileRoleAssignmentAddCommand_initOptions() {
|
|
118
|
-
this.options.unshift({
|
|
119
|
-
option: '-u, --webUrl <webUrl>'
|
|
120
|
-
}, {
|
|
121
|
-
option: '--fileUrl [fileUrl]'
|
|
122
|
-
}, {
|
|
123
|
-
option: '-i, --fileId [fileId]'
|
|
124
|
-
}, {
|
|
125
|
-
option: '--principalId [principalId]'
|
|
126
|
-
}, {
|
|
127
|
-
option: '--upn [upn]'
|
|
128
|
-
}, {
|
|
129
|
-
option: '--groupName [groupName]'
|
|
130
|
-
}, {
|
|
131
|
-
option: '--entraGroupId [entraGroupId]'
|
|
132
|
-
}, {
|
|
133
|
-
option: '--entraGroupName [entraGroupName]'
|
|
134
|
-
}, {
|
|
135
|
-
option: '--roleDefinitionId [roleDefinitionId]'
|
|
136
|
-
}, {
|
|
137
|
-
option: '--roleDefinitionName [roleDefinitionName]'
|
|
138
|
-
});
|
|
139
|
-
}, _SpoFileRoleAssignmentAddCommand_initValidators = function _SpoFileRoleAssignmentAddCommand_initValidators() {
|
|
140
|
-
this.validators.push(async (args) => {
|
|
141
|
-
const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.webUrl);
|
|
142
|
-
if (isValidSharePointUrl !== true) {
|
|
143
|
-
return isValidSharePointUrl;
|
|
144
|
-
}
|
|
145
|
-
if (args.options.fileId && !validation.isValidGuid(args.options.fileId)) {
|
|
146
|
-
return `${args.options.fileId} is not a valid GUID`;
|
|
147
|
-
}
|
|
148
|
-
if (args.options.principalId && isNaN(args.options.principalId)) {
|
|
149
|
-
return `Specified principalId ${args.options.principalId} is not a number`;
|
|
150
|
-
}
|
|
151
|
-
if (args.options.entraGroupId && !validation.isValidGuid(args.options.entraGroupId)) {
|
|
152
|
-
return `'${args.options.entraGroupId}' is not a valid GUID for option entraGroupId`;
|
|
153
|
-
}
|
|
154
|
-
if (args.options.roleDefinitionId && isNaN(args.options.roleDefinitionId)) {
|
|
155
|
-
return `Specified roleDefinitionId ${args.options.roleDefinitionId} is not a number`;
|
|
156
|
-
}
|
|
157
|
-
return true;
|
|
158
|
-
});
|
|
159
|
-
}, _SpoFileRoleAssignmentAddCommand_initOptionSets = function _SpoFileRoleAssignmentAddCommand_initOptionSets() {
|
|
160
|
-
this.optionSets.push({ options: ['fileId', 'fileUrl'] }, { options: ['principalId', 'upn', 'groupName', 'entraGroupId', 'entraGroupName'] }, { options: ['roleDefinitionId', 'roleDefinitionName'] });
|
|
161
|
-
}, _SpoFileRoleAssignmentAddCommand_initTypes = function _SpoFileRoleAssignmentAddCommand_initTypes() {
|
|
162
|
-
this.types.string.push('webUrl', 'fileUrl', 'fileId', 'upn', 'groupName', 'entraGroupId', 'entraGroupName', 'roleDefinitionName');
|
|
163
|
-
};
|
|
164
136
|
export default new SpoFileRoleAssignmentAddCommand();
|
|
165
137
|
//# sourceMappingURL=file-roleassignment-add.js.map
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
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 _SpoFileRoleAssignmentRemoveCommand_instances, _SpoFileRoleAssignmentRemoveCommand_initTelemetry, _SpoFileRoleAssignmentRemoveCommand_initOptions, _SpoFileRoleAssignmentRemoveCommand_initValidators, _SpoFileRoleAssignmentRemoveCommand_initOptionSets, _SpoFileRoleAssignmentRemoveCommand_initTypes;
|
|
1
|
+
import { z } from 'zod';
|
|
7
2
|
import { cli } from '../../../../cli/cli.js';
|
|
3
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
8
4
|
import request from '../../../../request.js';
|
|
9
5
|
import { formatting } from '../../../../utils/formatting.js';
|
|
10
6
|
import { spo } from '../../../../utils/spo.js';
|
|
@@ -13,6 +9,24 @@ import { validation } from '../../../../utils/validation.js';
|
|
|
13
9
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
14
10
|
import commands from '../../commands.js';
|
|
15
11
|
import { entraGroup } from '../../../../utils/entraGroup.js';
|
|
12
|
+
export const options = z.strictObject({
|
|
13
|
+
...globalOptionsZod.shape,
|
|
14
|
+
webUrl: z.string()
|
|
15
|
+
.refine(url => validation.isValidSharePointUrl(url) === true, {
|
|
16
|
+
error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
|
|
17
|
+
})
|
|
18
|
+
.alias('u'),
|
|
19
|
+
fileUrl: z.string().optional(),
|
|
20
|
+
fileId: z.guid().optional().alias('i'),
|
|
21
|
+
principalId: z.number().optional(),
|
|
22
|
+
upn: z.string().optional(),
|
|
23
|
+
groupName: z.string().optional(),
|
|
24
|
+
entraGroupId: z.string().refine(id => validation.isValidGuid(id), {
|
|
25
|
+
error: e => `'${e.input}' is not a valid GUID for option entraGroupId.`
|
|
26
|
+
}).optional(),
|
|
27
|
+
entraGroupName: z.string().optional(),
|
|
28
|
+
force: z.boolean().optional().alias('f')
|
|
29
|
+
});
|
|
16
30
|
class SpoFileRoleAssignmentRemoveCommand extends SpoCommand {
|
|
17
31
|
get name() {
|
|
18
32
|
return commands.FILE_ROLEASSIGNMENT_REMOVE;
|
|
@@ -20,14 +34,25 @@ class SpoFileRoleAssignmentRemoveCommand extends SpoCommand {
|
|
|
20
34
|
get description() {
|
|
21
35
|
return 'Removes a role assignment from a file.';
|
|
22
36
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
37
|
+
get schema() {
|
|
38
|
+
return options;
|
|
39
|
+
}
|
|
40
|
+
getRefinedSchema(schema) {
|
|
41
|
+
return schema
|
|
42
|
+
.refine(opts => [opts.fileUrl, opts.fileId].filter(o => o !== undefined).length === 1, {
|
|
43
|
+
error: `Specify 'fileUrl' or 'fileId', but not both.`,
|
|
44
|
+
params: {
|
|
45
|
+
customCode: 'optionSet',
|
|
46
|
+
options: ['fileUrl', 'fileId']
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
.refine(opts => [opts.upn, opts.groupName, opts.principalId, opts.entraGroupId, opts.entraGroupName].filter(o => o !== undefined).length === 1, {
|
|
50
|
+
error: `Specify either 'upn', 'groupName', 'principalId', 'entraGroupId', or 'entraGroupName'.`,
|
|
51
|
+
params: {
|
|
52
|
+
customCode: 'optionSet',
|
|
53
|
+
options: ['upn', 'groupName', 'principalId', 'entraGroupId', 'entraGroupName']
|
|
54
|
+
}
|
|
55
|
+
});
|
|
31
56
|
}
|
|
32
57
|
async commandAction(logger, args) {
|
|
33
58
|
const removeRoleAssignment = async () => {
|
|
@@ -100,61 +125,5 @@ class SpoFileRoleAssignmentRemoveCommand extends SpoCommand {
|
|
|
100
125
|
return group.Id;
|
|
101
126
|
}
|
|
102
127
|
}
|
|
103
|
-
_SpoFileRoleAssignmentRemoveCommand_instances = new WeakSet(), _SpoFileRoleAssignmentRemoveCommand_initTelemetry = function _SpoFileRoleAssignmentRemoveCommand_initTelemetry() {
|
|
104
|
-
this.telemetry.push((args) => {
|
|
105
|
-
Object.assign(this.telemetryProperties, {
|
|
106
|
-
fileUrl: typeof args.options.fileUrl !== 'undefined',
|
|
107
|
-
fileId: typeof args.options.fileId !== 'undefined',
|
|
108
|
-
principalId: typeof args.options.principalId !== 'undefined',
|
|
109
|
-
upn: typeof args.options.upn !== 'undefined',
|
|
110
|
-
groupName: typeof args.options.groupName !== 'undefined',
|
|
111
|
-
entraGroupId: typeof args.options.entraGroupId !== 'undefined',
|
|
112
|
-
entraGroupName: typeof args.options.entraGroupName !== 'undefined',
|
|
113
|
-
force: !!args.options.force
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
}, _SpoFileRoleAssignmentRemoveCommand_initOptions = function _SpoFileRoleAssignmentRemoveCommand_initOptions() {
|
|
117
|
-
this.options.unshift({
|
|
118
|
-
option: '-u, --webUrl <webUrl>'
|
|
119
|
-
}, {
|
|
120
|
-
option: '--fileUrl [fileUrl]'
|
|
121
|
-
}, {
|
|
122
|
-
option: '-i, --fileId [fileId]'
|
|
123
|
-
}, {
|
|
124
|
-
option: '--principalId [principalId]'
|
|
125
|
-
}, {
|
|
126
|
-
option: '--upn [upn]'
|
|
127
|
-
}, {
|
|
128
|
-
option: '--groupName [groupName]'
|
|
129
|
-
}, {
|
|
130
|
-
option: '--entraGroupId [entraGroupId]'
|
|
131
|
-
}, {
|
|
132
|
-
option: '--entraGroupName [entraGroupName]'
|
|
133
|
-
}, {
|
|
134
|
-
option: '-f, --force'
|
|
135
|
-
});
|
|
136
|
-
}, _SpoFileRoleAssignmentRemoveCommand_initValidators = function _SpoFileRoleAssignmentRemoveCommand_initValidators() {
|
|
137
|
-
this.validators.push(async (args) => {
|
|
138
|
-
const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.webUrl);
|
|
139
|
-
if (isValidSharePointUrl !== true) {
|
|
140
|
-
return isValidSharePointUrl;
|
|
141
|
-
}
|
|
142
|
-
if (args.options.principalId && isNaN(args.options.principalId)) {
|
|
143
|
-
return `Specified principalId ${args.options.principalId} is not a number`;
|
|
144
|
-
}
|
|
145
|
-
if (args.options.entraGroupId && !validation.isValidGuid(args.options.entraGroupId)) {
|
|
146
|
-
return `'${args.options.entraGroupId}' is not a valid GUID for option entraGroupId`;
|
|
147
|
-
}
|
|
148
|
-
if (args.options.fileId && !validation.isValidGuid(args.options.fileId)) {
|
|
149
|
-
return `${args.options.fileId} is not a valid GUID`;
|
|
150
|
-
}
|
|
151
|
-
return true;
|
|
152
|
-
});
|
|
153
|
-
}, _SpoFileRoleAssignmentRemoveCommand_initOptionSets = function _SpoFileRoleAssignmentRemoveCommand_initOptionSets() {
|
|
154
|
-
this.optionSets.push({ options: ['fileUrl', 'fileId'] }, { options: ['upn', 'groupName', 'principalId', 'entraGroupId', 'entraGroupName'] });
|
|
155
|
-
}, _SpoFileRoleAssignmentRemoveCommand_initTypes = function _SpoFileRoleAssignmentRemoveCommand_initTypes() {
|
|
156
|
-
this.types.string.push('webUrl', 'fileUrl', 'fileId', 'upn', 'groupName', 'entraGroupId', 'entraGroupName');
|
|
157
|
-
this.types.boolean.push('force');
|
|
158
|
-
};
|
|
159
128
|
export default new SpoFileRoleAssignmentRemoveCommand();
|
|
160
129
|
//# sourceMappingURL=file-roleassignment-remove.js.map
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
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 _SpoFileRoleInheritanceBreakCommand_instances, _SpoFileRoleInheritanceBreakCommand_initTelemetry, _SpoFileRoleInheritanceBreakCommand_initOptions, _SpoFileRoleInheritanceBreakCommand_initValidators, _SpoFileRoleInheritanceBreakCommand_initOptionSets, _SpoFileRoleInheritanceBreakCommand_initTypes;
|
|
1
|
+
import { z } from 'zod';
|
|
7
2
|
import { cli } from '../../../../cli/cli.js';
|
|
3
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
8
4
|
import request from '../../../../request.js';
|
|
9
5
|
import { formatting } from '../../../../utils/formatting.js';
|
|
10
6
|
import { spo } from '../../../../utils/spo.js';
|
|
@@ -12,6 +8,18 @@ import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
|
12
8
|
import { validation } from '../../../../utils/validation.js';
|
|
13
9
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
14
10
|
import commands from '../../commands.js';
|
|
11
|
+
export const options = z.strictObject({
|
|
12
|
+
...globalOptionsZod.shape,
|
|
13
|
+
webUrl: z.string()
|
|
14
|
+
.refine(url => validation.isValidSharePointUrl(url) === true, {
|
|
15
|
+
error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
|
|
16
|
+
})
|
|
17
|
+
.alias('u'),
|
|
18
|
+
fileUrl: z.string().optional(),
|
|
19
|
+
fileId: z.guid().optional().alias('i'),
|
|
20
|
+
clearExistingPermissions: z.boolean().optional().alias('c'),
|
|
21
|
+
force: z.boolean().optional().alias('f')
|
|
22
|
+
});
|
|
15
23
|
class SpoFileRoleInheritanceBreakCommand extends SpoCommand {
|
|
16
24
|
get name() {
|
|
17
25
|
return commands.FILE_ROLEINHERITANCE_BREAK;
|
|
@@ -19,14 +27,18 @@ class SpoFileRoleInheritanceBreakCommand extends SpoCommand {
|
|
|
19
27
|
get description() {
|
|
20
28
|
return 'Breaks inheritance of a file. Keeping existing permissions is the default behavior.';
|
|
21
29
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
get schema() {
|
|
31
|
+
return options;
|
|
32
|
+
}
|
|
33
|
+
getRefinedSchema(schema) {
|
|
34
|
+
return schema
|
|
35
|
+
.refine(opts => [opts.fileId, opts.fileUrl].filter(o => o !== undefined).length === 1, {
|
|
36
|
+
error: `Specify 'fileId' or 'fileUrl', but not both.`,
|
|
37
|
+
params: {
|
|
38
|
+
customCode: 'optionSet',
|
|
39
|
+
options: ['fileId', 'fileUrl']
|
|
40
|
+
}
|
|
41
|
+
});
|
|
30
42
|
}
|
|
31
43
|
async commandAction(logger, args) {
|
|
32
44
|
const breakFileRoleInheritance = async () => {
|
|
@@ -67,43 +79,5 @@ class SpoFileRoleInheritanceBreakCommand extends SpoCommand {
|
|
|
67
79
|
return file.ServerRelativeUrl;
|
|
68
80
|
}
|
|
69
81
|
}
|
|
70
|
-
_SpoFileRoleInheritanceBreakCommand_instances = new WeakSet(), _SpoFileRoleInheritanceBreakCommand_initTelemetry = function _SpoFileRoleInheritanceBreakCommand_initTelemetry() {
|
|
71
|
-
this.telemetry.push((args) => {
|
|
72
|
-
Object.assign(this.telemetryProperties, {
|
|
73
|
-
fileUrl: typeof args.options.fileUrl !== 'undefined',
|
|
74
|
-
fileId: typeof args.options.fileId !== 'undefined',
|
|
75
|
-
clearExistingPermissions: !!args.options.clearExistingPermissions,
|
|
76
|
-
force: !!args.options.force
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
}, _SpoFileRoleInheritanceBreakCommand_initOptions = function _SpoFileRoleInheritanceBreakCommand_initOptions() {
|
|
80
|
-
this.options.unshift({
|
|
81
|
-
option: '-u, --webUrl <webUrl>'
|
|
82
|
-
}, {
|
|
83
|
-
option: '--fileUrl [fileUrl]'
|
|
84
|
-
}, {
|
|
85
|
-
option: '-i, --fileId [fileId]'
|
|
86
|
-
}, {
|
|
87
|
-
option: '-c, --clearExistingPermissions'
|
|
88
|
-
}, {
|
|
89
|
-
option: '-f, --force'
|
|
90
|
-
});
|
|
91
|
-
}, _SpoFileRoleInheritanceBreakCommand_initValidators = function _SpoFileRoleInheritanceBreakCommand_initValidators() {
|
|
92
|
-
this.validators.push(async (args) => {
|
|
93
|
-
const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.webUrl);
|
|
94
|
-
if (isValidSharePointUrl !== true) {
|
|
95
|
-
return isValidSharePointUrl;
|
|
96
|
-
}
|
|
97
|
-
if (args.options.fileId && !validation.isValidGuid(args.options.fileId)) {
|
|
98
|
-
return `${args.options.fileId} is not a valid GUID`;
|
|
99
|
-
}
|
|
100
|
-
return true;
|
|
101
|
-
});
|
|
102
|
-
}, _SpoFileRoleInheritanceBreakCommand_initOptionSets = function _SpoFileRoleInheritanceBreakCommand_initOptionSets() {
|
|
103
|
-
this.optionSets.push({ options: ['fileId', 'fileUrl'] });
|
|
104
|
-
}, _SpoFileRoleInheritanceBreakCommand_initTypes = function _SpoFileRoleInheritanceBreakCommand_initTypes() {
|
|
105
|
-
this.types.string.push('webUrl', 'fileUrl', 'fileId');
|
|
106
|
-
this.types.boolean.push('clearExistingPermissions', 'force');
|
|
107
|
-
};
|
|
108
82
|
export default new SpoFileRoleInheritanceBreakCommand();
|
|
109
83
|
//# sourceMappingURL=file-roleinheritance-break.js.map
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
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 _SpoFileRoleInheritanceResetCommand_instances, _SpoFileRoleInheritanceResetCommand_initTelemetry, _SpoFileRoleInheritanceResetCommand_initOptions, _SpoFileRoleInheritanceResetCommand_initValidators, _SpoFileRoleInheritanceResetCommand_initOptionSets, _SpoFileRoleInheritanceResetCommand_initTypes;
|
|
1
|
+
import { z } from 'zod';
|
|
7
2
|
import { cli } from '../../../../cli/cli.js';
|
|
3
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
8
4
|
import request from '../../../../request.js';
|
|
9
5
|
import { formatting } from '../../../../utils/formatting.js';
|
|
10
6
|
import { spo } from '../../../../utils/spo.js';
|
|
@@ -12,6 +8,17 @@ import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
|
12
8
|
import { validation } from '../../../../utils/validation.js';
|
|
13
9
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
14
10
|
import commands from '../../commands.js';
|
|
11
|
+
export const options = z.strictObject({
|
|
12
|
+
...globalOptionsZod.shape,
|
|
13
|
+
webUrl: z.string()
|
|
14
|
+
.refine(url => validation.isValidSharePointUrl(url) === true, {
|
|
15
|
+
error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
|
|
16
|
+
})
|
|
17
|
+
.alias('u'),
|
|
18
|
+
fileUrl: z.string().optional(),
|
|
19
|
+
fileId: z.guid().optional().alias('i'),
|
|
20
|
+
force: z.boolean().optional().alias('f')
|
|
21
|
+
});
|
|
15
22
|
class SpoFileRoleInheritanceResetCommand extends SpoCommand {
|
|
16
23
|
get name() {
|
|
17
24
|
return commands.FILE_ROLEINHERITANCE_RESET;
|
|
@@ -19,14 +26,18 @@ class SpoFileRoleInheritanceResetCommand extends SpoCommand {
|
|
|
19
26
|
get description() {
|
|
20
27
|
return 'Restores the role inheritance of a file';
|
|
21
28
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
get schema() {
|
|
30
|
+
return options;
|
|
31
|
+
}
|
|
32
|
+
getRefinedSchema(schema) {
|
|
33
|
+
return schema
|
|
34
|
+
.refine(opts => [opts.fileId, opts.fileUrl].filter(o => o !== undefined).length === 1, {
|
|
35
|
+
error: `Specify 'fileId' or 'fileUrl', but not both.`,
|
|
36
|
+
params: {
|
|
37
|
+
customCode: 'optionSet',
|
|
38
|
+
options: ['fileId', 'fileUrl']
|
|
39
|
+
}
|
|
40
|
+
});
|
|
30
41
|
}
|
|
31
42
|
async commandAction(logger, args) {
|
|
32
43
|
const resetFileRoleInheritance = async () => {
|
|
@@ -66,40 +77,5 @@ class SpoFileRoleInheritanceResetCommand extends SpoCommand {
|
|
|
66
77
|
return file.ServerRelativeUrl;
|
|
67
78
|
}
|
|
68
79
|
}
|
|
69
|
-
_SpoFileRoleInheritanceResetCommand_instances = new WeakSet(), _SpoFileRoleInheritanceResetCommand_initTelemetry = function _SpoFileRoleInheritanceResetCommand_initTelemetry() {
|
|
70
|
-
this.telemetry.push((args) => {
|
|
71
|
-
Object.assign(this.telemetryProperties, {
|
|
72
|
-
fileUrl: typeof args.options.fileUrl !== 'undefined',
|
|
73
|
-
fileId: typeof args.options.fileId !== 'undefined',
|
|
74
|
-
force: !!args.options.force
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
}, _SpoFileRoleInheritanceResetCommand_initOptions = function _SpoFileRoleInheritanceResetCommand_initOptions() {
|
|
78
|
-
this.options.unshift({
|
|
79
|
-
option: '-u, --webUrl <webUrl>'
|
|
80
|
-
}, {
|
|
81
|
-
option: '--fileUrl [fileUrl]'
|
|
82
|
-
}, {
|
|
83
|
-
option: '-i, --fileId [fileId]'
|
|
84
|
-
}, {
|
|
85
|
-
option: '-f, --force'
|
|
86
|
-
});
|
|
87
|
-
}, _SpoFileRoleInheritanceResetCommand_initValidators = function _SpoFileRoleInheritanceResetCommand_initValidators() {
|
|
88
|
-
this.validators.push(async (args) => {
|
|
89
|
-
const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.webUrl);
|
|
90
|
-
if (isValidSharePointUrl !== true) {
|
|
91
|
-
return isValidSharePointUrl;
|
|
92
|
-
}
|
|
93
|
-
if (args.options.fileId && !validation.isValidGuid(args.options.fileId)) {
|
|
94
|
-
return `${args.options.fileId} is not a valid GUID`;
|
|
95
|
-
}
|
|
96
|
-
return true;
|
|
97
|
-
});
|
|
98
|
-
}, _SpoFileRoleInheritanceResetCommand_initOptionSets = function _SpoFileRoleInheritanceResetCommand_initOptionSets() {
|
|
99
|
-
this.optionSets.push({ options: ['fileId', 'fileUrl'] });
|
|
100
|
-
}, _SpoFileRoleInheritanceResetCommand_initTypes = function _SpoFileRoleInheritanceResetCommand_initTypes() {
|
|
101
|
-
this.types.string.push('webUrl', 'fileUrl', 'fileId');
|
|
102
|
-
this.types.boolean.push('force');
|
|
103
|
-
};
|
|
104
80
|
export default new SpoFileRoleInheritanceResetCommand();
|
|
105
81
|
//# sourceMappingURL=file-roleinheritance-reset.js.map
|