@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,33 +1,17 @@
|
|
|
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 _SpoFileGetCommand_instances, _SpoFileGetCommand_initTelemetry, _SpoFileGetCommand_initOptions, _SpoFileGetCommand_initValidators, _SpoFileGetCommand_initOptionSets, _SpoFileGetCommand_initTypes;
|
|
1
7
|
import fs from 'fs';
|
|
2
8
|
import path from 'path';
|
|
3
|
-
import { z } from 'zod';
|
|
4
|
-
import { globalOptionsZod } from '../../../../Command.js';
|
|
5
9
|
import request from '../../../../request.js';
|
|
6
10
|
import { formatting } from '../../../../utils/formatting.js';
|
|
7
11
|
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
|
-
url: z.string().optional(),
|
|
19
|
-
id: z.guid().optional().alias('i'),
|
|
20
|
-
asString: z.boolean().optional(),
|
|
21
|
-
asListItem: z.boolean().optional(),
|
|
22
|
-
asFile: z.boolean().optional(),
|
|
23
|
-
path: z.string()
|
|
24
|
-
.refine(p => fs.existsSync(path.dirname(p)), {
|
|
25
|
-
error: 'Specified path where to save the file does not exits'
|
|
26
|
-
})
|
|
27
|
-
.optional()
|
|
28
|
-
.alias('p'),
|
|
29
|
-
withPermissions: z.boolean().optional()
|
|
30
|
-
});
|
|
31
15
|
class SpoFileGetCommand extends SpoCommand {
|
|
32
16
|
get name() {
|
|
33
17
|
return commands.FILE_GET;
|
|
@@ -35,28 +19,14 @@ class SpoFileGetCommand extends SpoCommand {
|
|
|
35
19
|
get description() {
|
|
36
20
|
return 'Gets information about the specified file';
|
|
37
21
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
customCode: 'optionSet',
|
|
47
|
-
options: ['id', 'url']
|
|
48
|
-
}
|
|
49
|
-
})
|
|
50
|
-
.refine(opts => !opts.asFile || !!opts.path, {
|
|
51
|
-
error: 'The path should be specified when the --asFile option is used',
|
|
52
|
-
path: ['path'],
|
|
53
|
-
params: {
|
|
54
|
-
customCode: 'required'
|
|
55
|
-
}
|
|
56
|
-
})
|
|
57
|
-
.refine(opts => [opts.asFile, opts.asListItem, opts.asString].filter(o => o === true).length <= 1, {
|
|
58
|
-
error: 'Specify to retrieve the file either as file, list item or string but not multiple'
|
|
59
|
-
});
|
|
22
|
+
constructor() {
|
|
23
|
+
super();
|
|
24
|
+
_SpoFileGetCommand_instances.add(this);
|
|
25
|
+
__classPrivateFieldGet(this, _SpoFileGetCommand_instances, "m", _SpoFileGetCommand_initTelemetry).call(this);
|
|
26
|
+
__classPrivateFieldGet(this, _SpoFileGetCommand_instances, "m", _SpoFileGetCommand_initOptions).call(this);
|
|
27
|
+
__classPrivateFieldGet(this, _SpoFileGetCommand_instances, "m", _SpoFileGetCommand_initValidators).call(this);
|
|
28
|
+
__classPrivateFieldGet(this, _SpoFileGetCommand_instances, "m", _SpoFileGetCommand_initOptionSets).call(this);
|
|
29
|
+
__classPrivateFieldGet(this, _SpoFileGetCommand_instances, "m", _SpoFileGetCommand_initTypes).call(this);
|
|
60
30
|
}
|
|
61
31
|
getExcludedOptionsWithUrls() {
|
|
62
32
|
return ['url'];
|
|
@@ -147,5 +117,70 @@ class SpoFileGetCommand extends SpoCommand {
|
|
|
147
117
|
}
|
|
148
118
|
}
|
|
149
119
|
}
|
|
120
|
+
_SpoFileGetCommand_instances = new WeakSet(), _SpoFileGetCommand_initTelemetry = function _SpoFileGetCommand_initTelemetry() {
|
|
121
|
+
this.telemetry.push((args) => {
|
|
122
|
+
Object.assign(this.telemetryProperties, {
|
|
123
|
+
id: typeof args.options.id !== 'undefined',
|
|
124
|
+
url: typeof args.options.url !== 'undefined',
|
|
125
|
+
asString: !!args.options.asString,
|
|
126
|
+
asListItem: !!args.options.asListItem,
|
|
127
|
+
asFile: !!args.options.asFile,
|
|
128
|
+
path: typeof args.options.path !== 'undefined',
|
|
129
|
+
withPermissions: !!args.options.withPermissions
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
}, _SpoFileGetCommand_initOptions = function _SpoFileGetCommand_initOptions() {
|
|
133
|
+
this.options.unshift({
|
|
134
|
+
option: '-u, --webUrl <webUrl>'
|
|
135
|
+
}, {
|
|
136
|
+
option: '--url [url]'
|
|
137
|
+
}, {
|
|
138
|
+
option: '-i, --id [id]'
|
|
139
|
+
}, {
|
|
140
|
+
option: '--asString'
|
|
141
|
+
}, {
|
|
142
|
+
option: '--asListItem'
|
|
143
|
+
}, {
|
|
144
|
+
option: '--asFile'
|
|
145
|
+
}, {
|
|
146
|
+
option: '-p, --path [path]'
|
|
147
|
+
}, {
|
|
148
|
+
option: '--withPermissions'
|
|
149
|
+
});
|
|
150
|
+
}, _SpoFileGetCommand_initValidators = function _SpoFileGetCommand_initValidators() {
|
|
151
|
+
this.validators.push(async (args) => {
|
|
152
|
+
const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.webUrl);
|
|
153
|
+
if (isValidSharePointUrl !== true) {
|
|
154
|
+
return isValidSharePointUrl;
|
|
155
|
+
}
|
|
156
|
+
if (args.options.id) {
|
|
157
|
+
if (!validation.isValidGuid(args.options.id)) {
|
|
158
|
+
return `${args.options.id} is not a valid GUID`;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
if (args.options.asFile && !args.options.path) {
|
|
162
|
+
return 'The path should be specified when the --asFile option is used';
|
|
163
|
+
}
|
|
164
|
+
if (args.options.path && !fs.existsSync(path.dirname(args.options.path))) {
|
|
165
|
+
return 'Specified path where to save the file does not exits';
|
|
166
|
+
}
|
|
167
|
+
if (args.options.asFile) {
|
|
168
|
+
if (args.options.asListItem || args.options.asString) {
|
|
169
|
+
return 'Specify to retrieve the file either as file, list item or string but not multiple';
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
if (args.options.asListItem) {
|
|
173
|
+
if (args.options.asFile || args.options.asString) {
|
|
174
|
+
return 'Specify to retrieve the file either as file, list item or string but not multiple';
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
return true;
|
|
178
|
+
});
|
|
179
|
+
}, _SpoFileGetCommand_initOptionSets = function _SpoFileGetCommand_initOptionSets() {
|
|
180
|
+
this.optionSets.push({ options: ['id', 'url'] });
|
|
181
|
+
}, _SpoFileGetCommand_initTypes = function _SpoFileGetCommand_initTypes() {
|
|
182
|
+
this.types.string.push('webUrl', 'url', 'id', 'path');
|
|
183
|
+
this.types.boolean.push('asString', 'asListItem', 'asFile', 'withPermissions');
|
|
184
|
+
};
|
|
150
185
|
export default new SpoFileGetCommand();
|
|
151
186
|
//# sourceMappingURL=file-get.js.map
|
|
@@ -1,23 +1,15 @@
|
|
|
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 _SpoFileListCommand_instances, _SpoFileListCommand_initTelemetry, _SpoFileListCommand_initOptions, _SpoFileListCommand_initValidators, _SpoFileListCommand_initTypes;
|
|
3
7
|
import request from '../../../../request.js';
|
|
4
8
|
import { formatting } from '../../../../utils/formatting.js';
|
|
5
9
|
import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
6
10
|
import { validation } from '../../../../utils/validation.js';
|
|
7
11
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
8
12
|
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
|
-
folderUrl: z.string().alias('f'),
|
|
17
|
-
fields: z.string().optional(),
|
|
18
|
-
filter: z.string().optional(),
|
|
19
|
-
recursive: z.boolean().optional().alias('r')
|
|
20
|
-
});
|
|
21
13
|
class SpoFileListCommand extends SpoCommand {
|
|
22
14
|
get name() {
|
|
23
15
|
return commands.FILE_LIST;
|
|
@@ -25,8 +17,13 @@ class SpoFileListCommand extends SpoCommand {
|
|
|
25
17
|
get description() {
|
|
26
18
|
return 'Lists all available files in the specified folder and site';
|
|
27
19
|
}
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
constructor() {
|
|
21
|
+
super();
|
|
22
|
+
_SpoFileListCommand_instances.add(this);
|
|
23
|
+
__classPrivateFieldGet(this, _SpoFileListCommand_instances, "m", _SpoFileListCommand_initTelemetry).call(this);
|
|
24
|
+
__classPrivateFieldGet(this, _SpoFileListCommand_instances, "m", _SpoFileListCommand_initOptions).call(this);
|
|
25
|
+
__classPrivateFieldGet(this, _SpoFileListCommand_instances, "m", _SpoFileListCommand_initValidators).call(this);
|
|
26
|
+
__classPrivateFieldGet(this, _SpoFileListCommand_instances, "m", _SpoFileListCommand_initTypes).call(this);
|
|
30
27
|
}
|
|
31
28
|
async commandAction(logger, args) {
|
|
32
29
|
if (this.verbose) {
|
|
@@ -136,6 +133,32 @@ class SpoFileListCommand extends SpoCommand {
|
|
|
136
133
|
};
|
|
137
134
|
}
|
|
138
135
|
}
|
|
136
|
+
_SpoFileListCommand_instances = new WeakSet(), _SpoFileListCommand_initTelemetry = function _SpoFileListCommand_initTelemetry() {
|
|
137
|
+
this.telemetry.push((args) => {
|
|
138
|
+
Object.assign(this.telemetryProperties, {
|
|
139
|
+
recursive: args.options.recursive,
|
|
140
|
+
fields: typeof args.options.fields !== 'undefined',
|
|
141
|
+
filter: typeof args.options.filter !== 'undefined'
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
}, _SpoFileListCommand_initOptions = function _SpoFileListCommand_initOptions() {
|
|
145
|
+
this.options.unshift({
|
|
146
|
+
option: '-u, --webUrl <webUrl>'
|
|
147
|
+
}, {
|
|
148
|
+
option: '-f, --folderUrl <folderUrl>'
|
|
149
|
+
}, {
|
|
150
|
+
option: '--fields [fields]'
|
|
151
|
+
}, {
|
|
152
|
+
option: '--filter [filter]'
|
|
153
|
+
}, {
|
|
154
|
+
option: '-r, --recursive'
|
|
155
|
+
});
|
|
156
|
+
}, _SpoFileListCommand_initValidators = function _SpoFileListCommand_initValidators() {
|
|
157
|
+
this.validators.push(async (args) => validation.isValidSharePointUrl(args.options.webUrl));
|
|
158
|
+
}, _SpoFileListCommand_initTypes = function _SpoFileListCommand_initTypes() {
|
|
159
|
+
this.types.string.push('webUrl', 'folderUrl', 'fields', 'filter');
|
|
160
|
+
this.types.boolean.push('recursive');
|
|
161
|
+
};
|
|
139
162
|
SpoFileListCommand.pageSize = 5000;
|
|
140
163
|
export default new SpoFileListCommand();
|
|
141
164
|
//# sourceMappingURL=file-list.js.map
|
|
@@ -1,27 +1,15 @@
|
|
|
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 _SpoFileMoveCommand_instances, _SpoFileMoveCommand_initTelemetry, _SpoFileMoveCommand_initOptions, _SpoFileMoveCommand_initValidators, _SpoFileMoveCommand_initOptionSets, _SpoFileMoveCommand_initTypes;
|
|
3
7
|
import request from '../../../../request.js';
|
|
4
8
|
import { CreateFileCopyJobsNameConflictBehavior, spo } from '../../../../utils/spo.js';
|
|
5
9
|
import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
6
10
|
import { validation } from '../../../../utils/validation.js';
|
|
7
11
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
8
12
|
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
|
-
sourceUrl: z.string().optional().alias('s'),
|
|
17
|
-
sourceId: z.guid().optional().alias('i'),
|
|
18
|
-
targetUrl: z.string().alias('t'),
|
|
19
|
-
newName: z.string().optional(),
|
|
20
|
-
nameConflictBehavior: z.enum(['fail', 'replace', 'rename']).optional(),
|
|
21
|
-
withItemPermissions: z.boolean().optional(),
|
|
22
|
-
bypassSharedLock: z.boolean().optional(),
|
|
23
|
-
skipWait: z.boolean().optional()
|
|
24
|
-
});
|
|
25
13
|
class SpoFileMoveCommand extends SpoCommand {
|
|
26
14
|
get name() {
|
|
27
15
|
return commands.FILE_MOVE;
|
|
@@ -29,18 +17,15 @@ class SpoFileMoveCommand extends SpoCommand {
|
|
|
29
17
|
get description() {
|
|
30
18
|
return 'Moves a file to another location';
|
|
31
19
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
options: ['sourceUrl', 'sourceId']
|
|
42
|
-
}
|
|
43
|
-
});
|
|
20
|
+
constructor() {
|
|
21
|
+
super();
|
|
22
|
+
_SpoFileMoveCommand_instances.add(this);
|
|
23
|
+
this.nameConflictBehaviorOptions = ['fail', 'replace', 'rename'];
|
|
24
|
+
__classPrivateFieldGet(this, _SpoFileMoveCommand_instances, "m", _SpoFileMoveCommand_initTelemetry).call(this);
|
|
25
|
+
__classPrivateFieldGet(this, _SpoFileMoveCommand_instances, "m", _SpoFileMoveCommand_initOptions).call(this);
|
|
26
|
+
__classPrivateFieldGet(this, _SpoFileMoveCommand_instances, "m", _SpoFileMoveCommand_initValidators).call(this);
|
|
27
|
+
__classPrivateFieldGet(this, _SpoFileMoveCommand_instances, "m", _SpoFileMoveCommand_initOptionSets).call(this);
|
|
28
|
+
__classPrivateFieldGet(this, _SpoFileMoveCommand_instances, "m", _SpoFileMoveCommand_initTypes).call(this);
|
|
44
29
|
}
|
|
45
30
|
getExcludedOptionsWithUrls() {
|
|
46
31
|
return ['targetUrl', 'sourceUrl'];
|
|
@@ -126,5 +111,58 @@ class SpoFileMoveCommand extends SpoCommand {
|
|
|
126
111
|
return urlUtil.removeTrailingSlashes(result);
|
|
127
112
|
}
|
|
128
113
|
}
|
|
114
|
+
_SpoFileMoveCommand_instances = new WeakSet(), _SpoFileMoveCommand_initTelemetry = function _SpoFileMoveCommand_initTelemetry() {
|
|
115
|
+
this.telemetry.push((args) => {
|
|
116
|
+
Object.assign(this.telemetryProperties, {
|
|
117
|
+
sourceUrl: typeof args.options.sourceUrl !== 'undefined',
|
|
118
|
+
sourceId: typeof args.options.sourceId !== 'undefined',
|
|
119
|
+
newName: typeof args.options.newName !== 'undefined',
|
|
120
|
+
nameConflictBehavior: typeof args.options.nameConflictBehavior !== 'undefined',
|
|
121
|
+
withItemPermissions: !!args.options.withItemPermissions,
|
|
122
|
+
bypassSharedLock: !!args.options.bypassSharedLock,
|
|
123
|
+
skipWait: !!args.options.skipWait
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
}, _SpoFileMoveCommand_initOptions = function _SpoFileMoveCommand_initOptions() {
|
|
127
|
+
this.options.unshift({
|
|
128
|
+
option: '-u, --webUrl <webUrl>'
|
|
129
|
+
}, {
|
|
130
|
+
option: '-s, --sourceUrl [sourceUrl]'
|
|
131
|
+
}, {
|
|
132
|
+
option: '-i, --sourceId [sourceId]'
|
|
133
|
+
}, {
|
|
134
|
+
option: '-t, --targetUrl <targetUrl>'
|
|
135
|
+
}, {
|
|
136
|
+
option: '--newName [newName]'
|
|
137
|
+
}, {
|
|
138
|
+
option: '--nameConflictBehavior [nameConflictBehavior]',
|
|
139
|
+
autocomplete: this.nameConflictBehaviorOptions
|
|
140
|
+
}, {
|
|
141
|
+
option: '--withItemPermissions'
|
|
142
|
+
}, {
|
|
143
|
+
option: '--bypassSharedLock'
|
|
144
|
+
}, {
|
|
145
|
+
option: '--skipWait'
|
|
146
|
+
});
|
|
147
|
+
}, _SpoFileMoveCommand_initValidators = function _SpoFileMoveCommand_initValidators() {
|
|
148
|
+
this.validators.push(async (args) => {
|
|
149
|
+
const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.webUrl);
|
|
150
|
+
if (isValidSharePointUrl !== true) {
|
|
151
|
+
return isValidSharePointUrl;
|
|
152
|
+
}
|
|
153
|
+
if (args.options.sourceId && !validation.isValidGuid(args.options.sourceId)) {
|
|
154
|
+
return `'${args.options.sourceId}' is not a valid GUID for sourceId.`;
|
|
155
|
+
}
|
|
156
|
+
if (args.options.nameConflictBehavior && this.nameConflictBehaviorOptions.indexOf(args.options.nameConflictBehavior) === -1) {
|
|
157
|
+
return `'${args.options.nameConflictBehavior}' is not a valid value for nameConflictBehavior. Allowed values are: ${this.nameConflictBehaviorOptions.join(', ')}.`;
|
|
158
|
+
}
|
|
159
|
+
return true;
|
|
160
|
+
});
|
|
161
|
+
}, _SpoFileMoveCommand_initOptionSets = function _SpoFileMoveCommand_initOptionSets() {
|
|
162
|
+
this.optionSets.push({ options: ['sourceUrl', 'sourceId'] });
|
|
163
|
+
}, _SpoFileMoveCommand_initTypes = function _SpoFileMoveCommand_initTypes() {
|
|
164
|
+
this.types.string.push('webUrl', 'sourceUrl', 'sourceId', 'targetUrl', 'newName', 'nameConflictBehavior');
|
|
165
|
+
this.types.boolean.push('withItemPermissions', 'bypassSharedLock', 'skipWait');
|
|
166
|
+
};
|
|
129
167
|
export default new SpoFileMoveCommand();
|
|
130
168
|
//# sourceMappingURL=file-move.js.map
|
|
@@ -1,25 +1,16 @@
|
|
|
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 _SpoFileRemoveCommand_instances, _SpoFileRemoveCommand_initTelemetry, _SpoFileRemoveCommand_initOptions, _SpoFileRemoveCommand_initValidators, _SpoFileRemoveCommand_initOptionSets, _SpoFileRemoveCommand_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 { urlUtil } from '../../../../utils/urlUtil.js';
|
|
7
11
|
import { validation } from '../../../../utils/validation.js';
|
|
8
12
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
9
13
|
import commands from '../../commands.js';
|
|
10
|
-
export const options = z.strictObject({
|
|
11
|
-
...globalOptionsZod.shape,
|
|
12
|
-
webUrl: z.string()
|
|
13
|
-
.refine(url => validation.isValidSharePointUrl(url) === true, {
|
|
14
|
-
error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
|
|
15
|
-
})
|
|
16
|
-
.alias('u'),
|
|
17
|
-
id: z.guid().optional().alias('i'),
|
|
18
|
-
url: z.string().optional(),
|
|
19
|
-
permanent: z.boolean().optional(),
|
|
20
|
-
bypassSharedLock: z.boolean().optional(),
|
|
21
|
-
force: z.boolean().optional().alias('f')
|
|
22
|
-
});
|
|
23
14
|
class SpoFileRemoveCommand extends SpoCommand {
|
|
24
15
|
get name() {
|
|
25
16
|
return commands.FILE_REMOVE;
|
|
@@ -30,18 +21,14 @@ class SpoFileRemoveCommand extends SpoCommand {
|
|
|
30
21
|
alias() {
|
|
31
22
|
return [commands.PAGE_TEMPLATE_REMOVE];
|
|
32
23
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
customCode: 'optionSet',
|
|
42
|
-
options: ['id', 'url']
|
|
43
|
-
}
|
|
44
|
-
});
|
|
24
|
+
constructor() {
|
|
25
|
+
super();
|
|
26
|
+
_SpoFileRemoveCommand_instances.add(this);
|
|
27
|
+
__classPrivateFieldGet(this, _SpoFileRemoveCommand_instances, "m", _SpoFileRemoveCommand_initTelemetry).call(this);
|
|
28
|
+
__classPrivateFieldGet(this, _SpoFileRemoveCommand_instances, "m", _SpoFileRemoveCommand_initOptions).call(this);
|
|
29
|
+
__classPrivateFieldGet(this, _SpoFileRemoveCommand_instances, "m", _SpoFileRemoveCommand_initValidators).call(this);
|
|
30
|
+
__classPrivateFieldGet(this, _SpoFileRemoveCommand_instances, "m", _SpoFileRemoveCommand_initOptionSets).call(this);
|
|
31
|
+
__classPrivateFieldGet(this, _SpoFileRemoveCommand_instances, "m", _SpoFileRemoveCommand_initTypes).call(this);
|
|
45
32
|
}
|
|
46
33
|
getExcludedOptionsWithUrls() {
|
|
47
34
|
return ['url'];
|
|
@@ -93,5 +80,47 @@ class SpoFileRemoveCommand extends SpoCommand {
|
|
|
93
80
|
}
|
|
94
81
|
}
|
|
95
82
|
}
|
|
83
|
+
_SpoFileRemoveCommand_instances = new WeakSet(), _SpoFileRemoveCommand_initTelemetry = function _SpoFileRemoveCommand_initTelemetry() {
|
|
84
|
+
this.telemetry.push((args) => {
|
|
85
|
+
Object.assign(this.telemetryProperties, {
|
|
86
|
+
id: typeof args.options.id !== 'undefined',
|
|
87
|
+
url: typeof args.options.url !== 'undefined',
|
|
88
|
+
permanent: !!args.options.permanent,
|
|
89
|
+
bypassSharedLock: !!args.options.bypassSharedLock,
|
|
90
|
+
force: !!args.options.force
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
}, _SpoFileRemoveCommand_initOptions = function _SpoFileRemoveCommand_initOptions() {
|
|
94
|
+
this.options.unshift({
|
|
95
|
+
option: '-u, --webUrl <webUrl>'
|
|
96
|
+
}, {
|
|
97
|
+
option: '-i, --id [id]'
|
|
98
|
+
}, {
|
|
99
|
+
option: '--url [url]'
|
|
100
|
+
}, {
|
|
101
|
+
option: '--permanent'
|
|
102
|
+
}, {
|
|
103
|
+
option: '--bypassSharedLock'
|
|
104
|
+
}, {
|
|
105
|
+
option: '-f, --force'
|
|
106
|
+
});
|
|
107
|
+
}, _SpoFileRemoveCommand_initValidators = function _SpoFileRemoveCommand_initValidators() {
|
|
108
|
+
this.validators.push(async (args) => {
|
|
109
|
+
const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.webUrl);
|
|
110
|
+
if (isValidSharePointUrl !== true) {
|
|
111
|
+
return isValidSharePointUrl;
|
|
112
|
+
}
|
|
113
|
+
if (args.options.id &&
|
|
114
|
+
!validation.isValidGuid(args.options.id)) {
|
|
115
|
+
return `${args.options.id} is not a valid GUID`;
|
|
116
|
+
}
|
|
117
|
+
return true;
|
|
118
|
+
});
|
|
119
|
+
}, _SpoFileRemoveCommand_initOptionSets = function _SpoFileRemoveCommand_initOptionSets() {
|
|
120
|
+
this.optionSets.push({ options: ['id', 'url'] });
|
|
121
|
+
}, _SpoFileRemoveCommand_initTypes = function _SpoFileRemoveCommand_initTypes() {
|
|
122
|
+
this.types.string.push('webUrl', 'id', 'url');
|
|
123
|
+
this.types.boolean.push('permanent', 'bypassSharedLock', 'force');
|
|
124
|
+
};
|
|
96
125
|
export default new SpoFileRemoveCommand();
|
|
97
126
|
//# sourceMappingURL=file-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 _SpoFileRenameCommand_instances, _SpoFileRenameCommand_initTelemetry, _SpoFileRenameCommand_initOptions, _SpoFileRenameCommand_initValidators, _SpoFileRenameCommand_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 { urlUtil } from '../../../../utils/urlUtil.js';
|
|
@@ -8,17 +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 removeCommand from './file-remove.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
|
-
sourceUrl: z.string().alias('s'),
|
|
19
|
-
targetFileName: z.string().alias('t'),
|
|
20
|
-
force: z.boolean().optional()
|
|
21
|
-
});
|
|
22
15
|
class SpoFileRenameCommand extends SpoCommand {
|
|
23
16
|
get name() {
|
|
24
17
|
return commands.FILE_RENAME;
|
|
@@ -26,8 +19,13 @@ class SpoFileRenameCommand extends SpoCommand {
|
|
|
26
19
|
get description() {
|
|
27
20
|
return 'Renames a file';
|
|
28
21
|
}
|
|
29
|
-
|
|
30
|
-
|
|
22
|
+
constructor() {
|
|
23
|
+
super();
|
|
24
|
+
_SpoFileRenameCommand_instances.add(this);
|
|
25
|
+
__classPrivateFieldGet(this, _SpoFileRenameCommand_instances, "m", _SpoFileRenameCommand_initTelemetry).call(this);
|
|
26
|
+
__classPrivateFieldGet(this, _SpoFileRenameCommand_instances, "m", _SpoFileRenameCommand_initOptions).call(this);
|
|
27
|
+
__classPrivateFieldGet(this, _SpoFileRenameCommand_instances, "m", _SpoFileRenameCommand_initValidators).call(this);
|
|
28
|
+
__classPrivateFieldGet(this, _SpoFileRenameCommand_instances, "m", _SpoFileRenameCommand_initTypes).call(this);
|
|
31
29
|
}
|
|
32
30
|
async commandAction(logger, args) {
|
|
33
31
|
const webUrl = args.options.webUrl;
|
|
@@ -74,6 +72,7 @@ class SpoFileRenameCommand extends SpoCommand {
|
|
|
74
72
|
const removeOptions = {
|
|
75
73
|
webUrl: webUrl,
|
|
76
74
|
url: targetFileServerRelativeUrl,
|
|
75
|
+
recycle: true,
|
|
77
76
|
force: true,
|
|
78
77
|
debug: this.debug,
|
|
79
78
|
verbose: this.verbose
|
|
@@ -89,5 +88,27 @@ class SpoFileRenameCommand extends SpoCommand {
|
|
|
89
88
|
}
|
|
90
89
|
}
|
|
91
90
|
}
|
|
91
|
+
_SpoFileRenameCommand_instances = new WeakSet(), _SpoFileRenameCommand_initTelemetry = function _SpoFileRenameCommand_initTelemetry() {
|
|
92
|
+
this.telemetry.push((args) => {
|
|
93
|
+
Object.assign(this.telemetryProperties, {
|
|
94
|
+
force: !!args.options.force
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
}, _SpoFileRenameCommand_initOptions = function _SpoFileRenameCommand_initOptions() {
|
|
98
|
+
this.options.unshift({
|
|
99
|
+
option: '-u, --webUrl <webUrl>'
|
|
100
|
+
}, {
|
|
101
|
+
option: '-s, --sourceUrl <sourceUrl>'
|
|
102
|
+
}, {
|
|
103
|
+
option: '-t, --targetFileName <targetFileName>'
|
|
104
|
+
}, {
|
|
105
|
+
option: '--force'
|
|
106
|
+
});
|
|
107
|
+
}, _SpoFileRenameCommand_initValidators = function _SpoFileRenameCommand_initValidators() {
|
|
108
|
+
this.validators.push(async (args) => validation.isValidSharePointUrl(args.options.webUrl));
|
|
109
|
+
}, _SpoFileRenameCommand_initTypes = function _SpoFileRenameCommand_initTypes() {
|
|
110
|
+
this.types.string.push('webUrl', 'sourceUrl', 'targetFileName');
|
|
111
|
+
this.types.boolean.push('force');
|
|
112
|
+
};
|
|
92
113
|
export default new SpoFileRenameCommand();
|
|
93
114
|
//# sourceMappingURL=file-rename.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 _SpoFileRetentionLabelEnsureCommand_instances, _SpoFileRetentionLabelEnsureCommand_initTelemetry, _SpoFileRetentionLabelEnsureCommand_initOptions, _SpoFileRetentionLabelEnsureCommand_initValidators, _SpoFileRetentionLabelEnsureCommand_initOptionSets, _SpoFileRetentionLabelEnsureCommand_initTypes;
|
|
3
7
|
import request from '../../../../request.js';
|
|
4
8
|
import { validation } from '../../../../utils/validation.js';
|
|
5
9
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
@@ -7,18 +11,6 @@ import commands from '../../commands.js';
|
|
|
7
11
|
import { formatting } from '../../../../utils/formatting.js';
|
|
8
12
|
import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
9
13
|
import { spo } from '../../../../utils/spo.js';
|
|
10
|
-
export const options = z.strictObject({
|
|
11
|
-
...globalOptionsZod.shape,
|
|
12
|
-
webUrl: z.string()
|
|
13
|
-
.refine(url => validation.isValidSharePointUrl(url) === true, {
|
|
14
|
-
error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
|
|
15
|
-
})
|
|
16
|
-
.alias('u'),
|
|
17
|
-
name: z.string(),
|
|
18
|
-
fileUrl: z.string().optional(),
|
|
19
|
-
fileId: z.guid().optional().alias('i'),
|
|
20
|
-
assetId: z.string().optional().alias('a')
|
|
21
|
-
});
|
|
22
14
|
class SpoFileRetentionLabelEnsureCommand extends SpoCommand {
|
|
23
15
|
get name() {
|
|
24
16
|
return commands.FILE_RETENTIONLABEL_ENSURE;
|
|
@@ -26,18 +18,14 @@ class SpoFileRetentionLabelEnsureCommand extends SpoCommand {
|
|
|
26
18
|
get description() {
|
|
27
19
|
return 'Applies a retention label to a file';
|
|
28
20
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
customCode: 'optionSet',
|
|
38
|
-
options: ['fileUrl', 'fileId']
|
|
39
|
-
}
|
|
40
|
-
});
|
|
21
|
+
constructor() {
|
|
22
|
+
super();
|
|
23
|
+
_SpoFileRetentionLabelEnsureCommand_instances.add(this);
|
|
24
|
+
__classPrivateFieldGet(this, _SpoFileRetentionLabelEnsureCommand_instances, "m", _SpoFileRetentionLabelEnsureCommand_initTelemetry).call(this);
|
|
25
|
+
__classPrivateFieldGet(this, _SpoFileRetentionLabelEnsureCommand_instances, "m", _SpoFileRetentionLabelEnsureCommand_initOptions).call(this);
|
|
26
|
+
__classPrivateFieldGet(this, _SpoFileRetentionLabelEnsureCommand_instances, "m", _SpoFileRetentionLabelEnsureCommand_initValidators).call(this);
|
|
27
|
+
__classPrivateFieldGet(this, _SpoFileRetentionLabelEnsureCommand_instances, "m", _SpoFileRetentionLabelEnsureCommand_initOptionSets).call(this);
|
|
28
|
+
__classPrivateFieldGet(this, _SpoFileRetentionLabelEnsureCommand_instances, "m", _SpoFileRetentionLabelEnsureCommand_initTypes).call(this);
|
|
41
29
|
}
|
|
42
30
|
async commandAction(logger, args) {
|
|
43
31
|
try {
|
|
@@ -89,5 +77,42 @@ class SpoFileRetentionLabelEnsureCommand extends SpoCommand {
|
|
|
89
77
|
return request.post(requestOptions);
|
|
90
78
|
}
|
|
91
79
|
}
|
|
80
|
+
_SpoFileRetentionLabelEnsureCommand_instances = new WeakSet(), _SpoFileRetentionLabelEnsureCommand_initTelemetry = function _SpoFileRetentionLabelEnsureCommand_initTelemetry() {
|
|
81
|
+
this.telemetry.push((args) => {
|
|
82
|
+
Object.assign(this.telemetryProperties, {
|
|
83
|
+
fileUrl: typeof args.options.fileUrl !== 'undefined',
|
|
84
|
+
fileId: typeof args.options.fileId !== 'undefined',
|
|
85
|
+
assetId: typeof args.options.assetId !== 'undefined'
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
}, _SpoFileRetentionLabelEnsureCommand_initOptions = function _SpoFileRetentionLabelEnsureCommand_initOptions() {
|
|
89
|
+
this.options.unshift({
|
|
90
|
+
option: '-u, --webUrl <webUrl>'
|
|
91
|
+
}, {
|
|
92
|
+
option: '--name <name>'
|
|
93
|
+
}, {
|
|
94
|
+
option: '--fileUrl [fileUrl]'
|
|
95
|
+
}, {
|
|
96
|
+
option: '-i, --fileId [fileId]'
|
|
97
|
+
}, {
|
|
98
|
+
option: '-a, --assetId [assetId]'
|
|
99
|
+
});
|
|
100
|
+
}, _SpoFileRetentionLabelEnsureCommand_initValidators = function _SpoFileRetentionLabelEnsureCommand_initValidators() {
|
|
101
|
+
this.validators.push(async (args) => {
|
|
102
|
+
const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.webUrl);
|
|
103
|
+
if (isValidSharePointUrl !== true) {
|
|
104
|
+
return isValidSharePointUrl;
|
|
105
|
+
}
|
|
106
|
+
if (args.options.fileId &&
|
|
107
|
+
!validation.isValidGuid(args.options.fileId)) {
|
|
108
|
+
return `${args.options.fileId} is not a valid GUID`;
|
|
109
|
+
}
|
|
110
|
+
return true;
|
|
111
|
+
});
|
|
112
|
+
}, _SpoFileRetentionLabelEnsureCommand_initOptionSets = function _SpoFileRetentionLabelEnsureCommand_initOptionSets() {
|
|
113
|
+
this.optionSets.push({ options: ['fileUrl', 'fileId'] });
|
|
114
|
+
}, _SpoFileRetentionLabelEnsureCommand_initTypes = function _SpoFileRetentionLabelEnsureCommand_initTypes() {
|
|
115
|
+
this.types.string.push('webUrl', 'name', 'fileUrl', 'fileId', 'assetId');
|
|
116
|
+
};
|
|
92
117
|
export default new SpoFileRetentionLabelEnsureCommand();
|
|
93
118
|
//# sourceMappingURL=file-retentionlabel-ensure.js.map
|