@pnp/cli-microsoft365 9.0.0-beta.2f8dd1e → 9.0.0-beta.39e78b2
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/.eslintrc.cjs +1 -0
- package/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/Auth.js +10 -18
- package/dist/Command.js +50 -5
- package/dist/chili/chili.js +0 -23
- package/dist/cli/cli.js +100 -100
- package/dist/config.js +1 -1
- package/dist/m365/app/commands/permission/permission-add.js +9 -9
- package/dist/m365/cli/commands/cli-consent.js +3 -7
- package/dist/m365/commands/login.js +49 -96
- package/dist/m365/commands/setup.js +0 -4
- package/dist/m365/commands/status.js +2 -2
- package/dist/m365/connection/commands/connection-remove.js +6 -2
- package/dist/m365/connection/commands/connection-set.js +4 -1
- package/dist/m365/connection/commands/connection-use.js +25 -4
- package/dist/m365/entra/commands/enterpriseapp/enterpriseapp-add.js +13 -13
- package/dist/m365/entra/commands/enterpriseapp/enterpriseapp-get.js +18 -18
- package/dist/m365/entra/commands/enterpriseapp/enterpriseapp-list.js +1 -1
- package/dist/m365/entra/commands/enterpriseapp/enterpriseapp-remove.js +123 -0
- package/dist/m365/entra/commands/group/group-set.js +256 -0
- package/dist/m365/entra/commands/group/group-user-list.js +4 -4
- package/dist/m365/entra/commands/m365group/m365group-conversation-post-list.js +4 -4
- package/dist/m365/entra/commands/m365group/m365group-recyclebinitem-list.js +3 -3
- package/dist/m365/entra/commands/m365group/m365group-set.js +66 -29
- package/dist/m365/entra/commands/m365group/m365group-user-add.js +109 -32
- package/dist/m365/entra/commands/m365group/m365group-user-list.js +6 -9
- package/dist/m365/entra/commands/m365group/m365group-user-set.js +159 -84
- package/dist/m365/entra/commands/multitenant/MultitenantOrganization.js +2 -0
- package/dist/m365/entra/commands/multitenant/multitenant-add.js +65 -0
- package/dist/m365/entra/commands/multitenant/multitenant-get.js +32 -0
- package/dist/m365/entra/commands/multitenant/multitenant-remove.js +118 -0
- package/dist/m365/entra/commands/multitenant/multitenant-set.js +72 -0
- package/dist/m365/entra/commands.js +7 -0
- package/dist/m365/external/commands/connection/connection-doctor.js +10 -24
- package/dist/m365/flow/commands/flow-get.js +1 -1
- package/dist/m365/flow/commands/flow-list.js +23 -24
- package/dist/m365/graph/commands/subscription/subscription-add.js +4 -2
- package/dist/m365/onenote/commands/notebook/notebook-add.js +132 -0
- package/dist/m365/onenote/commands.js +1 -0
- package/dist/m365/outlook/commands/message/message-get.js +11 -11
- package/dist/m365/pa/commands/app/app-export.js +13 -7
- package/dist/m365/spe/ContainerTypeProperties.js +2 -0
- package/dist/m365/spe/commands/containertype/containertype-list.js +49 -0
- package/dist/m365/spe/commands.js +2 -1
- package/dist/m365/spfx/commands/project/DeployWorkflow.js +1 -1
- package/dist/m365/spfx/commands/project/base-project-command.js +36 -126
- package/dist/m365/spfx/commands/project/project-github-workflow-add.js +1 -10
- package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-get.js +16 -22
- package/dist/m365/spo/commands/cdn/cdn-get.js +12 -15
- package/dist/m365/spo/commands/cdn/cdn-set.js +6 -4
- package/dist/m365/spo/commands/commandset/commandset-get.js +31 -17
- package/dist/m365/spo/commands/contenttype/contenttype-field-list.js +124 -0
- package/dist/m365/spo/commands/field/field-list.js +1 -1
- package/dist/m365/spo/commands/file/file-copy.js +55 -34
- package/dist/m365/spo/commands/file/file-roleassignment-add.js +1 -1
- package/dist/m365/spo/commands/file/file-roleinheritance-break.js +1 -1
- package/dist/m365/spo/commands/file/file-roleinheritance-reset.js +1 -1
- package/dist/m365/spo/commands/folder/folder-retentionlabel-ensure.js +1 -1
- package/dist/m365/spo/commands/folder/folder-set.js +0 -4
- package/dist/m365/spo/commands/folder/folder-sharinglink-get.js +86 -0
- package/dist/m365/spo/commands/folder/folder-sharinglink-list.js +110 -0
- package/dist/m365/spo/commands/group/group-member-add.js +103 -99
- package/dist/m365/spo/commands/list/ListInstance.js +6 -1
- package/dist/m365/spo/commands/list/list-get.js +9 -3
- package/dist/m365/spo/commands/list/list-list.js +1 -4
- package/dist/m365/spo/commands/list/list-roleassignment-add.js +46 -21
- package/dist/m365/spo/commands/list/list-roleassignment-remove.js +48 -46
- package/dist/m365/spo/commands/page/page-clientsidewebpart-add.js +2 -3
- package/dist/m365/spo/commands/page/page-text-add.js +2 -3
- package/dist/m365/spo/commands/site/site-appcatalog-remove.js +48 -24
- package/dist/m365/spo/commands/site/site-get.js +12 -16
- package/dist/m365/spo/commands/site/site-remove.js +1 -7
- package/dist/m365/spo/commands/spo-search.js +3 -4
- package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-get.js +19 -5
- package/dist/m365/spo/commands/tenant/tenant-commandset-get.js +20 -6
- package/dist/m365/spo/commands/tenant/tenant-recyclebinitem-restore.js +2 -22
- package/dist/m365/spo/commands.js +3 -1
- package/dist/m365/teams/commands/meeting/meeting-attendancereport-get.js +119 -0
- package/dist/m365/teams/commands/message/message-remove.js +112 -0
- package/dist/m365/teams/commands/message/message-restore.js +106 -0
- package/dist/m365/teams/commands.js +3 -0
- package/dist/m365/viva/commands/engage/engage-community-add.js +166 -0
- package/dist/m365/viva/commands/engage/engage-group-list.js +0 -5
- package/dist/m365/viva/commands/engage/engage-group-user-add.js +0 -5
- package/dist/m365/viva/commands/engage/engage-group-user-remove.js +0 -5
- package/dist/m365/viva/commands/engage/engage-message-add.js +0 -5
- package/dist/m365/viva/commands/engage/engage-message-get.js +0 -5
- package/dist/m365/viva/commands/engage/engage-message-like-set.js +0 -5
- package/dist/m365/viva/commands/engage/engage-message-list.js +0 -5
- package/dist/m365/viva/commands/engage/engage-message-remove.js +0 -5
- package/dist/m365/viva/commands/engage/engage-network-list.js +0 -5
- package/dist/m365/viva/commands/engage/engage-report-activitycounts.js +0 -8
- package/dist/m365/viva/commands/engage/engage-report-activityusercounts.js +0 -8
- package/dist/m365/viva/commands/engage/engage-report-activityuserdetail.js +0 -8
- package/dist/m365/viva/commands/engage/engage-report-deviceusagedistributionusercounts.js +0 -8
- package/dist/m365/viva/commands/engage/engage-report-deviceusageusercounts.js +0 -8
- package/dist/m365/viva/commands/engage/engage-report-deviceusageuserdetail.js +0 -8
- package/dist/m365/viva/commands/engage/engage-report-groupsactivitycounts.js +0 -8
- package/dist/m365/viva/commands/engage/engage-report-groupsactivitydetail.js +0 -8
- package/dist/m365/viva/commands/engage/engage-report-groupsactivitygroupcounts.js +0 -8
- package/dist/m365/viva/commands/engage/engage-search.js +0 -5
- package/dist/m365/viva/commands/engage/engage-user-get.js +0 -5
- package/dist/m365/viva/commands/engage/engage-user-list.js +0 -5
- package/dist/m365/viva/commands.js +1 -0
- package/dist/utils/drive.js +61 -0
- package/dist/utils/formatting.js +30 -1
- package/dist/utils/spo.js +143 -6
- package/dist/utils/teams.js +49 -0
- package/dist/utils/validation.js +19 -0
- package/dist/utils/zod.js +124 -0
- package/docs/docs/cmd/app/permission/permission-add.mdx +5 -5
- package/docs/docs/cmd/cli/cli-consent.mdx +1 -1
- package/docs/docs/cmd/connection/connection-use.mdx +8 -2
- package/docs/docs/cmd/entra/enterpriseapp/enterpriseapp-add.mdx +12 -12
- package/docs/docs/cmd/entra/enterpriseapp/enterpriseapp-get.mdx +14 -14
- package/docs/docs/cmd/entra/enterpriseapp/enterpriseapp-list.mdx +5 -5
- package/docs/docs/cmd/entra/enterpriseapp/enterpriseapp-remove.mdx +65 -0
- package/docs/docs/cmd/entra/group/group-add.mdx +0 -4
- package/docs/docs/cmd/entra/group/group-set.mdx +89 -0
- package/docs/docs/cmd/entra/group/group-user-list.mdx +7 -7
- package/docs/docs/cmd/entra/m365group/m365group-conversation-post-list.mdx +5 -5
- package/docs/docs/cmd/entra/m365group/m365group-recyclebinitem-list.mdx +3 -3
- package/docs/docs/cmd/entra/m365group/m365group-set.mdx +37 -7
- package/docs/docs/cmd/entra/m365group/m365group-user-add.mdx +28 -10
- package/docs/docs/cmd/entra/m365group/m365group-user-list.mdx +1 -1
- package/docs/docs/cmd/entra/m365group/m365group-user-set.mdx +35 -11
- package/docs/docs/cmd/entra/multitenant/multitenant-add.mdx +107 -0
- package/docs/docs/cmd/entra/multitenant/multitenant-get.mdx +94 -0
- package/docs/docs/cmd/entra/multitenant/multitenant-remove.mdx +58 -0
- package/docs/docs/cmd/entra/multitenant/multitenant-set.mdx +53 -0
- package/docs/docs/cmd/external/connection/connection-doctor.mdx +9 -9
- package/docs/docs/cmd/flow/flow-get.mdx +149 -283
- package/docs/docs/cmd/flow/flow-list.mdx +114 -56
- package/docs/docs/cmd/graph/subscription/subscription-add.mdx +18 -0
- package/docs/docs/cmd/onenote/notebook/notebook-add.mdx +169 -0
- package/docs/docs/cmd/outlook/message/message-get.mdx +5 -5
- package/docs/docs/cmd/pa/app/app-export.mdx +15 -9
- package/docs/docs/cmd/planner/plan/plan-remove.mdx +1 -1
- package/docs/docs/cmd/spe/containertype/containertype-list.mdx +102 -0
- package/docs/docs/cmd/spfx/project/project-github-workflow-add.mdx +11 -12
- package/docs/docs/cmd/spo/app/app-uninstall.mdx +1 -1
- package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-get.mdx +88 -38
- package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-list.mdx +22 -28
- package/docs/docs/cmd/spo/cdn/cdn-set.mdx +3 -3
- package/docs/docs/cmd/spo/commandset/commandset-get.mdx +75 -24
- package/docs/docs/cmd/spo/commandset/commandset-list.mdx +26 -32
- package/docs/docs/cmd/spo/contenttype/contenttype-field-list.mdx +172 -0
- package/docs/docs/cmd/spo/contenttype/contenttype-list.mdx +3 -3
- package/docs/docs/cmd/spo/field/field-list.mdx +3 -3
- package/docs/docs/cmd/spo/file/file-copy.mdx +119 -12
- package/docs/docs/cmd/spo/file/file-retentionlabel-ensure.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-roleassignment-add.mdx +2 -2
- package/docs/docs/cmd/spo/file/file-roleassignment-remove.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-roleinheritance-break.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-roleinheritance-reset.mdx +1 -1
- package/docs/docs/cmd/spo/folder/folder-retentionlabel-ensure.mdx +2 -2
- package/docs/docs/cmd/spo/folder/folder-set.mdx +0 -6
- package/docs/docs/cmd/spo/folder/folder-sharinglink-get.mdx +110 -0
- package/docs/docs/cmd/spo/folder/folder-sharinglink-list.mdx +114 -0
- package/docs/docs/cmd/spo/group/group-member-add.mdx +34 -27
- package/docs/docs/cmd/spo/list/list-get.mdx +6 -0
- package/docs/docs/cmd/spo/list/list-list.mdx +5 -7
- package/docs/docs/cmd/spo/list/list-roleassignment-add.mdx +15 -3
- package/docs/docs/cmd/spo/list/list-roleassignment-remove.mdx +15 -3
- package/docs/docs/cmd/spo/listitem/listitem-retentionlabel-ensure.mdx +4 -4
- package/docs/docs/cmd/spo/listitem/listitem-retentionlabel-remove.mdx +1 -1
- package/docs/docs/cmd/spo/listitem/listitem-roleassignment-add.mdx +9 -9
- package/docs/docs/cmd/spo/listitem/listitem-roleassignment-remove.mdx +7 -7
- package/docs/docs/cmd/spo/site/site-appcatalog-remove.mdx +11 -2
- package/docs/docs/cmd/spo/site/site-recyclebinitem-list.mdx +1 -1
- package/docs/docs/cmd/spo/site/site-remove.mdx +0 -3
- package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-get.mdx +79 -30
- package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-list.mdx +20 -19
- package/docs/docs/cmd/spo/tenant/tenant-commandset-get.mdx +84 -38
- package/docs/docs/cmd/spo/tenant/tenant-commandset-list.mdx +20 -19
- package/docs/docs/cmd/spo/tenant/tenant-recyclebinitem-restore.mdx +2 -49
- package/docs/docs/cmd/spo/web/web-roleassignment-add.mdx +1 -1
- package/docs/docs/cmd/spo/web/web-roleassignment-remove.mdx +1 -1
- package/docs/docs/cmd/teams/meeting/meeting-attendancereport-get.mdx +138 -0
- package/docs/docs/cmd/teams/meeting/meeting-list.mdx +7 -3
- package/docs/docs/cmd/teams/message/message-remove.mdx +64 -0
- package/docs/docs/cmd/teams/message/message-restore.mdx +62 -0
- package/docs/docs/cmd/viva/engage/engage-community-add.mdx +168 -0
- package/npm-shrinkwrap.json +986 -1326
- package/package.json +27 -24
- package/dist/m365/viva/commands/engage/yammerCommands.js +0 -25
|
@@ -1,17 +1,30 @@
|
|
|
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 _LoginCommand_instances, _a, _LoginCommand_initTelemetry, _LoginCommand_initOptions, _LoginCommand_initValidators;
|
|
7
1
|
import fs from 'fs';
|
|
2
|
+
import { z } from 'zod';
|
|
8
3
|
import auth, { AuthType, CloudType } from '../../Auth.js';
|
|
9
|
-
import Command, { CommandError } from '../../Command.js';
|
|
4
|
+
import Command, { CommandError, globalOptionsZod } from '../../Command.js';
|
|
5
|
+
import { cli } from '../../cli/cli.js';
|
|
10
6
|
import config from '../../config.js';
|
|
11
|
-
import { misc } from '../../utils/misc.js';
|
|
12
|
-
import commands from './commands.js';
|
|
13
7
|
import { settingsNames } from '../../settingsNames.js';
|
|
14
|
-
import {
|
|
8
|
+
import { zod } from '../../utils/zod.js';
|
|
9
|
+
import commands from './commands.js';
|
|
10
|
+
const options = globalOptionsZod
|
|
11
|
+
.extend({
|
|
12
|
+
authType: zod.alias('t', z.enum(['certificate', 'deviceCode', 'password', 'identity', 'browser', 'secret']).optional()),
|
|
13
|
+
cloud: z.nativeEnum(CloudType).optional().default(CloudType.Public),
|
|
14
|
+
userName: zod.alias('u', z.string().optional()),
|
|
15
|
+
password: zod.alias('p', z.string().optional()),
|
|
16
|
+
certificateFile: zod.alias('c', z.string().optional()
|
|
17
|
+
.refine(filePath => !filePath || fs.existsSync(filePath), filePath => ({
|
|
18
|
+
message: `Certificate file ${filePath} does not exist`
|
|
19
|
+
}))),
|
|
20
|
+
certificateBase64Encoded: z.string().optional(),
|
|
21
|
+
thumbprint: z.string().optional(),
|
|
22
|
+
appId: z.string().optional(),
|
|
23
|
+
tenant: z.string().optional(),
|
|
24
|
+
secret: zod.alias('s', z.string().optional()),
|
|
25
|
+
connectionName: z.string().optional()
|
|
26
|
+
})
|
|
27
|
+
.strict();
|
|
15
28
|
class LoginCommand extends Command {
|
|
16
29
|
get name() {
|
|
17
30
|
return commands.LOGIN;
|
|
@@ -19,12 +32,31 @@ class LoginCommand extends Command {
|
|
|
19
32
|
get description() {
|
|
20
33
|
return 'Log in to Microsoft 365';
|
|
21
34
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
35
|
+
get schema() {
|
|
36
|
+
return options;
|
|
37
|
+
}
|
|
38
|
+
getRefinedSchema(schema) {
|
|
39
|
+
return schema
|
|
40
|
+
.refine(options => options.authType !== 'password' || options.userName, {
|
|
41
|
+
message: 'Username is required when using password authentication',
|
|
42
|
+
path: ['userName']
|
|
43
|
+
})
|
|
44
|
+
.refine(options => options.authType !== 'password' || options.password, {
|
|
45
|
+
message: 'Password is required when using password authentication',
|
|
46
|
+
path: ['password']
|
|
47
|
+
})
|
|
48
|
+
.refine(options => options.authType !== 'certificate' || !(options.certificateFile && options.certificateBase64Encoded), {
|
|
49
|
+
message: 'Specify either certificateFile or certificateBase64Encoded, but not both.',
|
|
50
|
+
path: ['certificateBase64Encoded']
|
|
51
|
+
})
|
|
52
|
+
.refine(options => options.authType !== 'certificate' || options.certificateFile || options.certificateBase64Encoded, {
|
|
53
|
+
message: 'Specify either certificateFile or certificateBase64Encoded',
|
|
54
|
+
path: ['certificateFile']
|
|
55
|
+
})
|
|
56
|
+
.refine(options => options.authType !== 'secret' || options.secret, {
|
|
57
|
+
message: 'Secret is required when using secret authentication',
|
|
58
|
+
path: ['secret']
|
|
59
|
+
});
|
|
28
60
|
}
|
|
29
61
|
async commandAction(logger, args) {
|
|
30
62
|
// disconnect before re-connecting
|
|
@@ -64,12 +96,7 @@ class LoginCommand extends Command {
|
|
|
64
96
|
auth.connection.secret = args.options.secret;
|
|
65
97
|
break;
|
|
66
98
|
}
|
|
67
|
-
|
|
68
|
-
auth.connection.cloudType = CloudType[args.options.cloud];
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
auth.connection.cloudType = CloudType.Public;
|
|
72
|
-
}
|
|
99
|
+
auth.connection.cloudType = args.options.cloud;
|
|
73
100
|
try {
|
|
74
101
|
await auth.ensureAccessToken(auth.defaultResource, logger, this.debug);
|
|
75
102
|
auth.connection.active = true;
|
|
@@ -102,79 +129,5 @@ class LoginCommand extends Command {
|
|
|
102
129
|
await this.commandAction(logger, args);
|
|
103
130
|
}
|
|
104
131
|
}
|
|
105
|
-
_a = LoginCommand, _LoginCommand_instances = new WeakSet(), _LoginCommand_initTelemetry = function _LoginCommand_initTelemetry() {
|
|
106
|
-
this.telemetry.push((args) => {
|
|
107
|
-
Object.assign(this.telemetryProperties, {
|
|
108
|
-
authType: args.options.authType || cli.getSettingWithDefaultValue(settingsNames.authType, 'deviceCode'),
|
|
109
|
-
cloud: args.options.cloud ?? CloudType.Public
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
}, _LoginCommand_initOptions = function _LoginCommand_initOptions() {
|
|
113
|
-
this.options.unshift({
|
|
114
|
-
option: '-t, --authType [authType]',
|
|
115
|
-
autocomplete: _a.allowedAuthTypes
|
|
116
|
-
}, {
|
|
117
|
-
option: '-u, --userName [userName]'
|
|
118
|
-
}, {
|
|
119
|
-
option: '-p, --password [password]'
|
|
120
|
-
}, {
|
|
121
|
-
option: '-c, --certificateFile [certificateFile]'
|
|
122
|
-
}, {
|
|
123
|
-
option: '--certificateBase64Encoded [certificateBase64Encoded]'
|
|
124
|
-
}, {
|
|
125
|
-
option: '--thumbprint [thumbprint]'
|
|
126
|
-
}, {
|
|
127
|
-
option: '--appId [appId]'
|
|
128
|
-
}, {
|
|
129
|
-
option: '--tenant [tenant]'
|
|
130
|
-
}, {
|
|
131
|
-
option: '-s, --secret [secret]'
|
|
132
|
-
}, {
|
|
133
|
-
option: '--cloud [cloud]',
|
|
134
|
-
autocomplete: misc.getEnums(CloudType)
|
|
135
|
-
}, {
|
|
136
|
-
option: '--connectionName [connectionName]'
|
|
137
|
-
});
|
|
138
|
-
}, _LoginCommand_initValidators = function _LoginCommand_initValidators() {
|
|
139
|
-
this.validators.push(async (args) => {
|
|
140
|
-
const authType = args.options.authType || cli.getSettingWithDefaultValue(settingsNames.authType, 'deviceCode');
|
|
141
|
-
if (authType === 'password') {
|
|
142
|
-
if (!args.options.userName) {
|
|
143
|
-
return 'Required option userName missing';
|
|
144
|
-
}
|
|
145
|
-
if (!args.options.password) {
|
|
146
|
-
return 'Required option password missing';
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
if (authType === 'certificate') {
|
|
150
|
-
if (args.options.certificateFile && args.options.certificateBase64Encoded) {
|
|
151
|
-
return 'Specify either certificateFile or certificateBase64Encoded, but not both.';
|
|
152
|
-
}
|
|
153
|
-
if (!args.options.certificateFile && !args.options.certificateBase64Encoded) {
|
|
154
|
-
return 'Specify either certificateFile or certificateBase64Encoded';
|
|
155
|
-
}
|
|
156
|
-
if (args.options.certificateFile) {
|
|
157
|
-
if (!fs.existsSync(args.options.certificateFile)) {
|
|
158
|
-
return `File '${args.options.certificateFile}' does not exist`;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
if (authType &&
|
|
163
|
-
_a.allowedAuthTypes.indexOf(authType) < 0) {
|
|
164
|
-
return `'${authType}' is not a valid authentication type. Allowed authentication types are ${_a.allowedAuthTypes.join(', ')}`;
|
|
165
|
-
}
|
|
166
|
-
if (authType === 'secret') {
|
|
167
|
-
if (!args.options.secret) {
|
|
168
|
-
return 'Required option secret missing';
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
if (args.options.cloud &&
|
|
172
|
-
typeof CloudType[args.options.cloud] === 'undefined') {
|
|
173
|
-
return `${args.options.cloud} is not a valid value for cloud. Valid options are ${misc.getEnums(CloudType).join(', ')}`;
|
|
174
|
-
}
|
|
175
|
-
return true;
|
|
176
|
-
});
|
|
177
|
-
};
|
|
178
|
-
LoginCommand.allowedAuthTypes = ['certificate', 'deviceCode', 'password', 'identity', 'browser', 'secret'];
|
|
179
132
|
export default new LoginCommand();
|
|
180
133
|
//# sourceMappingURL=login.js.map
|
|
@@ -42,8 +42,6 @@ class SetupCommand extends AnonymousCommand {
|
|
|
42
42
|
await this.configureSettings(settings, true, logger);
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
|
-
// stop the spinner. Fixes #5598
|
|
46
|
-
cli.spinner.stop();
|
|
47
45
|
await logger.logToStderr(`Welcome to the CLI for Microsoft 365 setup!`);
|
|
48
46
|
await logger.logToStderr(`This command will guide you through the process of configuring the CLI for your needs.`);
|
|
49
47
|
await logger.logToStderr(`Please, answer the following questions and we'll define a set of settings to best match how you intend to use the CLI.`);
|
|
@@ -85,8 +83,6 @@ class SetupCommand extends AnonymousCommand {
|
|
|
85
83
|
await logger.logToStderr('');
|
|
86
84
|
await logger.logToStderr('Configuring settings...');
|
|
87
85
|
await logger.logToStderr('');
|
|
88
|
-
// start the spinner. Fixes #5598
|
|
89
|
-
cli.spinner.start();
|
|
90
86
|
await this.configureSettings(settings, false, logger);
|
|
91
87
|
if (!this.verbose) {
|
|
92
88
|
await logger.logToStderr('');
|
|
@@ -30,8 +30,8 @@ class StatusCommand extends Command {
|
|
|
30
30
|
const connections = await auth.getAllConnections();
|
|
31
31
|
if (this.verbose) {
|
|
32
32
|
const message = connections.length > 0
|
|
33
|
-
? `Logged out
|
|
34
|
-
: 'Logged out
|
|
33
|
+
? `Logged out, signed in connections available`
|
|
34
|
+
: 'Logged out';
|
|
35
35
|
await logger.logToStderr(message);
|
|
36
36
|
}
|
|
37
37
|
else {
|
|
@@ -3,7 +3,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
3
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
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
|
-
var _ConnectionRemoveCommand_instances, _ConnectionRemoveCommand_initTelemetry, _ConnectionRemoveCommand_initOptions;
|
|
6
|
+
var _ConnectionRemoveCommand_instances, _ConnectionRemoveCommand_initTelemetry, _ConnectionRemoveCommand_initOptions, _ConnectionRemoveCommand_initTypes;
|
|
7
7
|
import auth from '../../../Auth.js';
|
|
8
8
|
import commands from '../commands.js';
|
|
9
9
|
import Command, { CommandError } from '../../../Command.js';
|
|
@@ -20,6 +20,7 @@ class ConnectionRemoveCommand extends Command {
|
|
|
20
20
|
_ConnectionRemoveCommand_instances.add(this);
|
|
21
21
|
__classPrivateFieldGet(this, _ConnectionRemoveCommand_instances, "m", _ConnectionRemoveCommand_initTelemetry).call(this);
|
|
22
22
|
__classPrivateFieldGet(this, _ConnectionRemoveCommand_instances, "m", _ConnectionRemoveCommand_initOptions).call(this);
|
|
23
|
+
__classPrivateFieldGet(this, _ConnectionRemoveCommand_instances, "m", _ConnectionRemoveCommand_initTypes).call(this);
|
|
23
24
|
}
|
|
24
25
|
async commandAction(logger, args) {
|
|
25
26
|
const deleteConnection = async () => {
|
|
@@ -53,7 +54,7 @@ class ConnectionRemoveCommand extends Command {
|
|
|
53
54
|
_ConnectionRemoveCommand_instances = new WeakSet(), _ConnectionRemoveCommand_initTelemetry = function _ConnectionRemoveCommand_initTelemetry() {
|
|
54
55
|
this.telemetry.push((args) => {
|
|
55
56
|
Object.assign(this.telemetryProperties, {
|
|
56
|
-
force:
|
|
57
|
+
force: !!args.options.force
|
|
57
58
|
});
|
|
58
59
|
});
|
|
59
60
|
}, _ConnectionRemoveCommand_initOptions = function _ConnectionRemoveCommand_initOptions() {
|
|
@@ -62,6 +63,9 @@ _ConnectionRemoveCommand_instances = new WeakSet(), _ConnectionRemoveCommand_ini
|
|
|
62
63
|
}, {
|
|
63
64
|
option: '-f, --force'
|
|
64
65
|
});
|
|
66
|
+
}, _ConnectionRemoveCommand_initTypes = function _ConnectionRemoveCommand_initTypes() {
|
|
67
|
+
this.types.string.push('name');
|
|
68
|
+
this.types.boolean.push('force');
|
|
65
69
|
};
|
|
66
70
|
export default new ConnectionRemoveCommand();
|
|
67
71
|
//# sourceMappingURL=connection-remove.js.map
|
|
@@ -3,7 +3,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
3
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
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
|
-
var _ConnectionSetCommand_instances, _ConnectionSetCommand_initOptions, _ConnectionSetCommand_initValidators;
|
|
6
|
+
var _ConnectionSetCommand_instances, _ConnectionSetCommand_initOptions, _ConnectionSetCommand_initValidators, _ConnectionSetCommand_initTypes;
|
|
7
7
|
import auth from '../../../Auth.js';
|
|
8
8
|
import commands from '../commands.js';
|
|
9
9
|
import Command, { CommandError } from '../../../Command.js';
|
|
@@ -19,6 +19,7 @@ class ConnectionSetCommand extends Command {
|
|
|
19
19
|
_ConnectionSetCommand_instances.add(this);
|
|
20
20
|
__classPrivateFieldGet(this, _ConnectionSetCommand_instances, "m", _ConnectionSetCommand_initOptions).call(this);
|
|
21
21
|
__classPrivateFieldGet(this, _ConnectionSetCommand_instances, "m", _ConnectionSetCommand_initValidators).call(this);
|
|
22
|
+
__classPrivateFieldGet(this, _ConnectionSetCommand_instances, "m", _ConnectionSetCommand_initTypes).call(this);
|
|
22
23
|
}
|
|
23
24
|
async commandAction(logger, args) {
|
|
24
25
|
const connection = await auth.getConnection(args.options.name);
|
|
@@ -51,6 +52,8 @@ _ConnectionSetCommand_instances = new WeakSet(), _ConnectionSetCommand_initOptio
|
|
|
51
52
|
}
|
|
52
53
|
return true;
|
|
53
54
|
});
|
|
55
|
+
}, _ConnectionSetCommand_initTypes = function _ConnectionSetCommand_initTypes() {
|
|
56
|
+
this.types.string.push('name', 'newName');
|
|
54
57
|
};
|
|
55
58
|
export default new ConnectionSetCommand();
|
|
56
59
|
//# sourceMappingURL=connection-set.js.map
|
|
@@ -3,10 +3,12 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
3
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
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
|
-
var _ConnectionUseCommand_instances, _ConnectionUseCommand_initOptions;
|
|
6
|
+
var _ConnectionUseCommand_instances, _ConnectionUseCommand_initTelemetry, _ConnectionUseCommand_initOptions, _ConnectionUseCommand_initTypes;
|
|
7
7
|
import auth from '../../../Auth.js';
|
|
8
8
|
import commands from '../commands.js';
|
|
9
9
|
import Command, { CommandError } from '../../../Command.js';
|
|
10
|
+
import { formatting } from '../../../utils/formatting.js';
|
|
11
|
+
import { cli } from '../../../cli/cli.js';
|
|
10
12
|
class ConnectionUseCommand extends Command {
|
|
11
13
|
get name() {
|
|
12
14
|
return commands.USE;
|
|
@@ -18,9 +20,20 @@ class ConnectionUseCommand extends Command {
|
|
|
18
20
|
super();
|
|
19
21
|
_ConnectionUseCommand_instances.add(this);
|
|
20
22
|
__classPrivateFieldGet(this, _ConnectionUseCommand_instances, "m", _ConnectionUseCommand_initOptions).call(this);
|
|
23
|
+
__classPrivateFieldGet(this, _ConnectionUseCommand_instances, "m", _ConnectionUseCommand_initTelemetry).call(this);
|
|
24
|
+
__classPrivateFieldGet(this, _ConnectionUseCommand_instances, "m", _ConnectionUseCommand_initTypes).call(this);
|
|
21
25
|
}
|
|
22
26
|
async commandAction(logger, args) {
|
|
23
|
-
|
|
27
|
+
let connection;
|
|
28
|
+
if (args.options.name) {
|
|
29
|
+
connection = await auth.getConnection(args.options.name);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
const connections = await auth.getAllConnections();
|
|
33
|
+
connections.sort((a, b) => a.name.localeCompare(b.name));
|
|
34
|
+
const keyValuePair = formatting.convertArrayToHashTable('name', connections);
|
|
35
|
+
connection = await cli.handleMultipleResultsFound('Please select the connection you want to activate.', keyValuePair);
|
|
36
|
+
}
|
|
24
37
|
if (this.verbose) {
|
|
25
38
|
await logger.logToStderr(`Switching to connection '${connection.identityName}', appId: ${connection.appId}, tenantId: ${connection.identityTenantId}...`);
|
|
26
39
|
}
|
|
@@ -42,10 +55,18 @@ class ConnectionUseCommand extends Command {
|
|
|
42
55
|
await this.commandAction(logger, args);
|
|
43
56
|
}
|
|
44
57
|
}
|
|
45
|
-
_ConnectionUseCommand_instances = new WeakSet(),
|
|
58
|
+
_ConnectionUseCommand_instances = new WeakSet(), _ConnectionUseCommand_initTelemetry = function _ConnectionUseCommand_initTelemetry() {
|
|
59
|
+
this.telemetry.push((args) => {
|
|
60
|
+
Object.assign(this.telemetryProperties, {
|
|
61
|
+
name: typeof args.options.name !== 'undefined'
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
}, _ConnectionUseCommand_initOptions = function _ConnectionUseCommand_initOptions() {
|
|
46
65
|
this.options.unshift({
|
|
47
|
-
option: '-n, --name
|
|
66
|
+
option: '-n, --name [name]'
|
|
48
67
|
});
|
|
68
|
+
}, _ConnectionUseCommand_initTypes = function _ConnectionUseCommand_initTypes() {
|
|
69
|
+
this.types.string.push('name');
|
|
49
70
|
};
|
|
50
71
|
export default new ConnectionUseCommand();
|
|
51
72
|
//# sourceMappingURL=connection-use.js.map
|
|
@@ -30,12 +30,12 @@ class EntraEnterpriseAppAddCommand extends GraphCommand {
|
|
|
30
30
|
__classPrivateFieldGet(this, _EntraEnterpriseAppAddCommand_instances, "m", _EntraEnterpriseAppAddCommand_initOptionSets).call(this);
|
|
31
31
|
}
|
|
32
32
|
async getAppId(args) {
|
|
33
|
-
if (args.options.
|
|
34
|
-
return args.options.
|
|
33
|
+
if (args.options.id) {
|
|
34
|
+
return args.options.id;
|
|
35
35
|
}
|
|
36
36
|
let spMatchQuery = '';
|
|
37
|
-
if (args.options.
|
|
38
|
-
spMatchQuery = `displayName eq '${formatting.encodeQueryParameter(args.options.
|
|
37
|
+
if (args.options.displayName) {
|
|
38
|
+
spMatchQuery = `displayName eq '${formatting.encodeQueryParameter(args.options.displayName)}'`;
|
|
39
39
|
}
|
|
40
40
|
else if (args.options.objectId) {
|
|
41
41
|
spMatchQuery = `id eq '${formatting.encodeQueryParameter(args.options.objectId)}'`;
|
|
@@ -54,7 +54,7 @@ class EntraEnterpriseAppAddCommand extends GraphCommand {
|
|
|
54
54
|
}
|
|
55
55
|
if (response.value.length > 1) {
|
|
56
56
|
const resultAsKeyValuePair = formatting.convertArrayToHashTable('appId', response.value);
|
|
57
|
-
const result = await cli.handleMultipleResultsFound(`Multiple Entra apps with name '${args.options.
|
|
57
|
+
const result = await cli.handleMultipleResultsFound(`Multiple Entra apps with name '${args.options.displayName}' found.`, resultAsKeyValuePair);
|
|
58
58
|
return result.appId;
|
|
59
59
|
}
|
|
60
60
|
return spItem.appId;
|
|
@@ -85,31 +85,31 @@ class EntraEnterpriseAppAddCommand extends GraphCommand {
|
|
|
85
85
|
_EntraEnterpriseAppAddCommand_instances = new WeakSet(), _EntraEnterpriseAppAddCommand_initTelemetry = function _EntraEnterpriseAppAddCommand_initTelemetry() {
|
|
86
86
|
this.telemetry.push((args) => {
|
|
87
87
|
Object.assign(this.telemetryProperties, {
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
id: (!(!args.options.id)).toString(),
|
|
89
|
+
displayName: (!(!args.options.displayName)).toString(),
|
|
90
90
|
objectId: (!(!args.options.objectId)).toString()
|
|
91
91
|
});
|
|
92
92
|
});
|
|
93
93
|
}, _EntraEnterpriseAppAddCommand_initOptions = function _EntraEnterpriseAppAddCommand_initOptions() {
|
|
94
94
|
this.options.unshift({
|
|
95
|
-
option: '--
|
|
95
|
+
option: '-i, --id [id]'
|
|
96
96
|
}, {
|
|
97
|
-
option: '--
|
|
97
|
+
option: '-n, --displayName [displayName]'
|
|
98
98
|
}, {
|
|
99
99
|
option: '--objectId [objectId]'
|
|
100
100
|
});
|
|
101
101
|
}, _EntraEnterpriseAppAddCommand_initValidators = function _EntraEnterpriseAppAddCommand_initValidators() {
|
|
102
102
|
this.validators.push(async (args) => {
|
|
103
|
-
if (args.options.
|
|
104
|
-
return `${args.options.
|
|
103
|
+
if (args.options.id && !validation.isValidGuid(args.options.id)) {
|
|
104
|
+
return `${args.options.id} is not a valid GUID`;
|
|
105
105
|
}
|
|
106
106
|
if (args.options.objectId && !validation.isValidGuid(args.options.objectId)) {
|
|
107
|
-
return `${args.options.objectId} is not a valid
|
|
107
|
+
return `${args.options.objectId} is not a valid GUID`;
|
|
108
108
|
}
|
|
109
109
|
return true;
|
|
110
110
|
});
|
|
111
111
|
}, _EntraEnterpriseAppAddCommand_initOptionSets = function _EntraEnterpriseAppAddCommand_initOptionSets() {
|
|
112
|
-
this.optionSets.push({ options: ['
|
|
112
|
+
this.optionSets.push({ options: ['id', 'displayName', 'objectId'] });
|
|
113
113
|
};
|
|
114
114
|
export default new EntraEnterpriseAppAddCommand();
|
|
115
115
|
//# sourceMappingURL=enterpriseapp-add.js.map
|
|
@@ -30,15 +30,15 @@ class EntraEnterpriseAppGetCommand extends GraphCommand {
|
|
|
30
30
|
__classPrivateFieldGet(this, _EntraEnterpriseAppGetCommand_instances, "m", _EntraEnterpriseAppGetCommand_initOptionSets).call(this);
|
|
31
31
|
}
|
|
32
32
|
async getSpId(args) {
|
|
33
|
-
if (args.options.
|
|
34
|
-
return args.options.
|
|
33
|
+
if (args.options.objectId) {
|
|
34
|
+
return args.options.objectId;
|
|
35
35
|
}
|
|
36
36
|
let spMatchQuery = '';
|
|
37
|
-
if (args.options.
|
|
38
|
-
spMatchQuery = `displayName eq '${formatting.encodeQueryParameter(args.options.
|
|
37
|
+
if (args.options.displayName) {
|
|
38
|
+
spMatchQuery = `displayName eq '${formatting.encodeQueryParameter(args.options.displayName)}'`;
|
|
39
39
|
}
|
|
40
|
-
else if (args.options.
|
|
41
|
-
spMatchQuery = `appId eq '${formatting.encodeQueryParameter(args.options.
|
|
40
|
+
else if (args.options.id) {
|
|
41
|
+
spMatchQuery = `appId eq '${formatting.encodeQueryParameter(args.options.id)}'`;
|
|
42
42
|
}
|
|
43
43
|
const idRequestOptions = {
|
|
44
44
|
url: `${this.resource}/v1.0/servicePrincipals?$filter=${spMatchQuery}`,
|
|
@@ -54,7 +54,7 @@ class EntraEnterpriseAppGetCommand extends GraphCommand {
|
|
|
54
54
|
}
|
|
55
55
|
if (response.value.length > 1) {
|
|
56
56
|
const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', response.value);
|
|
57
|
-
const result = await cli.handleMultipleResultsFound(`Multiple Entra apps with name '${args.options.
|
|
57
|
+
const result = await cli.handleMultipleResultsFound(`Multiple Entra apps with name '${args.options.displayName}' found.`, resultAsKeyValuePair);
|
|
58
58
|
return result.id;
|
|
59
59
|
}
|
|
60
60
|
return spItem.id;
|
|
@@ -85,31 +85,31 @@ class EntraEnterpriseAppGetCommand extends GraphCommand {
|
|
|
85
85
|
_EntraEnterpriseAppGetCommand_instances = new WeakSet(), _EntraEnterpriseAppGetCommand_initTelemetry = function _EntraEnterpriseAppGetCommand_initTelemetry() {
|
|
86
86
|
this.telemetry.push((args) => {
|
|
87
87
|
Object.assign(this.telemetryProperties, {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
id: (!(!args.options.id)).toString(),
|
|
89
|
+
displayName: (!(!args.options.displayName)).toString(),
|
|
90
|
+
objectId: (!(!args.options.objectId)).toString()
|
|
91
91
|
});
|
|
92
92
|
});
|
|
93
93
|
}, _EntraEnterpriseAppGetCommand_initOptions = function _EntraEnterpriseAppGetCommand_initOptions() {
|
|
94
94
|
this.options.unshift({
|
|
95
|
-
option: '-i, --
|
|
95
|
+
option: '-i, --id [id]'
|
|
96
96
|
}, {
|
|
97
|
-
option: '-n, --
|
|
97
|
+
option: '-n, --displayName [displayName]'
|
|
98
98
|
}, {
|
|
99
|
-
option: '--
|
|
99
|
+
option: '--objectId [objectId]'
|
|
100
100
|
});
|
|
101
101
|
}, _EntraEnterpriseAppGetCommand_initValidators = function _EntraEnterpriseAppGetCommand_initValidators() {
|
|
102
102
|
this.validators.push(async (args) => {
|
|
103
|
-
if (args.options.
|
|
104
|
-
return `${args.options.
|
|
103
|
+
if (args.options.id && !validation.isValidGuid(args.options.id)) {
|
|
104
|
+
return `${args.options.id} is not a valid GUID`;
|
|
105
105
|
}
|
|
106
|
-
if (args.options.
|
|
107
|
-
return `${args.options.
|
|
106
|
+
if (args.options.objectId && !validation.isValidGuid(args.options.objectId)) {
|
|
107
|
+
return `${args.options.objectId} is not a valid GUID`;
|
|
108
108
|
}
|
|
109
109
|
return true;
|
|
110
110
|
});
|
|
111
111
|
}, _EntraEnterpriseAppGetCommand_initOptionSets = function _EntraEnterpriseAppGetCommand_initOptionSets() {
|
|
112
|
-
this.optionSets.push({ options: ['
|
|
112
|
+
this.optionSets.push({ options: ['id', 'displayName', 'objectId'] });
|
|
113
113
|
};
|
|
114
114
|
export default new EntraEnterpriseAppGetCommand();
|
|
115
115
|
//# sourceMappingURL=enterpriseapp-get.js.map
|
|
@@ -61,7 +61,7 @@ _EntraEnterpriseAppListCommand_instances = new WeakSet(), _EntraEnterpriseAppLis
|
|
|
61
61
|
});
|
|
62
62
|
}, _EntraEnterpriseAppListCommand_initOptions = function _EntraEnterpriseAppListCommand_initOptions() {
|
|
63
63
|
this.options.unshift({
|
|
64
|
-
option: '--displayName [displayName]'
|
|
64
|
+
option: '-n, --displayName [displayName]'
|
|
65
65
|
}, {
|
|
66
66
|
option: '--tag [tag]'
|
|
67
67
|
});
|
|
@@ -0,0 +1,123 @@
|
|
|
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 _EntraEnterpriseAppRemoveCommand_instances, _EntraEnterpriseAppRemoveCommand_initTelemetry, _EntraEnterpriseAppRemoveCommand_initOptions, _EntraEnterpriseAppRemoveCommand_initValidators, _EntraEnterpriseAppRemoveCommand_initOptionSets, _EntraEnterpriseAppRemoveCommand_initTypes;
|
|
7
|
+
import { cli } from '../../../../cli/cli.js';
|
|
8
|
+
import request from '../../../../request.js';
|
|
9
|
+
import { odata } from '../../../../utils/odata.js';
|
|
10
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
11
|
+
import { validation } from '../../../../utils/validation.js';
|
|
12
|
+
import GraphCommand from '../../../base/GraphCommand.js';
|
|
13
|
+
import commands from '../../commands.js';
|
|
14
|
+
class EntraEnterpriseAppRemoveCommand extends GraphCommand {
|
|
15
|
+
get name() {
|
|
16
|
+
return commands.ENTERPRISEAPP_REMOVE;
|
|
17
|
+
}
|
|
18
|
+
get description() {
|
|
19
|
+
return 'Deletes an enterprise application (or service principal)';
|
|
20
|
+
}
|
|
21
|
+
alias() {
|
|
22
|
+
return [commands.SP_REMOVE];
|
|
23
|
+
}
|
|
24
|
+
constructor() {
|
|
25
|
+
super();
|
|
26
|
+
_EntraEnterpriseAppRemoveCommand_instances.add(this);
|
|
27
|
+
__classPrivateFieldGet(this, _EntraEnterpriseAppRemoveCommand_instances, "m", _EntraEnterpriseAppRemoveCommand_initTelemetry).call(this);
|
|
28
|
+
__classPrivateFieldGet(this, _EntraEnterpriseAppRemoveCommand_instances, "m", _EntraEnterpriseAppRemoveCommand_initOptions).call(this);
|
|
29
|
+
__classPrivateFieldGet(this, _EntraEnterpriseAppRemoveCommand_instances, "m", _EntraEnterpriseAppRemoveCommand_initValidators).call(this);
|
|
30
|
+
__classPrivateFieldGet(this, _EntraEnterpriseAppRemoveCommand_instances, "m", _EntraEnterpriseAppRemoveCommand_initOptionSets).call(this);
|
|
31
|
+
__classPrivateFieldGet(this, _EntraEnterpriseAppRemoveCommand_instances, "m", _EntraEnterpriseAppRemoveCommand_initTypes).call(this);
|
|
32
|
+
}
|
|
33
|
+
async commandAction(logger, args) {
|
|
34
|
+
const removeEnterpriseApplication = async () => {
|
|
35
|
+
if (this.verbose) {
|
|
36
|
+
await logger.logToStderr(`Removing enterprise application ${args.options.id || args.options.displayName || args.options.objectId}...`);
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
let url = `${this.resource}/v1.0`;
|
|
40
|
+
if (args.options.id) {
|
|
41
|
+
url += `/servicePrincipals(appId='${args.options.id}')`;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
const id = await this.getSpId(args.options);
|
|
45
|
+
url += `/servicePrincipals/${id}`;
|
|
46
|
+
}
|
|
47
|
+
const requestOptions = {
|
|
48
|
+
url: url,
|
|
49
|
+
headers: {
|
|
50
|
+
accept: 'application/json;odata.metadata=none'
|
|
51
|
+
},
|
|
52
|
+
responseType: 'json'
|
|
53
|
+
};
|
|
54
|
+
await request.delete(requestOptions);
|
|
55
|
+
}
|
|
56
|
+
catch (err) {
|
|
57
|
+
this.handleRejectedODataJsonPromise(err);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
if (args.options.force) {
|
|
61
|
+
await removeEnterpriseApplication();
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
const result = await cli.promptForConfirmation({ message: `Are you sure you want to remove enterprise application '${args.options.id || args.options.displayName || args.options.objectId}'?` });
|
|
65
|
+
if (result) {
|
|
66
|
+
await removeEnterpriseApplication();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
async getSpId(options) {
|
|
71
|
+
if (options.objectId) {
|
|
72
|
+
return options.objectId;
|
|
73
|
+
}
|
|
74
|
+
const spItemsResponse = await odata.getAllItems(`${this.resource}/v1.0/servicePrincipals?$filter=displayName eq '${formatting.encodeQueryParameter(options.displayName)}'&$select=id`);
|
|
75
|
+
if (spItemsResponse.length === 0) {
|
|
76
|
+
throw `The specified enterprise application does not exist.`;
|
|
77
|
+
}
|
|
78
|
+
if (spItemsResponse.length > 1) {
|
|
79
|
+
const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', spItemsResponse);
|
|
80
|
+
const result = await cli.handleMultipleResultsFound(`Multiple enterprise applications with name '${options.displayName}' found.`, resultAsKeyValuePair);
|
|
81
|
+
return result.id;
|
|
82
|
+
}
|
|
83
|
+
const spItem = spItemsResponse[0];
|
|
84
|
+
return spItem.id;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
_EntraEnterpriseAppRemoveCommand_instances = new WeakSet(), _EntraEnterpriseAppRemoveCommand_initTelemetry = function _EntraEnterpriseAppRemoveCommand_initTelemetry() {
|
|
88
|
+
this.telemetry.push((args) => {
|
|
89
|
+
Object.assign(this.telemetryProperties, {
|
|
90
|
+
id: typeof args.options.id !== 'undefined',
|
|
91
|
+
displayName: typeof args.options.displayName !== 'undefined',
|
|
92
|
+
objectId: typeof args.options.objectId !== 'undefined',
|
|
93
|
+
force: !!args.options.force
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
}, _EntraEnterpriseAppRemoveCommand_initOptions = function _EntraEnterpriseAppRemoveCommand_initOptions() {
|
|
97
|
+
this.options.unshift({
|
|
98
|
+
option: '-i, --id [id]'
|
|
99
|
+
}, {
|
|
100
|
+
option: '-n, --displayName [displayName]'
|
|
101
|
+
}, {
|
|
102
|
+
option: '--objectId [objectId]'
|
|
103
|
+
}, {
|
|
104
|
+
option: '-f, --force'
|
|
105
|
+
});
|
|
106
|
+
}, _EntraEnterpriseAppRemoveCommand_initValidators = function _EntraEnterpriseAppRemoveCommand_initValidators() {
|
|
107
|
+
this.validators.push(async (args) => {
|
|
108
|
+
if (args.options.id && !validation.isValidGuid(args.options.id)) {
|
|
109
|
+
return `The option 'id' with value '${args.options.id}' is not a valid GUID.`;
|
|
110
|
+
}
|
|
111
|
+
if (args.options.objectId && !validation.isValidGuid(args.options.objectId)) {
|
|
112
|
+
return `The option 'objectId' with value '${args.options.objectId}' is not a valid GUID.`;
|
|
113
|
+
}
|
|
114
|
+
return true;
|
|
115
|
+
});
|
|
116
|
+
}, _EntraEnterpriseAppRemoveCommand_initOptionSets = function _EntraEnterpriseAppRemoveCommand_initOptionSets() {
|
|
117
|
+
this.optionSets.push({ options: ['id', 'displayName', 'objectId'] });
|
|
118
|
+
}, _EntraEnterpriseAppRemoveCommand_initTypes = function _EntraEnterpriseAppRemoveCommand_initTypes() {
|
|
119
|
+
this.types.string.push('id', 'displayName', 'objectId');
|
|
120
|
+
this.types.boolean.push('force');
|
|
121
|
+
};
|
|
122
|
+
export default new EntraEnterpriseAppRemoveCommand();
|
|
123
|
+
//# sourceMappingURL=enterpriseapp-remove.js.map
|