@pnp/cli-microsoft365 11.4.0-beta.13d597c → 11.4.0-beta.37c2235
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.devproxy/api-specs/sharepoint.yaml +43 -0
- package/README.md +1 -1
- package/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/Auth.js +1 -1
- package/dist/AuthServer.js +2 -4
- package/dist/Command.js +2 -2
- package/dist/cli/cli.js +9 -9
- package/dist/m365/adaptivecard/commands/adaptivecard-send.js +10 -11
- package/dist/m365/app/commands/app-open.js +3 -4
- package/dist/m365/app/commands/permission/permission-add.js +4 -5
- package/dist/m365/base/AppCommand.js +3 -3
- package/dist/m365/booking/commands/business/business-get.js +6 -8
- package/dist/m365/booking/commands/business/business-list.js +2 -1
- package/dist/m365/cli/commands/app/app-add.js +5 -7
- package/dist/m365/commands/docs.js +1 -1
- package/dist/m365/commands/login.js +22 -19
- package/dist/m365/commands/logout.js +1 -1
- package/dist/m365/commands/status.js +2 -1
- package/dist/m365/connection/commands/connection-list.js +2 -1
- package/dist/m365/connection/commands/connection-set.js +15 -29
- package/dist/m365/context/commands/context-remove.js +4 -6
- package/dist/m365/context/commands/option/option-remove.js +5 -7
- package/dist/m365/entra/commands/administrativeunit/administrativeunit-add.js +5 -7
- package/dist/m365/entra/commands/administrativeunit/administrativeunit-get.js +7 -9
- package/dist/m365/entra/commands/administrativeunit/administrativeunit-list.js +4 -5
- package/dist/m365/entra/commands/administrativeunit/administrativeunit-remove.js +8 -10
- package/dist/m365/entra/commands/license/license-list.js +1 -1
- package/dist/m365/entra/commands/m365group/m365group-remove.js +1 -1
- package/dist/m365/entra/commands/multitenant/multitenant-add.js +3 -4
- package/dist/m365/entra/commands/organization/organization-list.js +4 -6
- package/dist/m365/entra/commands/organization/organization-set.js +24 -26
- package/dist/m365/entra/commands/roleassignment/roleassignment-add.js +21 -34
- package/dist/m365/entra/commands/roledefinition/roledefinition-add.js +8 -10
- package/dist/m365/entra/commands/roledefinition/roledefinition-get.js +11 -13
- package/dist/m365/entra/commands/roledefinition/roledefinition-list.js +5 -7
- package/dist/m365/entra/commands/roledefinition/roledefinition-remove.js +11 -13
- package/dist/m365/entra/commands/roledefinition/roledefinition-set.js +15 -17
- package/dist/m365/entra/commands/rolepermission/rolepermission-list.js +5 -7
- package/dist/m365/entra/commands/user/user-session-revoke.js +9 -13
- package/dist/m365/exo/commands/approleassignment/approleassignment-add.js +29 -31
- package/dist/m365/flow/commands/environment/environment-get.js +5 -7
- package/dist/m365/flow/commands/environment/environment-list.js +2 -1
- package/dist/m365/flow/commands/recyclebinitem/recyclebinitem-list.js +4 -6
- package/dist/m365/flow/commands/recyclebinitem/recyclebinitem-restore.js +5 -11
- package/dist/m365/graph/commands/directoryextension/directoryextension-add.js +11 -13
- package/dist/m365/graph/commands/directoryextension/directoryextension-get.js +10 -19
- package/dist/m365/graph/commands/directoryextension/directoryextension-list.js +6 -12
- package/dist/m365/graph/commands/directoryextension/directoryextension-remove.js +11 -20
- package/dist/m365/graph/commands/openextension/openextension-add.js +12 -13
- package/dist/m365/graph/commands/openextension/openextension-get.js +12 -14
- package/dist/m365/graph/commands/openextension/openextension-list.js +11 -13
- package/dist/m365/graph/commands/openextension/openextension-remove.js +13 -15
- package/dist/m365/graph/commands/openextension/openextension-set.js +16 -17
- package/dist/m365/onedrive/commands/onedrive-list.js +2 -1
- package/dist/m365/outlook/commands/mail/mail-searchfolder-add.js +9 -14
- package/dist/m365/outlook/commands/mailbox/mailbox-settings-get.js +8 -12
- package/dist/m365/outlook/commands/mailbox/mailbox-settings-set.js +15 -15
- package/dist/m365/outlook/commands/roomlist/roomlist-list.js +2 -1
- package/dist/m365/pa/commands/environment/environment-get.js +5 -7
- package/dist/m365/pa/commands/environment/environment-list.js +2 -1
- package/dist/m365/planner/commands/tenant/tenant-settings-list.js +1 -1
- package/dist/m365/pp/commands/environment/environment-get.js +5 -7
- package/dist/m365/pp/commands/environment/environment-list.js +3 -4
- package/dist/m365/pp/commands/gateway/gateway-list.js +1 -1
- package/dist/m365/pp/commands/tenant/tenant-settings-list.js +1 -1
- package/dist/m365/pp/commands/website/website-get.js +12 -12
- package/dist/m365/purview/commands/retentionevent/retentionevent-list.js +2 -1
- package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-list.js +1 -1
- package/dist/m365/purview/commands/retentionlabel/retentionlabel-list.js +1 -1
- package/dist/m365/spe/commands/container/container-add.js +10 -15
- package/dist/m365/spe/commands/container/container-permission-list.js +4 -6
- package/dist/m365/spe/commands/container/container-recyclebinitem-list.js +5 -10
- package/dist/m365/spe/commands/container/container-recyclebinitem-remove.js +96 -0
- package/dist/m365/spe/commands/container/container-recyclebinitem-restore.js +7 -12
- package/dist/m365/spe/commands/container/container-remove.js +10 -16
- package/dist/m365/spe/commands/containertype/containertype-add.js +15 -20
- package/dist/m365/spe/commands/containertype/containertype-get.js +6 -13
- package/dist/m365/spe/commands/containertype/containertype-remove.js +7 -14
- package/dist/m365/spe/commands.js +1 -0
- package/dist/m365/spfx/commands/project/project-upgrade.js +4 -6
- package/dist/m365/spo/commands/file/file-add.js +49 -11
- package/dist/m365/spo/commands/file/file-version-keep.js +10 -14
- package/dist/m365/spo/commands/homesite/homesite-add.js +13 -15
- package/dist/m365/spo/commands/homesite/homesite-get.js +8 -9
- package/dist/m365/spo/commands/homesite/homesite-remove.js +9 -10
- package/dist/m365/spo/commands/homesite/homesite-set.js +13 -14
- package/dist/m365/spo/commands/list/DefaultColumnValue.js +2 -0
- package/dist/m365/spo/commands/list/list-defaultvalue-clear.js +13 -17
- package/dist/m365/spo/commands/list/list-defaultvalue-get.js +124 -0
- package/dist/m365/spo/commands/list/list-defaultvalue-list.js +13 -37
- package/dist/m365/spo/commands/list/list-defaultvalue-remove.js +12 -16
- package/dist/m365/spo/commands/list/list-defaultvalue-set.js +11 -15
- package/dist/m365/spo/commands/list/list-view-add.js +16 -20
- package/dist/m365/spo/commands/listitem/listitem-set.js +1 -1
- package/dist/m365/spo/commands/page/page-control-remove.js +11 -15
- package/dist/m365/spo/commands/page/page-get.js +10 -11
- package/dist/m365/spo/commands/page/page-header-set.js +97 -89
- package/dist/m365/spo/commands/page/page-publish.js +9 -10
- package/dist/m365/spo/commands/page/page-section-remove.js +11 -12
- package/dist/m365/spo/commands/page/page-set.js +26 -26
- package/dist/m365/spo/commands/site/site-appcatalog-list.js +4 -6
- package/dist/m365/spo/commands/site/site-get.js +6 -8
- package/dist/m365/spo/commands/site/site-sharingpermission-set.js +7 -9
- package/dist/m365/spo/commands/site/site-versionpolicy-get.js +11 -13
- package/dist/m365/spo/commands/web/web-alert-list.js +20 -27
- package/dist/m365/spo/commands/web/web-alert-remove.js +15 -20
- package/dist/m365/spo/commands.js +1 -0
- package/dist/m365/spp/commands/model/model-apply.js +18 -24
- package/dist/m365/teams/commands/callrecord/callrecord-list.js +5 -9
- package/dist/m365/teams/commands/chat/chat-message-list.js +26 -27
- package/dist/m365/teams/commands/chat/chat-message-send.js +12 -3
- package/dist/m365/teams/commands/chat/chatUtil.js +1 -1
- package/dist/m365/tenant/commands/people/people-pronouns-set.js +4 -6
- package/dist/m365/tenant/commands/report/report-settings-set.js +4 -6
- package/dist/m365/viva/commands/engage/engage-community-user-add.js +17 -22
- package/dist/m365/viva/commands/engage/engage-community-user-list.js +8 -14
- package/dist/m365/viva/commands/engage/engage-community-user-remove.js +14 -22
- package/dist/m365/viva/commands/engage/engage-role-member-list.js +6 -11
- package/dist/utils/spo.js +30 -2
- package/dist/utils/zod.js +41 -76
- package/docs/docs/cmd/entra/app/app-permission-add.mdx +19 -0
- package/docs/docs/cmd/entra/app/app-permission-list.mdx +19 -0
- package/docs/docs/cmd/entra/app/app-permission-remove.mdx +21 -0
- package/docs/docs/cmd/spe/container/container-recyclebinitem-remove.mdx +79 -0
- package/docs/docs/cmd/spo/file/file-add.mdx +140 -1
- package/docs/docs/cmd/spo/list/list-defaultvalue-get.mdx +118 -0
- package/docs/docs/cmd/spo/page/page-header-set.mdx +28 -8
- package/docs/docs/cmd/spo/page/page-set.mdx +35 -5
- package/docs/docs/cmd/teams/chat/chat-message-list.mdx +34 -7
- package/docs/docs/cmd/teams/chat/chat-message-send.mdx +23 -1
- package/npm-shrinkwrap.json +274 -248
- package/package.json +12 -11
|
@@ -1,23 +1,16 @@
|
|
|
1
|
-
import { validation } from '../../../../utils/validation.js';
|
|
2
1
|
import commands from '../../commands.js';
|
|
3
2
|
import { globalOptionsZod } from '../../../../Command.js';
|
|
4
3
|
import { z } from 'zod';
|
|
5
|
-
import { zod } from '../../../../utils/zod.js';
|
|
6
4
|
import GraphDelegatedCommand from '../../../base/GraphDelegatedCommand.js';
|
|
7
5
|
import { formatting } from '../../../../utils/formatting.js';
|
|
8
6
|
import request from '../../../../request.js';
|
|
9
7
|
import { odata } from '../../../../utils/odata.js';
|
|
10
8
|
import { cli } from '../../../../cli/cli.js';
|
|
11
|
-
const options =
|
|
12
|
-
.
|
|
13
|
-
id:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}))
|
|
17
|
-
.optional()),
|
|
18
|
-
name: zod.alias('n', z.string().optional())
|
|
19
|
-
})
|
|
20
|
-
.strict();
|
|
9
|
+
export const options = z.strictObject({
|
|
10
|
+
...globalOptionsZod.shape,
|
|
11
|
+
id: z.uuid().optional().alias('i'),
|
|
12
|
+
name: z.string().optional().alias('n')
|
|
13
|
+
});
|
|
21
14
|
class SpeContainerTypeGetCommand extends GraphDelegatedCommand {
|
|
22
15
|
get name() {
|
|
23
16
|
return commands.CONTAINERTYPE_GET;
|
|
@@ -31,7 +24,7 @@ class SpeContainerTypeGetCommand extends GraphDelegatedCommand {
|
|
|
31
24
|
getRefinedSchema(schema) {
|
|
32
25
|
return schema
|
|
33
26
|
.refine(options => [options.id, options.name].filter(o => o !== undefined).length === 1, {
|
|
34
|
-
|
|
27
|
+
error: 'Use one of the following options: id or name.'
|
|
35
28
|
});
|
|
36
29
|
}
|
|
37
30
|
async commandAction(logger, args) {
|
|
@@ -1,25 +1,18 @@
|
|
|
1
1
|
import { globalOptionsZod } from '../../../../Command.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { zod } from '../../../../utils/zod.js';
|
|
4
3
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
5
4
|
import commands from '../../commands.js';
|
|
6
5
|
import { spo } from '../../../../utils/spo.js';
|
|
7
6
|
import { cli } from '../../../../cli/cli.js';
|
|
8
|
-
import { validation } from '../../../../utils/validation.js';
|
|
9
7
|
import request from '../../../../request.js';
|
|
10
8
|
import config from '../../../../config.js';
|
|
11
9
|
import { formatting } from '../../../../utils/formatting.js';
|
|
12
|
-
const options =
|
|
13
|
-
.
|
|
14
|
-
id:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
.optional()),
|
|
19
|
-
name: zod.alias('n', z.string().optional()),
|
|
20
|
-
force: zod.alias('f', z.boolean().optional())
|
|
21
|
-
})
|
|
22
|
-
.strict();
|
|
10
|
+
export const options = z.strictObject({
|
|
11
|
+
...globalOptionsZod.shape,
|
|
12
|
+
id: z.uuid().optional().alias('i'),
|
|
13
|
+
name: z.string().optional().alias('n'),
|
|
14
|
+
force: z.boolean().optional().alias('f')
|
|
15
|
+
});
|
|
23
16
|
class SpeContainerTypeRemoveCommand extends SpoCommand {
|
|
24
17
|
get name() {
|
|
25
18
|
return commands.CONTAINERTYPE_REMOVE;
|
|
@@ -33,7 +26,7 @@ class SpeContainerTypeRemoveCommand extends SpoCommand {
|
|
|
33
26
|
getRefinedSchema(schema) {
|
|
34
27
|
return schema
|
|
35
28
|
.refine(options => [options.id, options.name].filter(o => o !== undefined).length === 1, {
|
|
36
|
-
|
|
29
|
+
error: 'Use one of the following options: id, name.'
|
|
37
30
|
});
|
|
38
31
|
}
|
|
39
32
|
async commandAction(logger, args) {
|
|
@@ -7,6 +7,7 @@ export default {
|
|
|
7
7
|
CONTAINER_REMOVE: `${prefix} container remove`,
|
|
8
8
|
CONTAINER_PERMISSION_LIST: `${prefix} container permission list`,
|
|
9
9
|
CONTAINER_RECYCLEBINITEM_LIST: `${prefix} container recyclebinitem list`,
|
|
10
|
+
CONTAINER_RECYCLEBINITEM_REMOVE: `${prefix} container recyclebinitem remove`,
|
|
10
11
|
CONTAINER_RECYCLEBINITEM_RESTORE: `${prefix} container recyclebinitem restore`,
|
|
11
12
|
CONTAINERTYPE_ADD: `${prefix} containertype add`,
|
|
12
13
|
CONTAINERTYPE_GET: `${prefix} containertype get`,
|
|
@@ -7,19 +7,17 @@ import { z } from 'zod';
|
|
|
7
7
|
import { CommandError, globalOptionsZod } from '../../../../Command.js';
|
|
8
8
|
import { fsUtil } from '../../../../utils/fsUtil.js';
|
|
9
9
|
import { packageManager } from '../../../../utils/packageManager.js';
|
|
10
|
-
import { zod } from '../../../../utils/zod.js';
|
|
11
10
|
import commands from '../../commands.js';
|
|
12
11
|
import { BaseProjectCommand } from './base-project-command.js';
|
|
13
12
|
import { FN017001_MISC_npm_dedupe } from './project-upgrade/rules/FN017001_MISC_npm_dedupe.js';
|
|
14
|
-
const options =
|
|
15
|
-
.
|
|
13
|
+
export const options = z.strictObject({
|
|
14
|
+
...globalOptionsZod.shape,
|
|
16
15
|
packageManager: z.enum(['npm', 'pnpm', 'yarn']).default('npm'),
|
|
17
16
|
preview: z.boolean().optional(),
|
|
18
|
-
toVersion:
|
|
17
|
+
toVersion: z.string().optional().alias('v'),
|
|
19
18
|
shell: z.enum(['bash', 'powershell', 'cmd']).default('powershell'),
|
|
20
19
|
output: z.enum(['json', 'text', 'md', 'tour', 'csv', 'none']).optional()
|
|
21
|
-
})
|
|
22
|
-
.strict();
|
|
20
|
+
});
|
|
23
21
|
class SpfxProjectUpgradeCommand extends BaseProjectCommand {
|
|
24
22
|
get name() {
|
|
25
23
|
return commands.PROJECT_UPGRADE;
|
|
@@ -39,14 +39,38 @@ class SpoFileAddCommand extends SpoCommand {
|
|
|
39
39
|
async commandAction(logger, args) {
|
|
40
40
|
const folderPath = urlUtil.getServerRelativePath(args.options.webUrl, args.options.folder);
|
|
41
41
|
const fullPath = path.resolve(args.options.path);
|
|
42
|
-
const fileName = fsUtil.getSafeFileName(path.basename(fullPath));
|
|
42
|
+
const fileName = fsUtil.getSafeFileName(args.options.fileName ?? path.basename(fullPath));
|
|
43
43
|
let isCheckedOut = false;
|
|
44
44
|
let listSettings;
|
|
45
45
|
if (this.verbose) {
|
|
46
46
|
await logger.logToStderr(`file name: ${fileName}...`);
|
|
47
47
|
await logger.logToStderr(`folder path: ${folderPath}...`);
|
|
48
48
|
}
|
|
49
|
+
if (args.options.overwrite === undefined) {
|
|
50
|
+
await this.warn(logger, 'In the next major version, the --overwrite option will default to false. To avoid this warning, please set the --overwrite option explicitly to true or false.');
|
|
51
|
+
}
|
|
49
52
|
try {
|
|
53
|
+
if (args.options.overwrite === false) {
|
|
54
|
+
try {
|
|
55
|
+
const requestOptions = {
|
|
56
|
+
url: `${args.options.webUrl}/_api/Web/GetFileByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(folderPath + '/' + fileName)}')?$select=Exists`,
|
|
57
|
+
headers: {
|
|
58
|
+
accept: 'application/json;odata=nometadata'
|
|
59
|
+
},
|
|
60
|
+
responseType: 'json'
|
|
61
|
+
};
|
|
62
|
+
await request.get(requestOptions);
|
|
63
|
+
throw `File '${fileName}' already exists in folder '${folderPath}'. To overwrite the file, use the --overwrite option.`;
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
if (typeof err === 'string') {
|
|
67
|
+
throw err;
|
|
68
|
+
}
|
|
69
|
+
if (this.verbose) {
|
|
70
|
+
await logger.logToStderr(`File '${fileName}' does not exist in folder '${folderPath}'. Proceeding with upload.`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
50
74
|
try {
|
|
51
75
|
if (this.verbose) {
|
|
52
76
|
await logger.logToStderr('Check if the specified folder exists.');
|
|
@@ -78,6 +102,7 @@ class SpoFileAddCommand extends SpoCommand {
|
|
|
78
102
|
if (this.verbose) {
|
|
79
103
|
await logger.logToStderr(`File size is ${fileSize} bytes`);
|
|
80
104
|
}
|
|
105
|
+
let fileUploadResult;
|
|
81
106
|
// only up to 250 MB are allowed in a single request
|
|
82
107
|
if (fileSize > this.fileChunkingThreshold) {
|
|
83
108
|
const fileChunkCount = Math.ceil(fileSize / this.fileChunkSize);
|
|
@@ -106,7 +131,7 @@ class SpoFileAddCommand extends SpoCommand {
|
|
|
106
131
|
Size: fileSize
|
|
107
132
|
};
|
|
108
133
|
try {
|
|
109
|
-
await this.uploadFileChunks(fileUploadInfo, logger);
|
|
134
|
+
fileUploadResult = await this.uploadFileChunks(fileUploadInfo, logger);
|
|
110
135
|
if (this.verbose) {
|
|
111
136
|
await logger.logToStderr(`Finished uploading ${fileUploadInfo.Position} bytes in ${fileChunkCount} chunks`);
|
|
112
137
|
}
|
|
@@ -127,7 +152,7 @@ class SpoFileAddCommand extends SpoCommand {
|
|
|
127
152
|
throw err;
|
|
128
153
|
}
|
|
129
154
|
catch (err) {
|
|
130
|
-
if (this.
|
|
155
|
+
if (this.verbose) {
|
|
131
156
|
await logger.logToStderr(`Failed to cancel upload session: ${err}`);
|
|
132
157
|
}
|
|
133
158
|
throw err;
|
|
@@ -145,9 +170,10 @@ class SpoFileAddCommand extends SpoCommand {
|
|
|
145
170
|
accept: 'application/json;odata=nometadata',
|
|
146
171
|
'content-length': bodyLength
|
|
147
172
|
},
|
|
148
|
-
maxBodyLength: this.fileChunkingThreshold
|
|
173
|
+
maxBodyLength: this.fileChunkingThreshold,
|
|
174
|
+
responseType: 'json'
|
|
149
175
|
};
|
|
150
|
-
await request.post(requestOptions);
|
|
176
|
+
fileUploadResult = await request.post(requestOptions);
|
|
151
177
|
}
|
|
152
178
|
if (args.options.contentType || args.options.publish || args.options.approve) {
|
|
153
179
|
listSettings = await this.getFileParentList(fileName, args.options.webUrl, folderPath, logger);
|
|
@@ -206,6 +232,7 @@ class SpoFileAddCommand extends SpoCommand {
|
|
|
206
232
|
};
|
|
207
233
|
await request.post(requestOptions);
|
|
208
234
|
}
|
|
235
|
+
await logger.log(fileUploadResult);
|
|
209
236
|
}
|
|
210
237
|
catch (err) {
|
|
211
238
|
if (isCheckedOut) {
|
|
@@ -292,15 +319,16 @@ class SpoFileAddCommand extends SpoCommand {
|
|
|
292
319
|
accept: 'application/json;odata=nometadata',
|
|
293
320
|
'content-length': readCount
|
|
294
321
|
},
|
|
295
|
-
maxBodyLength: this.fileChunkingThreshold
|
|
322
|
+
maxBodyLength: this.fileChunkingThreshold,
|
|
323
|
+
responseType: 'json'
|
|
296
324
|
};
|
|
297
325
|
try {
|
|
298
|
-
await request.post(requestOptions);
|
|
326
|
+
const uploadResponse = await request.post(requestOptions);
|
|
299
327
|
if (this.verbose) {
|
|
300
328
|
await logger.logToStderr(`Uploaded ${info.Position} of ${info.Size} bytes (${Math.round(100 * info.Position / info.Size)}%)`);
|
|
301
329
|
}
|
|
302
330
|
if (isLastChunk) {
|
|
303
|
-
return;
|
|
331
|
+
return uploadResponse;
|
|
304
332
|
}
|
|
305
333
|
else {
|
|
306
334
|
return this.uploadFileChunks(info, logger);
|
|
@@ -407,9 +435,12 @@ class SpoFileAddCommand extends SpoCommand {
|
|
|
407
435
|
'approveComment',
|
|
408
436
|
'publish',
|
|
409
437
|
'publishComment',
|
|
438
|
+
'overwrite',
|
|
439
|
+
'fileName',
|
|
410
440
|
'debug',
|
|
411
441
|
'verbose',
|
|
412
442
|
'output',
|
|
443
|
+
'query',
|
|
413
444
|
'_',
|
|
414
445
|
'u',
|
|
415
446
|
'p',
|
|
@@ -434,7 +465,9 @@ _SpoFileAddCommand_instances = new WeakSet(), _SpoFileAddCommand_initTelemetry =
|
|
|
434
465
|
approve: !!args.options.approve,
|
|
435
466
|
approveComment: typeof args.options.approveComment !== 'undefined',
|
|
436
467
|
publish: !!args.options.publish,
|
|
437
|
-
publishComment: typeof args.options.publishComment !== 'undefined'
|
|
468
|
+
publishComment: typeof args.options.publishComment !== 'undefined',
|
|
469
|
+
overwrite: !!args.options.overwrite,
|
|
470
|
+
fileName: typeof args.options.fileName !== 'undefined'
|
|
438
471
|
});
|
|
439
472
|
});
|
|
440
473
|
}, _SpoFileAddCommand_initOptions = function _SpoFileAddCommand_initOptions() {
|
|
@@ -458,6 +491,11 @@ _SpoFileAddCommand_instances = new WeakSet(), _SpoFileAddCommand_initTelemetry =
|
|
|
458
491
|
option: '--publish'
|
|
459
492
|
}, {
|
|
460
493
|
option: '--publishComment [publishComment]'
|
|
494
|
+
}, {
|
|
495
|
+
option: '--overwrite [overwrite]',
|
|
496
|
+
autocomplete: ['true', 'false']
|
|
497
|
+
}, {
|
|
498
|
+
option: '--fileName [fileName]'
|
|
461
499
|
});
|
|
462
500
|
}, _SpoFileAddCommand_initValidators = function _SpoFileAddCommand_initValidators() {
|
|
463
501
|
this.validators.push(async (args) => {
|
|
@@ -477,8 +515,8 @@ _SpoFileAddCommand_instances = new WeakSet(), _SpoFileAddCommand_initTelemetry =
|
|
|
477
515
|
return true;
|
|
478
516
|
});
|
|
479
517
|
}, _SpoFileAddCommand_initTypes = function _SpoFileAddCommand_initTypes() {
|
|
480
|
-
this.types.string.push('webUrl', 'folder', 'path', 'contentType', 'checkInComment', 'approveComment', 'publishComment');
|
|
481
|
-
this.types.boolean.push('checkOut', 'approve', 'publish');
|
|
518
|
+
this.types.string.push('webUrl', 'folder', 'path', 'contentType', 'checkInComment', 'approveComment', 'publishComment', 'fileName');
|
|
519
|
+
this.types.boolean.push('checkOut', 'approve', 'publish', 'overwrite');
|
|
482
520
|
};
|
|
483
521
|
export default new SpoFileAddCommand();
|
|
484
522
|
//# sourceMappingURL=file-add.js.map
|
|
@@ -2,26 +2,22 @@ import commands from '../../commands.js';
|
|
|
2
2
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
3
3
|
import { globalOptionsZod } from '../../../../Command.js';
|
|
4
4
|
import { z } from 'zod';
|
|
5
|
-
import { zod } from '../../../../utils/zod.js';
|
|
6
5
|
import { validation } from '../../../../utils/validation.js';
|
|
7
6
|
import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
8
7
|
import request from '../../../../request.js';
|
|
9
8
|
import { formatting } from '../../../../utils/formatting.js';
|
|
10
9
|
import { odata } from '../../../../utils/odata.js';
|
|
11
|
-
export const options =
|
|
12
|
-
.
|
|
13
|
-
webUrl:
|
|
14
|
-
.refine(url => validation.isValidSharePointUrl(url) === true,
|
|
15
|
-
|
|
16
|
-
})
|
|
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
17
|
fileUrl: z.string().optional(),
|
|
18
|
-
fileId:
|
|
19
|
-
.refine(id => validation.isValidGuid(id), id => ({
|
|
20
|
-
message: `'${id}' is not a valid GUID.`
|
|
21
|
-
})).optional()),
|
|
18
|
+
fileId: z.uuid().optional().alias('i'),
|
|
22
19
|
label: z.string()
|
|
23
|
-
})
|
|
24
|
-
.strict();
|
|
20
|
+
});
|
|
25
21
|
class SpoFileVersionKeepCommand extends SpoCommand {
|
|
26
22
|
get name() {
|
|
27
23
|
return commands.FILE_VERSION_KEEP;
|
|
@@ -35,7 +31,7 @@ class SpoFileVersionKeepCommand extends SpoCommand {
|
|
|
35
31
|
getRefinedSchema(schema) {
|
|
36
32
|
return schema
|
|
37
33
|
.refine(options => [options.fileUrl, options.fileId].filter(o => o !== undefined).length === 1, {
|
|
38
|
-
|
|
34
|
+
error: `Specify 'fileUrl' or 'fileId', but not both.`
|
|
39
35
|
});
|
|
40
36
|
}
|
|
41
37
|
async commandAction(logger, args) {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { zod } from '../../../../utils/zod.js';
|
|
3
2
|
import { globalOptionsZod } from '../../../../Command.js';
|
|
4
3
|
import { spo } from '../../../../utils/spo.js';
|
|
5
4
|
import { validation } from '../../../../utils/validation.js';
|
|
@@ -7,25 +6,24 @@ import SpoCommand from '../../../base/SpoCommand.js';
|
|
|
7
6
|
import commands from '../../commands.js';
|
|
8
7
|
import request from '../../../../request.js';
|
|
9
8
|
import { entraGroup } from '../../../../utils/entraGroup.js';
|
|
10
|
-
const options =
|
|
11
|
-
.
|
|
12
|
-
url:
|
|
13
|
-
.refine(
|
|
14
|
-
|
|
15
|
-
}))
|
|
9
|
+
export const options = z.strictObject({
|
|
10
|
+
...globalOptionsZod.shape,
|
|
11
|
+
url: z.string()
|
|
12
|
+
.refine(url => validation.isValidSharePointUrl(url) === true, {
|
|
13
|
+
error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
|
|
14
|
+
}).alias('u'),
|
|
16
15
|
audienceIds: z.string()
|
|
17
|
-
.refine(audiences => validation.isValidGuidArray(audiences) === true,
|
|
18
|
-
|
|
19
|
-
})
|
|
16
|
+
.refine(audiences => validation.isValidGuidArray(audiences) === true, {
|
|
17
|
+
error: e => `The following GUIDs are invalid: ${e.input}.`
|
|
18
|
+
}).optional(),
|
|
20
19
|
audienceNames: z.string().optional(),
|
|
21
20
|
vivaConnectionsDefaultStart: z.boolean().optional(),
|
|
22
21
|
isInDraftMode: z.boolean().optional(),
|
|
23
22
|
order: z.number()
|
|
24
|
-
.refine(order => validation.isValidPositiveInteger(order) === true,
|
|
25
|
-
|
|
26
|
-
})
|
|
27
|
-
})
|
|
28
|
-
.strict();
|
|
23
|
+
.refine(order => validation.isValidPositiveInteger(order) === true, {
|
|
24
|
+
error: e => `'${e.input}' is not a positive integer.`
|
|
25
|
+
}).optional()
|
|
26
|
+
});
|
|
29
27
|
class SpoHomeSiteAddCommand extends SpoCommand {
|
|
30
28
|
get name() {
|
|
31
29
|
return commands.HOMESITE_ADD;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { zod } from '../../../../utils/zod.js';
|
|
3
2
|
import { globalOptionsZod } from '../../../../Command.js';
|
|
4
3
|
import { validation } from '../../../../utils/validation.js';
|
|
5
4
|
import { spo } from '../../../../utils/spo.js';
|
|
@@ -7,14 +6,14 @@ import SpoCommand from '../../../base/SpoCommand.js';
|
|
|
7
6
|
import commands from '../../commands.js';
|
|
8
7
|
import { odata } from '../../../../utils/odata.js';
|
|
9
8
|
import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
10
|
-
const options =
|
|
11
|
-
.
|
|
12
|
-
url:
|
|
13
|
-
.refine(url => validation.isValidSharePointUrl(url) === true,
|
|
14
|
-
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
export const options = z.strictObject({
|
|
10
|
+
...globalOptionsZod.shape,
|
|
11
|
+
url: 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
|
+
});
|
|
18
17
|
class SpoHomeSiteGetCommand extends SpoCommand {
|
|
19
18
|
get name() {
|
|
20
19
|
return commands.HOMESITE_GET;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { zod } from '../../../../utils/zod.js';
|
|
3
2
|
import { globalOptionsZod } from '../../../../Command.js';
|
|
4
3
|
import { validation } from '../../../../utils/validation.js';
|
|
5
4
|
import { cli } from '../../../../cli/cli.js';
|
|
@@ -7,15 +6,15 @@ import request from '../../../../request.js';
|
|
|
7
6
|
import { spo } from '../../../../utils/spo.js';
|
|
8
7
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
9
8
|
import commands from '../../commands.js';
|
|
10
|
-
const options =
|
|
11
|
-
.
|
|
12
|
-
url:
|
|
13
|
-
.refine(url => validation.isValidSharePointUrl(url) === true,
|
|
14
|
-
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
export const options = z.strictObject({
|
|
10
|
+
...globalOptionsZod.shape,
|
|
11
|
+
url: 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
|
+
force: z.boolean().optional().alias('f')
|
|
17
|
+
});
|
|
19
18
|
class SpoHomeSiteRemoveCommand extends SpoCommand {
|
|
20
19
|
get name() {
|
|
21
20
|
return commands.HOMESITE_REMOVE;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { zod } from '../../../../utils/zod.js';
|
|
3
2
|
import { globalOptionsZod } from '../../../../Command.js';
|
|
4
3
|
import request from '../../../../request.js';
|
|
5
4
|
import { spo } from '../../../../utils/spo.js';
|
|
@@ -7,24 +6,24 @@ import { validation } from '../../../../utils/validation.js';
|
|
|
7
6
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
8
7
|
import commands from '../../commands.js';
|
|
9
8
|
import { entraGroup } from '../../../../utils/entraGroup.js';
|
|
10
|
-
const
|
|
11
|
-
.
|
|
12
|
-
url:
|
|
13
|
-
.refine(
|
|
14
|
-
|
|
15
|
-
}))
|
|
9
|
+
export const options = z.strictObject({
|
|
10
|
+
...globalOptionsZod.shape,
|
|
11
|
+
url: z.string()
|
|
12
|
+
.refine(url => validation.isValidSharePointUrl(url) === true, {
|
|
13
|
+
error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
|
|
14
|
+
}).alias('u'),
|
|
16
15
|
vivaConnectionsDefaultStart: z.boolean().optional(),
|
|
17
16
|
draftMode: z.boolean().optional(),
|
|
18
17
|
audienceIds: z.string()
|
|
19
|
-
.refine(audiences => validation.isValidGuidArray(audiences) === true,
|
|
20
|
-
|
|
21
|
-
})
|
|
18
|
+
.refine(audiences => validation.isValidGuidArray(audiences) === true, {
|
|
19
|
+
error: e => `The following GUIDs are invalid: ${e.input}.`
|
|
20
|
+
}).optional(),
|
|
22
21
|
audienceNames: z.string().optional(),
|
|
23
22
|
targetedLicenseType: z.enum(['everyone', 'frontLineWorkers', 'informationWorkers']).optional(),
|
|
24
23
|
order: z.number()
|
|
25
|
-
.refine(order => validation.isValidPositiveInteger(order) === true,
|
|
26
|
-
|
|
27
|
-
})
|
|
24
|
+
.refine(order => validation.isValidPositiveInteger(order) === true, {
|
|
25
|
+
error: e => `'${e.input}' is not a positive integer.`
|
|
26
|
+
}).optional()
|
|
28
27
|
});
|
|
29
28
|
class SpoHomeSiteSetCommand extends SpoCommand {
|
|
30
29
|
get name() {
|
|
@@ -34,7 +33,7 @@ class SpoHomeSiteSetCommand extends SpoCommand {
|
|
|
34
33
|
return 'Updates an existing SharePoint home site.';
|
|
35
34
|
}
|
|
36
35
|
get schema() {
|
|
37
|
-
return
|
|
36
|
+
return options;
|
|
38
37
|
}
|
|
39
38
|
getRefinedSchema(schema) {
|
|
40
39
|
return schema
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
2
2
|
import { globalOptionsZod } from '../../../../Command.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
-
import { zod } from '../../../../utils/zod.js';
|
|
5
4
|
import commands from '../../commands.js';
|
|
6
5
|
import { DOMParser } from '@xmldom/xmldom';
|
|
7
6
|
import { validation } from '../../../../utils/validation.js';
|
|
@@ -9,23 +8,20 @@ import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
|
9
8
|
import request from '../../../../request.js';
|
|
10
9
|
import { formatting } from '../../../../utils/formatting.js';
|
|
11
10
|
import { cli } from '../../../../cli/cli.js';
|
|
12
|
-
const options =
|
|
13
|
-
.
|
|
14
|
-
webUrl:
|
|
15
|
-
.refine(url => validation.isValidSharePointUrl(url) === true,
|
|
16
|
-
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}))),
|
|
22
|
-
listTitle: zod.alias('t', z.string().optional()),
|
|
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
|
+
listId: z.uuid().optional().alias('i'),
|
|
19
|
+
listTitle: z.string().optional().alias('t'),
|
|
23
20
|
listUrl: z.string().optional(),
|
|
24
21
|
fieldName: z.string().optional(),
|
|
25
22
|
folderUrl: z.string().optional(),
|
|
26
|
-
force:
|
|
27
|
-
})
|
|
28
|
-
.strict();
|
|
23
|
+
force: z.boolean().optional().alias('f')
|
|
24
|
+
});
|
|
29
25
|
class SpoListDefaultValueClearCommand extends SpoCommand {
|
|
30
26
|
get name() {
|
|
31
27
|
return commands.LIST_DEFAULTVALUE_CLEAR;
|
|
@@ -39,10 +35,10 @@ class SpoListDefaultValueClearCommand extends SpoCommand {
|
|
|
39
35
|
getRefinedSchema(schema) {
|
|
40
36
|
return schema
|
|
41
37
|
.refine(options => [options.listId, options.listTitle, options.listUrl].filter(o => o !== undefined).length === 1, {
|
|
42
|
-
|
|
38
|
+
error: 'Use one of the following options: listId, listTitle, listUrl.'
|
|
43
39
|
})
|
|
44
40
|
.refine(options => (options.fieldName !== undefined) !== (options.folderUrl !== undefined) || (options.fieldName === undefined && options.folderUrl === undefined), {
|
|
45
|
-
|
|
41
|
+
error: `Specify 'fieldName' or 'folderUrl', but not both.`
|
|
46
42
|
});
|
|
47
43
|
}
|
|
48
44
|
async commandAction(logger, args) {
|