@pnp/cli-microsoft365 11.4.0-beta.13d597c → 11.4.0-beta.312ca0b
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/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/Command.js +2 -2
- package/dist/cli/cli.js +8 -8
- 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 +17 -18
- 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/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/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-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/spfx/commands/project/project-upgrade.js +4 -6
- 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/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-publish.js +9 -10
- package/dist/m365/spo/commands/page/page-section-remove.js +11 -12
- 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/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 +29 -0
- 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/spo/list/list-defaultvalue-get.mdx +118 -0
- package/npm-shrinkwrap.json +4 -11
- package/package.json +2 -2
package/dist/Command.js
CHANGED
|
@@ -13,9 +13,9 @@ import { settingsNames } from './settingsNames.js';
|
|
|
13
13
|
import { telemetry } from './telemetry.js';
|
|
14
14
|
import { accessToken } from './utils/accessToken.js';
|
|
15
15
|
import { md } from './utils/md.js';
|
|
16
|
+
import { optionsUtils } from './utils/optionsUtils.js';
|
|
16
17
|
import { prompt } from './utils/prompt.js';
|
|
17
18
|
import { zod } from './utils/zod.js';
|
|
18
|
-
import { optionsUtils } from './utils/optionsUtils.js';
|
|
19
19
|
export class CommandError {
|
|
20
20
|
constructor(message, code) {
|
|
21
21
|
this.message = message;
|
|
@@ -30,7 +30,7 @@ export class CommandErrorWithOutput {
|
|
|
30
30
|
}
|
|
31
31
|
export const globalOptionsZod = z.object({
|
|
32
32
|
query: z.string().optional(),
|
|
33
|
-
output:
|
|
33
|
+
output: z.enum(['csv', 'json', 'md', 'text', 'none']).optional().alias('o'),
|
|
34
34
|
debug: z.boolean().default(false),
|
|
35
35
|
verbose: z.boolean().default(false)
|
|
36
36
|
});
|
package/dist/cli/cli.js
CHANGED
|
@@ -153,13 +153,13 @@ async function execute(rawArgs) {
|
|
|
153
153
|
break;
|
|
154
154
|
}
|
|
155
155
|
else {
|
|
156
|
-
const hasNonRequiredErrors = result.error.
|
|
156
|
+
const hasNonRequiredErrors = result.error.issues.some(i => i.code !== 'invalid_type');
|
|
157
157
|
const shouldPrompt = cli.getSettingWithDefaultValue(settingsNames.prompt, true);
|
|
158
158
|
if (hasNonRequiredErrors === false &&
|
|
159
159
|
shouldPrompt) {
|
|
160
160
|
await cli.error('🌶️ Provide values for the following parameters:');
|
|
161
|
-
for (const
|
|
162
|
-
const optionName =
|
|
161
|
+
for (const issue of result.error.issues) {
|
|
162
|
+
const optionName = issue.path.join('.');
|
|
163
163
|
const optionInfo = cli.commandToExecute.options.find(o => o.name === optionName);
|
|
164
164
|
const answer = await cli.promptForValue(optionInfo);
|
|
165
165
|
// coerce the answer to the correct type
|
|
@@ -173,10 +173,10 @@ async function execute(rawArgs) {
|
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
else {
|
|
176
|
-
result.error.
|
|
177
|
-
if (
|
|
178
|
-
|
|
179
|
-
|
|
176
|
+
result.error.issues.forEach(i => {
|
|
177
|
+
if (i.code === 'invalid_type' &&
|
|
178
|
+
i.input === undefined) {
|
|
179
|
+
i.message = `Required option not specified`;
|
|
180
180
|
}
|
|
181
181
|
});
|
|
182
182
|
return cli.closeWithError(result.error, cli.optionsFromArgs, true);
|
|
@@ -793,7 +793,7 @@ async function closeWithError(error, args, showHelpIfEnabled = false) {
|
|
|
793
793
|
}
|
|
794
794
|
let errorMessage = error instanceof CommandError ? error.message : error;
|
|
795
795
|
if (error instanceof ZodError) {
|
|
796
|
-
errorMessage = error.
|
|
796
|
+
errorMessage = error.issues.map(i => (i.path.length > 0 ? `${i.path.join('.')}: ${i.message}` : i.message)).join(os.EOL);
|
|
797
797
|
}
|
|
798
798
|
if ((!args.options.output || args.options.output === 'json') &&
|
|
799
799
|
!cli.getSettingWithDefaultValue(settingsNames.printErrorsAsPlainText, true)) {
|
|
@@ -5,17 +5,16 @@ import { optionsUtils } from '../../../utils/optionsUtils.js';
|
|
|
5
5
|
import { zod } from '../../../utils/zod.js';
|
|
6
6
|
import AnonymousCommand from '../../base/AnonymousCommand.js';
|
|
7
7
|
import commands from '../commands.js';
|
|
8
|
-
export const options =
|
|
9
|
-
.
|
|
8
|
+
export const options = z.looseObject({
|
|
9
|
+
...globalOptionsZod.shape,
|
|
10
10
|
url: z.string(),
|
|
11
|
-
title:
|
|
12
|
-
description:
|
|
13
|
-
imageUrl:
|
|
14
|
-
actionUrl:
|
|
11
|
+
title: z.string().optional().alias('t'),
|
|
12
|
+
description: z.string().optional().alias('d'),
|
|
13
|
+
imageUrl: z.string().optional().alias('i'),
|
|
14
|
+
actionUrl: z.string().optional().alias('a'),
|
|
15
15
|
card: z.string().optional(),
|
|
16
16
|
cardData: z.string().optional()
|
|
17
|
-
})
|
|
18
|
-
.passthrough();
|
|
17
|
+
});
|
|
19
18
|
class AdaptiveCardSendCommand extends AnonymousCommand {
|
|
20
19
|
get name() {
|
|
21
20
|
return commands.SEND;
|
|
@@ -29,7 +28,7 @@ class AdaptiveCardSendCommand extends AnonymousCommand {
|
|
|
29
28
|
getRefinedSchema(schema) {
|
|
30
29
|
return schema
|
|
31
30
|
.refine(options => !options.cardData || options.card, {
|
|
32
|
-
|
|
31
|
+
error: 'When you specify cardData, you must also specify card.',
|
|
33
32
|
path: ['cardData']
|
|
34
33
|
})
|
|
35
34
|
.refine(options => {
|
|
@@ -44,7 +43,7 @@ class AdaptiveCardSendCommand extends AnonymousCommand {
|
|
|
44
43
|
}
|
|
45
44
|
return true;
|
|
46
45
|
}, {
|
|
47
|
-
|
|
46
|
+
error: 'Specified card is not a valid JSON string.',
|
|
48
47
|
path: ['card']
|
|
49
48
|
})
|
|
50
49
|
.refine(options => {
|
|
@@ -59,7 +58,7 @@ class AdaptiveCardSendCommand extends AnonymousCommand {
|
|
|
59
58
|
}
|
|
60
59
|
return true;
|
|
61
60
|
}, {
|
|
62
|
-
|
|
61
|
+
error: 'Specified cardData is not a valid JSON string.',
|
|
63
62
|
path: ['cardData']
|
|
64
63
|
});
|
|
65
64
|
}
|
|
@@ -4,11 +4,10 @@ import { settingsNames } from '../../../settingsNames.js';
|
|
|
4
4
|
import { browserUtil } from '../../../utils/browserUtil.js';
|
|
5
5
|
import AppCommand, { appCommandOptions } from '../../base/AppCommand.js';
|
|
6
6
|
import commands from '../commands.js';
|
|
7
|
-
const options =
|
|
8
|
-
.
|
|
7
|
+
export const options = z.strictObject({
|
|
8
|
+
...appCommandOptions.shape,
|
|
9
9
|
preview: z.boolean().optional().default(false)
|
|
10
|
-
})
|
|
11
|
-
.strict();
|
|
10
|
+
});
|
|
12
11
|
class AppOpenCommand extends AppCommand {
|
|
13
12
|
get name() {
|
|
14
13
|
return commands.OPEN;
|
|
@@ -5,13 +5,12 @@ import { odata } from '../../../../utils/odata.js';
|
|
|
5
5
|
import AppCommand, { appCommandOptions } from '../../../base/AppCommand.js';
|
|
6
6
|
import commands from '../../commands.js';
|
|
7
7
|
import { entraServicePrincipal } from '../../../../utils/entraServicePrincipal.js';
|
|
8
|
-
const options =
|
|
9
|
-
.
|
|
8
|
+
export const options = z.strictObject({
|
|
9
|
+
...appCommandOptions.shape,
|
|
10
10
|
applicationPermissions: z.string().optional(),
|
|
11
11
|
delegatedPermissions: z.string().optional(),
|
|
12
12
|
grantAdminConsent: z.boolean().optional()
|
|
13
|
-
})
|
|
14
|
-
.strict();
|
|
13
|
+
});
|
|
15
14
|
var ScopeType;
|
|
16
15
|
(function (ScopeType) {
|
|
17
16
|
ScopeType["Role"] = "Role";
|
|
@@ -30,7 +29,7 @@ class AppPermissionAddCommand extends AppCommand {
|
|
|
30
29
|
getRefinedSchema(schema) {
|
|
31
30
|
return schema
|
|
32
31
|
.refine(options => options.applicationPermissions || options.delegatedPermissions, {
|
|
33
|
-
|
|
32
|
+
error: 'Specify at least one of applicationPermissions or delegatedPermissions, or both.',
|
|
34
33
|
path: ['delegatedPermissions']
|
|
35
34
|
});
|
|
36
35
|
}
|
|
@@ -3,9 +3,9 @@ import { z } from 'zod';
|
|
|
3
3
|
import { cli } from '../../cli/cli.js';
|
|
4
4
|
import Command, { CommandError, globalOptionsZod } from '../../Command.js';
|
|
5
5
|
import { formatting } from '../../utils/formatting.js';
|
|
6
|
-
export const appCommandOptions =
|
|
7
|
-
.
|
|
8
|
-
appId: z.
|
|
6
|
+
export const appCommandOptions = z.object({
|
|
7
|
+
...globalOptionsZod.shape,
|
|
8
|
+
appId: z.uuid().optional()
|
|
9
9
|
});
|
|
10
10
|
export default class AppCommand extends Command {
|
|
11
11
|
get resource() {
|
|
@@ -3,15 +3,13 @@ import { cli } from '../../../../cli/cli.js';
|
|
|
3
3
|
import { globalOptionsZod } from '../../../../Command.js';
|
|
4
4
|
import request from '../../../../request.js';
|
|
5
5
|
import { formatting } from '../../../../utils/formatting.js';
|
|
6
|
-
import { zod } from '../../../../utils/zod.js';
|
|
7
6
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
8
7
|
import commands from '../../commands.js';
|
|
9
|
-
const options =
|
|
10
|
-
.
|
|
11
|
-
id:
|
|
12
|
-
name:
|
|
13
|
-
})
|
|
14
|
-
.strict();
|
|
8
|
+
export const options = z.strictObject({
|
|
9
|
+
...globalOptionsZod.shape,
|
|
10
|
+
id: z.string().optional().alias('i'),
|
|
11
|
+
name: z.string().optional().alias('n')
|
|
12
|
+
});
|
|
15
13
|
class BookingBusinessGetCommand extends GraphCommand {
|
|
16
14
|
get name() {
|
|
17
15
|
return commands.BUSINESS_GET;
|
|
@@ -25,7 +23,7 @@ class BookingBusinessGetCommand extends GraphCommand {
|
|
|
25
23
|
getRefinedSchema(schema) {
|
|
26
24
|
return schema
|
|
27
25
|
.refine(options => options.id || options.name, {
|
|
28
|
-
|
|
26
|
+
error: 'Specify either id or name'
|
|
29
27
|
});
|
|
30
28
|
}
|
|
31
29
|
async commandAction(logger, args) {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
1
2
|
import { globalOptionsZod } from '../../../../Command.js';
|
|
2
3
|
import { odata } from '../../../../utils/odata.js';
|
|
3
4
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
4
5
|
import commands from '../../commands.js';
|
|
5
|
-
const options = globalOptionsZod.
|
|
6
|
+
export const options = z.strictObject({ ...globalOptionsZod.shape });
|
|
6
7
|
class BookingBusinessListCommand extends GraphCommand {
|
|
7
8
|
get name() {
|
|
8
9
|
return commands.BUSINESS_LIST;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { globalOptionsZod } from '../../../../Command.js';
|
|
3
|
-
import { zod } from '../../../../utils/zod.js';
|
|
4
3
|
import config from '../../../../config.js';
|
|
5
4
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
6
5
|
import commands from '../../commands.js';
|
|
@@ -8,13 +7,12 @@ import { cli } from '../../../../cli/cli.js';
|
|
|
8
7
|
import { entraApp } from '../../../../utils/entraApp.js';
|
|
9
8
|
import { accessToken } from '../../../../utils/accessToken.js';
|
|
10
9
|
import auth from '../../../../Auth.js';
|
|
11
|
-
const options =
|
|
12
|
-
.
|
|
13
|
-
name:
|
|
14
|
-
scopes:
|
|
10
|
+
export const options = z.strictObject({
|
|
11
|
+
...globalOptionsZod.shape,
|
|
12
|
+
name: z.string().optional().default('CLI for M365').alias('n'),
|
|
13
|
+
scopes: z.string().optional().default('minimal').alias('s'),
|
|
15
14
|
saveToConfig: z.boolean().optional()
|
|
16
|
-
})
|
|
17
|
-
.strict();
|
|
15
|
+
});
|
|
18
16
|
class CliAppAddCommand extends GraphCommand {
|
|
19
17
|
get name() {
|
|
20
18
|
return commands.APP_ADD;
|
|
@@ -5,7 +5,7 @@ import { app } from '../../utils/app.js';
|
|
|
5
5
|
import { browserUtil } from '../../utils/browserUtil.js';
|
|
6
6
|
import AnonymousCommand from '../base/AnonymousCommand.js';
|
|
7
7
|
import commands from './commands.js';
|
|
8
|
-
const options = globalOptionsZod.strict();
|
|
8
|
+
export const options = globalOptionsZod.strict();
|
|
9
9
|
class DocsCommand extends AnonymousCommand {
|
|
10
10
|
get name() {
|
|
11
11
|
return commands.DOCS;
|
|
@@ -6,25 +6,24 @@ import { cli } from '../../cli/cli.js';
|
|
|
6
6
|
import { settingsNames } from '../../settingsNames.js';
|
|
7
7
|
import { zod } from '../../utils/zod.js';
|
|
8
8
|
import commands from './commands.js';
|
|
9
|
-
const options =
|
|
10
|
-
.
|
|
11
|
-
authType: zod.
|
|
9
|
+
export const options = z.strictObject({
|
|
10
|
+
...globalOptionsZod.shape,
|
|
11
|
+
authType: zod.coercedEnum(AuthType).optional().alias('t'),
|
|
12
12
|
cloud: zod.coercedEnum(CloudType).optional().default(CloudType.Public),
|
|
13
|
-
userName:
|
|
14
|
-
password:
|
|
15
|
-
certificateFile:
|
|
16
|
-
.refine(filePath => !filePath || fs.existsSync(filePath),
|
|
17
|
-
|
|
18
|
-
})
|
|
13
|
+
userName: z.string().optional().alias('u'),
|
|
14
|
+
password: z.string().optional().alias('p'),
|
|
15
|
+
certificateFile: z.string().optional().alias('c')
|
|
16
|
+
.refine(filePath => !filePath || fs.existsSync(filePath), {
|
|
17
|
+
error: e => `Certificate file ${e.input} does not exist`
|
|
18
|
+
}),
|
|
19
19
|
certificateBase64Encoded: z.string().optional(),
|
|
20
20
|
thumbprint: z.string().optional(),
|
|
21
21
|
appId: z.string().optional(),
|
|
22
22
|
tenant: z.string().optional(),
|
|
23
|
-
secret:
|
|
23
|
+
secret: z.string().optional().alias('s'),
|
|
24
24
|
connectionName: z.string().optional(),
|
|
25
25
|
ensure: z.boolean().optional()
|
|
26
|
-
})
|
|
27
|
-
.strict();
|
|
26
|
+
});
|
|
28
27
|
class LoginCommand extends Command {
|
|
29
28
|
get name() {
|
|
30
29
|
return commands.LOGIN;
|
|
@@ -38,19 +37,19 @@ class LoginCommand extends Command {
|
|
|
38
37
|
getRefinedSchema(schema) {
|
|
39
38
|
return schema
|
|
40
39
|
.refine(options => typeof options.appId !== 'undefined' || cli.getClientId() || options.authType === 'identity' || options.authType === 'federatedIdentity', {
|
|
41
|
-
|
|
40
|
+
error: `appId is required. TIP: use the "m365 setup" command to configure the default appId.`,
|
|
42
41
|
path: ['appId']
|
|
43
42
|
})
|
|
44
43
|
.refine(options => options.authType !== 'password' || options.userName, {
|
|
45
|
-
|
|
44
|
+
error: 'Username is required when using password authentication.',
|
|
46
45
|
path: ['userName']
|
|
47
46
|
})
|
|
48
47
|
.refine(options => options.authType !== 'password' || options.password, {
|
|
49
|
-
|
|
48
|
+
error: 'Password is required when using password authentication.',
|
|
50
49
|
path: ['password']
|
|
51
50
|
})
|
|
52
51
|
.refine(options => options.authType !== 'certificate' || !(options.certificateFile && options.certificateBase64Encoded), {
|
|
53
|
-
|
|
52
|
+
error: 'Specify either certificateFile or certificateBase64Encoded, but not both.',
|
|
54
53
|
path: ['certificateBase64Encoded']
|
|
55
54
|
})
|
|
56
55
|
.refine(options => options.authType !== 'certificate' ||
|
|
@@ -58,13 +57,13 @@ class LoginCommand extends Command {
|
|
|
58
57
|
options.certificateBase64Encoded ||
|
|
59
58
|
cli.getConfig().get(settingsNames.clientCertificateFile) ||
|
|
60
59
|
cli.getConfig().get(settingsNames.clientCertificateBase64Encoded), {
|
|
61
|
-
|
|
60
|
+
error: 'Specify either certificateFile or certificateBase64Encoded.',
|
|
62
61
|
path: ['certificateFile']
|
|
63
62
|
})
|
|
64
63
|
.refine(options => options.authType !== 'secret' ||
|
|
65
64
|
options.secret ||
|
|
66
65
|
cli.getConfig().get(settingsNames.clientSecret), {
|
|
67
|
-
|
|
66
|
+
error: 'Secret is required when using secret authentication.',
|
|
68
67
|
path: ['secret']
|
|
69
68
|
});
|
|
70
69
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import auth from '../../Auth.js';
|
|
2
2
|
import Command, { CommandError, globalOptionsZod } from '../../Command.js';
|
|
3
3
|
import commands from './commands.js';
|
|
4
|
-
const options = globalOptionsZod.strict();
|
|
4
|
+
export const options = globalOptionsZod.strict();
|
|
5
5
|
class LogoutCommand extends Command {
|
|
6
6
|
get name() {
|
|
7
7
|
return commands.LOGOUT;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
1
2
|
import auth from '../../Auth.js';
|
|
2
3
|
import Command, { CommandError, globalOptionsZod } from '../../Command.js';
|
|
3
4
|
import commands from './commands.js';
|
|
4
|
-
const options = globalOptionsZod.
|
|
5
|
+
export const options = z.strictObject({ ...globalOptionsZod.shape });
|
|
5
6
|
class StatusCommand extends Command {
|
|
6
7
|
get name() {
|
|
7
8
|
return commands.STATUS;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import assert from 'assert';
|
|
2
|
+
import { z } from 'zod';
|
|
2
3
|
import auth from '../../../Auth.js';
|
|
3
4
|
import Command, { CommandError, globalOptionsZod } from '../../../Command.js';
|
|
4
5
|
import commands from '../commands.js';
|
|
5
|
-
const options = globalOptionsZod.
|
|
6
|
+
export const options = z.strictObject({ ...globalOptionsZod.shape });
|
|
6
7
|
class ConnectionListCommand extends Command {
|
|
7
8
|
get name() {
|
|
8
9
|
return commands.LIST;
|
|
@@ -2,14 +2,12 @@ import fs from 'fs';
|
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { cli } from '../../../cli/cli.js';
|
|
4
4
|
import { CommandError, globalOptionsZod } from '../../../Command.js';
|
|
5
|
-
import { zod } from '../../../utils/zod.js';
|
|
6
5
|
import AnonymousCommand from '../../base/AnonymousCommand.js';
|
|
7
6
|
import commands from '../commands.js';
|
|
8
|
-
const options =
|
|
9
|
-
.
|
|
10
|
-
force:
|
|
11
|
-
})
|
|
12
|
-
.strict();
|
|
7
|
+
export const options = z.strictObject({
|
|
8
|
+
...globalOptionsZod.shape,
|
|
9
|
+
force: z.boolean().optional().alias('f')
|
|
10
|
+
});
|
|
13
11
|
class ContextRemoveCommand extends AnonymousCommand {
|
|
14
12
|
get name() {
|
|
15
13
|
return commands.REMOVE;
|
|
@@ -2,15 +2,13 @@ import fs from 'fs';
|
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { cli } from '../../../../cli/cli.js';
|
|
4
4
|
import { CommandError, globalOptionsZod } from '../../../../Command.js';
|
|
5
|
-
import { zod } from '../../../../utils/zod.js';
|
|
6
5
|
import ContextCommand from '../../../base/ContextCommand.js';
|
|
7
6
|
import commands from '../../commands.js';
|
|
8
|
-
const options =
|
|
9
|
-
.
|
|
10
|
-
name:
|
|
11
|
-
force:
|
|
12
|
-
})
|
|
13
|
-
.strict();
|
|
7
|
+
export const options = z.strictObject({
|
|
8
|
+
...globalOptionsZod.shape,
|
|
9
|
+
name: z.string().alias('n'),
|
|
10
|
+
force: z.boolean().optional().alias('f')
|
|
11
|
+
});
|
|
14
12
|
class ContextOptionRemoveCommand extends ContextCommand {
|
|
15
13
|
get name() {
|
|
16
14
|
return commands.OPTION_REMOVE;
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { globalOptionsZod } from '../../../../Command.js';
|
|
3
3
|
import request from "../../../../request.js";
|
|
4
|
-
import { zod } from '../../../../utils/zod.js';
|
|
5
4
|
import GraphCommand from "../../../base/GraphCommand.js";
|
|
6
5
|
import commands from "../../commands.js";
|
|
7
|
-
const options =
|
|
8
|
-
.
|
|
9
|
-
displayName:
|
|
10
|
-
description:
|
|
6
|
+
const options = z.looseObject({
|
|
7
|
+
...globalOptionsZod.shape,
|
|
8
|
+
displayName: z.string().alias('n'),
|
|
9
|
+
description: z.string().optional().alias('d'),
|
|
11
10
|
hiddenMembership: z.boolean().optional()
|
|
12
|
-
})
|
|
13
|
-
.passthrough();
|
|
11
|
+
});
|
|
14
12
|
class EntraAdministrativeUnitAddCommand extends GraphCommand {
|
|
15
13
|
get name() {
|
|
16
14
|
return commands.ADMINISTRATIVEUNIT_ADD;
|
|
@@ -4,14 +4,12 @@ import GraphCommand from "../../../base/GraphCommand.js";
|
|
|
4
4
|
import commands from "../../commands.js";
|
|
5
5
|
import { entraAdministrativeUnit } from "../../../../utils/entraAdministrativeUnit.js";
|
|
6
6
|
import { globalOptionsZod } from "../../../../Command.js";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
})
|
|
14
|
-
.strict();
|
|
7
|
+
export const options = z.strictObject({
|
|
8
|
+
...globalOptionsZod.shape,
|
|
9
|
+
id: z.uuid().optional().alias('i'),
|
|
10
|
+
displayName: z.string().optional().alias('n'),
|
|
11
|
+
properties: z.string().optional().alias('p')
|
|
12
|
+
});
|
|
15
13
|
class EntraAdministrativeUnitGetCommand extends GraphCommand {
|
|
16
14
|
get name() {
|
|
17
15
|
return commands.ADMINISTRATIVEUNIT_GET;
|
|
@@ -25,7 +23,7 @@ class EntraAdministrativeUnitGetCommand extends GraphCommand {
|
|
|
25
23
|
getRefinedSchema(schema) {
|
|
26
24
|
return schema
|
|
27
25
|
.refine(options => [options.id, options.displayName].filter(Boolean).length === 1, {
|
|
28
|
-
|
|
26
|
+
error: 'Specify either id or displayName'
|
|
29
27
|
});
|
|
30
28
|
}
|
|
31
29
|
async commandAction(logger, args) {
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { globalOptionsZod } from '../../../../Command.js';
|
|
3
3
|
import { odata } from '../../../../utils/odata.js';
|
|
4
|
-
import { zod } from '../../../../utils/zod.js';
|
|
5
4
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
6
5
|
import commands from '../../commands.js';
|
|
7
|
-
const options =
|
|
8
|
-
.
|
|
9
|
-
properties:
|
|
10
|
-
})
|
|
6
|
+
export const options = z.strictObject({
|
|
7
|
+
...globalOptionsZod.shape,
|
|
8
|
+
properties: z.string().optional().alias('p')
|
|
9
|
+
});
|
|
11
10
|
class EntraAdministrativeUnitListCommand extends GraphCommand {
|
|
12
11
|
get name() {
|
|
13
12
|
return commands.ADMINISTRATIVEUNIT_LIST;
|
|
@@ -3,16 +3,14 @@ import { cli } from '../../../../cli/cli.js';
|
|
|
3
3
|
import { globalOptionsZod } from '../../../../Command.js';
|
|
4
4
|
import request from '../../../../request.js';
|
|
5
5
|
import { entraAdministrativeUnit } from '../../../../utils/entraAdministrativeUnit.js';
|
|
6
|
-
import { zod } from '../../../../utils/zod.js';
|
|
7
6
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
8
7
|
import commands from '../../commands.js';
|
|
9
|
-
const options =
|
|
10
|
-
.
|
|
11
|
-
id:
|
|
12
|
-
displayName:
|
|
13
|
-
force:
|
|
14
|
-
})
|
|
15
|
-
.strict();
|
|
8
|
+
export const options = z.strictObject({
|
|
9
|
+
...globalOptionsZod.shape,
|
|
10
|
+
id: z.uuid().optional().alias('i'),
|
|
11
|
+
displayName: z.string().optional().alias('n'),
|
|
12
|
+
force: z.boolean().optional().alias('f')
|
|
13
|
+
});
|
|
16
14
|
class EntraAdministrativeUnitRemoveCommand extends GraphCommand {
|
|
17
15
|
get name() {
|
|
18
16
|
return commands.ADMINISTRATIVEUNIT_REMOVE;
|
|
@@ -26,10 +24,10 @@ class EntraAdministrativeUnitRemoveCommand extends GraphCommand {
|
|
|
26
24
|
getRefinedSchema(schema) {
|
|
27
25
|
return schema
|
|
28
26
|
.refine(options => options.id || options.displayName, {
|
|
29
|
-
|
|
27
|
+
error: 'Specify either id or displayName'
|
|
30
28
|
})
|
|
31
29
|
.refine(options => !(options.id && options.displayName), {
|
|
32
|
-
|
|
30
|
+
error: 'Specify either id or displayName but not both'
|
|
33
31
|
});
|
|
34
32
|
}
|
|
35
33
|
async commandAction(logger, args) {
|
|
@@ -2,7 +2,7 @@ import { odata } from '../../../../utils/odata.js';
|
|
|
2
2
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
3
3
|
import commands from '../../commands.js';
|
|
4
4
|
import { globalOptionsZod } from '../../../../Command.js';
|
|
5
|
-
const options = globalOptionsZod.strict();
|
|
5
|
+
export const options = globalOptionsZod.strict();
|
|
6
6
|
class EntraLicenseListCommand extends GraphCommand {
|
|
7
7
|
get name() {
|
|
8
8
|
return commands.LICENSE_LIST;
|
|
@@ -3,11 +3,10 @@ import { globalOptionsZod } from '../../../../Command.js';
|
|
|
3
3
|
import request from '../../../../request.js';
|
|
4
4
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
5
5
|
import commands from '../../commands.js';
|
|
6
|
-
|
|
7
|
-
const options = globalOptionsZod
|
|
6
|
+
export const options = globalOptionsZod
|
|
8
7
|
.extend({
|
|
9
|
-
displayName:
|
|
10
|
-
description:
|
|
8
|
+
displayName: z.string().alias('n'),
|
|
9
|
+
description: z.string().optional().alias('d')
|
|
11
10
|
}).strict();
|
|
12
11
|
class EntraMultitenantAddCommand extends GraphCommand {
|
|
13
12
|
get name() {
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { globalOptionsZod } from '../../../../Command.js';
|
|
3
|
-
import { zod } from '../../../../utils/zod.js';
|
|
4
3
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
5
4
|
import commands from '../../commands.js';
|
|
6
5
|
import { odata } from '../../../../utils/odata.js';
|
|
7
|
-
const options =
|
|
8
|
-
.
|
|
9
|
-
properties:
|
|
10
|
-
})
|
|
11
|
-
.strict();
|
|
6
|
+
export const options = z.strictObject({
|
|
7
|
+
...globalOptionsZod.shape,
|
|
8
|
+
properties: z.string().optional().alias('p')
|
|
9
|
+
});
|
|
12
10
|
class EntraOrganizationListCommand extends GraphCommand {
|
|
13
11
|
get name() {
|
|
14
12
|
return commands.ORGANIZATION_LIST;
|