@pnp/cli-microsoft365 12.1.0-beta.0c2915d → 12.1.0-beta.dbc076e
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/m365/spo/commands/file/file-add.js +77 -51
- package/dist/m365/spo/commands/file/file-archive.js +1 -1
- package/dist/m365/spo/commands/file/file-checkin.js +64 -35
- package/dist/m365/spo/commands/file/file-checkout-undo.js +49 -25
- package/dist/m365/spo/commands/file/file-checkout.js +47 -24
- package/dist/m365/spo/commands/file/file-copy.js +68 -37
- package/dist/m365/spo/commands/file/file-get.js +79 -44
- package/dist/m365/spo/commands/file/file-list.js +39 -16
- package/dist/m365/spo/commands/file/file-move.js +68 -30
- package/dist/m365/spo/commands/file/file-remove.js +56 -27
- package/dist/m365/spo/commands/file/file-rename.js +36 -15
- package/dist/m365/spo/commands/file/file-retentionlabel-ensure.js +51 -26
- package/dist/m365/spo/commands/file/file-retentionlabel-remove.js +50 -25
- package/dist/m365/spo/commands/file/file-roleassignment-add.js +75 -47
- package/dist/m365/spo/commands/file/file-roleassignment-remove.js +70 -39
- package/dist/m365/spo/commands/file/file-roleinheritance-break.js +52 -26
- package/dist/m365/spo/commands/file/file-roleinheritance-reset.js +49 -25
- package/dist/m365/spo/commands/file/file-sharinginfo-get.js +47 -24
- package/dist/m365/spo/commands/file/file-sharinglink-add.js +70 -46
- package/dist/m365/spo/commands/file/file-sharinglink-clear.js +57 -33
- package/dist/m365/spo/commands/file/file-sharinglink-get.js +47 -25
- package/dist/m365/spo/commands/file/file-sharinglink-list.js +53 -32
- package/dist/m365/spo/commands/file/file-sharinglink-remove.js +51 -26
- package/dist/m365/spo/commands/file/file-sharinglink-set.js +55 -29
- package/dist/m365/spo/commands/file/file-unarchive.js +1 -1
- package/dist/m365/spo/commands/file/file-version-clear.js +45 -25
- package/dist/m365/spo/commands/file/file-version-get.js +43 -25
- package/dist/m365/spo/commands/file/file-version-keep.js +1 -1
- package/dist/m365/spo/commands/file/file-version-list.js +41 -24
- package/dist/m365/spo/commands/file/file-version-remove.js +47 -26
- package/dist/m365/spo/commands/file/file-version-restore.js +47 -26
- package/dist/m365/spo/commands/folder/folder-add.js +48 -19
- package/dist/m365/spo/commands/folder/folder-copy.js +62 -36
- package/dist/m365/spo/commands/folder/folder-get.js +51 -30
- package/dist/m365/spo/commands/folder/folder-list.js +39 -16
- package/dist/m365/spo/commands/folder/folder-move.js +62 -36
- package/dist/m365/spo/commands/folder/folder-remove.js +36 -15
- package/dist/m365/spo/commands/folder/folder-retentionlabel-ensure.js +48 -30
- package/dist/m365/spo/commands/folder/folder-retentionlabel-remove.js +50 -30
- package/dist/m365/spo/commands/folder/folder-roleassignment-add.js +79 -49
- package/dist/m365/spo/commands/folder/folder-roleassignment-remove.js +67 -37
- package/dist/m365/spo/commands/folder/folder-roleinheritance-break.js +36 -15
- package/dist/m365/spo/commands/folder/folder-roleinheritance-reset.js +33 -14
- package/dist/m365/spo/commands/folder/folder-set.js +48 -28
- package/dist/m365/spo/commands/folder/folder-sharinglink-add.js +86 -58
- package/dist/m365/spo/commands/folder/folder-sharinglink-clear.js +50 -33
- package/dist/m365/spo/commands/folder/folder-sharinglink-get.js +42 -33
- package/dist/m365/spo/commands/folder/folder-sharinglink-list.js +47 -32
- package/dist/m365/spo/commands/folder/folder-sharinglink-remove.js +41 -34
- package/dist/m365/spo/commands/folder/folder-sharinglink-set.js +43 -38
- package/package.json +1 -1
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
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 _SpoFileRetentionLabelRemoveCommand_instances, _SpoFileRetentionLabelRemoveCommand_initTelemetry, _SpoFileRetentionLabelRemoveCommand_initOptions, _SpoFileRetentionLabelRemoveCommand_initValidators, _SpoFileRetentionLabelRemoveCommand_initOptionSets, _SpoFileRetentionLabelRemoveCommand_initTypes;
|
|
2
7
|
import { cli } from '../../../../cli/cli.js';
|
|
3
|
-
import { globalOptionsZod } from '../../../../Command.js';
|
|
4
8
|
import request from '../../../../request.js';
|
|
5
9
|
import { formatting } from '../../../../utils/formatting.js';
|
|
6
10
|
import { spo } from '../../../../utils/spo.js';
|
|
@@ -8,17 +12,6 @@ import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
|
8
12
|
import { validation } from '../../../../utils/validation.js';
|
|
9
13
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
10
14
|
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
|
-
});
|
|
22
15
|
class SpoFileRetentionLabelRemoveCommand extends SpoCommand {
|
|
23
16
|
get name() {
|
|
24
17
|
return commands.FILE_RETENTIONLABEL_REMOVE;
|
|
@@ -26,18 +19,14 @@ class SpoFileRetentionLabelRemoveCommand extends SpoCommand {
|
|
|
26
19
|
get description() {
|
|
27
20
|
return 'Clears the retention label from a file';
|
|
28
21
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
customCode: 'optionSet',
|
|
38
|
-
options: ['fileUrl', 'fileId']
|
|
39
|
-
}
|
|
40
|
-
});
|
|
22
|
+
constructor() {
|
|
23
|
+
super();
|
|
24
|
+
_SpoFileRetentionLabelRemoveCommand_instances.add(this);
|
|
25
|
+
__classPrivateFieldGet(this, _SpoFileRetentionLabelRemoveCommand_instances, "m", _SpoFileRetentionLabelRemoveCommand_initTelemetry).call(this);
|
|
26
|
+
__classPrivateFieldGet(this, _SpoFileRetentionLabelRemoveCommand_instances, "m", _SpoFileRetentionLabelRemoveCommand_initOptions).call(this);
|
|
27
|
+
__classPrivateFieldGet(this, _SpoFileRetentionLabelRemoveCommand_instances, "m", _SpoFileRetentionLabelRemoveCommand_initValidators).call(this);
|
|
28
|
+
__classPrivateFieldGet(this, _SpoFileRetentionLabelRemoveCommand_instances, "m", _SpoFileRetentionLabelRemoveCommand_initOptionSets).call(this);
|
|
29
|
+
__classPrivateFieldGet(this, _SpoFileRetentionLabelRemoveCommand_instances, "m", _SpoFileRetentionLabelRemoveCommand_initTypes).call(this);
|
|
41
30
|
}
|
|
42
31
|
async commandAction(logger, args) {
|
|
43
32
|
if (args.options.force) {
|
|
@@ -85,5 +74,41 @@ class SpoFileRetentionLabelRemoveCommand extends SpoCommand {
|
|
|
85
74
|
return { listItemId: response.ListItemAllFields.Id, listServerRelativeUrl: response.ListItemAllFields.ParentList.RootFolder.ServerRelativeUrl };
|
|
86
75
|
}
|
|
87
76
|
}
|
|
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
|
+
};
|
|
88
113
|
export default new SpoFileRetentionLabelRemoveCommand();
|
|
89
114
|
//# sourceMappingURL=file-retentionlabel-remove.js.map
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 _SpoFileRoleAssignmentAddCommand_instances, _SpoFileRoleAssignmentAddCommand_initTelemetry, _SpoFileRoleAssignmentAddCommand_initOptions, _SpoFileRoleAssignmentAddCommand_initValidators, _SpoFileRoleAssignmentAddCommand_initOptionSets, _SpoFileRoleAssignmentAddCommand_initTypes;
|
|
3
7
|
import request from '../../../../request.js';
|
|
4
8
|
import { formatting } from '../../../../utils/formatting.js';
|
|
5
9
|
import { spo } from '../../../../utils/spo.js';
|
|
@@ -8,25 +12,6 @@ import { validation } from '../../../../utils/validation.js';
|
|
|
8
12
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
9
13
|
import commands from '../../commands.js';
|
|
10
14
|
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
|
-
});
|
|
30
15
|
class SpoFileRoleAssignmentAddCommand extends SpoCommand {
|
|
31
16
|
get name() {
|
|
32
17
|
return commands.FILE_ROLEASSIGNMENT_ADD;
|
|
@@ -34,32 +19,14 @@ class SpoFileRoleAssignmentAddCommand extends SpoCommand {
|
|
|
34
19
|
get description() {
|
|
35
20
|
return 'Adds a role assignment to the specified file.';
|
|
36
21
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
});
|
|
22
|
+
constructor() {
|
|
23
|
+
super();
|
|
24
|
+
_SpoFileRoleAssignmentAddCommand_instances.add(this);
|
|
25
|
+
__classPrivateFieldGet(this, _SpoFileRoleAssignmentAddCommand_instances, "m", _SpoFileRoleAssignmentAddCommand_initTelemetry).call(this);
|
|
26
|
+
__classPrivateFieldGet(this, _SpoFileRoleAssignmentAddCommand_instances, "m", _SpoFileRoleAssignmentAddCommand_initOptions).call(this);
|
|
27
|
+
__classPrivateFieldGet(this, _SpoFileRoleAssignmentAddCommand_instances, "m", _SpoFileRoleAssignmentAddCommand_initValidators).call(this);
|
|
28
|
+
__classPrivateFieldGet(this, _SpoFileRoleAssignmentAddCommand_instances, "m", _SpoFileRoleAssignmentAddCommand_initOptionSets).call(this);
|
|
29
|
+
__classPrivateFieldGet(this, _SpoFileRoleAssignmentAddCommand_instances, "m", _SpoFileRoleAssignmentAddCommand_initTypes).call(this);
|
|
63
30
|
}
|
|
64
31
|
async commandAction(logger, args) {
|
|
65
32
|
if (this.verbose) {
|
|
@@ -133,5 +100,66 @@ class SpoFileRoleAssignmentAddCommand extends SpoCommand {
|
|
|
133
100
|
return file.ServerRelativeUrl;
|
|
134
101
|
}
|
|
135
102
|
}
|
|
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
|
+
};
|
|
136
164
|
export default new SpoFileRoleAssignmentAddCommand();
|
|
137
165
|
//# sourceMappingURL=file-roleassignment-add.js.map
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
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 _SpoFileRoleAssignmentRemoveCommand_instances, _SpoFileRoleAssignmentRemoveCommand_initTelemetry, _SpoFileRoleAssignmentRemoveCommand_initOptions, _SpoFileRoleAssignmentRemoveCommand_initValidators, _SpoFileRoleAssignmentRemoveCommand_initOptionSets, _SpoFileRoleAssignmentRemoveCommand_initTypes;
|
|
2
7
|
import { cli } from '../../../../cli/cli.js';
|
|
3
|
-
import { globalOptionsZod } from '../../../../Command.js';
|
|
4
8
|
import request from '../../../../request.js';
|
|
5
9
|
import { formatting } from '../../../../utils/formatting.js';
|
|
6
10
|
import { spo } from '../../../../utils/spo.js';
|
|
@@ -9,24 +13,6 @@ import { validation } from '../../../../utils/validation.js';
|
|
|
9
13
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
10
14
|
import commands from '../../commands.js';
|
|
11
15
|
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
|
-
});
|
|
30
16
|
class SpoFileRoleAssignmentRemoveCommand extends SpoCommand {
|
|
31
17
|
get name() {
|
|
32
18
|
return commands.FILE_ROLEASSIGNMENT_REMOVE;
|
|
@@ -34,25 +20,14 @@ class SpoFileRoleAssignmentRemoveCommand extends SpoCommand {
|
|
|
34
20
|
get description() {
|
|
35
21
|
return 'Removes a role assignment from a file.';
|
|
36
22
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
});
|
|
23
|
+
constructor() {
|
|
24
|
+
super();
|
|
25
|
+
_SpoFileRoleAssignmentRemoveCommand_instances.add(this);
|
|
26
|
+
__classPrivateFieldGet(this, _SpoFileRoleAssignmentRemoveCommand_instances, "m", _SpoFileRoleAssignmentRemoveCommand_initTelemetry).call(this);
|
|
27
|
+
__classPrivateFieldGet(this, _SpoFileRoleAssignmentRemoveCommand_instances, "m", _SpoFileRoleAssignmentRemoveCommand_initOptions).call(this);
|
|
28
|
+
__classPrivateFieldGet(this, _SpoFileRoleAssignmentRemoveCommand_instances, "m", _SpoFileRoleAssignmentRemoveCommand_initValidators).call(this);
|
|
29
|
+
__classPrivateFieldGet(this, _SpoFileRoleAssignmentRemoveCommand_instances, "m", _SpoFileRoleAssignmentRemoveCommand_initOptionSets).call(this);
|
|
30
|
+
__classPrivateFieldGet(this, _SpoFileRoleAssignmentRemoveCommand_instances, "m", _SpoFileRoleAssignmentRemoveCommand_initTypes).call(this);
|
|
56
31
|
}
|
|
57
32
|
async commandAction(logger, args) {
|
|
58
33
|
const removeRoleAssignment = async () => {
|
|
@@ -125,5 +100,61 @@ class SpoFileRoleAssignmentRemoveCommand extends SpoCommand {
|
|
|
125
100
|
return group.Id;
|
|
126
101
|
}
|
|
127
102
|
}
|
|
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
|
+
};
|
|
128
159
|
export default new SpoFileRoleAssignmentRemoveCommand();
|
|
129
160
|
//# sourceMappingURL=file-roleassignment-remove.js.map
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
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 _SpoFileRoleInheritanceBreakCommand_instances, _SpoFileRoleInheritanceBreakCommand_initTelemetry, _SpoFileRoleInheritanceBreakCommand_initOptions, _SpoFileRoleInheritanceBreakCommand_initValidators, _SpoFileRoleInheritanceBreakCommand_initOptionSets, _SpoFileRoleInheritanceBreakCommand_initTypes;
|
|
2
7
|
import { cli } from '../../../../cli/cli.js';
|
|
3
|
-
import { globalOptionsZod } from '../../../../Command.js';
|
|
4
8
|
import request from '../../../../request.js';
|
|
5
9
|
import { formatting } from '../../../../utils/formatting.js';
|
|
6
10
|
import { spo } from '../../../../utils/spo.js';
|
|
@@ -8,18 +12,6 @@ import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
|
8
12
|
import { validation } from '../../../../utils/validation.js';
|
|
9
13
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
10
14
|
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
|
-
});
|
|
23
15
|
class SpoFileRoleInheritanceBreakCommand extends SpoCommand {
|
|
24
16
|
get name() {
|
|
25
17
|
return commands.FILE_ROLEINHERITANCE_BREAK;
|
|
@@ -27,18 +19,14 @@ class SpoFileRoleInheritanceBreakCommand extends SpoCommand {
|
|
|
27
19
|
get description() {
|
|
28
20
|
return 'Breaks inheritance of a file. Keeping existing permissions is the default behavior.';
|
|
29
21
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
customCode: 'optionSet',
|
|
39
|
-
options: ['fileId', 'fileUrl']
|
|
40
|
-
}
|
|
41
|
-
});
|
|
22
|
+
constructor() {
|
|
23
|
+
super();
|
|
24
|
+
_SpoFileRoleInheritanceBreakCommand_instances.add(this);
|
|
25
|
+
__classPrivateFieldGet(this, _SpoFileRoleInheritanceBreakCommand_instances, "m", _SpoFileRoleInheritanceBreakCommand_initTelemetry).call(this);
|
|
26
|
+
__classPrivateFieldGet(this, _SpoFileRoleInheritanceBreakCommand_instances, "m", _SpoFileRoleInheritanceBreakCommand_initOptions).call(this);
|
|
27
|
+
__classPrivateFieldGet(this, _SpoFileRoleInheritanceBreakCommand_instances, "m", _SpoFileRoleInheritanceBreakCommand_initValidators).call(this);
|
|
28
|
+
__classPrivateFieldGet(this, _SpoFileRoleInheritanceBreakCommand_instances, "m", _SpoFileRoleInheritanceBreakCommand_initOptionSets).call(this);
|
|
29
|
+
__classPrivateFieldGet(this, _SpoFileRoleInheritanceBreakCommand_instances, "m", _SpoFileRoleInheritanceBreakCommand_initTypes).call(this);
|
|
42
30
|
}
|
|
43
31
|
async commandAction(logger, args) {
|
|
44
32
|
const breakFileRoleInheritance = async () => {
|
|
@@ -79,5 +67,43 @@ class SpoFileRoleInheritanceBreakCommand extends SpoCommand {
|
|
|
79
67
|
return file.ServerRelativeUrl;
|
|
80
68
|
}
|
|
81
69
|
}
|
|
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
|
+
};
|
|
82
108
|
export default new SpoFileRoleInheritanceBreakCommand();
|
|
83
109
|
//# sourceMappingURL=file-roleinheritance-break.js.map
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
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 _SpoFileRoleInheritanceResetCommand_instances, _SpoFileRoleInheritanceResetCommand_initTelemetry, _SpoFileRoleInheritanceResetCommand_initOptions, _SpoFileRoleInheritanceResetCommand_initValidators, _SpoFileRoleInheritanceResetCommand_initOptionSets, _SpoFileRoleInheritanceResetCommand_initTypes;
|
|
2
7
|
import { cli } from '../../../../cli/cli.js';
|
|
3
|
-
import { globalOptionsZod } from '../../../../Command.js';
|
|
4
8
|
import request from '../../../../request.js';
|
|
5
9
|
import { formatting } from '../../../../utils/formatting.js';
|
|
6
10
|
import { spo } from '../../../../utils/spo.js';
|
|
@@ -8,17 +12,6 @@ import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
|
8
12
|
import { validation } from '../../../../utils/validation.js';
|
|
9
13
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
10
14
|
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
|
-
});
|
|
22
15
|
class SpoFileRoleInheritanceResetCommand extends SpoCommand {
|
|
23
16
|
get name() {
|
|
24
17
|
return commands.FILE_ROLEINHERITANCE_RESET;
|
|
@@ -26,18 +19,14 @@ class SpoFileRoleInheritanceResetCommand extends SpoCommand {
|
|
|
26
19
|
get description() {
|
|
27
20
|
return 'Restores the role inheritance of a file';
|
|
28
21
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
customCode: 'optionSet',
|
|
38
|
-
options: ['fileId', 'fileUrl']
|
|
39
|
-
}
|
|
40
|
-
});
|
|
22
|
+
constructor() {
|
|
23
|
+
super();
|
|
24
|
+
_SpoFileRoleInheritanceResetCommand_instances.add(this);
|
|
25
|
+
__classPrivateFieldGet(this, _SpoFileRoleInheritanceResetCommand_instances, "m", _SpoFileRoleInheritanceResetCommand_initTelemetry).call(this);
|
|
26
|
+
__classPrivateFieldGet(this, _SpoFileRoleInheritanceResetCommand_instances, "m", _SpoFileRoleInheritanceResetCommand_initOptions).call(this);
|
|
27
|
+
__classPrivateFieldGet(this, _SpoFileRoleInheritanceResetCommand_instances, "m", _SpoFileRoleInheritanceResetCommand_initValidators).call(this);
|
|
28
|
+
__classPrivateFieldGet(this, _SpoFileRoleInheritanceResetCommand_instances, "m", _SpoFileRoleInheritanceResetCommand_initOptionSets).call(this);
|
|
29
|
+
__classPrivateFieldGet(this, _SpoFileRoleInheritanceResetCommand_instances, "m", _SpoFileRoleInheritanceResetCommand_initTypes).call(this);
|
|
41
30
|
}
|
|
42
31
|
async commandAction(logger, args) {
|
|
43
32
|
const resetFileRoleInheritance = async () => {
|
|
@@ -77,5 +66,40 @@ class SpoFileRoleInheritanceResetCommand extends SpoCommand {
|
|
|
77
66
|
return file.ServerRelativeUrl;
|
|
78
67
|
}
|
|
79
68
|
}
|
|
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
|
+
};
|
|
80
104
|
export default new SpoFileRoleInheritanceResetCommand();
|
|
81
105
|
//# sourceMappingURL=file-roleinheritance-reset.js.map
|