@pnp/cli-microsoft365 7.8.0-beta.3152fc7 → 7.8.0-beta.4a6e6f7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/cli/cli.js +21 -9
- package/dist/index.js +13 -12
- package/dist/m365/cli/commands/config/config-set.js +4 -0
- package/dist/m365/commands/setup.js +3 -3
- package/dist/m365/entra/commands/app/app-permission-add.js +25 -6
- package/dist/m365/entra/commands/app/app-permission-list.js +17 -5
- package/dist/m365/entra/commands/group/group-add.js +12 -14
- package/dist/m365/entra/commands/group/group-user-add.js +6 -7
- package/dist/m365/entra/commands/m365group/m365group-add.js +4 -2
- package/dist/m365/entra/commands/user/user-registrationdetails-list.js +6 -7
- package/dist/m365/flow/commands/run/run-list.js +25 -0
- package/dist/m365/outlook/commands/message/message-list.js +87 -17
- package/dist/m365/planner/commands/bucket/bucket-add.js +4 -7
- package/dist/m365/planner/commands/bucket/bucket-get.js +7 -30
- package/dist/m365/planner/commands/bucket/bucket-list.js +3 -6
- package/dist/m365/planner/commands/bucket/bucket-remove.js +8 -25
- package/dist/m365/planner/commands/bucket/bucket-set.js +12 -34
- package/dist/m365/planner/commands/plan/plan-add.js +17 -7
- package/dist/m365/planner/commands/plan/plan-get.js +12 -22
- package/dist/m365/planner/commands/plan/plan-list.js +1 -2
- package/dist/m365/planner/commands/plan/plan-remove.js +5 -3
- package/dist/m365/planner/commands/plan/plan-set.js +18 -10
- package/dist/m365/planner/commands/roster/roster-add.js +1 -2
- package/dist/m365/planner/commands/task/task-add.js +15 -21
- package/dist/m365/planner/commands/task/task-checklistitem-add.js +1 -1
- package/dist/m365/planner/commands/task/task-checklistitem-remove.js +1 -1
- package/dist/m365/planner/commands/task/task-get.js +5 -26
- package/dist/m365/planner/commands/task/task-list.js +11 -37
- package/dist/m365/planner/commands/task/task-reference-remove.js +1 -1
- package/dist/m365/planner/commands/task/task-remove.js +12 -29
- package/dist/m365/planner/commands/task/task-set.js +15 -21
- package/dist/m365/spfx/commands/project/project-doctor/{doctor-1.19.0-beta.0.js → doctor-1.19.0.js} +1 -1
- package/dist/m365/spfx/commands/project/project-doctor.js +1 -1
- package/dist/m365/spfx/commands/project/project-upgrade/{upgrade-1.19.0-beta.0.js → upgrade-1.19.0.js} +22 -22
- package/dist/m365/spfx/commands/project/project-upgrade.js +13 -15
- package/dist/m365/spfx/commands/spfx-doctor.js +1 -1
- package/dist/m365/spo/commands/listitem/listitem-batch-remove.js +222 -0
- package/dist/m365/spo/commands/navigation/navigation-node-add.js +3 -2
- package/dist/m365/spo/commands/navigation/navigation-node-set.js +3 -2
- package/dist/m365/spo/commands/site/site-add.js +17 -26
- package/dist/m365/spo/commands/site/site-recyclebinitem-move.js +5 -2
- package/dist/m365/spo/commands/site/site-recyclebinitem-remove.js +3 -2
- package/dist/m365/spo/commands/site/site-remove.js +129 -159
- package/dist/m365/spo/commands/site/site-set.js +9 -13
- package/dist/m365/spo/commands/spo-set.js +6 -2
- package/dist/m365/spo/commands/tenant/tenant-recyclebinitem-remove.js +9 -13
- package/dist/m365/spo/commands.js +1 -0
- package/dist/m365/teams/commands/meeting/meeting-add.js +3 -3
- package/dist/m365/teams/commands/team/team-add.js +22 -16
- package/dist/settingsNames.js +1 -0
- package/dist/utils/planner.js +87 -8
- package/dist/utils/spo.js +209 -278
- package/dist/utils/urlUtil.js +8 -0
- package/dist/utils/validation.js +8 -5
- package/docs/docs/_clisettings.mdx +1 -0
- package/docs/docs/cmd/entra/app/app-permission-add.mdx +7 -4
- package/docs/docs/cmd/entra/app/app-permission-list.mdx +14 -5
- package/docs/docs/cmd/entra/m365group/m365group-add.mdx +24 -24
- package/docs/docs/cmd/flow/run/run-list.mdx +74 -1
- package/docs/docs/cmd/outlook/message/message-list.mdx +18 -6
- package/docs/docs/cmd/spfx/project/project-upgrade.mdx +1 -1
- package/docs/docs/cmd/spo/listitem/listitem-batch-remove.mdx +70 -0
- package/docs/docs/cmd/spo/site/site-remove.mdx +9 -19
- package/npm-shrinkwrap.json +168 -228
- package/package.json +16 -16
package/dist/cli/cli.js
CHANGED
|
@@ -17,7 +17,7 @@ import { md } from '../utils/md.js';
|
|
|
17
17
|
import { validation } from '../utils/validation.js';
|
|
18
18
|
import { prompt } from '../utils/prompt.js';
|
|
19
19
|
import { timings } from './timings.js';
|
|
20
|
-
import
|
|
20
|
+
import { browserUtil } from '../utils/browserUtil.js';
|
|
21
21
|
const require = createRequire(import.meta.url);
|
|
22
22
|
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
|
23
23
|
let _config;
|
|
@@ -35,7 +35,9 @@ let commandToExecute;
|
|
|
35
35
|
let currentCommandName;
|
|
36
36
|
let optionsFromArgs;
|
|
37
37
|
const defaultHelpMode = 'options';
|
|
38
|
+
const defaultHelpTarget = 'console';
|
|
38
39
|
const helpModes = ['options', 'examples', 'remarks', 'response', 'full'];
|
|
40
|
+
const helpTargets = ['console', 'web'];
|
|
39
41
|
function getConfig() {
|
|
40
42
|
if (!_config) {
|
|
41
43
|
_config = new Configstore(config.configstoreName);
|
|
@@ -551,10 +553,17 @@ async function printHelp(helpMode, exitCode = 0) {
|
|
|
551
553
|
const properties = {};
|
|
552
554
|
if (cli.commandToExecute) {
|
|
553
555
|
properties.command = cli.commandToExecute.name;
|
|
554
|
-
|
|
556
|
+
const helpTarget = getSettingWithDefaultValue(settingsNames.helpTarget, defaultHelpTarget);
|
|
557
|
+
if (helpTarget === 'web') {
|
|
558
|
+
await openHelpInBrowser();
|
|
559
|
+
}
|
|
560
|
+
else {
|
|
561
|
+
printCommandHelp(helpMode);
|
|
562
|
+
}
|
|
555
563
|
}
|
|
556
564
|
else {
|
|
557
565
|
if (cli.currentCommandName && !cli.commands.some(command => command.name.startsWith(cli.currentCommandName))) {
|
|
566
|
+
const chalk = (await import('chalk')).default;
|
|
558
567
|
await cli.error(chalk.red(`Command '${cli.currentCommandName}' was not found. Below you can find the commands and command groups you can use. For detailed information on a command group, use 'm365 [command group] --help'.`));
|
|
559
568
|
}
|
|
560
569
|
cli.log();
|
|
@@ -567,6 +576,11 @@ async function printHelp(helpMode, exitCode = 0) {
|
|
|
567
576
|
telemetry.trackEvent('help', properties);
|
|
568
577
|
process.exit(exitCode);
|
|
569
578
|
}
|
|
579
|
+
async function openHelpInBrowser() {
|
|
580
|
+
const pathChunks = cli.commandToExecute.help?.replace(/\\/g, '/').replace(/\.[^/.]+$/, '');
|
|
581
|
+
const onlineUrl = `https://pnp.github.io/cli-microsoft365/cmd/${pathChunks}`;
|
|
582
|
+
await browserUtil.open(onlineUrl);
|
|
583
|
+
}
|
|
570
584
|
function printCommandHelp(helpMode) {
|
|
571
585
|
const docsRootDir = path.join(__dirname, '..', '..', 'docs');
|
|
572
586
|
const helpFilePath = path.join(docsRootDir, 'docs', 'cmd', cli.commandToExecute.help);
|
|
@@ -721,26 +735,23 @@ async function closeWithError(error, args, showHelpIfEnabled = false) {
|
|
|
721
735
|
if (args.options.output === 'none') {
|
|
722
736
|
return process.exit(exitCode);
|
|
723
737
|
}
|
|
724
|
-
const chalk = (await import('chalk')).default;
|
|
725
738
|
let errorMessage = error instanceof CommandError ? error.message : error;
|
|
726
739
|
if ((!args.options.output || args.options.output === 'json') &&
|
|
727
740
|
!cli.getSettingWithDefaultValue(settingsNames.printErrorsAsPlainText, true)) {
|
|
728
741
|
errorMessage = JSON.stringify({ error: errorMessage });
|
|
729
742
|
}
|
|
730
743
|
else {
|
|
744
|
+
const chalk = (await import('chalk')).default;
|
|
731
745
|
errorMessage = chalk.red(`Error: ${errorMessage}`);
|
|
732
746
|
}
|
|
733
747
|
if (error instanceof CommandError && error.code) {
|
|
734
748
|
exitCode = error.code;
|
|
735
749
|
}
|
|
736
750
|
await cli.error(errorMessage);
|
|
737
|
-
if (showHelpIfEnabled &&
|
|
738
|
-
await cli.
|
|
739
|
-
await printHelp(await getHelpMode(args.options), exitCode);
|
|
740
|
-
}
|
|
741
|
-
else {
|
|
742
|
-
process.exit(exitCode);
|
|
751
|
+
if (showHelpIfEnabled && cli.getSettingWithDefaultValue(settingsNames.showHelpOnFailure, showHelpIfEnabled)) {
|
|
752
|
+
await cli.error(`Run 'm365 ${cli.commandToExecute.name} -h' for help.`);
|
|
743
753
|
}
|
|
754
|
+
process.exit(exitCode);
|
|
744
755
|
// will never be run. Required for testing where we're stubbing process.exit
|
|
745
756
|
/* c8 ignore next */
|
|
746
757
|
throw new Error(errorMessage);
|
|
@@ -865,6 +876,7 @@ export const cli = {
|
|
|
865
876
|
getSettingWithDefaultValue,
|
|
866
877
|
handleMultipleResultsFound,
|
|
867
878
|
helpModes,
|
|
879
|
+
helpTargets,
|
|
868
880
|
loadAllCommandsInfo,
|
|
869
881
|
loadCommandFromArgs,
|
|
870
882
|
loadCommandFromFile,
|
package/dist/index.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { cli } from './cli/cli.js';
|
|
3
3
|
import { app } from './utils/app.js';
|
|
4
|
-
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
process.stdout._handle
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
(async () => {
|
|
5
|
+
// required to make console.log() in combination with piped output synchronous
|
|
6
|
+
// on Windows/in PowerShell so that the output is not trimmed by calling
|
|
7
|
+
// process.exit() after executing the command, while the output is still
|
|
8
|
+
// being processed; https://github.com/pnp/cli-microsoft365/issues/1266
|
|
9
|
+
if (process.stdout._handle) {
|
|
10
|
+
process.stdout._handle.setBlocking(true);
|
|
11
|
+
}
|
|
12
|
+
if (!process.env.CLIMICROSOFT365_NOUPDATE) {
|
|
13
|
+
const updateNotifier = await import('update-notifier');
|
|
13
14
|
updateNotifier.default({ pkg: app.packageJson() }).notify({ defer: false });
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
}
|
|
16
|
+
await cli.execute(process.argv.slice(2));
|
|
17
|
+
})();
|
|
17
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -87,6 +87,10 @@ _a = CliConfigSetCommand, _CliConfigSetCommand_instances = new WeakSet(), _CliCo
|
|
|
87
87
|
allowedAuthTypes.indexOf(args.options.value) === -1) {
|
|
88
88
|
return `${args.options.value} is not a valid value for the option ${args.options.key}. Allowed values: ${allowedAuthTypes.join(', ')}`;
|
|
89
89
|
}
|
|
90
|
+
if (args.options.key === settingsNames.helpTarget &&
|
|
91
|
+
!cli.helpTargets.includes(args.options.value)) {
|
|
92
|
+
return `${args.options.value} is not a valid value for the option ${args.options.key}. Allowed values: ${cli.helpTargets.join(', ')}`;
|
|
93
|
+
}
|
|
90
94
|
return true;
|
|
91
95
|
});
|
|
92
96
|
};
|
|
@@ -35,9 +35,9 @@ class SetupCommand extends AnonymousCommand {
|
|
|
35
35
|
}
|
|
36
36
|
else if (args.options.scripting) {
|
|
37
37
|
Object.assign(settings, scriptingPreset);
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
if (pid.isPowerShell()) {
|
|
39
|
+
Object.assign(settings, powerShellPreset);
|
|
40
|
+
}
|
|
41
41
|
}
|
|
42
42
|
await this.configureSettings(settings, true, logger);
|
|
43
43
|
return;
|
|
@@ -10,6 +10,8 @@ import commands from "../../commands.js";
|
|
|
10
10
|
import request from "../../../../request.js";
|
|
11
11
|
import { validation } from "../../../../utils/validation.js";
|
|
12
12
|
import aadCommands from "../../aadCommands.js";
|
|
13
|
+
import { formatting } from "../../../../utils/formatting.js";
|
|
14
|
+
import { cli } from "../../../../cli/cli.js";
|
|
13
15
|
var ScopeType;
|
|
14
16
|
(function (ScopeType) {
|
|
15
17
|
ScopeType["Role"] = "Role";
|
|
@@ -68,11 +70,27 @@ class EntraAppPermissionAddCommand extends GraphCommand {
|
|
|
68
70
|
}
|
|
69
71
|
}
|
|
70
72
|
async getAppObject(options) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
73
|
+
let appNotFoundMessage = '';
|
|
74
|
+
let apps = [];
|
|
75
|
+
if (options.appId) {
|
|
76
|
+
apps = await odata.getAllItems(`${this.resource}/v1.0/applications?$filter=appId eq '${options.appId}'&$select=id,appId,requiredResourceAccess`);
|
|
77
|
+
appNotFoundMessage = `client id ${options.appId}`;
|
|
78
|
+
}
|
|
79
|
+
else if (options.appName) {
|
|
80
|
+
apps = await odata.getAllItems(`${this.resource}/v1.0/applications?$filter=displayName eq '${formatting.encodeQueryParameter(options.appName)}'&$select=id,appId,requiredResourceAccess`);
|
|
81
|
+
appNotFoundMessage = `name ${options.appName}`;
|
|
82
|
+
if (apps.length > 1) {
|
|
83
|
+
const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', apps);
|
|
84
|
+
const result = await cli.handleMultipleResultsFound(`Multiple Entra application registrations with name '${options.appName}' found.`, resultAsKeyValuePair);
|
|
85
|
+
return result;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
else if (options.appObjectId) {
|
|
89
|
+
apps = await odata.getAllItems(`${this.resource}/v1.0/applications?$filter=id eq '${options.appObjectId}'&$select=id,appId,requiredResourceAccess`);
|
|
90
|
+
appNotFoundMessage = `object id ${options.appObjectId}`;
|
|
91
|
+
}
|
|
74
92
|
if (apps.length === 0) {
|
|
75
|
-
throw `App with ${
|
|
93
|
+
throw `App with ${appNotFoundMessage} not found in Microsoft Entra ID`;
|
|
76
94
|
}
|
|
77
95
|
return apps[0];
|
|
78
96
|
}
|
|
@@ -209,6 +227,7 @@ _EntraAppPermissionAddCommand_instances = new WeakSet(), _EntraAppPermissionAddC
|
|
|
209
227
|
this.telemetry.push((args) => {
|
|
210
228
|
Object.assign(this.telemetryProperties, {
|
|
211
229
|
appId: typeof args.options.appId !== 'undefined',
|
|
230
|
+
appName: typeof args.options.appName !== 'undefined',
|
|
212
231
|
appObjectId: typeof args.options.appObjectId !== 'undefined',
|
|
213
232
|
applicationPermissions: typeof args.options.applicationPermissions !== 'undefined',
|
|
214
233
|
delegatedPermissions: typeof args.options.delegatedPermissions !== 'undefined',
|
|
@@ -216,7 +235,7 @@ _EntraAppPermissionAddCommand_instances = new WeakSet(), _EntraAppPermissionAddC
|
|
|
216
235
|
});
|
|
217
236
|
});
|
|
218
237
|
}, _EntraAppPermissionAddCommand_initOptions = function _EntraAppPermissionAddCommand_initOptions() {
|
|
219
|
-
this.options.unshift({ option: '-i, --appId [appId]' }, { option: '--appObjectId [appObjectId]' }, { option: '-a, --applicationPermissions [applicationPermissions]' }, { option: '-d, --delegatedPermissions [delegatedPermissions]' }, { option: '--grantAdminConsent' });
|
|
238
|
+
this.options.unshift({ option: '-i, --appId [appId]' }, { option: '-n, --appName [appName]' }, { option: '--appObjectId [appObjectId]' }, { option: '-a, --applicationPermissions [applicationPermissions]' }, { option: '-d, --delegatedPermissions [delegatedPermissions]' }, { option: '--grantAdminConsent' });
|
|
220
239
|
}, _EntraAppPermissionAddCommand_initValidators = function _EntraAppPermissionAddCommand_initValidators() {
|
|
221
240
|
this.validators.push(async (args) => {
|
|
222
241
|
if (args.options.appId && !validation.isValidGuid(args.options.appId)) {
|
|
@@ -228,7 +247,7 @@ _EntraAppPermissionAddCommand_instances = new WeakSet(), _EntraAppPermissionAddC
|
|
|
228
247
|
return true;
|
|
229
248
|
});
|
|
230
249
|
}, _EntraAppPermissionAddCommand_initOptionSets = function _EntraAppPermissionAddCommand_initOptionSets() {
|
|
231
|
-
this.optionSets.push({ options: ['appId', 'appObjectId'] });
|
|
250
|
+
this.optionSets.push({ options: ['appId', 'appName', 'appObjectId'] });
|
|
232
251
|
this.optionSets.push({
|
|
233
252
|
options: ['applicationPermissions', 'delegatedPermissions'],
|
|
234
253
|
runsWhen: (args) => args.options.delegatedPermissions === undefined && args.options.applicationPermissions === undefined
|
|
@@ -9,6 +9,7 @@ import commands from "../../commands.js";
|
|
|
9
9
|
import request from "../../../../request.js";
|
|
10
10
|
import { validation } from "../../../../utils/validation.js";
|
|
11
11
|
import { formatting } from "../../../../utils/formatting.js";
|
|
12
|
+
import { cli } from "../../../../cli/cli.js";
|
|
12
13
|
class EntraAppPermissionListCommand extends GraphCommand {
|
|
13
14
|
get name() {
|
|
14
15
|
return commands.APP_PERMISSION_LIST;
|
|
@@ -40,18 +41,28 @@ class EntraAppPermissionListCommand extends GraphCommand {
|
|
|
40
41
|
if (options.appObjectId) {
|
|
41
42
|
return options.appObjectId;
|
|
42
43
|
}
|
|
44
|
+
const { appId, appName } = options;
|
|
45
|
+
const filter = appId ?
|
|
46
|
+
`appId eq '${formatting.encodeQueryParameter(appId)}'` :
|
|
47
|
+
`displayName eq '${formatting.encodeQueryParameter(appName)}'`;
|
|
43
48
|
const requestOptions = {
|
|
44
|
-
url: `${this.resource}/v1.0/myorganization/applications?$filter
|
|
49
|
+
url: `${this.resource}/v1.0/myorganization/applications?$filter=${filter}&$select=id`,
|
|
45
50
|
headers: {
|
|
46
51
|
accept: 'application/json;odata.metadata=none'
|
|
47
52
|
},
|
|
48
53
|
responseType: 'json'
|
|
49
54
|
};
|
|
50
55
|
const res = await request.get(requestOptions);
|
|
56
|
+
if (res.value.length === 1) {
|
|
57
|
+
return res.value[0].id;
|
|
58
|
+
}
|
|
51
59
|
if (res.value.length === 0) {
|
|
52
|
-
|
|
60
|
+
const applicationIdentifier = appId ? `ID ${appId}` : `name ${appName}`;
|
|
61
|
+
throw `No Microsoft Entra application registration with ${applicationIdentifier} found`;
|
|
53
62
|
}
|
|
54
|
-
|
|
63
|
+
const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', res.value);
|
|
64
|
+
const result = await cli.handleMultipleResultsFound(`Multiple Entra application registrations with name '${appName}' found.`, resultAsKeyValuePair);
|
|
65
|
+
return result.id;
|
|
55
66
|
}
|
|
56
67
|
async getAppRegPermissions(appObjectId, permissionType, logger) {
|
|
57
68
|
const requestOptions = {
|
|
@@ -156,12 +167,13 @@ _EntraAppPermissionListCommand_instances = new WeakSet(), _EntraAppPermissionLis
|
|
|
156
167
|
this.telemetry.push((args) => {
|
|
157
168
|
Object.assign(this.telemetryProperties, {
|
|
158
169
|
appId: typeof args.options.appId !== 'undefined',
|
|
170
|
+
appName: typeof args.options.appName !== 'undefined',
|
|
159
171
|
appObjectId: typeof args.options.appObjectId !== 'undefined',
|
|
160
172
|
type: typeof args.options.type !== 'undefined'
|
|
161
173
|
});
|
|
162
174
|
});
|
|
163
175
|
}, _EntraAppPermissionListCommand_initOptions = function _EntraAppPermissionListCommand_initOptions() {
|
|
164
|
-
this.options.unshift({ option: '-i, --appId [appId]' }, { option: '--appObjectId [appObjectId]' }, { option: '--type [type]', autocomplete: this.allowedTypes });
|
|
176
|
+
this.options.unshift({ option: '-i, --appId [appId]' }, { option: '-n, --appName [appName]' }, { option: '--appObjectId [appObjectId]' }, { option: '--type [type]', autocomplete: this.allowedTypes });
|
|
165
177
|
}, _EntraAppPermissionListCommand_initValidators = function _EntraAppPermissionListCommand_initValidators() {
|
|
166
178
|
this.validators.push(async (args) => {
|
|
167
179
|
if (args.options.appId && !validation.isValidGuid(args.options.appId)) {
|
|
@@ -176,7 +188,7 @@ _EntraAppPermissionListCommand_instances = new WeakSet(), _EntraAppPermissionLis
|
|
|
176
188
|
return true;
|
|
177
189
|
});
|
|
178
190
|
}, _EntraAppPermissionListCommand_initOptionSets = function _EntraAppPermissionListCommand_initOptionSets() {
|
|
179
|
-
this.optionSets.push({ options: ['appId', 'appObjectId'] });
|
|
191
|
+
this.optionSets.push({ options: ['appId', 'appName', 'appObjectId'] });
|
|
180
192
|
};
|
|
181
193
|
export default new EntraAppPermissionListCommand();
|
|
182
194
|
//# sourceMappingURL=app-permission-list.js.map
|
|
@@ -169,29 +169,27 @@ _EntraGroupAddCommand_instances = new WeakSet(), _EntraGroupAddCommand_initOptio
|
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
if (args.options.ownerIds) {
|
|
172
|
-
const
|
|
173
|
-
if (
|
|
174
|
-
|
|
175
|
-
return `'${invalidGuid}' is not a valid GUID for option 'ownerIds'.`;
|
|
172
|
+
const isValidGUIDArrayResult = validation.isValidGuidArray(args.options.ownerIds);
|
|
173
|
+
if (isValidGUIDArrayResult !== true) {
|
|
174
|
+
return `The following GUIDs are invalid for the option 'ownerIds': ${isValidGUIDArrayResult}.`;
|
|
176
175
|
}
|
|
177
176
|
}
|
|
178
177
|
if (args.options.ownerUserNames) {
|
|
179
|
-
const
|
|
180
|
-
if (
|
|
181
|
-
return `
|
|
178
|
+
const isValidUPNArrayResult = validation.isValidUserPrincipalNameArray(args.options.ownerUserNames);
|
|
179
|
+
if (isValidUPNArrayResult !== true) {
|
|
180
|
+
return `The following user principal names are invalid for the option 'ownerUserNames': ${isValidUPNArrayResult}.`;
|
|
182
181
|
}
|
|
183
182
|
}
|
|
184
183
|
if (args.options.memberIds) {
|
|
185
|
-
const
|
|
186
|
-
if (
|
|
187
|
-
|
|
188
|
-
return `'${invalidGuid}' is not a valid GUID for option 'memberIds'.`;
|
|
184
|
+
const isValidGUIDArrayResult = validation.isValidGuidArray(args.options.memberIds);
|
|
185
|
+
if (isValidGUIDArrayResult !== true) {
|
|
186
|
+
return `The following GUIDs are invalid for the option 'memberIds': ${isValidGUIDArrayResult}.`;
|
|
189
187
|
}
|
|
190
188
|
}
|
|
191
189
|
if (args.options.memberUserNames) {
|
|
192
|
-
const
|
|
193
|
-
if (
|
|
194
|
-
return `
|
|
190
|
+
const isValidUPNArrayResult = validation.isValidUserPrincipalNameArray(args.options.memberUserNames);
|
|
191
|
+
if (isValidUPNArrayResult !== true) {
|
|
192
|
+
return `The following user principal names are invalid for the option 'memberUserNames': ${isValidUPNArrayResult}.`;
|
|
195
193
|
}
|
|
196
194
|
}
|
|
197
195
|
if (['microsoft365', 'security'].indexOf(args.options.type) === -1) {
|
|
@@ -119,16 +119,15 @@ _EntraGroupUserAddCommand_instances = new WeakSet(), _EntraGroupUserAddCommand_i
|
|
|
119
119
|
return `${args.options.groupId} is not a valid GUID for option groupId.`;
|
|
120
120
|
}
|
|
121
121
|
if (args.options.ids) {
|
|
122
|
-
const
|
|
123
|
-
if (
|
|
124
|
-
|
|
125
|
-
return `'${invalidGuid}' is not a valid GUID for option 'ids'.`;
|
|
122
|
+
const isValidGUIDArrayResult = validation.isValidGuidArray(args.options.ids);
|
|
123
|
+
if (isValidGUIDArrayResult !== true) {
|
|
124
|
+
return `The following GUIDs are invalid for the option 'ids': ${isValidGUIDArrayResult}.`;
|
|
126
125
|
}
|
|
127
126
|
}
|
|
128
127
|
if (args.options.userNames) {
|
|
129
|
-
const
|
|
130
|
-
if (
|
|
131
|
-
return `
|
|
128
|
+
const isValidUPNArrayResult = validation.isValidUserPrincipalNameArray(args.options.userNames);
|
|
129
|
+
if (isValidUPNArrayResult !== true) {
|
|
130
|
+
return `The following user principal names are invalid for the option 'userNames': ${isValidUPNArrayResult}.`;
|
|
132
131
|
}
|
|
133
132
|
}
|
|
134
133
|
if (this.roleValues.indexOf(args.options.role) === -1) {
|
|
@@ -189,6 +189,7 @@ class EntraM365GroupAddCommand extends GraphCommand {
|
|
|
189
189
|
_EntraM365GroupAddCommand_instances = new WeakSet(), _EntraM365GroupAddCommand_initTelemetry = function _EntraM365GroupAddCommand_initTelemetry() {
|
|
190
190
|
this.telemetry.push((args) => {
|
|
191
191
|
Object.assign(this.telemetryProperties, {
|
|
192
|
+
description: typeof args.options.description !== 'undefined',
|
|
192
193
|
owners: typeof args.options.owners !== 'undefined',
|
|
193
194
|
members: typeof args.options.members !== 'undefined',
|
|
194
195
|
logoPath: typeof args.options.logoPath !== 'undefined',
|
|
@@ -202,10 +203,10 @@ _EntraM365GroupAddCommand_instances = new WeakSet(), _EntraM365GroupAddCommand_i
|
|
|
202
203
|
}, _EntraM365GroupAddCommand_initOptions = function _EntraM365GroupAddCommand_initOptions() {
|
|
203
204
|
this.options.unshift({
|
|
204
205
|
option: '-n, --displayName <displayName>'
|
|
205
|
-
}, {
|
|
206
|
-
option: '-d, --description <description>'
|
|
207
206
|
}, {
|
|
208
207
|
option: '-m, --mailNickname <mailNickname>'
|
|
208
|
+
}, {
|
|
209
|
+
option: '-d, --description [description]'
|
|
209
210
|
}, {
|
|
210
211
|
option: '--owners [owners]'
|
|
211
212
|
}, {
|
|
@@ -229,6 +230,7 @@ _EntraM365GroupAddCommand_instances = new WeakSet(), _EntraM365GroupAddCommand_i
|
|
|
229
230
|
option: '-l, --logoPath [logoPath]'
|
|
230
231
|
});
|
|
231
232
|
}, _EntraM365GroupAddCommand_initTypes = function _EntraM365GroupAddCommand_initTypes() {
|
|
233
|
+
this.types.string.push('displayName', 'mailNickname', 'description', 'owners', 'members', 'visibility', 'logoPath');
|
|
232
234
|
this.types.boolean.push('allowMembersToPost', 'hideGroupInOutlook', 'subscribeNewGroupMembers', 'welcomeEmailDisabled');
|
|
233
235
|
}, _EntraM365GroupAddCommand_initValidators = function _EntraM365GroupAddCommand_initValidators() {
|
|
234
236
|
this.validators.push(async (args) => {
|
|
@@ -205,16 +205,15 @@ _EntraUserRegistrationDetailsListCommand_instances = new WeakSet(), _EntraUserRe
|
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
207
|
if (args.options.userIds) {
|
|
208
|
-
const
|
|
209
|
-
if (
|
|
210
|
-
|
|
211
|
-
return `'${invalidGuid}' is not a valid GUID for option 'userIds'.`;
|
|
208
|
+
const isValidGUIDArrayResult = validation.isValidGuidArray(args.options.userIds);
|
|
209
|
+
if (isValidGUIDArrayResult !== true) {
|
|
210
|
+
return `The following GUIDs are invalid for the option 'userIds': ${isValidGUIDArrayResult}.`;
|
|
212
211
|
}
|
|
213
212
|
}
|
|
214
213
|
if (args.options.userPrincipalNames) {
|
|
215
|
-
const
|
|
216
|
-
if (
|
|
217
|
-
return `
|
|
214
|
+
const isValidUPNArrayResult = validation.isValidUserPrincipalNameArray(args.options.userPrincipalNames);
|
|
215
|
+
if (isValidUPNArrayResult !== true) {
|
|
216
|
+
return `The following user principal names are invalid for the option 'userPrincipalNames': ${isValidUPNArrayResult}.`;
|
|
218
217
|
}
|
|
219
218
|
}
|
|
220
219
|
return true;
|
|
@@ -4,6 +4,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
6
|
var _FlowRunListCommand_instances, _FlowRunListCommand_initTelemetry, _FlowRunListCommand_initOptions, _FlowRunListCommand_initValidators;
|
|
7
|
+
import request from '../../../../request.js';
|
|
7
8
|
import { formatting } from '../../../../utils/formatting.js';
|
|
8
9
|
import { odata } from '../../../../utils/odata.js';
|
|
9
10
|
import { validation } from '../../../../utils/validation.js';
|
|
@@ -38,6 +39,9 @@ class FlowRunListCommand extends PowerAutomateCommand {
|
|
|
38
39
|
}
|
|
39
40
|
try {
|
|
40
41
|
const items = await odata.getAllItems(url);
|
|
42
|
+
if (args.options.withTrigger) {
|
|
43
|
+
await this.retrieveTriggerInformation(items);
|
|
44
|
+
}
|
|
41
45
|
if (args.options.output !== 'json' && items.length > 0) {
|
|
42
46
|
items.forEach(i => {
|
|
43
47
|
i.startTime = i.properties.startTime;
|
|
@@ -63,6 +67,21 @@ class FlowRunListCommand extends PowerAutomateCommand {
|
|
|
63
67
|
}
|
|
64
68
|
return filters;
|
|
65
69
|
}
|
|
70
|
+
async retrieveTriggerInformation(items) {
|
|
71
|
+
const tasks = items.map(async (item) => {
|
|
72
|
+
const requestOptions = {
|
|
73
|
+
url: item.properties.trigger.outputsLink.uri,
|
|
74
|
+
headers: {
|
|
75
|
+
accept: 'application/json',
|
|
76
|
+
'x-anonymous': true
|
|
77
|
+
},
|
|
78
|
+
responseType: 'json'
|
|
79
|
+
};
|
|
80
|
+
const response = await request.get(requestOptions);
|
|
81
|
+
item.triggerInformation = response.body;
|
|
82
|
+
});
|
|
83
|
+
await Promise.all(tasks);
|
|
84
|
+
}
|
|
66
85
|
}
|
|
67
86
|
_FlowRunListCommand_instances = new WeakSet(), _FlowRunListCommand_initTelemetry = function _FlowRunListCommand_initTelemetry() {
|
|
68
87
|
this.telemetry.push((args) => {
|
|
@@ -70,6 +89,7 @@ _FlowRunListCommand_instances = new WeakSet(), _FlowRunListCommand_initTelemetry
|
|
|
70
89
|
status: typeof args.options.status !== 'undefined',
|
|
71
90
|
triggerStartTime: typeof args.options.triggerStartTime !== 'undefined',
|
|
72
91
|
triggerEndTime: typeof args.options.triggerEndTime !== 'undefined',
|
|
92
|
+
withTrigger: !!args.options.withTrigger,
|
|
73
93
|
asAdmin: !!args.options.asAdmin
|
|
74
94
|
});
|
|
75
95
|
});
|
|
@@ -85,6 +105,8 @@ _FlowRunListCommand_instances = new WeakSet(), _FlowRunListCommand_initTelemetry
|
|
|
85
105
|
option: '--triggerStartTime [triggerStartTime]'
|
|
86
106
|
}, {
|
|
87
107
|
option: '--triggerEndTime [triggerEndTime]'
|
|
108
|
+
}, {
|
|
109
|
+
option: '--withTrigger'
|
|
88
110
|
}, {
|
|
89
111
|
option: '--asAdmin'
|
|
90
112
|
});
|
|
@@ -102,6 +124,9 @@ _FlowRunListCommand_instances = new WeakSet(), _FlowRunListCommand_initTelemetry
|
|
|
102
124
|
if (args.options.triggerEndTime && !validation.isValidISODateTime(args.options.triggerEndTime)) {
|
|
103
125
|
return `'${args.options.triggerEndTime}' is not a valid datetime.`;
|
|
104
126
|
}
|
|
127
|
+
if (args.options.output !== 'json' && args.options.withTrigger) {
|
|
128
|
+
return 'The --withTrigger option is only available when output is set to json';
|
|
129
|
+
}
|
|
105
130
|
return true;
|
|
106
131
|
});
|
|
107
132
|
};
|
|
@@ -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 _OutlookMessageListCommand_instances, _OutlookMessageListCommand_initTelemetry, _OutlookMessageListCommand_initOptions, _OutlookMessageListCommand_initOptionSets;
|
|
6
|
+
var _OutlookMessageListCommand_instances, _OutlookMessageListCommand_initTelemetry, _OutlookMessageListCommand_initOptions, _OutlookMessageListCommand_initValidators, _OutlookMessageListCommand_initTypes, _OutlookMessageListCommand_initOptionSets;
|
|
7
7
|
import request from '../../../../request.js';
|
|
8
8
|
import { formatting } from '../../../../utils/formatting.js';
|
|
9
9
|
import { odata } from '../../../../utils/odata.js';
|
|
@@ -11,6 +11,9 @@ import GraphCommand from '../../../base/GraphCommand.js';
|
|
|
11
11
|
import commands from '../../commands.js';
|
|
12
12
|
import { Outlook } from '../../Outlook.js';
|
|
13
13
|
import { cli } from '../../../../cli/cli.js';
|
|
14
|
+
import { validation } from '../../../../utils/validation.js';
|
|
15
|
+
import { accessToken } from '../../../../utils/accessToken.js';
|
|
16
|
+
import auth from '../../../../Auth.js';
|
|
14
17
|
class OutlookMessageListCommand extends GraphCommand {
|
|
15
18
|
get name() {
|
|
16
19
|
return commands.MESSAGE_LIST;
|
|
@@ -23,6 +26,8 @@ class OutlookMessageListCommand extends GraphCommand {
|
|
|
23
26
|
_OutlookMessageListCommand_instances.add(this);
|
|
24
27
|
__classPrivateFieldGet(this, _OutlookMessageListCommand_instances, "m", _OutlookMessageListCommand_initTelemetry).call(this);
|
|
25
28
|
__classPrivateFieldGet(this, _OutlookMessageListCommand_instances, "m", _OutlookMessageListCommand_initOptions).call(this);
|
|
29
|
+
__classPrivateFieldGet(this, _OutlookMessageListCommand_instances, "m", _OutlookMessageListCommand_initValidators).call(this);
|
|
30
|
+
__classPrivateFieldGet(this, _OutlookMessageListCommand_instances, "m", _OutlookMessageListCommand_initTypes).call(this);
|
|
26
31
|
__classPrivateFieldGet(this, _OutlookMessageListCommand_instances, "m", _OutlookMessageListCommand_initOptionSets).call(this);
|
|
27
32
|
}
|
|
28
33
|
defaultProperties() {
|
|
@@ -30,27 +35,44 @@ class OutlookMessageListCommand extends GraphCommand {
|
|
|
30
35
|
}
|
|
31
36
|
async commandAction(logger, args) {
|
|
32
37
|
try {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
38
|
+
if (!args.options.userId && !args.options.userName && accessToken.isAppOnlyAccessToken(auth.connection.accessTokens[auth.defaultResource].accessToken)) {
|
|
39
|
+
throw 'You must specify either the userId or userName option when using app-only permissions.';
|
|
40
|
+
}
|
|
41
|
+
const userUrl = args.options.userId || args.options.userName ? `users/${args.options.userId || formatting.encodeQueryParameter(args.options.userName)}` : 'me';
|
|
42
|
+
const folderId = await this.getFolderId(userUrl, args.options);
|
|
43
|
+
const folderUrl = folderId ? `/mailFolders/${folderId}` : '';
|
|
44
|
+
let requestUrl = `${this.resource}/v1.0/${userUrl}${folderUrl}/messages?$top=100`;
|
|
45
|
+
if (args.options.startTime || args.options.endTime) {
|
|
46
|
+
const filters = [];
|
|
47
|
+
if (args.options.startTime) {
|
|
48
|
+
filters.push(`receivedDateTime ge ${args.options.startTime}`);
|
|
49
|
+
}
|
|
50
|
+
if (args.options.endTime) {
|
|
51
|
+
filters.push(`receivedDateTime lt ${args.options.endTime}`);
|
|
52
|
+
}
|
|
53
|
+
if (filters.length > 0) {
|
|
54
|
+
requestUrl += `&$filter=${filters.join(' and ')}`;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const messages = await odata.getAllItems(requestUrl);
|
|
36
58
|
await logger.log(messages);
|
|
37
59
|
}
|
|
38
60
|
catch (err) {
|
|
39
61
|
this.handleRejectedODataJsonPromise(err);
|
|
40
62
|
}
|
|
41
63
|
}
|
|
42
|
-
async getFolderId(
|
|
43
|
-
if (!
|
|
64
|
+
async getFolderId(userUrl, options) {
|
|
65
|
+
if (!options.folderId && !options.folderName) {
|
|
44
66
|
return '';
|
|
45
67
|
}
|
|
46
|
-
if (
|
|
47
|
-
return
|
|
68
|
+
if (options.folderId) {
|
|
69
|
+
return options.folderId;
|
|
48
70
|
}
|
|
49
|
-
if (Outlook.wellKnownFolderNames.
|
|
50
|
-
return
|
|
71
|
+
if (Outlook.wellKnownFolderNames.includes(options.folderName.toLowerCase())) {
|
|
72
|
+
return options.folderName;
|
|
51
73
|
}
|
|
52
74
|
const requestOptions = {
|
|
53
|
-
url: `${this.resource}/v1.0/
|
|
75
|
+
url: `${this.resource}/v1.0/${userUrl}/mailFolders?$filter=displayName eq '${formatting.encodeQueryParameter(options.folderName)}'&$select=id`,
|
|
54
76
|
headers: {
|
|
55
77
|
accept: 'application/json;odata.metadata=none'
|
|
56
78
|
},
|
|
@@ -58,11 +80,11 @@ class OutlookMessageListCommand extends GraphCommand {
|
|
|
58
80
|
};
|
|
59
81
|
const response = await request.get(requestOptions);
|
|
60
82
|
if (response.value.length === 0) {
|
|
61
|
-
throw `Folder with name '${
|
|
83
|
+
throw `Folder with name '${options.folderName}' not found`;
|
|
62
84
|
}
|
|
63
85
|
if (response.value.length > 1) {
|
|
64
86
|
const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', response.value);
|
|
65
|
-
const result = await cli.handleMultipleResultsFound(`Multiple folders with name '${
|
|
87
|
+
const result = await cli.handleMultipleResultsFound(`Multiple folders with name '${options.folderName}' found.`, resultAsKeyValuePair);
|
|
66
88
|
return result.id;
|
|
67
89
|
}
|
|
68
90
|
return response.value[0].id;
|
|
@@ -72,7 +94,11 @@ _OutlookMessageListCommand_instances = new WeakSet(), _OutlookMessageListCommand
|
|
|
72
94
|
this.telemetry.push((args) => {
|
|
73
95
|
Object.assign(this.telemetryProperties, {
|
|
74
96
|
folderId: typeof args.options.folderId !== 'undefined',
|
|
75
|
-
folderName: typeof args.options.folderName !== 'undefined'
|
|
97
|
+
folderName: typeof args.options.folderName !== 'undefined',
|
|
98
|
+
startTime: typeof args.options.startTime !== 'undefined',
|
|
99
|
+
endTime: typeof args.options.endTime !== 'undefined',
|
|
100
|
+
userId: typeof args.options.userId !== 'undefined',
|
|
101
|
+
userName: typeof args.options.userName !== 'undefined'
|
|
76
102
|
});
|
|
77
103
|
});
|
|
78
104
|
}, _OutlookMessageListCommand_initOptions = function _OutlookMessageListCommand_initOptions() {
|
|
@@ -80,11 +106,55 @@ _OutlookMessageListCommand_instances = new WeakSet(), _OutlookMessageListCommand
|
|
|
80
106
|
option: '--folderName [folderName]',
|
|
81
107
|
autocomplete: Outlook.wellKnownFolderNames
|
|
82
108
|
}, {
|
|
83
|
-
option: '--folderId [folderId]'
|
|
84
|
-
|
|
109
|
+
option: '--folderId [folderId]'
|
|
110
|
+
}, {
|
|
111
|
+
option: '--startTime [startTime]'
|
|
112
|
+
}, {
|
|
113
|
+
option: '--endTime [endTime]'
|
|
114
|
+
}, {
|
|
115
|
+
option: '--userId [userId]'
|
|
116
|
+
}, {
|
|
117
|
+
option: '--userName [userName]'
|
|
85
118
|
});
|
|
119
|
+
}, _OutlookMessageListCommand_initValidators = function _OutlookMessageListCommand_initValidators() {
|
|
120
|
+
this.validators.push(async (args) => {
|
|
121
|
+
if (args.options.startTime) {
|
|
122
|
+
if (!validation.isValidISODateTime(args.options.startTime)) {
|
|
123
|
+
return `'${args.options.startTime}' is not a valid ISO date string for option startTime.`;
|
|
124
|
+
}
|
|
125
|
+
if (new Date(args.options.startTime) > new Date()) {
|
|
126
|
+
return 'startTime value cannot be in the future.';
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
if (args.options.endTime) {
|
|
130
|
+
if (!validation.isValidISODateTime(args.options.endTime)) {
|
|
131
|
+
return `'${args.options.endTime}' is not a valid ISO date string for option endTime.`;
|
|
132
|
+
}
|
|
133
|
+
if (new Date(args.options.endTime) > new Date()) {
|
|
134
|
+
return 'endTime value cannot be in the future.';
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (args.options.startTime && args.options.endTime && new Date(args.options.startTime) >= new Date(args.options.endTime)) {
|
|
138
|
+
return 'startTime must be before endTime.';
|
|
139
|
+
}
|
|
140
|
+
if (args.options.userId && !validation.isValidGuid(args.options.userId)) {
|
|
141
|
+
return `${args.options.userId} is not a valid GUID for option userId.`;
|
|
142
|
+
}
|
|
143
|
+
if (args.options.userName && !validation.isValidUserPrincipalName(args.options.userName)) {
|
|
144
|
+
return `${args.options.userName} is not a valid UPN for option userName.`;
|
|
145
|
+
}
|
|
146
|
+
return true;
|
|
147
|
+
});
|
|
148
|
+
}, _OutlookMessageListCommand_initTypes = function _OutlookMessageListCommand_initTypes() {
|
|
149
|
+
this.types.string.push('folderName', 'folderId', 'startTime', 'endTime', 'userId', 'userName');
|
|
86
150
|
}, _OutlookMessageListCommand_initOptionSets = function _OutlookMessageListCommand_initOptionSets() {
|
|
87
|
-
this.optionSets.push({
|
|
151
|
+
this.optionSets.push({
|
|
152
|
+
options: ['folderId', 'folderName'],
|
|
153
|
+
runsWhen: (args) => args.options.folderId || args.options.folderName
|
|
154
|
+
}, {
|
|
155
|
+
options: ['userId', 'userName'],
|
|
156
|
+
runsWhen: (args) => args.options.userId || args.options.userName
|
|
157
|
+
});
|
|
88
158
|
};
|
|
89
159
|
export default new OutlookMessageListCommand();
|
|
90
160
|
//# sourceMappingURL=message-list.js.map
|