@pnp/cli-microsoft365 7.3.0-beta.e0b37b9 → 7.4.0-beta.ae3d33b
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-get.js +112 -0
- package/dist/m365/aad/commands.js +1 -0
- package/dist/m365/base/PowerAutomateCommand.js +18 -0
- package/dist/m365/external/commands/connection/connection-schema-add.js +36 -3
- 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/pa/commands/app/app-get.js +26 -11
- package/dist/m365/pa/commands/app/app-remove.js +19 -2
- package/dist/m365/spo/commands/listitem/listitem-batch-add.js +18 -7
- package/dist/m365/spo/commands/page/page-add.js +7 -28
- package/dist/utils/aadAdministrativeUnit.js +4 -4
- package/docs/docs/cmd/aad/administrativeunit/administrativeunit-member-get.mdx +130 -0
- package/docs/docs/cmd/external/connection/connection-schema-add.mdx +14 -1
- package/docs/docs/cmd/pa/app/app-get.mdx +15 -0
- package/docs/docs/cmd/pa/app/app-remove.mdx +14 -0
- package/docs/docs/cmd/spo/listitem/listitem-batch-add.mdx +25 -3
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/Auth.js
CHANGED
|
@@ -570,6 +570,9 @@ export class Auth {
|
|
|
570
570
|
resource.endsWith('.api.bap.microsoft.com')) {
|
|
571
571
|
resource = 'https://service.powerapps.com/';
|
|
572
572
|
}
|
|
573
|
+
if (resource === 'https://api.flow.microsoft.com') {
|
|
574
|
+
resource = 'https://management.azure.com/';
|
|
575
|
+
}
|
|
573
576
|
if (resource === 'https://api.powerbi.com') {
|
|
574
577
|
// api.powerbi.com is not a valid resource
|
|
575
578
|
// we need to use https://analysis.windows.net/powerbi/api instead
|
|
@@ -0,0 +1,112 @@
|
|
|
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 _AadAdministrativeUnitMemberGetCommand_instances, _AadAdministrativeUnitMemberGetCommand_initTelemetry, _AadAdministrativeUnitMemberGetCommand_initOptions, _AadAdministrativeUnitMemberGetCommand_initValidators, _AadAdministrativeUnitMemberGetCommand_initOptionSets;
|
|
7
|
+
import GraphCommand from '../../../base/GraphCommand.js';
|
|
8
|
+
import commands from '../../commands.js';
|
|
9
|
+
import { validation } from '../../../../utils/validation.js';
|
|
10
|
+
import { aadAdministrativeUnit } from '../../../../utils/aadAdministrativeUnit.js';
|
|
11
|
+
import request from '../../../../request.js';
|
|
12
|
+
class AadAdministrativeUnitMemberGetCommand extends GraphCommand {
|
|
13
|
+
get name() {
|
|
14
|
+
return commands.ADMINISTRATIVEUNIT_MEMBER_GET;
|
|
15
|
+
}
|
|
16
|
+
get description() {
|
|
17
|
+
return 'Retrieve a specific member (user, group, or device) of an administrative unit';
|
|
18
|
+
}
|
|
19
|
+
constructor() {
|
|
20
|
+
super();
|
|
21
|
+
_AadAdministrativeUnitMemberGetCommand_instances.add(this);
|
|
22
|
+
__classPrivateFieldGet(this, _AadAdministrativeUnitMemberGetCommand_instances, "m", _AadAdministrativeUnitMemberGetCommand_initTelemetry).call(this);
|
|
23
|
+
__classPrivateFieldGet(this, _AadAdministrativeUnitMemberGetCommand_instances, "m", _AadAdministrativeUnitMemberGetCommand_initOptions).call(this);
|
|
24
|
+
__classPrivateFieldGet(this, _AadAdministrativeUnitMemberGetCommand_instances, "m", _AadAdministrativeUnitMemberGetCommand_initValidators).call(this);
|
|
25
|
+
__classPrivateFieldGet(this, _AadAdministrativeUnitMemberGetCommand_instances, "m", _AadAdministrativeUnitMemberGetCommand_initOptionSets).call(this);
|
|
26
|
+
}
|
|
27
|
+
async commandAction(logger, args) {
|
|
28
|
+
let administrativeUnitId = args.options.administrativeUnitId;
|
|
29
|
+
try {
|
|
30
|
+
if (args.options.administrativeUnitName) {
|
|
31
|
+
if (this.verbose) {
|
|
32
|
+
await logger.logToStderr(`Retrieving Administrative Unit Id...`);
|
|
33
|
+
}
|
|
34
|
+
administrativeUnitId = (await aadAdministrativeUnit.getAdministrativeUnitByDisplayName(args.options.administrativeUnitName)).id;
|
|
35
|
+
}
|
|
36
|
+
const url = this.getRequestUrl(administrativeUnitId, args.options.id, args.options);
|
|
37
|
+
const requestOptions = {
|
|
38
|
+
url: url,
|
|
39
|
+
headers: {
|
|
40
|
+
accept: 'application/json;odata.metadata=minimal'
|
|
41
|
+
},
|
|
42
|
+
responseType: 'json'
|
|
43
|
+
};
|
|
44
|
+
const result = await request.get(requestOptions);
|
|
45
|
+
const odataType = result['@odata.type'];
|
|
46
|
+
if (odataType) {
|
|
47
|
+
result.type = odataType.replace('#microsoft.graph.', '');
|
|
48
|
+
}
|
|
49
|
+
delete result['@odata.type'];
|
|
50
|
+
delete result['@odata.context'];
|
|
51
|
+
await logger.log(result);
|
|
52
|
+
}
|
|
53
|
+
catch (err) {
|
|
54
|
+
this.handleRejectedODataJsonPromise(err);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
getRequestUrl(administrativeUnitId, memberId, options) {
|
|
58
|
+
const queryParameters = [];
|
|
59
|
+
if (options.properties) {
|
|
60
|
+
const allProperties = options.properties.split(',');
|
|
61
|
+
const selectProperties = allProperties.filter(prop => !prop.includes('/'));
|
|
62
|
+
const expandProperties = allProperties.filter(prop => prop.includes('/'));
|
|
63
|
+
if (selectProperties.length > 0) {
|
|
64
|
+
queryParameters.push(`$select=${selectProperties}`);
|
|
65
|
+
}
|
|
66
|
+
if (expandProperties.length > 0) {
|
|
67
|
+
const fieldExpands = expandProperties.map(p => {
|
|
68
|
+
const properties = p.split('/');
|
|
69
|
+
return `${properties[0]}($select=${properties[1]})`;
|
|
70
|
+
});
|
|
71
|
+
queryParameters.push(`$expand=${fieldExpands.join(',')}`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
const queryString = queryParameters.length > 0
|
|
75
|
+
? `?${queryParameters.join('&')}`
|
|
76
|
+
: '';
|
|
77
|
+
return `${this.resource}/v1.0/directory/administrativeUnits/${administrativeUnitId}/members/${memberId}${queryString}`;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
_AadAdministrativeUnitMemberGetCommand_instances = new WeakSet(), _AadAdministrativeUnitMemberGetCommand_initTelemetry = function _AadAdministrativeUnitMemberGetCommand_initTelemetry() {
|
|
81
|
+
this.telemetry.push((args) => {
|
|
82
|
+
Object.assign(this.telemetryProperties, {
|
|
83
|
+
administrativeUnitId: typeof args.options.administrativeUnitId !== 'undefined',
|
|
84
|
+
administrativeUnitName: typeof args.options.administrativeUnitName !== 'undefined',
|
|
85
|
+
properties: typeof args.options.properties !== 'undefined'
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
}, _AadAdministrativeUnitMemberGetCommand_initOptions = function _AadAdministrativeUnitMemberGetCommand_initOptions() {
|
|
89
|
+
this.options.unshift({
|
|
90
|
+
option: '-i, --id <id>'
|
|
91
|
+
}, {
|
|
92
|
+
option: '-u, --administrativeUnitId [administrativeUnitId]'
|
|
93
|
+
}, {
|
|
94
|
+
option: '-n, --administrativeUnitName [administrativeUnitName]'
|
|
95
|
+
}, {
|
|
96
|
+
option: '-p, --properties [properties]'
|
|
97
|
+
});
|
|
98
|
+
}, _AadAdministrativeUnitMemberGetCommand_initValidators = function _AadAdministrativeUnitMemberGetCommand_initValidators() {
|
|
99
|
+
this.validators.push(async (args) => {
|
|
100
|
+
if (args.options.id && !validation.isValidGuid(args.options.id)) {
|
|
101
|
+
return `${args.options.id} is not a valid GUID`;
|
|
102
|
+
}
|
|
103
|
+
if (args.options.administrativeUnitId && !validation.isValidGuid(args.options.administrativeUnitId)) {
|
|
104
|
+
return `${args.options.administrativeUnitId} is not a valid GUID`;
|
|
105
|
+
}
|
|
106
|
+
return true;
|
|
107
|
+
});
|
|
108
|
+
}, _AadAdministrativeUnitMemberGetCommand_initOptionSets = function _AadAdministrativeUnitMemberGetCommand_initOptionSets() {
|
|
109
|
+
this.optionSets.push({ options: ['administrativeUnitId', 'administrativeUnitName'] });
|
|
110
|
+
};
|
|
111
|
+
export default new AadAdministrativeUnitMemberGetCommand();
|
|
112
|
+
//# sourceMappingURL=administrativeunit-member-get.js.map
|
|
@@ -5,6 +5,7 @@ export default {
|
|
|
5
5
|
ADMINISTRATIVEUNIT_LIST: `${prefix} administrativeunit list`,
|
|
6
6
|
ADMINISTRATIVEUNIT_REMOVE: `${prefix} administrativeunit remove`,
|
|
7
7
|
ADMINISTRATIVEUNIT_MEMBER_ADD: `${prefix} administrativeunit member add`,
|
|
8
|
+
ADMINISTRATIVEUNIT_MEMBER_GET: `${prefix} administrativeunit member get`,
|
|
8
9
|
ADMINISTRATIVEUNIT_MEMBER_LIST: `${prefix} administrativeunit member list`,
|
|
9
10
|
APP_ADD: `${prefix} app add`,
|
|
10
11
|
APP_GET: `${prefix} app get`,
|
|
@@ -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
|
|
@@ -33,10 +33,41 @@ class ExternalConnectionSchemaAddCommand extends GraphCommand {
|
|
|
33
33
|
accept: 'application/json;odata.metadata=none'
|
|
34
34
|
},
|
|
35
35
|
responseType: 'json',
|
|
36
|
-
data: args.options.schema
|
|
36
|
+
data: args.options.schema,
|
|
37
|
+
fullResponse: true
|
|
37
38
|
};
|
|
38
39
|
try {
|
|
39
|
-
await request.
|
|
40
|
+
const res = await request.patch(requestOptions);
|
|
41
|
+
const location = res.headers.location;
|
|
42
|
+
logger.log(location);
|
|
43
|
+
if (!args.options.wait) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
let status;
|
|
47
|
+
do {
|
|
48
|
+
if (this.verbose) {
|
|
49
|
+
logger.logToStderr(`Waiting 60 seconds...`);
|
|
50
|
+
}
|
|
51
|
+
// waiting 60s before polling as recommended by Microsoft
|
|
52
|
+
await new Promise(resolve => setTimeout(resolve, 60000));
|
|
53
|
+
if (this.debug) {
|
|
54
|
+
logger.logToStderr(`Checking schema operation status...`);
|
|
55
|
+
}
|
|
56
|
+
const operation = await request.get({
|
|
57
|
+
url: location,
|
|
58
|
+
headers: {
|
|
59
|
+
accept: 'application/json;odata.metadata=none'
|
|
60
|
+
},
|
|
61
|
+
responseType: 'json'
|
|
62
|
+
});
|
|
63
|
+
status = operation.status;
|
|
64
|
+
if (this.verbose) {
|
|
65
|
+
logger.logToStderr(`Schema operation status: ${status}`);
|
|
66
|
+
}
|
|
67
|
+
if (status === 'failed') {
|
|
68
|
+
throw `Provisioning schema failed: ${operation.error?.message}`;
|
|
69
|
+
}
|
|
70
|
+
} while (status === 'inprogress');
|
|
40
71
|
}
|
|
41
72
|
catch (err) {
|
|
42
73
|
this.handleRejectedODataJsonPromise(err);
|
|
@@ -48,6 +79,8 @@ _ExternalConnectionSchemaAddCommand_instances = new WeakSet(), _ExternalConnecti
|
|
|
48
79
|
option: '-i, --externalConnectionId <externalConnectionId>'
|
|
49
80
|
}, {
|
|
50
81
|
option: '-s, --schema <schema>'
|
|
82
|
+
}, {
|
|
83
|
+
option: '--wait'
|
|
51
84
|
});
|
|
52
85
|
}, _ExternalConnectionSchemaAddCommand_initValidators = function _ExternalConnectionSchemaAddCommand_initValidators() {
|
|
53
86
|
this.validators.push(async (args) => {
|
|
@@ -67,7 +100,7 @@ _ExternalConnectionSchemaAddCommand_instances = new WeakSet(), _ExternalConnecti
|
|
|
67
100
|
return `The schema needs a required property 'baseType' with value 'microsoft.graph.externalItem'`;
|
|
68
101
|
}
|
|
69
102
|
if (!schemaObject.properties || schemaObject.properties.length > 128) {
|
|
70
|
-
return `We need
|
|
103
|
+
return `We need at least one property and a maximum of 128 properties in the schema object`;
|
|
71
104
|
}
|
|
72
105
|
return true;
|
|
73
106
|
});
|
|
@@ -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
|
},
|