@pnp/cli-microsoft365 10.8.0-beta.708bf27 → 10.8.0-beta.7160233
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 +2 -1
- package/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/Auth.js +82 -22
- package/dist/cli/cli.js +1 -1
- package/dist/config.js +1 -0
- package/dist/m365/adaptivecard/commands/adaptivecard-send.js +54 -67
- package/dist/m365/app/commands/app-get.js +5 -2
- package/dist/m365/app/commands/app-open.js +9 -22
- package/dist/m365/app/commands/permission/permission-add.js +18 -30
- package/dist/m365/app/commands/permission/permission-list.js +5 -2
- package/dist/m365/base/AppCommand.js +9 -25
- package/dist/m365/booking/commands/business/business-get.js +18 -25
- package/dist/m365/cli/commands/app/app-reconsent.js +103 -0
- package/dist/m365/cli/commands.js +1 -0
- package/dist/m365/commands/login.js +1 -1
- package/dist/m365/commands/setup.js +1 -2
- package/dist/m365/context/commands/context-remove.js +12 -25
- package/dist/m365/context/commands/option/option-remove.js +11 -25
- package/dist/m365/entra/commands/organization/organization-list.js +51 -0
- package/dist/m365/entra/commands.js +1 -0
- package/dist/m365/graph/commands/directoryextension/directoryextension-list.js +74 -0
- package/dist/m365/graph/commands/openextension/openextension-set.js +107 -0
- package/dist/m365/graph/commands.js +2 -0
- package/dist/m365/spe/commands/container/container-add.js +85 -0
- package/dist/m365/spe/commands/container/container-list.js +2 -9
- package/dist/m365/spe/commands/container/container-permission-list.js +52 -0
- package/dist/m365/spe/commands/container/container-recyclebinitem-list.js +62 -0
- package/dist/m365/spe/commands/container/container-remove.js +99 -0
- package/dist/m365/spe/commands/containertype/containertype-add.js +11 -11
- package/dist/m365/spe/commands/containertype/containertype-get.js +28 -32
- package/dist/m365/spe/commands/containertype/containertype-list.js +14 -4
- package/dist/m365/spe/commands/containertype/containertype-remove.js +81 -0
- package/dist/m365/spe/commands.js +6 -1
- package/dist/m365/spo/commands/page/page-section-add.js +20 -23
- package/dist/utils/entraServicePrincipal.js +11 -0
- package/dist/utils/formatting.js +12 -0
- package/dist/utils/spe.js +77 -0
- package/dist/utils/spo.js +0 -18
- package/dist/utils/zod.js +26 -1
- package/docs/docs/cmd/adaptivecard/adaptivecard-send.mdx +1 -1
- package/docs/docs/cmd/cli/app/app-reconsent.mdx +63 -0
- package/docs/docs/cmd/entra/organization/organization-list.mdx +154 -0
- package/docs/docs/cmd/graph/directoryextension/directoryextension-list.mdx +135 -0
- package/docs/docs/cmd/graph/openextension/openextension-set.mdx +97 -0
- package/docs/docs/cmd/spe/container/container-activate.mdx +0 -2
- package/docs/docs/cmd/spe/container/container-add.mdx +128 -0
- package/docs/docs/cmd/spe/container/container-permission-list.mdx +90 -0
- package/docs/docs/cmd/spe/container/container-recyclebinitem-list.mdx +96 -0
- package/docs/docs/cmd/spe/container/container-remove.mdx +65 -0
- package/docs/docs/cmd/spe/containertype/containertype-add.mdx +9 -1
- package/docs/docs/cmd/spe/containertype/containertype-get.mdx +8 -0
- package/docs/docs/cmd/spe/containertype/containertype-list.mdx +8 -0
- package/docs/docs/cmd/spe/containertype/containertype-remove.mdx +52 -0
- package/docs/docs/cmd/spo/field/field-get.mdx +0 -1
- package/npm-shrinkwrap.json +894 -477
- package/package.json +10 -10
- package/dist/m365/spe/ContainerProperties.js +0 -2
package/dist/Auth.js
CHANGED
|
@@ -562,19 +562,93 @@ export class Auth {
|
|
|
562
562
|
if (debug) {
|
|
563
563
|
await logger.logToStderr('Trying to retrieve access token using federated identity...');
|
|
564
564
|
}
|
|
565
|
-
if (
|
|
566
|
-
|
|
565
|
+
if (process.env.ACTIONS_ID_TOKEN_REQUEST_URL && process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN) {
|
|
566
|
+
if (debug) {
|
|
567
|
+
await logger.logToStderr('ACTIONS_ID_TOKEN_REQUEST_URL and ACTIONS_ID_TOKEN_REQUEST_TOKEN env variables found. The context is GitHub Actions...');
|
|
568
|
+
}
|
|
569
|
+
const federationToken = await this.getFederationTokenFromGithub(logger, debug);
|
|
570
|
+
return this.getAccessTokenWithFederatedToken(resource, federationToken, logger, debug);
|
|
571
|
+
}
|
|
572
|
+
else if (process.env.SYSTEM_OIDCREQUESTURI) {
|
|
573
|
+
if (debug) {
|
|
574
|
+
await logger.logToStderr('SYSTEM_OIDCREQUESTURI env variable found. The context is Azure DevOps...');
|
|
575
|
+
}
|
|
576
|
+
if (!process.env.SYSTEM_ACCESSTOKEN) {
|
|
577
|
+
throw new CommandError(`The SYSTEM_ACCESSTOKEN environment variable is not available. Please check the Azure DevOps pipeline task configuration. It should contain 'SYSTEM_ACCESSTOKEN: $(System.AccessToken)' in the env section.`);
|
|
578
|
+
}
|
|
579
|
+
const serviceConnectionId = process.env.AZURESUBSCRIPTION_SERVICE_CONNECTION_ID;
|
|
580
|
+
const serviceConnectionAppId = process.env.AZURESUBSCRIPTION_CLIENT_ID;
|
|
581
|
+
const serviceConnectionTenantId = process.env.AZURESUBSCRIPTION_TENANT_ID;
|
|
582
|
+
const useServiceConnection = serviceConnectionId && serviceConnectionAppId && serviceConnectionTenantId;
|
|
583
|
+
if (!useServiceConnection) {
|
|
584
|
+
if (debug) {
|
|
585
|
+
await logger.logToStderr('Not using a service connection. Run this command in an AzurePowerShell task to be able to use a service connection.');
|
|
586
|
+
}
|
|
587
|
+
if (!this.connection.appId || this.connection.tenant === 'common') {
|
|
588
|
+
throw new CommandError('The appId and tenant parameters are required when not using a service connection.');
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
else {
|
|
592
|
+
if (debug) {
|
|
593
|
+
if (this.connection.appId || this.connection.tenant !== 'common') {
|
|
594
|
+
await logger.logToStderr('When using a service connection, the appId and tenant values are updated to the values of the service connection.');
|
|
595
|
+
}
|
|
596
|
+
await logger.logToStderr(`Using service connection '${serviceConnectionId}' with app Id '${serviceConnectionAppId}' and tenant Id '${serviceConnectionTenantId}'...`);
|
|
597
|
+
}
|
|
598
|
+
this.connection.appId = serviceConnectionAppId;
|
|
599
|
+
this.connection.tenant = serviceConnectionTenantId;
|
|
600
|
+
}
|
|
601
|
+
const federationToken = await this.getFederationTokenFromAzureDevOps(logger, debug, serviceConnectionId);
|
|
602
|
+
return this.getAccessTokenWithFederatedToken(resource, federationToken, logger, debug);
|
|
603
|
+
}
|
|
604
|
+
else {
|
|
605
|
+
throw new CommandError('Federated identity is currently only supported in GitHub Actions and Azure DevOps.');
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
async getFederationTokenFromGithub(logger, debug) {
|
|
609
|
+
if (debug) {
|
|
610
|
+
await logger.logToStderr('Retrieving GitHub federation token...');
|
|
611
|
+
}
|
|
612
|
+
const requestOptions = {
|
|
613
|
+
url: `${process.env.ACTIONS_ID_TOKEN_REQUEST_URL}&audience=${encodeURIComponent('api://AzureADTokenExchange')}`,
|
|
614
|
+
headers: {
|
|
615
|
+
Authorization: `Bearer ${process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN}`,
|
|
616
|
+
Accept: 'application/json',
|
|
617
|
+
'x-anonymous': true
|
|
618
|
+
},
|
|
619
|
+
responseType: 'json'
|
|
620
|
+
};
|
|
621
|
+
const accessTokenResponse = await request.get(requestOptions);
|
|
622
|
+
return accessTokenResponse.value;
|
|
623
|
+
}
|
|
624
|
+
async getFederationTokenFromAzureDevOps(logger, debug, serviceConnectionId) {
|
|
625
|
+
if (debug) {
|
|
626
|
+
await logger.logToStderr('Retrieving Azure DevOps federation token...');
|
|
567
627
|
}
|
|
628
|
+
const urlSuffix = serviceConnectionId ? `&serviceConnectionId=${serviceConnectionId}` : '';
|
|
629
|
+
const requestOptions = {
|
|
630
|
+
url: `${process.env.SYSTEM_OIDCREQUESTURI}?api-version=7.1${urlSuffix}`,
|
|
631
|
+
headers: {
|
|
632
|
+
Authorization: `Bearer ${process.env.SYSTEM_ACCESSTOKEN}`,
|
|
633
|
+
Accept: 'application/json',
|
|
634
|
+
'Content-Type': 'application/json',
|
|
635
|
+
'x-anonymous': true
|
|
636
|
+
},
|
|
637
|
+
responseType: 'json'
|
|
638
|
+
};
|
|
639
|
+
const accessTokenResponse = await request.post(requestOptions);
|
|
640
|
+
return accessTokenResponse.oidcToken;
|
|
641
|
+
}
|
|
642
|
+
async getAccessTokenWithFederatedToken(resource, federatedToken, logger, debug) {
|
|
568
643
|
if (debug) {
|
|
569
|
-
await logger.logToStderr('
|
|
644
|
+
await logger.logToStderr('Retrieving Entra ID Access Token with federated token...');
|
|
570
645
|
}
|
|
571
|
-
const federationToken = await this.getFederationTokenFromGithub(logger, debug);
|
|
572
646
|
const queryParams = [
|
|
573
647
|
'grant_type=client_credentials',
|
|
574
648
|
`scope=${encodeURIComponent(`${resource}/.default`)}`,
|
|
575
649
|
`client_id=${this.connection.appId}`,
|
|
576
650
|
`client_assertion_type=${encodeURIComponent('urn:ietf:params:oauth:client-assertion-type:jwt-bearer')}`,
|
|
577
|
-
`client_assertion=${
|
|
651
|
+
`client_assertion=${federatedToken}`
|
|
578
652
|
];
|
|
579
653
|
const requestOptions = {
|
|
580
654
|
url: `https://login.microsoftonline.com/${this.connection.tenant}/oauth2/v2.0/token`,
|
|
@@ -587,27 +661,13 @@ export class Auth {
|
|
|
587
661
|
responseType: 'json'
|
|
588
662
|
};
|
|
589
663
|
const accessTokenResponse = await request.post(requestOptions);
|
|
664
|
+
const expiresIn = parseInt(accessTokenResponse.expires_in) * 1000;
|
|
665
|
+
const now = new Date();
|
|
590
666
|
return {
|
|
591
667
|
accessToken: accessTokenResponse.access_token,
|
|
592
|
-
expiresOn: new Date(
|
|
668
|
+
expiresOn: new Date(now.getTime() + expiresIn)
|
|
593
669
|
};
|
|
594
670
|
}
|
|
595
|
-
async getFederationTokenFromGithub(logger, debug) {
|
|
596
|
-
if (debug) {
|
|
597
|
-
await logger.logToStderr('Retrieving GitHub federation token...');
|
|
598
|
-
}
|
|
599
|
-
const requestOptions = {
|
|
600
|
-
url: `${process.env.ACTIONS_ID_TOKEN_REQUEST_URL}&audience=${encodeURIComponent('api://AzureADTokenExchange')}`,
|
|
601
|
-
headers: {
|
|
602
|
-
Authorization: `Bearer ${process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN}`,
|
|
603
|
-
accept: 'application/json',
|
|
604
|
-
'x-anonymous': true
|
|
605
|
-
},
|
|
606
|
-
responseType: 'json'
|
|
607
|
-
};
|
|
608
|
-
const accessTokenResponse = await request.get(requestOptions);
|
|
609
|
-
return accessTokenResponse.value;
|
|
610
|
-
}
|
|
611
671
|
async ensureAccessTokenWithSecret(resource, logger, debug, fetchNew) {
|
|
612
672
|
this.clientApplication = await this.getConfidentialClient(logger, debug, undefined, undefined, this.connection.secret);
|
|
613
673
|
return this.clientApplication.acquireTokenByClientCredential({
|
package/dist/cli/cli.js
CHANGED
|
@@ -406,7 +406,7 @@ async function loadCommandFromFile(commandFileUrl) {
|
|
|
406
406
|
catch { }
|
|
407
407
|
}
|
|
408
408
|
function getCommandInfo(command, filePath = '', helpFilePath = '') {
|
|
409
|
-
const options = command.schema ? zod.
|
|
409
|
+
const options = command.schema ? zod.schemaToOptionInfo(command.schema) : getCommandOptions(command);
|
|
410
410
|
command.optionsInfo = options;
|
|
411
411
|
return {
|
|
412
412
|
aliases: command.alias(),
|
package/dist/config.js
CHANGED
|
@@ -18,6 +18,7 @@ export default {
|
|
|
18
18
|
'https://graph.microsoft.com/Directory.ReadWrite.All',
|
|
19
19
|
'https://graph.microsoft.com/ExternalConnection.ReadWrite.All',
|
|
20
20
|
'https://graph.microsoft.com/ExternalItem.ReadWrite.All',
|
|
21
|
+
'https://graph.microsoft.com/FileStorageContainer.Selected',
|
|
21
22
|
'https://graph.microsoft.com/Group.ReadWrite.All',
|
|
22
23
|
'https://graph.microsoft.com/IdentityProvider.ReadWrite.All',
|
|
23
24
|
'https://graph.microsoft.com/InformationProtectionPolicy.Read',
|
|
@@ -1,13 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 _AdaptiveCardSendCommand_instances, _AdaptiveCardSendCommand_initTelemetry, _AdaptiveCardSendCommand_initOptions, _AdaptiveCardSendCommand_initValidators, _AdaptiveCardSendCommand_initOptionSets;
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { globalOptionsZod } from '../../../Command.js';
|
|
7
3
|
import request from '../../../request.js';
|
|
4
|
+
import { optionsUtils } from '../../../utils/optionsUtils.js';
|
|
5
|
+
import { zod } from '../../../utils/zod.js';
|
|
8
6
|
import AnonymousCommand from '../../base/AnonymousCommand.js';
|
|
9
7
|
import commands from '../commands.js';
|
|
10
|
-
|
|
8
|
+
export const options = globalOptionsZod
|
|
9
|
+
.extend({
|
|
10
|
+
url: z.string(),
|
|
11
|
+
title: zod.alias('t', z.string().optional()),
|
|
12
|
+
description: zod.alias('d', z.string().optional()),
|
|
13
|
+
imageUrl: zod.alias('i', z.string().optional()),
|
|
14
|
+
actionUrl: zod.alias('a', z.string().optional()),
|
|
15
|
+
card: z.string().optional(),
|
|
16
|
+
cardData: z.string().optional()
|
|
17
|
+
})
|
|
18
|
+
.and(z.any());
|
|
11
19
|
class AdaptiveCardSendCommand extends AnonymousCommand {
|
|
12
20
|
get name() {
|
|
13
21
|
return commands.SEND;
|
|
@@ -15,19 +23,48 @@ class AdaptiveCardSendCommand extends AnonymousCommand {
|
|
|
15
23
|
get description() {
|
|
16
24
|
return 'Sends adaptive card to the specified URL';
|
|
17
25
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
_AdaptiveCardSendCommand_instances.add(this);
|
|
21
|
-
__classPrivateFieldGet(this, _AdaptiveCardSendCommand_instances, "m", _AdaptiveCardSendCommand_initTelemetry).call(this);
|
|
22
|
-
__classPrivateFieldGet(this, _AdaptiveCardSendCommand_instances, "m", _AdaptiveCardSendCommand_initOptions).call(this);
|
|
23
|
-
__classPrivateFieldGet(this, _AdaptiveCardSendCommand_instances, "m", _AdaptiveCardSendCommand_initValidators).call(this);
|
|
24
|
-
__classPrivateFieldGet(this, _AdaptiveCardSendCommand_instances, "m", _AdaptiveCardSendCommand_initOptionSets).call(this);
|
|
26
|
+
get schema() {
|
|
27
|
+
return options;
|
|
25
28
|
}
|
|
26
|
-
|
|
27
|
-
return
|
|
29
|
+
getRefinedSchema(schema) {
|
|
30
|
+
return schema
|
|
31
|
+
.refine(options => !options.cardData || options.card, {
|
|
32
|
+
message: 'When you specify cardData, you must also specify card.',
|
|
33
|
+
path: ['cardData']
|
|
34
|
+
})
|
|
35
|
+
.refine(options => {
|
|
36
|
+
if (options.card) {
|
|
37
|
+
try {
|
|
38
|
+
JSON.parse(options.card);
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
catch (e) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return true;
|
|
46
|
+
}, {
|
|
47
|
+
message: 'Specified card is not a valid JSON string.',
|
|
48
|
+
path: ['card']
|
|
49
|
+
})
|
|
50
|
+
.refine(options => {
|
|
51
|
+
if (options.cardData) {
|
|
52
|
+
try {
|
|
53
|
+
JSON.parse(options.cardData);
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
catch (e) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return true;
|
|
61
|
+
}, {
|
|
62
|
+
message: 'Specified cardData is not a valid JSON string.',
|
|
63
|
+
path: ['cardData']
|
|
64
|
+
});
|
|
28
65
|
}
|
|
29
66
|
async commandAction(logger, args) {
|
|
30
|
-
const unknownOptions = optionsUtils.getUnknownOptions(args.options, this.
|
|
67
|
+
const unknownOptions = optionsUtils.getUnknownOptions(args.options, zod.schemaToOptions(this.schema));
|
|
31
68
|
const unknownOptionNames = Object.getOwnPropertyNames(unknownOptions);
|
|
32
69
|
const card = await this.getCard(args, unknownOptionNames, unknownOptions);
|
|
33
70
|
const requestOptions = {
|
|
@@ -166,55 +203,5 @@ class AdaptiveCardSendCommand extends AnonymousCommand {
|
|
|
166
203
|
return cardData;
|
|
167
204
|
}
|
|
168
205
|
}
|
|
169
|
-
_AdaptiveCardSendCommand_instances = new WeakSet(), _AdaptiveCardSendCommand_initTelemetry = function _AdaptiveCardSendCommand_initTelemetry() {
|
|
170
|
-
this.telemetry.push((args) => {
|
|
171
|
-
Object.assign(this.telemetryProperties, {
|
|
172
|
-
actionUrl: typeof args.options.actionUrl !== 'undefined',
|
|
173
|
-
card: typeof args.options.card !== 'undefined',
|
|
174
|
-
cardData: typeof args.options.cardData !== 'undefined',
|
|
175
|
-
description: typeof args.options.description !== 'undefined',
|
|
176
|
-
imageUrl: typeof args.options.imageUrl !== 'undefined',
|
|
177
|
-
title: typeof args.options.title !== 'undefined'
|
|
178
|
-
});
|
|
179
|
-
});
|
|
180
|
-
}, _AdaptiveCardSendCommand_initOptions = function _AdaptiveCardSendCommand_initOptions() {
|
|
181
|
-
this.options.unshift({
|
|
182
|
-
option: '-u, --url <url>'
|
|
183
|
-
}, {
|
|
184
|
-
option: '-t, --title [title]'
|
|
185
|
-
}, {
|
|
186
|
-
option: '-d, --description [description]'
|
|
187
|
-
}, {
|
|
188
|
-
option: '-i, --imageUrl [imageUrl]'
|
|
189
|
-
}, {
|
|
190
|
-
option: '-a, --actionUrl [actionUrl]'
|
|
191
|
-
}, {
|
|
192
|
-
option: '--card [card]'
|
|
193
|
-
}, {
|
|
194
|
-
option: '--cardData [cardData]'
|
|
195
|
-
});
|
|
196
|
-
}, _AdaptiveCardSendCommand_initValidators = function _AdaptiveCardSendCommand_initValidators() {
|
|
197
|
-
this.validators.push(async (args) => {
|
|
198
|
-
if (args.options.card) {
|
|
199
|
-
try {
|
|
200
|
-
JSON.parse(args.options.card);
|
|
201
|
-
}
|
|
202
|
-
catch (e) {
|
|
203
|
-
return `Error while parsing the card: ${e}`;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
if (args.options.cardData) {
|
|
207
|
-
try {
|
|
208
|
-
JSON.parse(args.options.cardData);
|
|
209
|
-
}
|
|
210
|
-
catch (e) {
|
|
211
|
-
return `Error while parsing card data: ${e}`;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
return true;
|
|
215
|
-
});
|
|
216
|
-
}, _AdaptiveCardSendCommand_initOptionSets = function _AdaptiveCardSendCommand_initOptionSets() {
|
|
217
|
-
this.optionSets.push({ options: ['title', 'card'] });
|
|
218
|
-
};
|
|
219
206
|
export default new AdaptiveCardSendCommand();
|
|
220
207
|
//# sourceMappingURL=adaptivecard-send.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import AppCommand from '../../base/AppCommand.js';
|
|
2
|
-
import commands from '../commands.js';
|
|
3
1
|
import { entraApp } from '../../../utils/entraApp.js';
|
|
2
|
+
import AppCommand, { appCommandOptions } from '../../base/AppCommand.js';
|
|
3
|
+
import commands from '../commands.js';
|
|
4
4
|
class AppGetCommand extends AppCommand {
|
|
5
5
|
get name() {
|
|
6
6
|
return commands.GET;
|
|
@@ -8,6 +8,9 @@ class AppGetCommand extends AppCommand {
|
|
|
8
8
|
get description() {
|
|
9
9
|
return 'Retrieves information about the current Microsoft Entra app';
|
|
10
10
|
}
|
|
11
|
+
get schema() {
|
|
12
|
+
return appCommandOptions;
|
|
13
|
+
}
|
|
11
14
|
async commandAction(logger, args) {
|
|
12
15
|
try {
|
|
13
16
|
const app = await entraApp.getAppRegistrationByAppId(args.options.appId);
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
|
|
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 _AppOpenCommand_instances, _AppOpenCommand_initTelemetry, _AppOpenCommand_initOptions;
|
|
1
|
+
import { z } from 'zod';
|
|
7
2
|
import { cli } from '../../../cli/cli.js';
|
|
8
3
|
import { settingsNames } from '../../../settingsNames.js';
|
|
9
4
|
import { browserUtil } from '../../../utils/browserUtil.js';
|
|
10
|
-
import AppCommand from '../../base/AppCommand.js';
|
|
5
|
+
import AppCommand, { appCommandOptions } from '../../base/AppCommand.js';
|
|
11
6
|
import commands from '../commands.js';
|
|
7
|
+
const options = appCommandOptions
|
|
8
|
+
.extend({
|
|
9
|
+
preview: z.boolean().optional().default(false)
|
|
10
|
+
})
|
|
11
|
+
.strict();
|
|
12
12
|
class AppOpenCommand extends AppCommand {
|
|
13
13
|
get name() {
|
|
14
14
|
return commands.OPEN;
|
|
@@ -16,11 +16,8 @@ class AppOpenCommand extends AppCommand {
|
|
|
16
16
|
get description() {
|
|
17
17
|
return 'Opens Microsoft Entra app in the Microsoft Entra ID portal';
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
_AppOpenCommand_instances.add(this);
|
|
22
|
-
__classPrivateFieldGet(this, _AppOpenCommand_instances, "m", _AppOpenCommand_initTelemetry).call(this);
|
|
23
|
-
__classPrivateFieldGet(this, _AppOpenCommand_instances, "m", _AppOpenCommand_initOptions).call(this);
|
|
19
|
+
get schema() {
|
|
20
|
+
return options;
|
|
24
21
|
}
|
|
25
22
|
async commandAction(logger, args) {
|
|
26
23
|
try {
|
|
@@ -41,15 +38,5 @@ class AppOpenCommand extends AppCommand {
|
|
|
41
38
|
await browserUtil.open(url);
|
|
42
39
|
}
|
|
43
40
|
}
|
|
44
|
-
_AppOpenCommand_instances = new WeakSet(), _AppOpenCommand_initTelemetry = function _AppOpenCommand_initTelemetry() {
|
|
45
|
-
this.telemetry.push((args) => {
|
|
46
|
-
Object.assign(this.telemetryProperties, {
|
|
47
|
-
appId: typeof args.options.appId !== 'undefined',
|
|
48
|
-
preview: typeof args.options.preview !== 'undefined'
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
}, _AppOpenCommand_initOptions = function _AppOpenCommand_initOptions() {
|
|
52
|
-
this.options.unshift({ option: '--appId [appId]' }, { option: '--preview' });
|
|
53
|
-
};
|
|
54
41
|
export default new AppOpenCommand();
|
|
55
42
|
//# sourceMappingURL=app-open.js.map
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
|
|
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 _AppPermissionAddCommand_instances, _AppPermissionAddCommand_initTelemetry, _AppPermissionAddCommand_initOptions, _AppPermissionAddCommand_initOptionSets;
|
|
1
|
+
import { z } from 'zod';
|
|
7
2
|
import request from '../../../../request.js';
|
|
8
3
|
import { formatting } from '../../../../utils/formatting.js';
|
|
9
4
|
import { odata } from '../../../../utils/odata.js';
|
|
10
|
-
import AppCommand from '../../../base/AppCommand.js';
|
|
5
|
+
import AppCommand, { appCommandOptions } from '../../../base/AppCommand.js';
|
|
11
6
|
import commands from '../../commands.js';
|
|
7
|
+
const options = appCommandOptions
|
|
8
|
+
.extend({
|
|
9
|
+
applicationPermissions: z.string().optional(),
|
|
10
|
+
delegatedPermissions: z.string().optional(),
|
|
11
|
+
grantAdminConsent: z.boolean().optional()
|
|
12
|
+
})
|
|
13
|
+
.strict();
|
|
12
14
|
var ScopeType;
|
|
13
15
|
(function (ScopeType) {
|
|
14
16
|
ScopeType["Role"] = "Role";
|
|
@@ -21,12 +23,15 @@ class AppPermissionAddCommand extends AppCommand {
|
|
|
21
23
|
get description() {
|
|
22
24
|
return 'Adds the specified application and/or delegated permissions to the current Microsoft Entra app API permissions';
|
|
23
25
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
get schema() {
|
|
27
|
+
return options;
|
|
28
|
+
}
|
|
29
|
+
getRefinedSchema(schema) {
|
|
30
|
+
return schema
|
|
31
|
+
.refine(options => options.applicationPermissions || options.delegatedPermissions, {
|
|
32
|
+
message: 'Specify at least one of applicationPermissions or delegatedPermissions, or both.',
|
|
33
|
+
path: ['delegatedPermissions']
|
|
34
|
+
});
|
|
30
35
|
}
|
|
31
36
|
async commandAction(logger, args) {
|
|
32
37
|
try {
|
|
@@ -194,22 +199,5 @@ class AppPermissionAddCommand extends AppCommand {
|
|
|
194
199
|
return request.post(requestOptions);
|
|
195
200
|
}
|
|
196
201
|
}
|
|
197
|
-
_AppPermissionAddCommand_instances = new WeakSet(), _AppPermissionAddCommand_initTelemetry = function _AppPermissionAddCommand_initTelemetry() {
|
|
198
|
-
this.telemetry.push((args) => {
|
|
199
|
-
Object.assign(this.telemetryProperties, {
|
|
200
|
-
appId: typeof args.options.appId !== 'undefined',
|
|
201
|
-
applicationPermissions: typeof args.options.applicationPermissions !== 'undefined',
|
|
202
|
-
delegatedPermissions: typeof args.options.delegatedPermissions !== 'undefined',
|
|
203
|
-
grantAdminConsent: !!args.options.grantAdminConsent
|
|
204
|
-
});
|
|
205
|
-
});
|
|
206
|
-
}, _AppPermissionAddCommand_initOptions = function _AppPermissionAddCommand_initOptions() {
|
|
207
|
-
this.options.unshift({ option: '--appId [appId]' }, { option: '--applicationPermissions [applicationPermissions]' }, { option: '--delegatedPermissions [delegatedPermissions]' }, { option: '--grantAdminConsent' });
|
|
208
|
-
}, _AppPermissionAddCommand_initOptionSets = function _AppPermissionAddCommand_initOptionSets() {
|
|
209
|
-
this.optionSets.push({
|
|
210
|
-
options: ['applicationPermissions', 'delegatedPermissions'],
|
|
211
|
-
runsWhen: (args) => args.options.delegatedPermissions === undefined && args.options.applicationPermissions === undefined
|
|
212
|
-
});
|
|
213
|
-
};
|
|
214
202
|
export default new AppPermissionAddCommand();
|
|
215
203
|
//# sourceMappingURL=permission-add.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import request from '../../../../request.js';
|
|
2
|
-
import AppCommand from '../../../base/AppCommand.js';
|
|
3
|
-
import commands from '../../commands.js';
|
|
4
2
|
import { entraApp } from '../../../../utils/entraApp.js';
|
|
3
|
+
import AppCommand, { appCommandOptions } from '../../../base/AppCommand.js';
|
|
4
|
+
import commands from '../../commands.js';
|
|
5
5
|
var GetServicePrincipal;
|
|
6
6
|
(function (GetServicePrincipal) {
|
|
7
7
|
GetServicePrincipal[GetServicePrincipal["withPermissions"] = 0] = "withPermissions";
|
|
@@ -14,6 +14,9 @@ class AppPermissionListCommand extends AppCommand {
|
|
|
14
14
|
get description() {
|
|
15
15
|
return 'Lists API permissions for the current Microsoft Entra app';
|
|
16
16
|
}
|
|
17
|
+
get schema() {
|
|
18
|
+
return appCommandOptions;
|
|
19
|
+
}
|
|
17
20
|
async commandAction(logger) {
|
|
18
21
|
try {
|
|
19
22
|
const servicePrincipal = await this.getServicePrincipal({ appId: this.appId }, logger, GetServicePrincipal.withPermissions);
|
|
@@ -1,23 +1,18 @@
|
|
|
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 _AppCommand_instances, _AppCommand_initOptions, _AppCommand_initValidators;
|
|
7
1
|
import fs from 'fs';
|
|
2
|
+
import { z } from 'zod';
|
|
8
3
|
import { cli } from '../../cli/cli.js';
|
|
9
|
-
import Command, { CommandError } from '../../Command.js';
|
|
10
|
-
import { validation } from '../../utils/validation.js';
|
|
4
|
+
import Command, { CommandError, globalOptionsZod } from '../../Command.js';
|
|
11
5
|
import { formatting } from '../../utils/formatting.js';
|
|
12
|
-
|
|
6
|
+
export const appCommandOptions = globalOptionsZod
|
|
7
|
+
.extend({
|
|
8
|
+
appId: z.string().uuid().optional()
|
|
9
|
+
});
|
|
10
|
+
export default class AppCommand extends Command {
|
|
13
11
|
get resource() {
|
|
14
12
|
return 'https://graph.microsoft.com';
|
|
15
13
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
_AppCommand_instances.add(this);
|
|
19
|
-
__classPrivateFieldGet(this, _AppCommand_instances, "m", _AppCommand_initOptions).call(this);
|
|
20
|
-
__classPrivateFieldGet(this, _AppCommand_instances, "m", _AppCommand_initValidators).call(this);
|
|
14
|
+
get schema() {
|
|
15
|
+
return appCommandOptions;
|
|
21
16
|
}
|
|
22
17
|
async action(logger, args) {
|
|
23
18
|
const m365rcJsonPath = '.m365rc.json';
|
|
@@ -63,15 +58,4 @@ class AppCommand extends Command {
|
|
|
63
58
|
}
|
|
64
59
|
}
|
|
65
60
|
}
|
|
66
|
-
_AppCommand_instances = new WeakSet(), _AppCommand_initOptions = function _AppCommand_initOptions() {
|
|
67
|
-
this.options.unshift({ option: '--appId [appId]' });
|
|
68
|
-
}, _AppCommand_initValidators = function _AppCommand_initValidators() {
|
|
69
|
-
this.validators.push(async (args) => {
|
|
70
|
-
if (args.options.appId && !validation.isValidGuid(args.options.appId)) {
|
|
71
|
-
return `${args.options.appId} is not a valid GUID`;
|
|
72
|
-
}
|
|
73
|
-
return true;
|
|
74
|
-
});
|
|
75
|
-
};
|
|
76
|
-
export default AppCommand;
|
|
77
61
|
//# sourceMappingURL=AppCommand.js.map
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
-
};
|
|
6
|
-
var _BookingBusinessGetCommand_instances, _BookingBusinessGetCommand_initTelemetry, _BookingBusinessGetCommand_initOptions, _BookingBusinessGetCommand_initOptionSets;
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { cli } from '../../../../cli/cli.js';
|
|
3
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
7
4
|
import request from '../../../../request.js';
|
|
8
5
|
import { formatting } from '../../../../utils/formatting.js';
|
|
6
|
+
import { zod } from '../../../../utils/zod.js';
|
|
9
7
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
10
8
|
import commands from '../../commands.js';
|
|
11
|
-
|
|
9
|
+
const options = globalOptionsZod
|
|
10
|
+
.extend({
|
|
11
|
+
id: zod.alias('i', z.string().optional()),
|
|
12
|
+
name: zod.alias('n', z.string().optional())
|
|
13
|
+
})
|
|
14
|
+
.strict();
|
|
12
15
|
class BookingBusinessGetCommand extends GraphCommand {
|
|
13
16
|
get name() {
|
|
14
17
|
return commands.BUSINESS_GET;
|
|
@@ -16,12 +19,14 @@ class BookingBusinessGetCommand extends GraphCommand {
|
|
|
16
19
|
get description() {
|
|
17
20
|
return 'Retrieve the specified Microsoft Bookings business.';
|
|
18
21
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
get schema() {
|
|
23
|
+
return options;
|
|
24
|
+
}
|
|
25
|
+
getRefinedSchema(schema) {
|
|
26
|
+
return schema
|
|
27
|
+
.refine(options => options.id || options.name, {
|
|
28
|
+
message: 'Specify either id or name'
|
|
29
|
+
});
|
|
25
30
|
}
|
|
26
31
|
async commandAction(logger, args) {
|
|
27
32
|
try {
|
|
@@ -65,17 +70,5 @@ class BookingBusinessGetCommand extends GraphCommand {
|
|
|
65
70
|
return bookingBusinesses[0].id;
|
|
66
71
|
}
|
|
67
72
|
}
|
|
68
|
-
_BookingBusinessGetCommand_instances = new WeakSet(), _BookingBusinessGetCommand_initTelemetry = function _BookingBusinessGetCommand_initTelemetry() {
|
|
69
|
-
this.telemetry.push((args) => {
|
|
70
|
-
Object.assign(this.telemetryProperties, {
|
|
71
|
-
id: typeof args.options.id !== 'undefined',
|
|
72
|
-
name: typeof args.options.name !== 'undefined'
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
}, _BookingBusinessGetCommand_initOptions = function _BookingBusinessGetCommand_initOptions() {
|
|
76
|
-
this.options.unshift({ option: '-i, --id [id]' }, { option: '-n, --name [name]' });
|
|
77
|
-
}, _BookingBusinessGetCommand_initOptionSets = function _BookingBusinessGetCommand_initOptionSets() {
|
|
78
|
-
this.optionSets.push({ options: ['id', 'name'] });
|
|
79
|
-
};
|
|
80
73
|
export default new BookingBusinessGetCommand();
|
|
81
74
|
//# sourceMappingURL=business-get.js.map
|