@pnp/cli-microsoft365 7.11.0-beta.c513557 → 8.0.0-beta.3c404b8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.cjs +6 -2
- package/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/Auth.js +2 -10
- package/dist/AuthServer.js +10 -10
- package/dist/Command.js +10 -10
- package/dist/chili/chili.js +0 -23
- package/dist/chili/index.js +1 -1
- package/dist/cli/cli.js +12 -74
- package/dist/index.js +1 -1
- package/dist/m365/base/AnonymousCommand.js +1 -1
- package/dist/m365/base/DelegatedGraphCommand.js +2 -2
- package/dist/m365/base/PowerAppsCommand.js +2 -2
- package/dist/m365/base/PowerAutomateCommand.js +2 -2
- package/dist/m365/base/PowerBICommand.js +2 -2
- package/dist/m365/base/PowerPlatformCommand.js +2 -2
- package/dist/m365/base/VivaEngageCommand.js +2 -2
- package/dist/m365/cli/commands/cli-consent.js +1 -1
- package/dist/m365/commands/login.js +1 -1
- package/dist/m365/commands/logout.js +1 -1
- package/dist/m365/commands/setup.js +0 -4
- package/dist/m365/commands/status.js +1 -1
- package/dist/m365/connection/commands/connection-list.js +1 -1
- package/dist/m365/connection/commands/connection-remove.js +1 -1
- package/dist/m365/connection/commands/connection-set.js +1 -1
- package/dist/m365/connection/commands/connection-use.js +1 -1
- package/dist/m365/entra/commands/app/app-permission-add.js +21 -1
- package/dist/m365/entra/commands/app/app-permission-remove.js +17 -0
- package/dist/m365/entra/commands/m365group/m365group-add.js +1 -0
- package/dist/m365/entra/commands/m365group/m365group-set.js +66 -29
- package/dist/m365/entra/commands/m365group/m365group-user-list.js +1 -1
- package/dist/m365/entra/commands/multitenant/MultitenantOrganization.js +2 -0
- package/dist/m365/entra/commands/multitenant/multitenant-get.js +32 -0
- package/dist/m365/entra/commands.js +1 -0
- package/dist/m365/external/commands/connection/connection-doctor.js +11 -25
- package/dist/m365/external/commands/connection/connection-schema-add.js +4 -4
- package/dist/m365/file/commands/file-copy.js +3 -3
- package/dist/m365/flow/commands/flow-list.js +23 -24
- package/dist/m365/graph/commands/subscription/subscription-add.js +4 -2
- package/dist/m365/pa/commands/app/app-export.js +1 -1
- package/dist/m365/pa/commands/app/app-owner-set.js +1 -1
- package/dist/m365/pp/commands/solution/solution-publish.js +1 -1
- package/dist/m365/purview/commands/threatassessment/threatassessment-list.js +1 -1
- package/dist/m365/spfx/commands/project/base-project-command.js +36 -126
- package/dist/m365/spfx/commands/project/project-azuredevops-pipeline-add.js +1 -1
- package/dist/m365/spfx/commands/project/project-externalize.js +1 -1
- package/dist/m365/spfx/commands/project/project-github-workflow-add.js +1 -1
- package/dist/m365/spfx/commands/spfx-doctor.js +4 -4
- package/dist/m365/spo/commands/cdn/cdn-get.js +12 -15
- package/dist/m365/spo/commands/cdn/cdn-set.js +6 -4
- package/dist/m365/spo/commands/commandset/commandset-get.js +1 -1
- package/dist/m365/spo/commands/contenttype/contenttype-field-list.js +124 -0
- package/dist/m365/spo/commands/field/field-list.js +1 -1
- package/dist/m365/spo/commands/file/file-retentionlabel-remove.js +1 -1
- package/dist/m365/spo/commands/group/group-member-add.js +103 -99
- package/dist/m365/spo/commands/group/group-member-remove.js +2 -2
- package/dist/m365/spo/commands/list/list-retentionlabel-ensure.js +1 -1
- package/dist/m365/spo/commands/listitem/listitem-batch-remove.js +1 -1
- package/dist/m365/spo/commands/listitem/listitem-retentionlabel-ensure.js +2 -2
- package/dist/m365/spo/commands/listitem/listitem-retentionlabel-remove.js +2 -2
- package/dist/m365/spo/commands/page/page-clientsidewebpart-add.js +2 -3
- package/dist/m365/spo/commands/page/page-text-add.js +2 -3
- package/dist/m365/spo/commands/site/site-commsite-enable.js +1 -1
- package/dist/m365/spo/commands/spo-search.js +4 -5
- package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-set.js +4 -4
- package/dist/m365/spo/commands/tenant/tenant-commandset-set.js +2 -2
- package/dist/m365/spo/commands/user/user-ensure.js +1 -1
- package/dist/m365/spo/commands.js +1 -0
- package/dist/m365/teams/commands/chat/chat-member-add.js +1 -1
- package/dist/m365/teams/commands/meeting/meeting-attendancereport-get.js +119 -0
- package/dist/m365/teams/commands/meeting/meeting-list.js +1 -1
- package/dist/m365/teams/commands/message/message-remove.js +112 -0
- package/dist/m365/teams/commands.js +2 -0
- package/dist/m365/viva/commands/engage/engage-community-add.js +166 -0
- package/dist/m365/viva/commands/engage/engage-community-get.js +1 -1
- package/dist/m365/viva/commands.js +1 -0
- package/dist/request.js +13 -14
- package/dist/utils/formatting.js +14 -1
- package/dist/utils/spo.js +5 -5
- package/dist/utils/teams.js +49 -0
- package/dist/utils/validation.js +25 -0
- package/docs/docs/cmd/entra/m365group/m365group-set.mdx +37 -7
- package/docs/docs/cmd/entra/multitenant/multitenant-get.mdx +94 -0
- package/docs/docs/cmd/external/connection/connection-doctor.mdx +9 -9
- package/docs/docs/cmd/flow/flow-list.mdx +114 -56
- package/docs/docs/cmd/graph/subscription/subscription-add.mdx +18 -0
- package/docs/docs/cmd/spo/cdn/cdn-set.mdx +3 -3
- package/docs/docs/cmd/spo/contenttype/contenttype-field-list.mdx +172 -0
- package/docs/docs/cmd/spo/contenttype/contenttype-list.mdx +3 -3
- package/docs/docs/cmd/spo/field/field-list.mdx +3 -3
- package/docs/docs/cmd/spo/group/group-member-add.mdx +34 -27
- package/docs/docs/cmd/teams/meeting/meeting-attendancereport-get.mdx +138 -0
- package/docs/docs/cmd/teams/message/message-remove.mdx +63 -0
- package/docs/docs/cmd/viva/engage/engage-community-add.mdx +168 -0
- package/npm-shrinkwrap.json +809 -803
- package/package.json +13 -13
|
@@ -13,6 +13,8 @@ import GraphCommand from '../../../base/GraphCommand.js';
|
|
|
13
13
|
import commands from '../../commands.js';
|
|
14
14
|
import { entraGroup } from '../../../../utils/entraGroup.js';
|
|
15
15
|
import aadCommands from '../../aadCommands.js';
|
|
16
|
+
import { accessToken } from '../../../../utils/accessToken.js';
|
|
17
|
+
import auth from '../../../../Auth.js';
|
|
16
18
|
class EntraM365GroupSetCommand extends GraphCommand {
|
|
17
19
|
get name() {
|
|
18
20
|
return commands.M365GROUP_SET;
|
|
@@ -35,22 +37,22 @@ class EntraM365GroupSetCommand extends GraphCommand {
|
|
|
35
37
|
async commandAction(logger, args) {
|
|
36
38
|
await this.showDeprecationWarning(logger, aadCommands.M365GROUP_SET, commands.M365GROUP_SET);
|
|
37
39
|
try {
|
|
40
|
+
if ((args.options.allowExternalSenders !== undefined || args.options.autoSubscribeNewMembers !== undefined) && accessToken.isAppOnlyAccessToken(auth.connection.accessTokens[auth.defaultResource].accessToken)) {
|
|
41
|
+
throw `Option 'allowExternalSenders' and 'autoSubscribeNewMembers' can only be used when using delegated permissions.`;
|
|
42
|
+
}
|
|
38
43
|
const isUnifiedGroup = await entraGroup.isUnifiedGroup(args.options.id);
|
|
39
44
|
if (!isUnifiedGroup) {
|
|
40
45
|
throw Error(`Specified group with id '${args.options.id}' is not a Microsoft 365 group.`);
|
|
41
46
|
}
|
|
42
|
-
if (
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const update = {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
if (args.options.
|
|
51
|
-
update.description = args.options.description;
|
|
52
|
-
}
|
|
53
|
-
if (typeof args.options.isPrivate !== 'undefined') {
|
|
47
|
+
if (this.verbose) {
|
|
48
|
+
await logger.logToStderr(`Updating Microsoft 365 Group ${args.options.id}...`);
|
|
49
|
+
}
|
|
50
|
+
if (args.options.displayName || args.options.description !== undefined || args.options.isPrivate !== undefined) {
|
|
51
|
+
const update = {
|
|
52
|
+
displayName: args.options.displayName,
|
|
53
|
+
description: args.options.description !== '' ? args.options.description : null
|
|
54
|
+
};
|
|
55
|
+
if (args.options.isPrivate !== undefined) {
|
|
54
56
|
update.visibility = args.options.isPrivate ? 'Private' : 'Public';
|
|
55
57
|
}
|
|
56
58
|
const requestOptions = {
|
|
@@ -63,6 +65,24 @@ class EntraM365GroupSetCommand extends GraphCommand {
|
|
|
63
65
|
};
|
|
64
66
|
await request.patch(requestOptions);
|
|
65
67
|
}
|
|
68
|
+
// This has to be a separate request due to some Graph API limitations. Otherwise it will throw an error.
|
|
69
|
+
if (args.options.allowExternalSenders !== undefined || args.options.autoSubscribeNewMembers !== undefined || args.options.hideFromAddressLists !== undefined || args.options.hideFromOutlookClients !== undefined) {
|
|
70
|
+
const requestBody = {
|
|
71
|
+
allowExternalSenders: args.options.allowExternalSenders,
|
|
72
|
+
autoSubscribeNewMembers: args.options.autoSubscribeNewMembers,
|
|
73
|
+
hideFromAddressLists: args.options.hideFromAddressLists,
|
|
74
|
+
hideFromOutlookClients: args.options.hideFromOutlookClients
|
|
75
|
+
};
|
|
76
|
+
const requestOptions = {
|
|
77
|
+
url: `${this.resource}/v1.0/groups/${args.options.id}`,
|
|
78
|
+
headers: {
|
|
79
|
+
accept: 'application/json;odata.metadata=none'
|
|
80
|
+
},
|
|
81
|
+
responseType: 'json',
|
|
82
|
+
data: requestBody
|
|
83
|
+
};
|
|
84
|
+
await request.patch(requestOptions);
|
|
85
|
+
}
|
|
66
86
|
if (args.options.logoPath) {
|
|
67
87
|
const fullPath = path.resolve(args.options.logoPath);
|
|
68
88
|
if (this.verbose) {
|
|
@@ -172,8 +192,12 @@ _EntraM365GroupSetCommand_instances = new WeakSet(), _EntraM365GroupSetCommand_i
|
|
|
172
192
|
description: typeof args.options.description !== 'undefined',
|
|
173
193
|
owners: typeof args.options.owners !== 'undefined',
|
|
174
194
|
members: typeof args.options.members !== 'undefined',
|
|
175
|
-
isPrivate: args.options.isPrivate,
|
|
176
|
-
logoPath: typeof args.options.logoPath !== 'undefined'
|
|
195
|
+
isPrivate: !!args.options.isPrivate,
|
|
196
|
+
logoPath: typeof args.options.logoPath !== 'undefined',
|
|
197
|
+
allowExternalSenders: !!args.options.allowExternalSenders,
|
|
198
|
+
autoSubscribeNewMembers: !!args.options.autoSubscribeNewMembers,
|
|
199
|
+
hideFromAddressLists: !!args.options.hideFromAddressLists,
|
|
200
|
+
hideFromOutlookClients: !!args.options.hideFromOutlookClients
|
|
177
201
|
});
|
|
178
202
|
});
|
|
179
203
|
}, _EntraM365GroupSetCommand_initOptions = function _EntraM365GroupSetCommand_initOptions() {
|
|
@@ -192,36 +216,49 @@ _EntraM365GroupSetCommand_instances = new WeakSet(), _EntraM365GroupSetCommand_i
|
|
|
192
216
|
autocomplete: ['true', 'false']
|
|
193
217
|
}, {
|
|
194
218
|
option: '-l, --logoPath [logoPath]'
|
|
219
|
+
}, {
|
|
220
|
+
option: '--allowExternalSenders [allowExternalSenders]',
|
|
221
|
+
autocomplete: ['true', 'false']
|
|
222
|
+
}, {
|
|
223
|
+
option: '--autoSubscribeNewMembers [autoSubscribeNewMembers]',
|
|
224
|
+
autocomplete: ['true', 'false']
|
|
225
|
+
}, {
|
|
226
|
+
option: '--hideFromAddressLists [hideFromAddressLists]',
|
|
227
|
+
autocomplete: ['true', 'false']
|
|
228
|
+
}, {
|
|
229
|
+
option: '--hideFromOutlookClients [hideFromOutlookClients]',
|
|
230
|
+
autocomplete: ['true', 'false']
|
|
195
231
|
});
|
|
196
232
|
}, _EntraM365GroupSetCommand_initTypes = function _EntraM365GroupSetCommand_initTypes() {
|
|
197
|
-
this.types.boolean.push('isPrivate');
|
|
233
|
+
this.types.boolean.push('isPrivate', 'allowEternalSenders', 'autoSubscribeNewMembers', 'hideFromAddressLists', 'hideFromOutlookClients');
|
|
234
|
+
this.types.string.push('id', 'displayName', 'description', 'owners', 'members', 'logoPath');
|
|
198
235
|
}, _EntraM365GroupSetCommand_initValidators = function _EntraM365GroupSetCommand_initValidators() {
|
|
199
236
|
this.validators.push(async (args) => {
|
|
200
237
|
if (!args.options.displayName &&
|
|
201
|
-
|
|
238
|
+
args.options.description === undefined &&
|
|
202
239
|
!args.options.members &&
|
|
203
240
|
!args.options.owners &&
|
|
204
|
-
|
|
205
|
-
!args.options.logoPath
|
|
206
|
-
|
|
241
|
+
args.options.isPrivate === undefined &&
|
|
242
|
+
!args.options.logoPath &&
|
|
243
|
+
args.options.allowExternalSenders === undefined &&
|
|
244
|
+
args.options.autoSubscribeNewMembers === undefined &&
|
|
245
|
+
args.options.hideFromAddressLists === undefined &&
|
|
246
|
+
args.options.hideFromOutlookClients === undefined) {
|
|
247
|
+
return 'Specify at least one option to update.';
|
|
207
248
|
}
|
|
208
249
|
if (!validation.isValidGuid(args.options.id)) {
|
|
209
250
|
return `${args.options.id} is not a valid GUID`;
|
|
210
251
|
}
|
|
211
252
|
if (args.options.owners) {
|
|
212
|
-
const
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
return `${owners[i]} is not a valid userPrincipalName`;
|
|
216
|
-
}
|
|
253
|
+
const isValidArray = validation.isValidUserPrincipalNameArray(args.options.owners);
|
|
254
|
+
if (isValidArray !== true) {
|
|
255
|
+
return `Option 'owners' contains one or more invalid UPNs: ${isValidArray}.`;
|
|
217
256
|
}
|
|
218
257
|
}
|
|
219
258
|
if (args.options.members) {
|
|
220
|
-
const
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
return `${members[i]} is not a valid userPrincipalName`;
|
|
224
|
-
}
|
|
259
|
+
const isValidArray = validation.isValidUserPrincipalNameArray(args.options.members);
|
|
260
|
+
if (isValidArray !== true) {
|
|
261
|
+
return `Option 'members' contains one or more invalid UPNs: ${isValidArray}.`;
|
|
225
262
|
}
|
|
226
263
|
}
|
|
227
264
|
if (args.options.logoPath) {
|
|
@@ -32,7 +32,7 @@ class EntraM365GroupUserListCommand extends GraphCommand {
|
|
|
32
32
|
await this.showDeprecationWarning(logger, aadCommands.M365GROUP_USER_LIST, commands.M365GROUP_USER_LIST);
|
|
33
33
|
try {
|
|
34
34
|
if (args.options.role === 'Guest') {
|
|
35
|
-
this.warn(logger, `Value 'Guest' for the option role is deprecated. Use --filter "userType eq 'Guest'" instead.`);
|
|
35
|
+
await this.warn(logger, `Value 'Guest' for the option role is deprecated. Use --filter "userType eq 'Guest'" instead.`);
|
|
36
36
|
}
|
|
37
37
|
const groupId = await this.getGroupId(args.options, logger);
|
|
38
38
|
const isUnifiedGroup = await entraGroup.isUnifiedGroup(groupId);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import request from '../../../../request.js';
|
|
2
|
+
import GraphCommand from '../../../base/GraphCommand.js';
|
|
3
|
+
import commands from '../../commands.js';
|
|
4
|
+
class EntraMultitenantGetCommand extends GraphCommand {
|
|
5
|
+
get name() {
|
|
6
|
+
return commands.MULTITENANT_GET;
|
|
7
|
+
}
|
|
8
|
+
get description() {
|
|
9
|
+
return 'Gets properties of the multitenant organization';
|
|
10
|
+
}
|
|
11
|
+
async commandAction(logger) {
|
|
12
|
+
const requestOptions = {
|
|
13
|
+
url: `${this.resource}/v1.0/tenantRelationships/multiTenantOrganization`,
|
|
14
|
+
headers: {
|
|
15
|
+
accept: 'application/json;odata.metadata=none'
|
|
16
|
+
},
|
|
17
|
+
responseType: 'json'
|
|
18
|
+
};
|
|
19
|
+
try {
|
|
20
|
+
if (this.verbose) {
|
|
21
|
+
await logger.logToStderr('Retrieving multitenant organization...');
|
|
22
|
+
}
|
|
23
|
+
const multitenantOrg = await request.get(requestOptions);
|
|
24
|
+
await logger.log(multitenantOrg);
|
|
25
|
+
}
|
|
26
|
+
catch (err) {
|
|
27
|
+
this.handleRejectedODataJsonPromise(err);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export default new EntraMultitenantGetCommand();
|
|
32
|
+
//# sourceMappingURL=multitenant-get.js.map
|
|
@@ -72,6 +72,7 @@ export default {
|
|
|
72
72
|
M365GROUP_USER_LIST: `${prefix} m365group user list`,
|
|
73
73
|
M365GROUP_USER_REMOVE: `${prefix} m365group user remove`,
|
|
74
74
|
M365GROUP_USER_SET: `${prefix} m365group user set`,
|
|
75
|
+
MULTITENANT_GET: `${prefix} multitenant get`,
|
|
75
76
|
OAUTH2GRANT_ADD: `${prefix} oauth2grant add`,
|
|
76
77
|
OAUTH2GRANT_LIST: `${prefix} oauth2grant list`,
|
|
77
78
|
OAUTH2GRANT_REMOVE: `${prefix} oauth2grant remove`,
|
|
@@ -5,11 +5,10 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
5
5
|
};
|
|
6
6
|
var _ExternalConnectionDoctorCommand_instances, _a, _ExternalConnectionDoctorCommand_initOptions, _ExternalConnectionDoctorCommand_initValidators;
|
|
7
7
|
import os from 'os';
|
|
8
|
-
import { cli } from '../../../../cli/cli.js';
|
|
9
8
|
import request from '../../../../request.js';
|
|
10
|
-
import { settingsNames } from '../../../../settingsNames.js';
|
|
11
9
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
12
10
|
import commands from '../../commands.js';
|
|
11
|
+
import { CheckStatus, formatting } from '../../../../utils/formatting.js';
|
|
13
12
|
class ExternalConnectionDoctorCommand extends GraphCommand {
|
|
14
13
|
get name() {
|
|
15
14
|
return commands.CONNECTION_DOCTOR;
|
|
@@ -28,9 +27,7 @@ class ExternalConnectionDoctorCommand extends GraphCommand {
|
|
|
28
27
|
const ux = args.options.ux ?? 'all';
|
|
29
28
|
const output = args.options.output;
|
|
30
29
|
this.checksStatus = [];
|
|
31
|
-
const
|
|
32
|
-
output === 'text' &&
|
|
33
|
-
typeof global.it === 'undefined';
|
|
30
|
+
const show = output === 'text';
|
|
34
31
|
let checks = [
|
|
35
32
|
{
|
|
36
33
|
id: 'loadExternalConnection',
|
|
@@ -112,19 +109,12 @@ class ExternalConnectionDoctorCommand extends GraphCommand {
|
|
|
112
109
|
checks = checks.filter((check, index, self) => self.findIndex(c => c.id === check.id) === index);
|
|
113
110
|
for (const check of checks) {
|
|
114
111
|
if (this.debug) {
|
|
115
|
-
logger.logToStderr(`Running check ${check.id}...`);
|
|
116
|
-
}
|
|
117
|
-
// don't show spinner if running tests
|
|
118
|
-
/* c8 ignore next 3 */
|
|
119
|
-
if (showSpinner) {
|
|
120
|
-
cli.spinner.start(check.text);
|
|
112
|
+
await logger.logToStderr(`Running check ${check.id}...`);
|
|
121
113
|
}
|
|
122
114
|
// only automated checks have functions
|
|
123
115
|
if (!check.fn) {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
if (showSpinner) {
|
|
127
|
-
cli.spinner.info(`${check.text} (manual)`);
|
|
116
|
+
if (show) {
|
|
117
|
+
await logger.log(formatting.getStatus(CheckStatus.Information, `${check.text} (manual)`));
|
|
128
118
|
}
|
|
129
119
|
this.checksStatus.push({
|
|
130
120
|
...check,
|
|
@@ -135,23 +125,19 @@ class ExternalConnectionDoctorCommand extends GraphCommand {
|
|
|
135
125
|
const result = await check.fn.bind(this)(check.id, args);
|
|
136
126
|
this.checksStatus.push({ ...check, ...result });
|
|
137
127
|
if (result.status === 'passed') {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
if (showSpinner) {
|
|
141
|
-
cli.spinner.succeed();
|
|
128
|
+
if (show) {
|
|
129
|
+
await logger.log(formatting.getStatus(CheckStatus.Success, check.text));
|
|
142
130
|
}
|
|
143
131
|
continue;
|
|
144
132
|
}
|
|
145
133
|
if (result.status === 'failed') {
|
|
146
|
-
|
|
147
|
-
/* c8 ignore next 9 */
|
|
148
|
-
if (showSpinner) {
|
|
134
|
+
if (show) {
|
|
149
135
|
const message = `${check.text}: ${result.errorMessage}`;
|
|
150
136
|
if (check.type === 'required') {
|
|
151
|
-
|
|
137
|
+
await logger.log(formatting.getStatus(CheckStatus.Failure, message));
|
|
152
138
|
}
|
|
153
139
|
else {
|
|
154
|
-
|
|
140
|
+
await logger.log(formatting.getStatus(CheckStatus.Warning, check.text));
|
|
155
141
|
}
|
|
156
142
|
}
|
|
157
143
|
if (result.shouldStop) {
|
|
@@ -159,7 +145,7 @@ class ExternalConnectionDoctorCommand extends GraphCommand {
|
|
|
159
145
|
}
|
|
160
146
|
}
|
|
161
147
|
}
|
|
162
|
-
if (
|
|
148
|
+
if (show || output === 'none') {
|
|
163
149
|
return;
|
|
164
150
|
}
|
|
165
151
|
this.checksStatus.forEach(s => {
|
|
@@ -39,19 +39,19 @@ class ExternalConnectionSchemaAddCommand extends GraphCommand {
|
|
|
39
39
|
try {
|
|
40
40
|
const res = await request.patch(requestOptions);
|
|
41
41
|
const location = res.headers.location;
|
|
42
|
-
logger.log(location);
|
|
42
|
+
await logger.log(location);
|
|
43
43
|
if (!args.options.wait) {
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
46
|
let status;
|
|
47
47
|
do {
|
|
48
48
|
if (this.verbose) {
|
|
49
|
-
logger.logToStderr(`Waiting 60 seconds...`);
|
|
49
|
+
await logger.logToStderr(`Waiting 60 seconds...`);
|
|
50
50
|
}
|
|
51
51
|
// waiting 60s before polling as recommended by Microsoft
|
|
52
52
|
await new Promise(resolve => setTimeout(resolve, 60000));
|
|
53
53
|
if (this.debug) {
|
|
54
|
-
logger.logToStderr(`Checking schema operation status...`);
|
|
54
|
+
await logger.logToStderr(`Checking schema operation status...`);
|
|
55
55
|
}
|
|
56
56
|
const operation = await request.get({
|
|
57
57
|
url: location,
|
|
@@ -62,7 +62,7 @@ class ExternalConnectionSchemaAddCommand extends GraphCommand {
|
|
|
62
62
|
});
|
|
63
63
|
status = operation.status;
|
|
64
64
|
if (this.verbose) {
|
|
65
|
-
logger.logToStderr(`Schema operation status: ${status}`);
|
|
65
|
+
await logger.logToStderr(`Schema operation status: ${status}`);
|
|
66
66
|
}
|
|
67
67
|
if (status === 'failed') {
|
|
68
68
|
throw `Provisioning schema failed: ${operation.error?.message}`;
|
|
@@ -31,7 +31,7 @@ class FileCopyCommand extends GraphCommand {
|
|
|
31
31
|
const sourcePath = this.getAbsoluteUrl(webUrl, sourceUrl);
|
|
32
32
|
const destinationPath = this.getAbsoluteUrl(webUrl, targetUrl);
|
|
33
33
|
if (this.verbose) {
|
|
34
|
-
logger.logToStderr(`Copying file '${sourcePath}' to '${destinationPath}'...`);
|
|
34
|
+
await logger.logToStderr(`Copying file '${sourcePath}' to '${destinationPath}'...`);
|
|
35
35
|
}
|
|
36
36
|
const copyUrl = await this.getCopyUrl(args.options, sourcePath, logger);
|
|
37
37
|
const { targetDriveId, targetItemId } = await this.getTargetDriveAndItemId(webUrl, targetUrl, logger, verbose);
|
|
@@ -83,7 +83,7 @@ class FileCopyCommand extends GraphCommand {
|
|
|
83
83
|
}
|
|
84
84
|
async getDocumentLibrary(siteId, folderUrl, folderUrlFromUser, logger) {
|
|
85
85
|
if (this.verbose) {
|
|
86
|
-
logger.logToStderr(`Getting document library...`);
|
|
86
|
+
await logger.logToStderr(`Getting document library...`);
|
|
87
87
|
}
|
|
88
88
|
const requestOptions = {
|
|
89
89
|
url: `${this.resource}/v1.0/sites/${siteId}/drives?$select=webUrl,id`,
|
|
@@ -110,7 +110,7 @@ class FileCopyCommand extends GraphCommand {
|
|
|
110
110
|
}
|
|
111
111
|
async getStartingFolderId(documentLibrary, folderUrl, logger) {
|
|
112
112
|
if (this.verbose) {
|
|
113
|
-
logger.logToStderr(`Getting starting folder id...`);
|
|
113
|
+
await logger.logToStderr(`Getting starting folder id...`);
|
|
114
114
|
}
|
|
115
115
|
const documentLibraryRelativeFolderUrl = folderUrl.href.replace(new RegExp(`${documentLibrary.webUrl}`, 'i'), '').replace(/\/+$/, '');
|
|
116
116
|
const requestOptions = {
|
|
@@ -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 _FlowListCommand_instances, _FlowListCommand_initTelemetry, _FlowListCommand_initOptions, _FlowListCommand_initValidators;
|
|
6
|
+
var _FlowListCommand_instances, _FlowListCommand_initTelemetry, _FlowListCommand_initOptions, _FlowListCommand_initValidators, _FlowListCommand_initTypes;
|
|
7
7
|
import { formatting } from '../../../utils/formatting.js';
|
|
8
8
|
import { odata } from '../../../utils/odata.js';
|
|
9
9
|
import PowerAutomateCommand from '../../base/PowerAutomateCommand.js';
|
|
@@ -13,7 +13,7 @@ class FlowListCommand extends PowerAutomateCommand {
|
|
|
13
13
|
return commands.LIST;
|
|
14
14
|
}
|
|
15
15
|
get description() {
|
|
16
|
-
return 'Lists
|
|
16
|
+
return 'Lists Power Automate flows in the given environment';
|
|
17
17
|
}
|
|
18
18
|
defaultProperties() {
|
|
19
19
|
return ['name', 'displayName'];
|
|
@@ -25,8 +25,12 @@ class FlowListCommand extends PowerAutomateCommand {
|
|
|
25
25
|
__classPrivateFieldGet(this, _FlowListCommand_instances, "m", _FlowListCommand_initTelemetry).call(this);
|
|
26
26
|
__classPrivateFieldGet(this, _FlowListCommand_instances, "m", _FlowListCommand_initOptions).call(this);
|
|
27
27
|
__classPrivateFieldGet(this, _FlowListCommand_instances, "m", _FlowListCommand_initValidators).call(this);
|
|
28
|
+
__classPrivateFieldGet(this, _FlowListCommand_instances, "m", _FlowListCommand_initTypes).call(this);
|
|
28
29
|
}
|
|
29
30
|
async commandAction(logger, args) {
|
|
31
|
+
if (this.verbose) {
|
|
32
|
+
await logger.logToStderr(`Getting Power Automate flows${args.options.asAdmin && ' as admin'} in environment '${args.options.environmentName}'...`);
|
|
33
|
+
}
|
|
30
34
|
try {
|
|
31
35
|
const { environmentName, asAdmin, sharingStatus, includeSolutions } = args.options;
|
|
32
36
|
let items = [];
|
|
@@ -42,7 +46,8 @@ class FlowListCommand extends PowerAutomateCommand {
|
|
|
42
46
|
let url = this.getApiUrl(environmentName, asAdmin, includeSolutions, 'personal');
|
|
43
47
|
items = await odata.getAllItems(url);
|
|
44
48
|
url = this.getApiUrl(environmentName, asAdmin, includeSolutions, 'team');
|
|
45
|
-
|
|
49
|
+
const teamFlows = await odata.getAllItems(url);
|
|
50
|
+
items = items.concat(teamFlows);
|
|
46
51
|
}
|
|
47
52
|
else {
|
|
48
53
|
const url = this.getApiUrl(environmentName, asAdmin, includeSolutions);
|
|
@@ -50,34 +55,25 @@ class FlowListCommand extends PowerAutomateCommand {
|
|
|
50
55
|
}
|
|
51
56
|
// Remove duplicates
|
|
52
57
|
items = items.filter((flow, index, self) => index === self.findIndex(f => f.id === flow.id));
|
|
53
|
-
if (
|
|
54
|
-
items.forEach(
|
|
55
|
-
|
|
58
|
+
if (args.options.output && args.options.output !== 'json') {
|
|
59
|
+
items.forEach(flow => {
|
|
60
|
+
flow.displayName = flow.properties.displayName;
|
|
56
61
|
});
|
|
57
|
-
await logger.log(items);
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
if (this.verbose) {
|
|
61
|
-
await logger.logToStderr('No Flows found');
|
|
62
|
-
}
|
|
63
62
|
}
|
|
63
|
+
await logger.log(items);
|
|
64
64
|
}
|
|
65
65
|
catch (err) {
|
|
66
66
|
this.handleRejectedODataJsonPromise(err);
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
getApiUrl(environmentName, asAdmin, includeSolutionFlows, filter) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
if (includeSolutionFlows) {
|
|
78
|
-
url += '&include=includeSolutionCloudFlows';
|
|
79
|
-
}
|
|
80
|
-
return url;
|
|
70
|
+
const baseEndpoint = `${this.resource}/providers/Microsoft.ProcessSimple`;
|
|
71
|
+
const environmentSegment = `/environments/${formatting.encodeQueryParameter(environmentName)}`;
|
|
72
|
+
const adminSegment = `/scopes/admin${environmentSegment}/v2`;
|
|
73
|
+
const flowsEndpoint = '/flows?api-version=2016-11-01';
|
|
74
|
+
const filterQuery = filter === 'personal' || filter === 'team' ? `&$filter=search('${filter}')` : '';
|
|
75
|
+
const includeQuery = includeSolutionFlows ? '&include=includeSolutionCloudFlows' : '';
|
|
76
|
+
return `${baseEndpoint}${asAdmin ? adminSegment : environmentSegment}${flowsEndpoint}${filterQuery}${includeQuery}`;
|
|
81
77
|
}
|
|
82
78
|
}
|
|
83
79
|
_FlowListCommand_instances = new WeakSet(), _FlowListCommand_initTelemetry = function _FlowListCommand_initTelemetry() {
|
|
@@ -105,10 +101,13 @@ _FlowListCommand_instances = new WeakSet(), _FlowListCommand_initTelemetry = fun
|
|
|
105
101
|
return `The options asAdmin and sharingStatus cannot be specified together.`;
|
|
106
102
|
}
|
|
107
103
|
if (args.options.sharingStatus && !this.allowedSharingStatuses.some(status => status === args.options.sharingStatus)) {
|
|
108
|
-
return `${args.options.sharingStatus} is not a valid sharing status. Allowed values are: ${this.allowedSharingStatuses.join(',')}`;
|
|
104
|
+
return `${args.options.sharingStatus} is not a valid sharing status. Allowed values are: ${this.allowedSharingStatuses.join(', ')}`;
|
|
109
105
|
}
|
|
110
106
|
return true;
|
|
111
107
|
});
|
|
108
|
+
}, _FlowListCommand_initTypes = function _FlowListCommand_initTypes() {
|
|
109
|
+
this.types.string.push('environmentName', 'sharingStatus');
|
|
110
|
+
this.types.boolean.push('includeSolutions', 'asAdmin');
|
|
112
111
|
};
|
|
113
112
|
export default new FlowListCommand();
|
|
114
113
|
//# sourceMappingURL=flow-list.js.map
|
|
@@ -141,8 +141,10 @@ _GraphSubscriptionAddCommand_instances = new WeakSet(), _GraphSubscriptionAddCom
|
|
|
141
141
|
});
|
|
142
142
|
}, _GraphSubscriptionAddCommand_initValidators = function _GraphSubscriptionAddCommand_initValidators() {
|
|
143
143
|
this.validators.push(async (args) => {
|
|
144
|
-
if (args.options.notificationUrl.
|
|
145
|
-
|
|
144
|
+
if (!args.options.notificationUrl.toLowerCase().startsWith('https://')
|
|
145
|
+
&& !args.options.notificationUrl.toLowerCase().startsWith('eventhub:https://')
|
|
146
|
+
&& !args.options.notificationUrl.toLowerCase().startsWith('eventgrid:?azuresubscriptionid=')) {
|
|
147
|
+
return `The specified notification URL '${args.options.notificationUrl}' does not start with either 'https://' or 'EventHub:https://' or 'EventGrid:?azuresubscriptionid='`;
|
|
146
148
|
}
|
|
147
149
|
if (!this.isValidChangeTypes(args.options.changeTypes)) {
|
|
148
150
|
return `The specified changeTypes are invalid. Valid options are 'created', 'updated' and 'deleted'`;
|
|
@@ -128,7 +128,7 @@ class PaAppExportCommand extends PowerPlatformCommand {
|
|
|
128
128
|
link = response.properties.packageLink.value;
|
|
129
129
|
}
|
|
130
130
|
else {
|
|
131
|
-
setTimeout(this.pollingInterval);
|
|
131
|
+
await setTimeout(this.pollingInterval);
|
|
132
132
|
}
|
|
133
133
|
if (this.verbose) {
|
|
134
134
|
await logger.logToStderr(`Current status of the get package link: ${status}`);
|
|
@@ -26,7 +26,7 @@ class PaAppOwnerSetCommand extends PowerAppsCommand {
|
|
|
26
26
|
}
|
|
27
27
|
async commandAction(logger, args) {
|
|
28
28
|
if (this.verbose) {
|
|
29
|
-
logger.logToStderr(`Setting new owner ${args.options.userId || args.options.userName} for Power Apps app ${args.options.appName}...`);
|
|
29
|
+
await logger.logToStderr(`Setting new owner ${args.options.userId || args.options.userName} for Power Apps app ${args.options.appName}...`);
|
|
30
30
|
}
|
|
31
31
|
try {
|
|
32
32
|
const userId = await this.getUserId(args.options);
|
|
@@ -26,7 +26,7 @@ class PurviewThreatAssessmentListCommand extends GraphCommand {
|
|
|
26
26
|
}
|
|
27
27
|
async commandAction(logger, args) {
|
|
28
28
|
if (this.verbose) {
|
|
29
|
-
logger.logToStderr('Retrieving a list of threat assessments');
|
|
29
|
+
await logger.logToStderr('Retrieving a list of threat assessments');
|
|
30
30
|
}
|
|
31
31
|
try {
|
|
32
32
|
const filter = this.getFilterQuery(args.options);
|