@pnp/cli-microsoft365 7.3.0-beta.6062919 → 7.3.0-beta.66401a3
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/Auth.js +3 -0
- package/dist/m365/aad/commands/administrativeunit/administrativeunit-member-add.js +137 -0
- package/dist/m365/aad/commands/administrativeunit/administrativeunit-member-get.js +112 -0
- package/dist/m365/aad/commands/administrativeunit/administrativeunit-member-list.js +138 -0
- package/dist/m365/aad/commands/app/app-permission-add.js +237 -0
- package/dist/m365/aad/commands.js +5 -1
- package/dist/m365/base/PowerAutomateCommand.js +18 -0
- package/dist/m365/flow/commands/environment/environment-get.js +3 -3
- package/dist/m365/flow/commands/environment/environment-list.js +3 -3
- package/dist/m365/flow/commands/flow-disable.js +3 -3
- package/dist/m365/flow/commands/flow-enable.js +3 -3
- package/dist/m365/flow/commands/flow-get.js +3 -3
- package/dist/m365/flow/commands/flow-list.js +14 -12
- package/dist/m365/flow/commands/flow-remove.js +3 -3
- package/dist/m365/flow/commands/owner/owner-ensure.js +3 -3
- package/dist/m365/flow/commands/owner/owner-list.js +3 -3
- package/dist/m365/flow/commands/owner/owner-remove.js +3 -3
- package/dist/m365/flow/commands/run/run-cancel.js +3 -3
- package/dist/m365/flow/commands/run/run-get.js +3 -3
- package/dist/m365/flow/commands/run/run-list.js +8 -7
- package/dist/m365/flow/commands/run/run-resubmit.js +4 -4
- package/dist/m365/teams/commands/app/app-install.js +30 -3
- package/dist/m365/teams/commands/user/user-app-add.js +23 -5
- package/dist/utils/aadAdministrativeUnit.js +4 -4
- package/dist/utils/aadDevice.js +25 -0
- package/docs/docs/cmd/aad/administrativeunit/administrativeunit-member-add.mdx +93 -0
- package/docs/docs/cmd/aad/administrativeunit/administrativeunit-member-get.mdx +130 -0
- package/docs/docs/cmd/aad/administrativeunit/administrativeunit-member-list.mdx +312 -0
- package/docs/docs/cmd/aad/app/app-permission-add.mdx +62 -0
- package/docs/docs/cmd/teams/app/app-install.mdx +11 -2
- package/docs/docs/cmd/teams/user/user-app-add.mdx +12 -3
- package/docs/docs/cmd/teams/user/user-app-remove.mdx +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import auth, { CloudType } from '../../Auth.js';
|
|
2
|
+
import Command, { CommandError } from '../../Command.js';
|
|
3
|
+
export default class PowerAutomateCommand extends Command {
|
|
4
|
+
get resource() {
|
|
5
|
+
return 'https://api.flow.microsoft.com';
|
|
6
|
+
}
|
|
7
|
+
initAction(args, logger) {
|
|
8
|
+
super.initAction(args, logger);
|
|
9
|
+
if (!auth.service.connected) {
|
|
10
|
+
// we fail no login in the base command command class
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
if (auth.service.cloudType !== CloudType.Public) {
|
|
14
|
+
throw new CommandError(`Power Automate commands only support the public cloud at the moment. We'll add support for other clouds in the future. Sorry for the inconvenience.`);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=PowerAutomateCommand.js.map
|
|
@@ -6,9 +6,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
6
6
|
var _FlowEnvironmentGetCommand_instances, _FlowEnvironmentGetCommand_initOptions, _FlowEnvironmentGetCommand_initTelemetry;
|
|
7
7
|
import request from '../../../../request.js';
|
|
8
8
|
import { formatting } from '../../../../utils/formatting.js';
|
|
9
|
-
import
|
|
9
|
+
import PowerAutomateCommand from '../../../base/PowerAutomateCommand.js';
|
|
10
10
|
import commands from '../../commands.js';
|
|
11
|
-
class FlowEnvironmentGetCommand extends
|
|
11
|
+
class FlowEnvironmentGetCommand extends PowerAutomateCommand {
|
|
12
12
|
get name() {
|
|
13
13
|
return commands.ENVIRONMENT_GET;
|
|
14
14
|
}
|
|
@@ -28,7 +28,7 @@ class FlowEnvironmentGetCommand extends AzmgmtCommand {
|
|
|
28
28
|
if (this.verbose) {
|
|
29
29
|
await logger.logToStderr(`Retrieving information about Microsoft Flow environment ${args.options.name ?? ''}...`);
|
|
30
30
|
}
|
|
31
|
-
let requestUrl = `${this.resource}providers/Microsoft.ProcessSimple/environments/`;
|
|
31
|
+
let requestUrl = `${this.resource}/providers/Microsoft.ProcessSimple/environments/`;
|
|
32
32
|
if (args.options.name) {
|
|
33
33
|
requestUrl += `${formatting.encodeQueryParameter(args.options.name)}`;
|
|
34
34
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { odata } from '../../../../utils/odata.js';
|
|
2
|
-
import
|
|
2
|
+
import PowerAutomateCommand from '../../../base/PowerAutomateCommand.js';
|
|
3
3
|
import commands from '../../commands.js';
|
|
4
|
-
class FlowEnvironmentListCommand extends
|
|
4
|
+
class FlowEnvironmentListCommand extends PowerAutomateCommand {
|
|
5
5
|
get name() {
|
|
6
6
|
return commands.ENVIRONMENT_LIST;
|
|
7
7
|
}
|
|
@@ -16,7 +16,7 @@ class FlowEnvironmentListCommand extends AzmgmtCommand {
|
|
|
16
16
|
await logger.logToStderr(`Retrieving list of Microsoft Flow environments...`);
|
|
17
17
|
}
|
|
18
18
|
try {
|
|
19
|
-
const res = await odata.getAllItems(`${this.resource}providers/Microsoft.ProcessSimple/environments?api-version=2016-11-01`);
|
|
19
|
+
const res = await odata.getAllItems(`${this.resource}/providers/Microsoft.ProcessSimple/environments?api-version=2016-11-01`);
|
|
20
20
|
if (res.length > 0) {
|
|
21
21
|
if (args.options.output !== 'json') {
|
|
22
22
|
res.forEach(e => {
|
|
@@ -6,9 +6,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
6
6
|
var _FlowDisableCommand_instances, _FlowDisableCommand_initTelemetry, _FlowDisableCommand_initOptions;
|
|
7
7
|
import request from '../../../request.js';
|
|
8
8
|
import { formatting } from '../../../utils/formatting.js';
|
|
9
|
-
import
|
|
9
|
+
import PowerAutomateCommand from '../../base/PowerAutomateCommand.js';
|
|
10
10
|
import commands from '../commands.js';
|
|
11
|
-
class FlowDisableCommand extends
|
|
11
|
+
class FlowDisableCommand extends PowerAutomateCommand {
|
|
12
12
|
get name() {
|
|
13
13
|
return commands.DISABLE;
|
|
14
14
|
}
|
|
@@ -26,7 +26,7 @@ class FlowDisableCommand extends AzmgmtCommand {
|
|
|
26
26
|
await logger.logToStderr(`Disables Microsoft Flow ${args.options.name}...`);
|
|
27
27
|
}
|
|
28
28
|
const requestOptions = {
|
|
29
|
-
url: `${this.resource}providers/Microsoft.ProcessSimple/${args.options.asAdmin ? 'scopes/admin/' : ''}environments/${formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting.encodeQueryParameter(args.options.name)}/stop?api-version=2016-11-01`,
|
|
29
|
+
url: `${this.resource}/providers/Microsoft.ProcessSimple/${args.options.asAdmin ? 'scopes/admin/' : ''}environments/${formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting.encodeQueryParameter(args.options.name)}/stop?api-version=2016-11-01`,
|
|
30
30
|
headers: {
|
|
31
31
|
accept: 'application/json'
|
|
32
32
|
},
|
|
@@ -6,9 +6,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
6
6
|
var _FlowEnableCommand_instances, _FlowEnableCommand_initTelemetry, _FlowEnableCommand_initOptions;
|
|
7
7
|
import request from '../../../request.js';
|
|
8
8
|
import { formatting } from '../../../utils/formatting.js';
|
|
9
|
-
import
|
|
9
|
+
import PowerAutomateCommand from '../../base/PowerAutomateCommand.js';
|
|
10
10
|
import commands from '../commands.js';
|
|
11
|
-
class FlowEnableCommand extends
|
|
11
|
+
class FlowEnableCommand extends PowerAutomateCommand {
|
|
12
12
|
get name() {
|
|
13
13
|
return commands.ENABLE;
|
|
14
14
|
}
|
|
@@ -26,7 +26,7 @@ class FlowEnableCommand extends AzmgmtCommand {
|
|
|
26
26
|
await logger.logToStderr(`Enables Microsoft Flow ${args.options.name}...`);
|
|
27
27
|
}
|
|
28
28
|
const requestOptions = {
|
|
29
|
-
url: `${this.resource}providers/Microsoft.ProcessSimple/${args.options.asAdmin ? 'scopes/admin/' : ''}environments/${formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting.encodeQueryParameter(args.options.name)}/start?api-version=2016-11-01`,
|
|
29
|
+
url: `${this.resource}/providers/Microsoft.ProcessSimple/${args.options.asAdmin ? 'scopes/admin/' : ''}environments/${formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting.encodeQueryParameter(args.options.name)}/start?api-version=2016-11-01`,
|
|
30
30
|
headers: {
|
|
31
31
|
accept: 'application/json'
|
|
32
32
|
},
|
|
@@ -6,9 +6,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
6
6
|
var _FlowGetCommand_instances, _FlowGetCommand_initTelemetry, _FlowGetCommand_initOptions;
|
|
7
7
|
import request from '../../../request.js';
|
|
8
8
|
import { formatting } from '../../../utils/formatting.js';
|
|
9
|
-
import
|
|
9
|
+
import PowerAutomateCommand from '../../base/PowerAutomateCommand.js';
|
|
10
10
|
import commands from '../commands.js';
|
|
11
|
-
class FlowGetCommand extends
|
|
11
|
+
class FlowGetCommand extends PowerAutomateCommand {
|
|
12
12
|
get name() {
|
|
13
13
|
return commands.GET;
|
|
14
14
|
}
|
|
@@ -29,7 +29,7 @@ class FlowGetCommand extends AzmgmtCommand {
|
|
|
29
29
|
await logger.logToStderr(`Retrieving information about Microsoft Flow ${args.options.name}...`);
|
|
30
30
|
}
|
|
31
31
|
const requestOptions = {
|
|
32
|
-
url: `${this.resource}providers/Microsoft.ProcessSimple/${args.options.asAdmin ? 'scopes/admin/' : ''}environments/${formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting.encodeQueryParameter(args.options.name)}?api-version=2016-11-01`,
|
|
32
|
+
url: `${this.resource}/providers/Microsoft.ProcessSimple/${args.options.asAdmin ? 'scopes/admin/' : ''}environments/${formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting.encodeQueryParameter(args.options.name)}?api-version=2016-11-01`,
|
|
33
33
|
headers: {
|
|
34
34
|
accept: 'application/json'
|
|
35
35
|
},
|
|
@@ -5,9 +5,10 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
5
5
|
};
|
|
6
6
|
var _FlowListCommand_instances, _FlowListCommand_initTelemetry, _FlowListCommand_initOptions, _FlowListCommand_initValidators;
|
|
7
7
|
import { formatting } from '../../../utils/formatting.js';
|
|
8
|
-
import {
|
|
8
|
+
import { odata } from '../../../utils/odata.js';
|
|
9
|
+
import PowerAutomateCommand from '../../base/PowerAutomateCommand.js';
|
|
9
10
|
import commands from '../commands.js';
|
|
10
|
-
class FlowListCommand extends
|
|
11
|
+
class FlowListCommand extends PowerAutomateCommand {
|
|
11
12
|
get name() {
|
|
12
13
|
return commands.LIST;
|
|
13
14
|
}
|
|
@@ -28,31 +29,32 @@ class FlowListCommand extends AzmgmtItemsListCommand {
|
|
|
28
29
|
async commandAction(logger, args) {
|
|
29
30
|
try {
|
|
30
31
|
const { environmentName, asAdmin, sharingStatus, includeSolutions } = args.options;
|
|
32
|
+
let items = [];
|
|
31
33
|
if (sharingStatus === 'personal') {
|
|
32
34
|
const url = this.getApiUrl(environmentName, asAdmin, includeSolutions, 'personal');
|
|
33
|
-
await
|
|
35
|
+
items = await odata.getAllItems(url);
|
|
34
36
|
}
|
|
35
37
|
else if (sharingStatus === 'sharedWithMe') {
|
|
36
38
|
const url = this.getApiUrl(environmentName, asAdmin, includeSolutions, 'team');
|
|
37
|
-
await
|
|
39
|
+
items = await odata.getAllItems(url);
|
|
38
40
|
}
|
|
39
41
|
else if (sharingStatus === 'all') {
|
|
40
42
|
let url = this.getApiUrl(environmentName, asAdmin, includeSolutions, 'personal');
|
|
41
|
-
await
|
|
43
|
+
items = await odata.getAllItems(url);
|
|
42
44
|
url = this.getApiUrl(environmentName, asAdmin, includeSolutions, 'team');
|
|
43
|
-
await
|
|
45
|
+
items = await odata.getAllItems(url);
|
|
44
46
|
}
|
|
45
47
|
else {
|
|
46
48
|
const url = this.getApiUrl(environmentName, asAdmin, includeSolutions);
|
|
47
|
-
await
|
|
49
|
+
items = await odata.getAllItems(url);
|
|
48
50
|
}
|
|
49
51
|
// Remove duplicates
|
|
50
|
-
|
|
51
|
-
if (
|
|
52
|
-
|
|
52
|
+
items = items.filter((flow, index, self) => index === self.findIndex(f => f.id === flow.id));
|
|
53
|
+
if (items.length > 0) {
|
|
54
|
+
items.forEach(i => {
|
|
53
55
|
i.displayName = i.properties.displayName;
|
|
54
56
|
});
|
|
55
|
-
await logger.log(
|
|
57
|
+
await logger.log(items);
|
|
56
58
|
}
|
|
57
59
|
else {
|
|
58
60
|
if (this.verbose) {
|
|
@@ -65,7 +67,7 @@ class FlowListCommand extends AzmgmtItemsListCommand {
|
|
|
65
67
|
}
|
|
66
68
|
}
|
|
67
69
|
getApiUrl(environmentName, asAdmin, includeSolutionFlows, filter) {
|
|
68
|
-
let url = `${this.resource}providers/Microsoft.ProcessSimple${asAdmin ? '/scopes/admin' : ''}/environments/${formatting.encodeQueryParameter(environmentName)}/flows?api-version=2016-11-01`;
|
|
70
|
+
let url = `${this.resource}/providers/Microsoft.ProcessSimple${asAdmin ? '/scopes/admin' : ''}/environments/${formatting.encodeQueryParameter(environmentName)}/flows?api-version=2016-11-01`;
|
|
69
71
|
if (filter === 'personal') {
|
|
70
72
|
url += `&$filter=search('personal')`;
|
|
71
73
|
}
|
|
@@ -8,9 +8,9 @@ import { cli } from '../../../cli/cli.js';
|
|
|
8
8
|
import request from '../../../request.js';
|
|
9
9
|
import { formatting } from '../../../utils/formatting.js';
|
|
10
10
|
import { validation } from '../../../utils/validation.js';
|
|
11
|
-
import AzmgmtCommand from '../../base/AzmgmtCommand.js';
|
|
12
11
|
import commands from '../commands.js';
|
|
13
|
-
|
|
12
|
+
import PowerAutomateCommand from '../../base/PowerAutomateCommand.js';
|
|
13
|
+
class FlowRemoveCommand extends PowerAutomateCommand {
|
|
14
14
|
get name() {
|
|
15
15
|
return commands.REMOVE;
|
|
16
16
|
}
|
|
@@ -30,7 +30,7 @@ class FlowRemoveCommand extends AzmgmtCommand {
|
|
|
30
30
|
}
|
|
31
31
|
const removeFlow = async () => {
|
|
32
32
|
const requestOptions = {
|
|
33
|
-
url: `${this.resource}providers/Microsoft.ProcessSimple/${args.options.asAdmin ? 'scopes/admin/' : ''}environments/${formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting.encodeQueryParameter(args.options.name)}?api-version=2016-11-01`,
|
|
33
|
+
url: `${this.resource}/providers/Microsoft.ProcessSimple/${args.options.asAdmin ? 'scopes/admin/' : ''}environments/${formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting.encodeQueryParameter(args.options.name)}?api-version=2016-11-01`,
|
|
34
34
|
fullResponse: true,
|
|
35
35
|
headers: {
|
|
36
36
|
accept: 'application/json'
|
|
@@ -9,9 +9,9 @@ import { aadGroup } from '../../../../utils/aadGroup.js';
|
|
|
9
9
|
import { aadUser } from '../../../../utils/aadUser.js';
|
|
10
10
|
import { formatting } from '../../../../utils/formatting.js';
|
|
11
11
|
import { validation } from '../../../../utils/validation.js';
|
|
12
|
-
import
|
|
12
|
+
import PowerAutomateCommand from '../../../base/PowerAutomateCommand.js';
|
|
13
13
|
import commands from '../../commands.js';
|
|
14
|
-
class FlowOwnerEnsureCommand extends
|
|
14
|
+
class FlowOwnerEnsureCommand extends PowerAutomateCommand {
|
|
15
15
|
get name() {
|
|
16
16
|
return commands.OWNER_ENSURE;
|
|
17
17
|
}
|
|
@@ -52,7 +52,7 @@ class FlowOwnerEnsureCommand extends AzmgmtCommand {
|
|
|
52
52
|
type = 'Group';
|
|
53
53
|
}
|
|
54
54
|
const requestOptions = {
|
|
55
|
-
url: `${this.resource}providers/Microsoft.ProcessSimple/${args.options.asAdmin ? 'scopes/admin/' : ''}environments/${formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting.encodeQueryParameter(args.options.flowName)}/modifyPermissions?api-version=2016-11-01`,
|
|
55
|
+
url: `${this.resource}/providers/Microsoft.ProcessSimple/${args.options.asAdmin ? 'scopes/admin/' : ''}environments/${formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting.encodeQueryParameter(args.options.flowName)}/modifyPermissions?api-version=2016-11-01`,
|
|
56
56
|
headers: {
|
|
57
57
|
accept: 'application/json'
|
|
58
58
|
},
|
|
@@ -8,9 +8,9 @@ import { cli } from '../../../../cli/cli.js';
|
|
|
8
8
|
import { formatting } from '../../../../utils/formatting.js';
|
|
9
9
|
import { odata } from '../../../../utils/odata.js';
|
|
10
10
|
import { validation } from '../../../../utils/validation.js';
|
|
11
|
-
import
|
|
11
|
+
import PowerAutomateCommand from '../../../base/PowerAutomateCommand.js';
|
|
12
12
|
import commands from '../../commands.js';
|
|
13
|
-
class FlowOwnerListCommand extends
|
|
13
|
+
class FlowOwnerListCommand extends PowerAutomateCommand {
|
|
14
14
|
get name() {
|
|
15
15
|
return commands.OWNER_LIST;
|
|
16
16
|
}
|
|
@@ -32,7 +32,7 @@ class FlowOwnerListCommand extends AzmgmtCommand {
|
|
|
32
32
|
if (this.verbose) {
|
|
33
33
|
await logger.logToStderr(`Listing owners for flow ${args.options.flowName} in environment ${args.options.environmentName}`);
|
|
34
34
|
}
|
|
35
|
-
const response = await odata.getAllItems(`${this.resource}providers/Microsoft.ProcessSimple/${args.options.asAdmin ? 'scopes/admin/' : ''}environments/${formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting.encodeQueryParameter(args.options.flowName)}/permissions?api-version=2016-11-01`);
|
|
35
|
+
const response = await odata.getAllItems(`${this.resource}/providers/Microsoft.ProcessSimple/${args.options.asAdmin ? 'scopes/admin/' : ''}environments/${formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting.encodeQueryParameter(args.options.flowName)}/permissions?api-version=2016-11-01`);
|
|
36
36
|
if (!cli.shouldTrimOutput(args.options.output)) {
|
|
37
37
|
await logger.log(response);
|
|
38
38
|
}
|
|
@@ -10,9 +10,9 @@ import { aadGroup } from '../../../../utils/aadGroup.js';
|
|
|
10
10
|
import { aadUser } from '../../../../utils/aadUser.js';
|
|
11
11
|
import { formatting } from '../../../../utils/formatting.js';
|
|
12
12
|
import { validation } from '../../../../utils/validation.js';
|
|
13
|
-
import
|
|
13
|
+
import PowerAutomateCommand from '../../../base/PowerAutomateCommand.js';
|
|
14
14
|
import commands from '../../commands.js';
|
|
15
|
-
class FlowOwnerRemoveCommand extends
|
|
15
|
+
class FlowOwnerRemoveCommand extends PowerAutomateCommand {
|
|
16
16
|
get name() {
|
|
17
17
|
return commands.OWNER_REMOVE;
|
|
18
18
|
}
|
|
@@ -47,7 +47,7 @@ class FlowOwnerRemoveCommand extends AzmgmtCommand {
|
|
|
47
47
|
idToRemove = await aadGroup.getGroupIdByDisplayName(args.options.groupName);
|
|
48
48
|
}
|
|
49
49
|
const requestOptions = {
|
|
50
|
-
url: `${this.resource}providers/Microsoft.ProcessSimple/${args.options.asAdmin ? 'scopes/admin/' : ''}environments/${formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting.encodeQueryParameter(args.options.flowName)}/modifyPermissions?api-version=2016-11-01`,
|
|
50
|
+
url: `${this.resource}/providers/Microsoft.ProcessSimple/${args.options.asAdmin ? 'scopes/admin/' : ''}environments/${formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting.encodeQueryParameter(args.options.flowName)}/modifyPermissions?api-version=2016-11-01`,
|
|
51
51
|
headers: {
|
|
52
52
|
accept: 'application/json'
|
|
53
53
|
},
|
|
@@ -8,9 +8,9 @@ import { cli } from '../../../../cli/cli.js';
|
|
|
8
8
|
import request from '../../../../request.js';
|
|
9
9
|
import { formatting } from '../../../../utils/formatting.js';
|
|
10
10
|
import { validation } from '../../../../utils/validation.js';
|
|
11
|
-
import
|
|
11
|
+
import PowerAutomateCommand from '../../../base/PowerAutomateCommand.js';
|
|
12
12
|
import commands from '../../commands.js';
|
|
13
|
-
class FlowRunCancelCommand extends
|
|
13
|
+
class FlowRunCancelCommand extends PowerAutomateCommand {
|
|
14
14
|
get name() {
|
|
15
15
|
return commands.RUN_CANCEL;
|
|
16
16
|
}
|
|
@@ -30,7 +30,7 @@ class FlowRunCancelCommand extends AzmgmtCommand {
|
|
|
30
30
|
}
|
|
31
31
|
const cancelFlow = async () => {
|
|
32
32
|
const requestOptions = {
|
|
33
|
-
url: `${this.resource}providers/Microsoft.ProcessSimple/environments/${formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting.encodeQueryParameter(args.options.flowName)}/runs/${formatting.encodeQueryParameter(args.options.name)}/cancel?api-version=2016-11-01`,
|
|
33
|
+
url: `${this.resource}/providers/Microsoft.ProcessSimple/environments/${formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting.encodeQueryParameter(args.options.flowName)}/runs/${formatting.encodeQueryParameter(args.options.name)}/cancel?api-version=2016-11-01`,
|
|
34
34
|
headers: {
|
|
35
35
|
accept: 'application/json'
|
|
36
36
|
},
|
|
@@ -7,9 +7,9 @@ var _FlowRunGetCommand_instances, _FlowRunGetCommand_initOptions, _FlowRunGetCom
|
|
|
7
7
|
import request from '../../../../request.js';
|
|
8
8
|
import { formatting } from '../../../../utils/formatting.js';
|
|
9
9
|
import { validation } from '../../../../utils/validation.js';
|
|
10
|
-
import
|
|
10
|
+
import PowerAutomateCommand from '../../../base/PowerAutomateCommand.js';
|
|
11
11
|
import commands from '../../commands.js';
|
|
12
|
-
class FlowRunGetCommand extends
|
|
12
|
+
class FlowRunGetCommand extends PowerAutomateCommand {
|
|
13
13
|
get name() {
|
|
14
14
|
return commands.RUN_GET;
|
|
15
15
|
}
|
|
@@ -31,7 +31,7 @@ class FlowRunGetCommand extends AzmgmtCommand {
|
|
|
31
31
|
await logger.logToStderr(`Retrieving information about run ${args.options.name} of Microsoft Flow ${args.options.flowName}...`);
|
|
32
32
|
}
|
|
33
33
|
const requestOptions = {
|
|
34
|
-
url: `${this.resource}providers/Microsoft.ProcessSimple/environments/${formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting.encodeQueryParameter(args.options.flowName)}/runs/${formatting.encodeQueryParameter(args.options.name)}?api-version=2016-11-01`,
|
|
34
|
+
url: `${this.resource}/providers/Microsoft.ProcessSimple/environments/${formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting.encodeQueryParameter(args.options.flowName)}/runs/${formatting.encodeQueryParameter(args.options.name)}?api-version=2016-11-01`,
|
|
35
35
|
headers: {
|
|
36
36
|
accept: 'application/json'
|
|
37
37
|
},
|
|
@@ -5,10 +5,11 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
5
5
|
};
|
|
6
6
|
var _FlowRunListCommand_instances, _FlowRunListCommand_initTelemetry, _FlowRunListCommand_initOptions, _FlowRunListCommand_initValidators;
|
|
7
7
|
import { formatting } from '../../../../utils/formatting.js';
|
|
8
|
+
import { odata } from '../../../../utils/odata.js';
|
|
8
9
|
import { validation } from '../../../../utils/validation.js';
|
|
9
|
-
import
|
|
10
|
+
import PowerAutomateCommand from '../../../base/PowerAutomateCommand.js';
|
|
10
11
|
import commands from '../../commands.js';
|
|
11
|
-
class FlowRunListCommand extends
|
|
12
|
+
class FlowRunListCommand extends PowerAutomateCommand {
|
|
12
13
|
get name() {
|
|
13
14
|
return commands.RUN_LIST;
|
|
14
15
|
}
|
|
@@ -30,20 +31,20 @@ class FlowRunListCommand extends AzmgmtItemsListCommand {
|
|
|
30
31
|
if (this.verbose) {
|
|
31
32
|
await logger.logToStderr(`Retrieving list of runs for Microsoft Flow ${args.options.flowName}...`);
|
|
32
33
|
}
|
|
33
|
-
let url = `${this.resource}providers/Microsoft.ProcessSimple/${args.options.asAdmin ? 'scopes/admin/' : ''}environments/${formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting.encodeQueryParameter(args.options.flowName)}/runs?api-version=2016-11-01`;
|
|
34
|
+
let url = `${this.resource}/providers/Microsoft.ProcessSimple/${args.options.asAdmin ? 'scopes/admin/' : ''}environments/${formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting.encodeQueryParameter(args.options.flowName)}/runs?api-version=2016-11-01`;
|
|
34
35
|
const filters = this.getFilters(args.options);
|
|
35
36
|
if (filters.length > 0) {
|
|
36
37
|
url += `&$filter=${filters.join(' and ')}`;
|
|
37
38
|
}
|
|
38
39
|
try {
|
|
39
|
-
await
|
|
40
|
-
if (args.options.output !== 'json' &&
|
|
41
|
-
|
|
40
|
+
const items = await odata.getAllItems(url);
|
|
41
|
+
if (args.options.output !== 'json' && items.length > 0) {
|
|
42
|
+
items.forEach(i => {
|
|
42
43
|
i.startTime = i.properties.startTime;
|
|
43
44
|
i.status = i.properties.status;
|
|
44
45
|
});
|
|
45
46
|
}
|
|
46
|
-
await logger.log(
|
|
47
|
+
await logger.log(items);
|
|
47
48
|
}
|
|
48
49
|
catch (err) {
|
|
49
50
|
this.handleRejectedODataJsonPromise(err);
|
|
@@ -9,9 +9,9 @@ import { cli } from '../../../../cli/cli.js';
|
|
|
9
9
|
import request from '../../../../request.js';
|
|
10
10
|
import { formatting } from '../../../../utils/formatting.js';
|
|
11
11
|
import { validation } from '../../../../utils/validation.js';
|
|
12
|
-
import AzmgmtCommand from '../../../base/AzmgmtCommand.js';
|
|
13
12
|
import commands from '../../commands.js';
|
|
14
|
-
|
|
13
|
+
import PowerAutomateCommand from '../../../base/PowerAutomateCommand.js';
|
|
14
|
+
class FlowRunResubmitCommand extends PowerAutomateCommand {
|
|
15
15
|
get name() {
|
|
16
16
|
return commands.RUN_RESUBMIT;
|
|
17
17
|
}
|
|
@@ -36,7 +36,7 @@ class FlowRunResubmitCommand extends AzmgmtCommand {
|
|
|
36
36
|
await logger.logToStderr(chalk.yellow(`Retrieved trigger: ${triggerName}`));
|
|
37
37
|
}
|
|
38
38
|
const requestOptions = {
|
|
39
|
-
url: `${this.resource}providers/Microsoft.ProcessSimple/environments/${formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting.encodeQueryParameter(args.options.flowName)}/triggers/${formatting.encodeQueryParameter(triggerName)}/histories/${formatting.encodeQueryParameter(args.options.name)}/resubmit?api-version=2016-11-01`,
|
|
39
|
+
url: `${this.resource}/providers/Microsoft.ProcessSimple/environments/${formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting.encodeQueryParameter(args.options.flowName)}/triggers/${formatting.encodeQueryParameter(triggerName)}/histories/${formatting.encodeQueryParameter(args.options.name)}/resubmit?api-version=2016-11-01`,
|
|
40
40
|
headers: {
|
|
41
41
|
accept: 'application/json'
|
|
42
42
|
},
|
|
@@ -60,7 +60,7 @@ class FlowRunResubmitCommand extends AzmgmtCommand {
|
|
|
60
60
|
}
|
|
61
61
|
async getTriggerName(environment, flow) {
|
|
62
62
|
const requestOptions = {
|
|
63
|
-
url: `${this.resource}providers/Microsoft.ProcessSimple/environments/${formatting.encodeQueryParameter(environment)}/flows/${formatting.encodeQueryParameter(flow)}/triggers?api-version=2016-11-01`,
|
|
63
|
+
url: `${this.resource}/providers/Microsoft.ProcessSimple/environments/${formatting.encodeQueryParameter(environment)}/flows/${formatting.encodeQueryParameter(flow)}/triggers?api-version=2016-11-01`,
|
|
64
64
|
headers: {
|
|
65
65
|
accept: 'application/json'
|
|
66
66
|
},
|
|
@@ -29,6 +29,7 @@ class TeamsAppInstallCommand extends GraphCommand {
|
|
|
29
29
|
async commandAction(logger, args) {
|
|
30
30
|
try {
|
|
31
31
|
await this.validateUser(args, logger);
|
|
32
|
+
const appId = await this.getAppId(args.options);
|
|
32
33
|
let url = `${this.resource}/v1.0`;
|
|
33
34
|
if (args.options.teamId) {
|
|
34
35
|
url += `/teams/${formatting.encodeQueryParameter(args.options.teamId)}/installedApps`;
|
|
@@ -44,7 +45,7 @@ class TeamsAppInstallCommand extends GraphCommand {
|
|
|
44
45
|
},
|
|
45
46
|
responseType: 'json',
|
|
46
47
|
data: {
|
|
47
|
-
'teamsApp@odata.bind': `${this.resource}/v1.0/appCatalogs/teamsApps/${
|
|
48
|
+
'teamsApp@odata.bind': `${this.resource}/v1.0/appCatalogs/teamsApps/${appId}`
|
|
48
49
|
}
|
|
49
50
|
};
|
|
50
51
|
await request.post(requestOptions);
|
|
@@ -82,20 +83,45 @@ class TeamsAppInstallCommand extends GraphCommand {
|
|
|
82
83
|
throw `User with ID ${args.options.userId} not found. Original error: ${err.error.message}`;
|
|
83
84
|
}
|
|
84
85
|
}
|
|
86
|
+
async getAppId(options) {
|
|
87
|
+
if (options.id) {
|
|
88
|
+
return options.id;
|
|
89
|
+
}
|
|
90
|
+
const requestOptions = {
|
|
91
|
+
url: `${this.resource}/v1.0/appCatalogs/teamsApps?$filter=displayName eq '${formatting.encodeQueryParameter(options.name)}'`,
|
|
92
|
+
headers: {
|
|
93
|
+
accept: 'application/json;odata.metadata=none'
|
|
94
|
+
},
|
|
95
|
+
responseType: 'json'
|
|
96
|
+
};
|
|
97
|
+
const response = await request.get(requestOptions);
|
|
98
|
+
const app = response.value[0];
|
|
99
|
+
if (!app) {
|
|
100
|
+
throw `The specified Teams app does not exist`;
|
|
101
|
+
}
|
|
102
|
+
if (response.value.length > 1) {
|
|
103
|
+
const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', response.value);
|
|
104
|
+
const result = await cli.handleMultipleResultsFound(`Multiple Teams apps with name ${options.name} found.`, resultAsKeyValuePair);
|
|
105
|
+
return result.id;
|
|
106
|
+
}
|
|
107
|
+
return app.id;
|
|
108
|
+
}
|
|
85
109
|
}
|
|
86
110
|
_TeamsAppInstallCommand_instances = new WeakSet(), _TeamsAppInstallCommand_initTelemetry = function _TeamsAppInstallCommand_initTelemetry() {
|
|
87
111
|
this.telemetry.push((args) => {
|
|
88
112
|
Object.assign(this.telemetryProperties, {
|
|
113
|
+
id: typeof args.options.id !== 'undefined',
|
|
114
|
+
name: typeof args.options.name !== 'undefined',
|
|
89
115
|
teamId: typeof args.options.teamId !== 'undefined',
|
|
90
116
|
userId: typeof args.options.userId !== 'undefined',
|
|
91
117
|
userName: typeof args.options.userName !== 'undefined'
|
|
92
118
|
});
|
|
93
119
|
});
|
|
94
120
|
}, _TeamsAppInstallCommand_initOptions = function _TeamsAppInstallCommand_initOptions() {
|
|
95
|
-
this.options.unshift({ option: '--id
|
|
121
|
+
this.options.unshift({ option: '-i, --id [id]' }, { option: '-n, --name [name]' }, { option: '--teamId [teamId]' }, { option: '--userId [userId]' }, { option: '--userName [userName]' });
|
|
96
122
|
}, _TeamsAppInstallCommand_initValidators = function _TeamsAppInstallCommand_initValidators() {
|
|
97
123
|
this.validators.push(async (args) => {
|
|
98
|
-
if (!validation.isValidGuid(args.options.id)) {
|
|
124
|
+
if (args.options.id && !validation.isValidGuid(args.options.id)) {
|
|
99
125
|
return `${args.options.id} is not a valid GUID`;
|
|
100
126
|
}
|
|
101
127
|
if (args.options.teamId &&
|
|
@@ -110,6 +136,7 @@ _TeamsAppInstallCommand_instances = new WeakSet(), _TeamsAppInstallCommand_initT
|
|
|
110
136
|
});
|
|
111
137
|
}, _TeamsAppInstallCommand_initOptionSets = function _TeamsAppInstallCommand_initOptionSets() {
|
|
112
138
|
this.optionSets.push({ options: ['teamId', 'userId', 'userName'] });
|
|
139
|
+
this.optionSets.push({ options: ['id', 'name'] });
|
|
113
140
|
};
|
|
114
141
|
export default new TeamsAppInstallCommand();
|
|
115
142
|
//# sourceMappingURL=app-install.js.map
|
|
@@ -3,8 +3,9 @@ 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 _TeamsUserAppAddCommand_instances, _TeamsUserAppAddCommand_initOptions, _TeamsUserAppAddCommand_initValidators;
|
|
6
|
+
var _TeamsUserAppAddCommand_instances, _TeamsUserAppAddCommand_initTelemetry, _TeamsUserAppAddCommand_initOptions, _TeamsUserAppAddCommand_initValidators, _TeamsUserAppAddCommand_initOptionSets;
|
|
7
7
|
import request from '../../../../request.js';
|
|
8
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
8
9
|
import { validation } from '../../../../utils/validation.js';
|
|
9
10
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
10
11
|
import commands from '../../commands.js';
|
|
@@ -18,13 +19,16 @@ class TeamsUserAppAddCommand extends GraphCommand {
|
|
|
18
19
|
constructor() {
|
|
19
20
|
super();
|
|
20
21
|
_TeamsUserAppAddCommand_instances.add(this);
|
|
22
|
+
__classPrivateFieldGet(this, _TeamsUserAppAddCommand_instances, "m", _TeamsUserAppAddCommand_initTelemetry).call(this);
|
|
21
23
|
__classPrivateFieldGet(this, _TeamsUserAppAddCommand_instances, "m", _TeamsUserAppAddCommand_initOptions).call(this);
|
|
22
24
|
__classPrivateFieldGet(this, _TeamsUserAppAddCommand_instances, "m", _TeamsUserAppAddCommand_initValidators).call(this);
|
|
25
|
+
__classPrivateFieldGet(this, _TeamsUserAppAddCommand_instances, "m", _TeamsUserAppAddCommand_initOptionSets).call(this);
|
|
23
26
|
}
|
|
24
27
|
async commandAction(logger, args) {
|
|
28
|
+
const userId = (args.options.userId ?? args.options.userName);
|
|
25
29
|
const endpoint = `${this.resource}/v1.0`;
|
|
26
30
|
const requestOptions = {
|
|
27
|
-
url: `${endpoint}/users/${
|
|
31
|
+
url: `${endpoint}/users/${formatting.encodeQueryParameter(userId)}/teamwork/installedApps`,
|
|
28
32
|
headers: {
|
|
29
33
|
'content-type': 'application/json;odata=nometadata',
|
|
30
34
|
'accept': 'application/json;odata.metadata=none'
|
|
@@ -42,22 +46,36 @@ class TeamsUserAppAddCommand extends GraphCommand {
|
|
|
42
46
|
}
|
|
43
47
|
}
|
|
44
48
|
}
|
|
45
|
-
_TeamsUserAppAddCommand_instances = new WeakSet(),
|
|
49
|
+
_TeamsUserAppAddCommand_instances = new WeakSet(), _TeamsUserAppAddCommand_initTelemetry = function _TeamsUserAppAddCommand_initTelemetry() {
|
|
50
|
+
this.telemetry.push((args) => {
|
|
51
|
+
Object.assign(this.telemetryProperties, {
|
|
52
|
+
userId: typeof args.options.userId !== 'undefined',
|
|
53
|
+
userName: typeof args.options.userName !== 'undefined'
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
}, _TeamsUserAppAddCommand_initOptions = function _TeamsUserAppAddCommand_initOptions() {
|
|
46
57
|
this.options.unshift({
|
|
47
58
|
option: '--id <id>'
|
|
48
59
|
}, {
|
|
49
|
-
option: '--userId
|
|
60
|
+
option: '--userId [userId]'
|
|
61
|
+
}, {
|
|
62
|
+
option: '--userName [userName]'
|
|
50
63
|
});
|
|
51
64
|
}, _TeamsUserAppAddCommand_initValidators = function _TeamsUserAppAddCommand_initValidators() {
|
|
52
65
|
this.validators.push(async (args) => {
|
|
53
66
|
if (!validation.isValidGuid(args.options.id)) {
|
|
54
67
|
return `${args.options.id} is not a valid GUID`;
|
|
55
68
|
}
|
|
56
|
-
if (!validation.isValidGuid(args.options.userId)) {
|
|
69
|
+
if (args.options.userId && !validation.isValidGuid(args.options.userId)) {
|
|
57
70
|
return `${args.options.userId} is not a valid GUID`;
|
|
58
71
|
}
|
|
72
|
+
if (args.options.userName && !validation.isValidUserPrincipalName(args.options.userName)) {
|
|
73
|
+
return `${args.options.userName} is not a valid userName`;
|
|
74
|
+
}
|
|
59
75
|
return true;
|
|
60
76
|
});
|
|
77
|
+
}, _TeamsUserAppAddCommand_initOptionSets = function _TeamsUserAppAddCommand_initOptionSets() {
|
|
78
|
+
this.optionSets.push({ options: ['userId', 'userName'] });
|
|
61
79
|
};
|
|
62
80
|
export default new TeamsUserAppAddCommand();
|
|
63
81
|
//# sourceMappingURL=user-app-add.js.map
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { odata } from
|
|
2
|
-
import { formatting } from
|
|
3
|
-
import { cli } from
|
|
4
|
-
const graphResource = 'https://graph.microsoft.com';
|
|
1
|
+
import { odata } from './odata.js';
|
|
2
|
+
import { formatting } from './formatting.js';
|
|
3
|
+
import { cli } from '../cli/cli.js';
|
|
5
4
|
export const aadAdministrativeUnit = {
|
|
6
5
|
/**
|
|
7
6
|
* Get an administrative unit by its display name.
|
|
@@ -10,6 +9,7 @@ export const aadAdministrativeUnit = {
|
|
|
10
9
|
* @throws Error when administrative unit was not found.
|
|
11
10
|
*/
|
|
12
11
|
async getAdministrativeUnitByDisplayName(displayName) {
|
|
12
|
+
const graphResource = 'https://graph.microsoft.com';
|
|
13
13
|
const administrativeUnits = await odata.getAllItems(`${graphResource}/v1.0/directory/administrativeUnits?$filter=displayName eq '${formatting.encodeQueryParameter(displayName)}'`);
|
|
14
14
|
if (administrativeUnits.length === 0) {
|
|
15
15
|
throw `The specified administrative unit '${displayName}' does not exist.`;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { odata } from "./odata.js";
|
|
2
|
+
import { formatting } from "./formatting.js";
|
|
3
|
+
import { cli } from "../cli/cli.js";
|
|
4
|
+
const graphResource = 'https://graph.microsoft.com';
|
|
5
|
+
export const aadDevice = {
|
|
6
|
+
/**
|
|
7
|
+
* Get a device by its display name.
|
|
8
|
+
* @param displayName Device display name.
|
|
9
|
+
* @returns The device.
|
|
10
|
+
* @throws Error when device was not found.
|
|
11
|
+
*/
|
|
12
|
+
async getDeviceByDisplayName(displayName) {
|
|
13
|
+
const devices = await odata.getAllItems(`${graphResource}/v1.0/devices?$filter=displayName eq '${formatting.encodeQueryParameter(displayName)}'`);
|
|
14
|
+
if (devices.length === 0) {
|
|
15
|
+
throw `The specified device '${displayName}' does not exist.`;
|
|
16
|
+
}
|
|
17
|
+
if (devices.length > 1) {
|
|
18
|
+
const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', devices);
|
|
19
|
+
const selectedDevice = await cli.handleMultipleResultsFound(`Multiple devices with name '${displayName}' found.`, resultAsKeyValuePair);
|
|
20
|
+
return selectedDevice;
|
|
21
|
+
}
|
|
22
|
+
return devices[0];
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=aadDevice.js.map
|