@pnp/cli-microsoft365 10.0.0-beta.787c5f1 → 10.0.0-beta.7be7794
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 +6 -4
- package/dist/AuthServer.js +7 -7
- package/dist/api.js +1 -1
- package/dist/config.js +1 -0
- package/dist/m365/cli/commands/cli-doctor.js +2 -2
- package/dist/m365/cli/commands.js +1 -2
- package/dist/m365/commands/login.js +120 -67
- package/dist/m365/entra/commands/group/{group-user-add.js → group-member-add.js} +18 -18
- package/dist/m365/entra/commands/group/{group-user-list.js → group-member-list.js} +17 -17
- package/dist/m365/entra/commands/group/{group-user-set.js → group-member-set.js} +19 -19
- package/dist/m365/entra/commands/m365group/m365group-set.js +159 -81
- package/dist/m365/entra/commands/m365group/m365group-user-add.js +5 -12
- package/dist/m365/entra/commands/oauth2grant/oauth2grant-list.js +3 -12
- package/dist/m365/entra/commands.js +3 -3
- package/dist/m365/external/commands/item/item-add.js +2 -5
- package/dist/m365/file/commands/file-move.js +135 -0
- package/dist/m365/file/commands.js +2 -1
- package/dist/m365/flow/commands/environment/environment-list.js +1 -1
- package/dist/m365/pa/commands/app/app-list.js +1 -6
- package/dist/m365/pa/commands/connector/connector-list.js +1 -6
- package/dist/m365/pa/commands/environment/environment-list.js +1 -1
- package/dist/m365/pp/commands/environment/environment-list.js +1 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.20.0.js +27 -0
- package/dist/m365/spfx/commands/project/project-doctor/rules/FN002021_DEVDEP_rushstack_eslint_config.js +10 -0
- package/dist/m365/spfx/commands/project/project-doctor.js +2 -1
- package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.20.0.js +59 -0
- package/dist/m365/spfx/commands/project/project-upgrade.js +2 -1
- package/dist/m365/spfx/commands/spfx-doctor.js +15 -0
- package/dist/m365/spo/commands/app/app-instance-list.js +3 -18
- package/dist/m365/spo/commands/app/app-list.js +1 -8
- package/dist/m365/spo/commands/feature/feature-list.js +1 -8
- package/dist/m365/spo/commands/file/file-copy.js +5 -1
- package/dist/m365/spo/commands/file/file-move.js +55 -33
- package/dist/m365/spo/commands/list/list-webhook-list.js +1 -6
- package/dist/m365/spo/commands/listitem/listitem-attachment-list.js +1 -8
- package/dist/m365/spo/commands/page/page-list.js +1 -1
- package/dist/m365/spo/commands/page/page-remove.js +37 -16
- package/dist/m365/spo/commands/page/page-template-list.js +1 -3
- package/dist/m365/spo/commands/site/site-admin-list.js +8 -9
- package/dist/m365/spo/commands/site/site-admin-remove.js +194 -0
- package/dist/m365/spo/commands/site/site-sharingpermission-set.js +68 -0
- package/dist/m365/spo/commands/sitescript/sitescript-get.js +3 -2
- package/dist/m365/spo/commands/sitescript/sitescript-list.js +1 -3
- package/dist/m365/spo/commands/{site/site-rename.js → tenant/tenant-site-rename.js} +29 -32
- package/dist/m365/spo/commands/theme/theme-list.js +1 -1
- package/dist/m365/spo/commands/web/web-clientsidewebpart-list.js +1 -6
- package/dist/m365/spo/commands.js +3 -1
- package/dist/m365/teams/MeetingTranscript.js +2 -0
- package/dist/m365/teams/commands/meeting/meeting-transcript-get.js +152 -0
- package/dist/m365/teams/commands/tab/tab-list.js +5 -3
- package/dist/m365/teams/commands.js +1 -0
- package/dist/m365/viva/commands/engage/Community.js +2 -0
- package/dist/m365/viva/commands/engage/engage-community-list.js +28 -0
- package/dist/m365/viva/commands.js +1 -0
- package/dist/request.js +46 -61
- package/dist/utils/driveUtil.js +51 -0
- package/dist/utils/spo.js +8 -8
- package/dist/utils/timersUtil.js +12 -0
- package/dist/utils/urlUtil.js +8 -0
- package/docs/docs/cmd/cli/cli-doctor.mdx +24 -23
- package/docs/docs/cmd/entra/group/group-member-add.mdx +62 -0
- package/docs/docs/cmd/entra/group/{group-user-list.mdx → group-member-list.mdx} +14 -14
- package/docs/docs/cmd/entra/group/group-member-set.mdx +62 -0
- package/docs/docs/cmd/entra/m365group/m365group-report-activitystorage.mdx +2 -2
- package/docs/docs/cmd/entra/m365group/m365group-set.mdx +37 -16
- package/docs/docs/cmd/entra/m365group/m365group-user-add.mdx +0 -3
- package/docs/docs/cmd/external/item/item-add.mdx +3 -3
- package/docs/docs/cmd/file/file-move.mdx +79 -0
- package/docs/docs/cmd/login.mdx +9 -0
- package/docs/docs/cmd/spfx/project/project-upgrade.mdx +1 -1
- package/docs/docs/cmd/spo/cdn/cdn-get.mdx +1 -1
- package/docs/docs/cmd/spo/cdn/cdn-origin-add.mdx +1 -1
- package/docs/docs/cmd/spo/cdn/cdn-origin-list.mdx +1 -1
- package/docs/docs/cmd/spo/cdn/cdn-origin-remove.mdx +1 -1
- package/docs/docs/cmd/spo/cdn/cdn-policy-list.mdx +1 -1
- package/docs/docs/cmd/spo/cdn/cdn-policy-set.mdx +1 -1
- package/docs/docs/cmd/spo/externaluser/externaluser-list.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-move.mdx +116 -9
- package/docs/docs/cmd/spo/hidedefaultthemes/hidedefaultthemes-get.mdx +1 -1
- package/docs/docs/cmd/spo/hidedefaultthemes/hidedefaultthemes-set.mdx +1 -1
- package/docs/docs/cmd/spo/homesite/homesite-remove.mdx +1 -1
- package/docs/docs/cmd/spo/knowledgehub/knowledgehub-get.mdx +1 -1
- package/docs/docs/cmd/spo/knowledgehub/knowledgehub-remove.mdx +1 -1
- package/docs/docs/cmd/spo/knowledgehub/knowledgehub-set.mdx +1 -1
- package/docs/docs/cmd/spo/orgassetslibrary/orgassetslibrary-add.mdx +1 -1
- package/docs/docs/cmd/spo/orgassetslibrary/orgassetslibrary-list.mdx +1 -1
- package/docs/docs/cmd/spo/orgassetslibrary/orgassetslibrary-remove.mdx +1 -1
- package/docs/docs/cmd/spo/orgnewssite/orgnewssite-list.mdx +1 -1
- package/docs/docs/cmd/spo/orgnewssite/orgnewssite-remove.mdx +1 -1
- package/docs/docs/cmd/spo/orgnewssite/orgnewssite-set.mdx +1 -1
- package/docs/docs/cmd/spo/page/page-remove.mdx +30 -12
- package/docs/docs/cmd/spo/site/site-admin-add.mdx +2 -2
- package/docs/docs/cmd/spo/site/site-admin-list.mdx +64 -12
- package/docs/docs/cmd/spo/site/site-admin-remove.mdx +67 -0
- package/docs/docs/cmd/spo/site/site-appcatalog-add.mdx +1 -1
- package/docs/docs/cmd/spo/site/site-appcatalog-remove.mdx +1 -1
- package/docs/docs/cmd/spo/site/site-commsite-enable.mdx +1 -1
- package/docs/docs/cmd/spo/site/site-list.mdx +6 -4
- package/docs/docs/cmd/spo/site/site-set.mdx +1 -1
- package/docs/docs/cmd/spo/site/site-sharingpermission-set.mdx +58 -0
- package/docs/docs/cmd/spo/sitescript/sitescript-get.mdx +14 -1
- package/docs/docs/cmd/spo/storageentity/storageentity-remove.mdx +1 -1
- package/docs/docs/cmd/spo/storageentity/storageentity-set.mdx +1 -1
- package/docs/docs/cmd/spo/tenant/tenant-appcatalog-add.mdx +1 -1
- package/docs/docs/cmd/spo/tenant/tenant-appcatalogurl-get.mdx +1 -1
- package/docs/docs/cmd/spo/tenant/tenant-recyclebinitem-list.mdx +1 -1
- package/docs/docs/cmd/spo/tenant/tenant-recyclebinitem-remove.mdx +1 -1
- package/docs/docs/cmd/spo/tenant/tenant-settings-list.mdx +1 -1
- package/docs/docs/cmd/spo/{site/site-rename.mdx → tenant/tenant-site-rename.mdx} +7 -7
- package/docs/docs/cmd/spo/theme/theme-apply.mdx +1 -1
- package/docs/docs/cmd/spo/theme/theme-get.mdx +1 -1
- package/docs/docs/cmd/spo/theme/theme-list.mdx +1 -1
- package/docs/docs/cmd/spo/theme/theme-remove.mdx +1 -1
- package/docs/docs/cmd/spo/theme/theme-set.mdx +1 -1
- package/docs/docs/cmd/spp/contentcenter/contentcenter-list.mdx +3 -5
- package/docs/docs/cmd/teams/meeting/meeting-transcript-get.mdx +132 -0
- package/docs/docs/cmd/teams/tab/tab-list.mdx +1 -2
- package/docs/docs/cmd/viva/engage/engage-community-list.mdx +81 -0
- package/package.json +1 -1
- package/dist/m365/cli/commands/cli-reconsent.js +0 -29
- package/docs/docs/cmd/cli/cli-reconsent.mdx +0 -62
- package/docs/docs/cmd/entra/group/group-user-add.mdx +0 -62
- package/docs/docs/cmd/entra/group/group-user-set.mdx +0 -62
|
@@ -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 _EntraM365GroupSetCommand_instances, _EntraM365GroupSetCommand_initTelemetry, _EntraM365GroupSetCommand_initOptions, _EntraM365GroupSetCommand_initTypes, _EntraM365GroupSetCommand_initValidators;
|
|
6
|
+
var _EntraM365GroupSetCommand_instances, _EntraM365GroupSetCommand_initTelemetry, _EntraM365GroupSetCommand_initOptions, _EntraM365GroupSetCommand_initOptionSets, _EntraM365GroupSetCommand_initTypes, _EntraM365GroupSetCommand_initValidators;
|
|
7
7
|
import { setTimeout } from 'timers/promises';
|
|
8
8
|
import fs from 'fs';
|
|
9
9
|
import path from 'path';
|
|
@@ -15,6 +15,9 @@ import { entraGroup } from '../../../../utils/entraGroup.js';
|
|
|
15
15
|
import aadCommands from '../../aadCommands.js';
|
|
16
16
|
import { accessToken } from '../../../../utils/accessToken.js';
|
|
17
17
|
import auth from '../../../../Auth.js';
|
|
18
|
+
import { entraUser } from '../../../../utils/entraUser.js';
|
|
19
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
20
|
+
import { odata } from '../../../../utils/odata.js';
|
|
18
21
|
class EntraM365GroupSetCommand extends GraphCommand {
|
|
19
22
|
get name() {
|
|
20
23
|
return commands.M365GROUP_SET;
|
|
@@ -31,8 +34,9 @@ class EntraM365GroupSetCommand extends GraphCommand {
|
|
|
31
34
|
this.pollingInterval = 500;
|
|
32
35
|
__classPrivateFieldGet(this, _EntraM365GroupSetCommand_instances, "m", _EntraM365GroupSetCommand_initTelemetry).call(this);
|
|
33
36
|
__classPrivateFieldGet(this, _EntraM365GroupSetCommand_instances, "m", _EntraM365GroupSetCommand_initOptions).call(this);
|
|
34
|
-
__classPrivateFieldGet(this, _EntraM365GroupSetCommand_instances, "m", _EntraM365GroupSetCommand_initTypes).call(this);
|
|
35
37
|
__classPrivateFieldGet(this, _EntraM365GroupSetCommand_instances, "m", _EntraM365GroupSetCommand_initValidators).call(this);
|
|
38
|
+
__classPrivateFieldGet(this, _EntraM365GroupSetCommand_instances, "m", _EntraM365GroupSetCommand_initOptionSets).call(this);
|
|
39
|
+
__classPrivateFieldGet(this, _EntraM365GroupSetCommand_instances, "m", _EntraM365GroupSetCommand_initTypes).call(this);
|
|
36
40
|
}
|
|
37
41
|
async commandAction(logger, args) {
|
|
38
42
|
await this.showDeprecationWarning(logger, aadCommands.M365GROUP_SET, commands.M365GROUP_SET);
|
|
@@ -40,23 +44,24 @@ class EntraM365GroupSetCommand extends GraphCommand {
|
|
|
40
44
|
if ((args.options.allowExternalSenders !== undefined || args.options.autoSubscribeNewMembers !== undefined) && accessToken.isAppOnlyAccessToken(auth.connection.accessTokens[auth.defaultResource].accessToken)) {
|
|
41
45
|
throw `Option 'allowExternalSenders' and 'autoSubscribeNewMembers' can only be used when using delegated permissions.`;
|
|
42
46
|
}
|
|
43
|
-
const
|
|
47
|
+
const groupId = args.options.id || await entraGroup.getGroupIdByDisplayName(args.options.displayName);
|
|
48
|
+
const isUnifiedGroup = await entraGroup.isUnifiedGroup(groupId);
|
|
44
49
|
if (!isUnifiedGroup) {
|
|
45
|
-
throw Error(`Specified group with id '${
|
|
50
|
+
throw Error(`Specified group with id '${groupId}' is not a Microsoft 365 group.`);
|
|
46
51
|
}
|
|
47
52
|
if (this.verbose) {
|
|
48
|
-
await logger.logToStderr(`Updating Microsoft 365 Group ${args.options.id}...`);
|
|
53
|
+
await logger.logToStderr(`Updating Microsoft 365 Group ${args.options.id || args.options.displayName}...`);
|
|
49
54
|
}
|
|
50
|
-
if (args.options.
|
|
55
|
+
if (args.options.newDisplayName || args.options.description !== undefined || args.options.isPrivate !== undefined) {
|
|
51
56
|
const update = {
|
|
52
|
-
displayName: args.options.
|
|
57
|
+
displayName: args.options.newDisplayName,
|
|
53
58
|
description: args.options.description !== '' ? args.options.description : null
|
|
54
59
|
};
|
|
55
60
|
if (args.options.isPrivate !== undefined) {
|
|
56
61
|
update.visibility = args.options.isPrivate ? 'Private' : 'Public';
|
|
57
62
|
}
|
|
58
63
|
const requestOptions = {
|
|
59
|
-
url: `${this.resource}/v1.0/groups/${
|
|
64
|
+
url: `${this.resource}/v1.0/groups/${groupId}`,
|
|
60
65
|
headers: {
|
|
61
66
|
'accept': 'application/json;odata.metadata=none'
|
|
62
67
|
},
|
|
@@ -74,7 +79,7 @@ class EntraM365GroupSetCommand extends GraphCommand {
|
|
|
74
79
|
hideFromOutlookClients: args.options.hideFromOutlookClients
|
|
75
80
|
};
|
|
76
81
|
const requestOptions = {
|
|
77
|
-
url: `${this.resource}/v1.0/groups/${
|
|
82
|
+
url: `${this.resource}/v1.0/groups/${groupId}`,
|
|
78
83
|
headers: {
|
|
79
84
|
accept: 'application/json;odata.metadata=none'
|
|
80
85
|
},
|
|
@@ -89,7 +94,7 @@ class EntraM365GroupSetCommand extends GraphCommand {
|
|
|
89
94
|
await logger.logToStderr(`Setting group logo ${fullPath}...`);
|
|
90
95
|
}
|
|
91
96
|
const requestOptions = {
|
|
92
|
-
url: `${this.resource}/v1.0/groups/${
|
|
97
|
+
url: `${this.resource}/v1.0/groups/${groupId}/photo/$value`,
|
|
93
98
|
headers: {
|
|
94
99
|
'content-type': this.getImageContentType(fullPath)
|
|
95
100
|
},
|
|
@@ -100,59 +105,13 @@ class EntraM365GroupSetCommand extends GraphCommand {
|
|
|
100
105
|
else if (this.debug) {
|
|
101
106
|
await logger.logToStderr('logoPath not set. Skipping');
|
|
102
107
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
const requestOptions = {
|
|
109
|
-
url: `${this.resource}/v1.0/users?$filter=${owners.map(o => `userPrincipalName eq '${o}'`).join(' or ')}&$select=id`,
|
|
110
|
-
headers: {
|
|
111
|
-
'content-type': 'application/json'
|
|
112
|
-
},
|
|
113
|
-
responseType: 'json'
|
|
114
|
-
};
|
|
115
|
-
const res = await request.get(requestOptions);
|
|
116
|
-
await Promise.all(res.value.map(u => request.post({
|
|
117
|
-
url: `${this.resource}/v1.0/groups/${args.options.id}/owners/$ref`,
|
|
118
|
-
headers: {
|
|
119
|
-
'content-type': 'application/json'
|
|
120
|
-
},
|
|
121
|
-
responseType: 'json',
|
|
122
|
-
data: {
|
|
123
|
-
"@odata.id": `https://graph.microsoft.com/v1.0/users/${u.id}`
|
|
124
|
-
}
|
|
125
|
-
})));
|
|
108
|
+
const ownerIds = await this.getUserIds(logger, args.options.ownerIds, args.options.ownerUserNames);
|
|
109
|
+
const memberIds = await this.getUserIds(logger, args.options.memberIds, args.options.memberUserNames);
|
|
110
|
+
if (ownerIds.length > 0) {
|
|
111
|
+
await this.updateUsers(logger, groupId, 'owners', ownerIds);
|
|
126
112
|
}
|
|
127
|
-
|
|
128
|
-
await
|
|
129
|
-
}
|
|
130
|
-
if (args.options.members) {
|
|
131
|
-
const members = args.options.members.split(',').map(o => o.trim());
|
|
132
|
-
if (this.verbose) {
|
|
133
|
-
await logger.logToStderr('Retrieving user information to set group members...');
|
|
134
|
-
}
|
|
135
|
-
const requestOptions = {
|
|
136
|
-
url: `${this.resource}/v1.0/users?$filter=${members.map(o => `userPrincipalName eq '${o}'`).join(' or ')}&$select=id`,
|
|
137
|
-
headers: {
|
|
138
|
-
'content-type': 'application/json'
|
|
139
|
-
},
|
|
140
|
-
responseType: 'json'
|
|
141
|
-
};
|
|
142
|
-
const res = await request.get(requestOptions);
|
|
143
|
-
await Promise.all(res.value.map(u => request.post({
|
|
144
|
-
url: `${this.resource}/v1.0/groups/${args.options.id}/members/$ref`,
|
|
145
|
-
headers: {
|
|
146
|
-
'content-type': 'application/json'
|
|
147
|
-
},
|
|
148
|
-
responseType: 'json',
|
|
149
|
-
data: {
|
|
150
|
-
"@odata.id": `https://graph.microsoft.com/v1.0/users/${u.id}`
|
|
151
|
-
}
|
|
152
|
-
})));
|
|
153
|
-
}
|
|
154
|
-
else if (this.debug) {
|
|
155
|
-
await logger.logToStderr('Members not set. Skipping');
|
|
113
|
+
if (memberIds.length > 0) {
|
|
114
|
+
await this.updateUsers(logger, groupId, 'members', memberIds);
|
|
156
115
|
}
|
|
157
116
|
}
|
|
158
117
|
catch (err) {
|
|
@@ -184,14 +143,99 @@ class EntraM365GroupSetCommand extends GraphCommand {
|
|
|
184
143
|
return 'image/jpeg';
|
|
185
144
|
}
|
|
186
145
|
}
|
|
146
|
+
async getUserIds(logger, userIds, userNames) {
|
|
147
|
+
if (userIds) {
|
|
148
|
+
return formatting.splitAndTrim(userIds);
|
|
149
|
+
}
|
|
150
|
+
if (userNames) {
|
|
151
|
+
if (this.verbose) {
|
|
152
|
+
await logger.logToStderr(`Retrieving user IDs...`);
|
|
153
|
+
}
|
|
154
|
+
return entraUser.getUserIdsByUpns(formatting.splitAndTrim(userNames));
|
|
155
|
+
}
|
|
156
|
+
return [];
|
|
157
|
+
}
|
|
158
|
+
async updateUsers(logger, groupId, role, userIds) {
|
|
159
|
+
const groupUsers = await odata.getAllItems(`${this.resource}/v1.0/groups/${groupId}/${role}/microsoft.graph.user?$select=id`);
|
|
160
|
+
const userIdsToAdd = userIds.filter(userId => !groupUsers.some(groupUser => groupUser.id === userId));
|
|
161
|
+
const userIdsToRemove = groupUsers.filter(groupUser => !userIds.some(userId => groupUser.id === userId)).map(user => user.id);
|
|
162
|
+
if (this.verbose) {
|
|
163
|
+
await logger.logToStderr(`Adding ${userIdsToAdd.length} ${role}...`);
|
|
164
|
+
}
|
|
165
|
+
for (let i = 0; i < userIdsToAdd.length; i += 400) {
|
|
166
|
+
const userIdsBatch = userIdsToAdd.slice(i, i + 400);
|
|
167
|
+
const batchRequestOptions = this.getBatchRequestOptions();
|
|
168
|
+
// only 20 requests per one batch are allowed
|
|
169
|
+
for (let j = 0; j < userIdsBatch.length; j += 20) {
|
|
170
|
+
// only 20 users can be added in one request
|
|
171
|
+
const userIdsChunk = userIdsBatch.slice(j, j + 20);
|
|
172
|
+
batchRequestOptions.data.requests.push({
|
|
173
|
+
id: j + 1,
|
|
174
|
+
method: 'PATCH',
|
|
175
|
+
url: `/groups/${groupId}`,
|
|
176
|
+
headers: {
|
|
177
|
+
'content-type': 'application/json;odata.metadata=none',
|
|
178
|
+
accept: 'application/json;odata.metadata=none'
|
|
179
|
+
},
|
|
180
|
+
body: {
|
|
181
|
+
[`${role}@odata.bind`]: userIdsChunk.map(u => `${this.resource}/v1.0/directoryObjects/${u}`)
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
const res = await request.post(batchRequestOptions);
|
|
186
|
+
for (const response of res.responses) {
|
|
187
|
+
if (response.status !== 204) {
|
|
188
|
+
throw response.body;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
if (this.verbose) {
|
|
193
|
+
await logger.logToStderr(`Removing ${userIdsToRemove.length} ${role}...`);
|
|
194
|
+
}
|
|
195
|
+
for (let i = 0; i < userIdsToRemove.length; i += 20) {
|
|
196
|
+
const userIdsBatch = userIdsToRemove.slice(i, i + 20);
|
|
197
|
+
const batchRequestOptions = this.getBatchRequestOptions();
|
|
198
|
+
userIdsBatch.map(userId => {
|
|
199
|
+
batchRequestOptions.data.requests.push({
|
|
200
|
+
id: userId,
|
|
201
|
+
method: 'DELETE',
|
|
202
|
+
url: `/groups/${groupId}/${role}/${userId}/$ref`
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
const res = await request.post(batchRequestOptions);
|
|
206
|
+
for (const response of res.responses) {
|
|
207
|
+
if (response.status !== 204) {
|
|
208
|
+
throw response.body;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
getBatchRequestOptions() {
|
|
214
|
+
const requestOptions = {
|
|
215
|
+
url: `${this.resource}/v1.0/$batch`,
|
|
216
|
+
headers: {
|
|
217
|
+
'content-type': 'application/json;odata.metadata=none',
|
|
218
|
+
accept: 'application/json;odata.metadata=none'
|
|
219
|
+
},
|
|
220
|
+
responseType: 'json',
|
|
221
|
+
data: {
|
|
222
|
+
requests: []
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
return requestOptions;
|
|
226
|
+
}
|
|
187
227
|
}
|
|
188
228
|
_EntraM365GroupSetCommand_instances = new WeakSet(), _EntraM365GroupSetCommand_initTelemetry = function _EntraM365GroupSetCommand_initTelemetry() {
|
|
189
229
|
this.telemetry.push((args) => {
|
|
190
230
|
Object.assign(this.telemetryProperties, {
|
|
231
|
+
id: typeof args.options.id !== 'undefined',
|
|
191
232
|
displayName: typeof args.options.displayName !== 'undefined',
|
|
233
|
+
newDisplayName: typeof args.options.newDisplayName !== 'undefined',
|
|
192
234
|
description: typeof args.options.description !== 'undefined',
|
|
193
|
-
|
|
194
|
-
|
|
235
|
+
ownerIds: typeof args.options.ownerIds !== 'undefined',
|
|
236
|
+
ownerUserNames: typeof args.options.ownerUserNames !== 'undefined',
|
|
237
|
+
memberIds: typeof args.options.memberIds !== 'undefined',
|
|
238
|
+
memberUserNames: typeof args.options.memberUserNames !== 'undefined',
|
|
195
239
|
isPrivate: !!args.options.isPrivate,
|
|
196
240
|
logoPath: typeof args.options.logoPath !== 'undefined',
|
|
197
241
|
allowExternalSenders: !!args.options.allowExternalSenders,
|
|
@@ -202,15 +246,21 @@ _EntraM365GroupSetCommand_instances = new WeakSet(), _EntraM365GroupSetCommand_i
|
|
|
202
246
|
});
|
|
203
247
|
}, _EntraM365GroupSetCommand_initOptions = function _EntraM365GroupSetCommand_initOptions() {
|
|
204
248
|
this.options.unshift({
|
|
205
|
-
option: '-i, --id
|
|
249
|
+
option: '-i, --id [id]'
|
|
206
250
|
}, {
|
|
207
251
|
option: '-n, --displayName [displayName]'
|
|
252
|
+
}, {
|
|
253
|
+
option: '--newDisplayName [newDisplayName]'
|
|
208
254
|
}, {
|
|
209
255
|
option: '-d, --description [description]'
|
|
210
256
|
}, {
|
|
211
|
-
option: '--
|
|
257
|
+
option: '--ownerIds [ownerIds]'
|
|
212
258
|
}, {
|
|
213
|
-
option: '--
|
|
259
|
+
option: '--ownerUserNames [ownerUserNames]'
|
|
260
|
+
}, {
|
|
261
|
+
option: '--memberIds [memberIds]'
|
|
262
|
+
}, {
|
|
263
|
+
option: '--memberUserNames [memberUserNames]'
|
|
214
264
|
}, {
|
|
215
265
|
option: '--isPrivate [isPrivate]',
|
|
216
266
|
autocomplete: ['true', 'false']
|
|
@@ -229,36 +279,64 @@ _EntraM365GroupSetCommand_instances = new WeakSet(), _EntraM365GroupSetCommand_i
|
|
|
229
279
|
option: '--hideFromOutlookClients [hideFromOutlookClients]',
|
|
230
280
|
autocomplete: ['true', 'false']
|
|
231
281
|
});
|
|
282
|
+
}, _EntraM365GroupSetCommand_initOptionSets = function _EntraM365GroupSetCommand_initOptionSets() {
|
|
283
|
+
this.optionSets.push({ options: ['id', 'displayName'] });
|
|
284
|
+
this.optionSets.push({
|
|
285
|
+
options: ['ownerIds', 'ownerUserNames'],
|
|
286
|
+
runsWhen: (args) => {
|
|
287
|
+
return args.options.ownerIds !== undefined || args.options.ownerUserNames !== undefined;
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
this.optionSets.push({
|
|
291
|
+
options: ['memberIds', 'memberUserNames'],
|
|
292
|
+
runsWhen: (args) => {
|
|
293
|
+
return args.options.memberIds !== undefined || args.options.memberUserNames !== undefined;
|
|
294
|
+
}
|
|
295
|
+
});
|
|
232
296
|
}, _EntraM365GroupSetCommand_initTypes = function _EntraM365GroupSetCommand_initTypes() {
|
|
233
297
|
this.types.boolean.push('isPrivate', 'allowEternalSenders', 'autoSubscribeNewMembers', 'hideFromAddressLists', 'hideFromOutlookClients');
|
|
234
|
-
this.types.string.push('id', 'displayName', 'description', '
|
|
298
|
+
this.types.string.push('id', 'displayName', 'newDisplayName', 'description', 'ownerIds', 'ownerUserNames', 'memberIds', 'memberUserNames', 'logoPath');
|
|
235
299
|
}, _EntraM365GroupSetCommand_initValidators = function _EntraM365GroupSetCommand_initValidators() {
|
|
236
300
|
this.validators.push(async (args) => {
|
|
237
|
-
if (!args.options.
|
|
301
|
+
if (!args.options.newDisplayName &&
|
|
238
302
|
args.options.description === undefined &&
|
|
239
|
-
|
|
240
|
-
|
|
303
|
+
args.options.ownerIds === undefined &&
|
|
304
|
+
args.options.ownerUserNames === undefined &&
|
|
305
|
+
args.options.memberIds === undefined &&
|
|
306
|
+
args.options.memberUserNames === undefined &&
|
|
241
307
|
args.options.isPrivate === undefined &&
|
|
242
|
-
|
|
308
|
+
args.options.logoPath === undefined &&
|
|
243
309
|
args.options.allowExternalSenders === undefined &&
|
|
244
310
|
args.options.autoSubscribeNewMembers === undefined &&
|
|
245
311
|
args.options.hideFromAddressLists === undefined &&
|
|
246
312
|
args.options.hideFromOutlookClients === undefined) {
|
|
247
313
|
return 'Specify at least one option to update.';
|
|
248
314
|
}
|
|
249
|
-
if (!validation.isValidGuid(args.options.id)) {
|
|
315
|
+
if (args.options.id && !validation.isValidGuid(args.options.id)) {
|
|
250
316
|
return `${args.options.id} is not a valid GUID`;
|
|
251
317
|
}
|
|
252
|
-
if (args.options.
|
|
253
|
-
const
|
|
254
|
-
if (
|
|
255
|
-
return `
|
|
318
|
+
if (args.options.ownerIds) {
|
|
319
|
+
const isValidGUIDArrayResult = validation.isValidGuidArray(args.options.ownerIds);
|
|
320
|
+
if (isValidGUIDArrayResult !== true) {
|
|
321
|
+
return `The following GUIDs are invalid for the option 'ownerIds': ${isValidGUIDArrayResult}.`;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
if (args.options.ownerUserNames) {
|
|
325
|
+
const isValidUPNArrayResult = validation.isValidUserPrincipalNameArray(args.options.ownerUserNames);
|
|
326
|
+
if (isValidUPNArrayResult !== true) {
|
|
327
|
+
return `The following user principal names are invalid for the option 'ownerUserNames': ${isValidUPNArrayResult}.`;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
if (args.options.memberIds) {
|
|
331
|
+
const isValidGUIDArrayResult = validation.isValidGuidArray(args.options.memberIds);
|
|
332
|
+
if (isValidGUIDArrayResult !== true) {
|
|
333
|
+
return `The following GUIDs are invalid for the option 'memberIds': ${isValidGUIDArrayResult}.`;
|
|
256
334
|
}
|
|
257
335
|
}
|
|
258
|
-
if (args.options.
|
|
259
|
-
const
|
|
260
|
-
if (
|
|
261
|
-
return `
|
|
336
|
+
if (args.options.memberUserNames) {
|
|
337
|
+
const isValidUPNArrayResult = validation.isValidUserPrincipalNameArray(args.options.memberUserNames);
|
|
338
|
+
if (isValidUPNArrayResult !== true) {
|
|
339
|
+
return `The following user principal names are invalid for the option 'memberUserNames': ${isValidUPNArrayResult}.`;
|
|
262
340
|
}
|
|
263
341
|
}
|
|
264
342
|
if (args.options.logoPath) {
|
|
@@ -35,19 +35,15 @@ class EntraM365GroupUserAddCommand extends GraphCommand {
|
|
|
35
35
|
}
|
|
36
36
|
async commandAction(logger, args) {
|
|
37
37
|
await this.showDeprecationWarning(logger, aadCommands.M365GROUP_USER_ADD, commands.M365GROUP_USER_ADD);
|
|
38
|
-
if (args.options.userName) {
|
|
39
|
-
await this.warn(logger, `Option 'userName' is deprecated. Please use 'ids' or 'userNames' instead.`);
|
|
40
|
-
}
|
|
41
38
|
try {
|
|
42
|
-
const userNames = args.options.userNames || args.options.userName;
|
|
43
39
|
const providedGroupId = await this.getGroupId(logger, args);
|
|
44
40
|
const isUnifiedGroup = await entraGroup.isUnifiedGroup(providedGroupId);
|
|
45
41
|
if (!isUnifiedGroup) {
|
|
46
42
|
throw Error(`Specified group with id '${providedGroupId}' is not a Microsoft 365 group.`);
|
|
47
43
|
}
|
|
48
|
-
const userIds = await this.getUserIds(logger, args.options.ids, userNames);
|
|
44
|
+
const userIds = await this.getUserIds(logger, args.options.ids, args.options.userNames);
|
|
49
45
|
if (this.verbose) {
|
|
50
|
-
await logger.logToStderr(`Adding user(s) ${args.options.ids || userNames} to group ${args.options.groupId || args.options.groupName || args.options.teamId || args.options.teamName}...`);
|
|
46
|
+
await logger.logToStderr(`Adding user(s) ${args.options.ids || args.options.userNames} to group ${args.options.groupId || args.options.groupName || args.options.teamId || args.options.teamName}...`);
|
|
51
47
|
}
|
|
52
48
|
await this.addUsers(providedGroupId, userIds, args.options.role);
|
|
53
49
|
}
|
|
@@ -122,14 +118,11 @@ _EntraM365GroupUserAddCommand_instances = new WeakSet(), _EntraM365GroupUserAddC
|
|
|
122
118
|
teamName: typeof args.options.teamName !== 'undefined',
|
|
123
119
|
groupName: typeof args.options.groupName !== 'undefined',
|
|
124
120
|
ids: typeof args.options.ids !== 'undefined',
|
|
125
|
-
userNames: typeof args.options.userNames !== 'undefined'
|
|
126
|
-
userName: typeof args.options.userName !== 'undefined'
|
|
121
|
+
userNames: typeof args.options.userNames !== 'undefined'
|
|
127
122
|
});
|
|
128
123
|
});
|
|
129
124
|
}, _EntraM365GroupUserAddCommand_initOptions = function _EntraM365GroupUserAddCommand_initOptions() {
|
|
130
125
|
this.options.unshift({
|
|
131
|
-
option: '-n, --userName [userName]'
|
|
132
|
-
}, {
|
|
133
126
|
option: '--ids [ids]'
|
|
134
127
|
}, {
|
|
135
128
|
option: '--userNames [userNames]'
|
|
@@ -172,9 +165,9 @@ _EntraM365GroupUserAddCommand_instances = new WeakSet(), _EntraM365GroupUserAddC
|
|
|
172
165
|
});
|
|
173
166
|
}, _EntraM365GroupUserAddCommand_initOptionSets = function _EntraM365GroupUserAddCommand_initOptionSets() {
|
|
174
167
|
this.optionSets.push({ options: ['groupId', 'groupName', 'teamId', 'teamName'] });
|
|
175
|
-
this.optionSets.push({ options: ['
|
|
168
|
+
this.optionSets.push({ options: ['ids', 'userNames'] });
|
|
176
169
|
}, _EntraM365GroupUserAddCommand_initTypes = function _EntraM365GroupUserAddCommand_initTypes() {
|
|
177
|
-
this.types.string.push('
|
|
170
|
+
this.types.string.push('ids', 'userNames', 'groupId', 'groupName', 'teamId', 'teamName', 'role');
|
|
178
171
|
};
|
|
179
172
|
export default new EntraM365GroupUserAddCommand();
|
|
180
173
|
//# sourceMappingURL=m365group-user-add.js.map
|
|
@@ -4,8 +4,8 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
6
|
var _EntraOAuth2GrantListCommand_instances, _EntraOAuth2GrantListCommand_initOptions, _EntraOAuth2GrantListCommand_initValidators;
|
|
7
|
-
import request from '../../../../request.js';
|
|
8
7
|
import { formatting } from '../../../../utils/formatting.js';
|
|
8
|
+
import { odata } from '../../../../utils/odata.js';
|
|
9
9
|
import { validation } from '../../../../utils/validation.js';
|
|
10
10
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
11
11
|
import aadCommands from '../../aadCommands.js';
|
|
@@ -35,17 +35,8 @@ class EntraOAuth2GrantListCommand extends GraphCommand {
|
|
|
35
35
|
await logger.logToStderr(`Retrieving list of OAuth grants for the service principal...`);
|
|
36
36
|
}
|
|
37
37
|
try {
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
headers: {
|
|
41
|
-
accept: 'application/json;odata.metadata=none'
|
|
42
|
-
},
|
|
43
|
-
responseType: 'json'
|
|
44
|
-
};
|
|
45
|
-
const res = await request.get(requestOptions);
|
|
46
|
-
if (res.value && res.value.length > 0) {
|
|
47
|
-
await logger.log(res.value);
|
|
48
|
-
}
|
|
38
|
+
const res = await odata.getAllItems(`${this.resource}/v1.0/oauth2PermissionGrants?$filter=clientId eq '${formatting.encodeQueryParameter(args.options.spObjectId)}'`);
|
|
39
|
+
await logger.log(res);
|
|
49
40
|
}
|
|
50
41
|
catch (err) {
|
|
51
42
|
this.handleRejectedODataJsonPromise(err);
|
|
@@ -41,9 +41,9 @@ export default {
|
|
|
41
41
|
GROUP_LIST: `${prefix} group list`,
|
|
42
42
|
GROUP_REMOVE: `${prefix} group remove`,
|
|
43
43
|
GROUP_SET: `${prefix} group set`,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
GROUP_MEMBER_ADD: `${prefix} group member add`,
|
|
45
|
+
GROUP_MEMBER_LIST: `${prefix} group member list`,
|
|
46
|
+
GROUP_MEMBER_SET: `${prefix} group member set`,
|
|
47
47
|
GROUPSETTING_ADD: `${prefix} groupsetting add`,
|
|
48
48
|
GROUPSETTING_GET: `${prefix} groupsetting get`,
|
|
49
49
|
GROUPSETTING_LIST: `${prefix} groupsetting list`,
|
|
@@ -45,8 +45,7 @@ class ExternalItemAddCommand extends GraphCommand {
|
|
|
45
45
|
properties: {}
|
|
46
46
|
};
|
|
47
47
|
// we need to rewrite the @odata properties to the correct format
|
|
48
|
-
//
|
|
49
|
-
// we also need to extract multiple values for collections into arrays
|
|
48
|
+
// to extract multiple values for collections into arrays
|
|
50
49
|
this.rewriteCollectionProperties(args.options);
|
|
51
50
|
this.addUnknownOptionsToPayload(requestBody.properties, args.options);
|
|
52
51
|
const requestOptions = {
|
|
@@ -81,11 +80,9 @@ class ExternalItemAddCommand extends GraphCommand {
|
|
|
81
80
|
}
|
|
82
81
|
rewriteCollectionProperties(options) {
|
|
83
82
|
Object.getOwnPropertyNames(options).forEach(name => {
|
|
84
|
-
if (!name.
|
|
83
|
+
if (!name.includes('@odata')) {
|
|
85
84
|
return;
|
|
86
85
|
}
|
|
87
|
-
options[`${name}.type`] = options[name].type;
|
|
88
|
-
delete options[name];
|
|
89
86
|
// convert the value of a collection to an array
|
|
90
87
|
const nameWithoutOData = name.substring(0, name.indexOf('@odata'));
|
|
91
88
|
if (options[nameWithoutOData]) {
|
|
@@ -0,0 +1,135 @@
|
|
|
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 _FileMoveCommand_instances, _FileMoveCommand_initTelemetry, _FileMoveCommand_initOptions, _FileMoveCommand_initValidators;
|
|
7
|
+
import GraphCommand from '../../base/GraphCommand.js';
|
|
8
|
+
import { setTimeout } from 'timers/promises';
|
|
9
|
+
import commands from '../commands.js';
|
|
10
|
+
import request from '../../../request.js';
|
|
11
|
+
import { spo } from '../../../utils/spo.js';
|
|
12
|
+
import { urlUtil } from '../../../utils/urlUtil.js';
|
|
13
|
+
import { driveUtil } from '../../../utils/driveUtil.js';
|
|
14
|
+
import { validation } from '../../../utils/validation.js';
|
|
15
|
+
class FileMoveCommand extends GraphCommand {
|
|
16
|
+
get name() {
|
|
17
|
+
return commands.MOVE;
|
|
18
|
+
}
|
|
19
|
+
get description() {
|
|
20
|
+
return 'Moves a file to another location using the Microsoft Graph';
|
|
21
|
+
}
|
|
22
|
+
constructor() {
|
|
23
|
+
super();
|
|
24
|
+
_FileMoveCommand_instances.add(this);
|
|
25
|
+
this.pollingInterval = 10000;
|
|
26
|
+
this.nameConflictBehaviorOptions = ['fail', 'replace', 'rename'];
|
|
27
|
+
__classPrivateFieldGet(this, _FileMoveCommand_instances, "m", _FileMoveCommand_initTelemetry).call(this);
|
|
28
|
+
__classPrivateFieldGet(this, _FileMoveCommand_instances, "m", _FileMoveCommand_initOptions).call(this);
|
|
29
|
+
__classPrivateFieldGet(this, _FileMoveCommand_instances, "m", _FileMoveCommand_initValidators).call(this);
|
|
30
|
+
}
|
|
31
|
+
async commandAction(logger, args) {
|
|
32
|
+
try {
|
|
33
|
+
const { webUrl, sourceUrl, targetUrl, nameConflictBehavior, newName, verbose } = args.options;
|
|
34
|
+
const sourcePath = this.getAbsoluteUrl(webUrl, sourceUrl);
|
|
35
|
+
const destinationPath = this.getAbsoluteUrl(webUrl, targetUrl);
|
|
36
|
+
const { driveId, itemId } = await this.getDriveIdAndItemId(webUrl, sourcePath, sourceUrl, logger, verbose);
|
|
37
|
+
const targetSiteUrl = urlUtil.getTargetSiteAbsoluteUrl(webUrl, targetUrl);
|
|
38
|
+
const targetFolderUrl = this.getAbsoluteUrl(targetSiteUrl, targetUrl);
|
|
39
|
+
const { driveId: targetDriveId, itemId: targetItemId } = await this.getDriveIdAndItemId(targetSiteUrl, targetFolderUrl, targetUrl, logger, verbose);
|
|
40
|
+
const requestOptions = this.getRequestOptions(driveId, itemId, targetDriveId, targetItemId, newName, sourcePath, nameConflictBehavior);
|
|
41
|
+
if (verbose) {
|
|
42
|
+
await logger.logToStderr(`Moving file '${sourcePath}' to '${destinationPath}'...`);
|
|
43
|
+
}
|
|
44
|
+
if (driveId === targetDriveId) {
|
|
45
|
+
await request.patch(requestOptions);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
const response = await request.post(requestOptions);
|
|
49
|
+
await this.waitUntilCopyOperationCompleted(response.headers.location, logger);
|
|
50
|
+
const itemUrl = `${this.resource}/v1.0/drives/${driveId}/items/${itemId}`;
|
|
51
|
+
await request.delete({ url: itemUrl, headers: requestOptions.headers });
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
catch (err) {
|
|
55
|
+
this.handleRejectedODataJsonPromise(err);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
getAbsoluteUrl(webUrl, url) {
|
|
59
|
+
return url.startsWith('https://') ? url : urlUtil.getAbsoluteUrl(webUrl, url);
|
|
60
|
+
}
|
|
61
|
+
async getDriveIdAndItemId(webUrl, folderUrl, sourceUrl, logger, verbose) {
|
|
62
|
+
const siteId = await spo.getSiteId(webUrl, logger, verbose);
|
|
63
|
+
const drive = await driveUtil.getDriveByUrl(siteId, new URL(folderUrl));
|
|
64
|
+
const itemId = await driveUtil.getDriveItemId(drive, new URL(folderUrl));
|
|
65
|
+
return { driveId: drive.id, itemId };
|
|
66
|
+
}
|
|
67
|
+
getRequestOptions(sourceDriveId, sourceItemId, targetDriveId, targetItemId, newName, sourcePath, nameConflictBehavior) {
|
|
68
|
+
const apiUrl = sourceDriveId === targetDriveId
|
|
69
|
+
? `${this.resource}/v1.0/drives/${sourceDriveId}/items/${sourceItemId}`
|
|
70
|
+
: `${this.resource}/v1.0/drives/${sourceDriveId}/items/${sourceItemId}/copy`;
|
|
71
|
+
const queryParameters = nameConflictBehavior && nameConflictBehavior !== 'fail'
|
|
72
|
+
? `@microsoft.graph.conflictBehavior=${nameConflictBehavior}`
|
|
73
|
+
: '';
|
|
74
|
+
const urlWithQuery = `${apiUrl}${queryParameters ? `?${queryParameters}` : ''}`;
|
|
75
|
+
const requestOptions = {
|
|
76
|
+
url: urlWithQuery,
|
|
77
|
+
headers: { accept: 'application/json;odata.metadata=none' },
|
|
78
|
+
responseType: 'json',
|
|
79
|
+
fullResponse: true,
|
|
80
|
+
data: { parentReference: { driveId: targetDriveId, id: targetItemId } }
|
|
81
|
+
};
|
|
82
|
+
if (newName) {
|
|
83
|
+
const sourceFileName = sourcePath.substring(sourcePath.lastIndexOf('/') + 1);
|
|
84
|
+
const sourceFileExtension = sourceFileName.includes('.') ? sourceFileName.substring(sourceFileName.lastIndexOf('.')) : '';
|
|
85
|
+
const newNameExtension = newName.includes('.') ? newName.substring(newName.lastIndexOf('.')) : '';
|
|
86
|
+
requestOptions.data.name = newNameExtension ? `${newName.replace(newNameExtension, "")}${sourceFileExtension}` : `${newName}${sourceFileExtension}`;
|
|
87
|
+
}
|
|
88
|
+
return requestOptions;
|
|
89
|
+
}
|
|
90
|
+
async waitUntilCopyOperationCompleted(monitorUrl, logger) {
|
|
91
|
+
const requestOptions = {
|
|
92
|
+
url: monitorUrl,
|
|
93
|
+
responseType: 'json'
|
|
94
|
+
};
|
|
95
|
+
const response = await request.get(requestOptions);
|
|
96
|
+
if (response.status === 'completed') {
|
|
97
|
+
if (this.verbose) {
|
|
98
|
+
await logger.logToStderr('Copy operation completed succesfully. Returning...');
|
|
99
|
+
}
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
else if (response.status === 'failed') {
|
|
103
|
+
throw response.error.message;
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
if (this.verbose) {
|
|
107
|
+
await logger.logToStderr(`Still copying. Retrying in ${this.pollingInterval / 1000} seconds...`);
|
|
108
|
+
}
|
|
109
|
+
await setTimeout(this.pollingInterval);
|
|
110
|
+
await this.waitUntilCopyOperationCompleted(monitorUrl, logger);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
_FileMoveCommand_instances = new WeakSet(), _FileMoveCommand_initTelemetry = function _FileMoveCommand_initTelemetry() {
|
|
115
|
+
this.telemetry.push((args) => {
|
|
116
|
+
Object.assign(this.telemetryProperties, {
|
|
117
|
+
webUrl: typeof args.options.webUrl !== 'undefined',
|
|
118
|
+
sourceUrl: typeof args.options.sourceUrl !== 'undefined',
|
|
119
|
+
targetUrl: typeof args.options.targetUrl !== 'undefined',
|
|
120
|
+
newName: typeof args.options.newName !== 'undefined',
|
|
121
|
+
nameConflictBehavior: typeof args.options.nameConflictBehavior !== 'undefined'
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
}, _FileMoveCommand_initOptions = function _FileMoveCommand_initOptions() {
|
|
125
|
+
this.options.unshift({ option: '-u, --webUrl <webUrl>' }, { option: '-s, --sourceUrl <sourceUrl>' }, { option: '-t, --targetUrl <targetUrl>' }, { option: '--newName [newName]' }, { option: '--nameConflictBehavior [nameConflictBehavior]', autocomplete: this.nameConflictBehaviorOptions });
|
|
126
|
+
}, _FileMoveCommand_initValidators = function _FileMoveCommand_initValidators() {
|
|
127
|
+
this.validators.push(async (args) => {
|
|
128
|
+
if (args.options.nameConflictBehavior && this.nameConflictBehaviorOptions.indexOf(args.options.nameConflictBehavior) === -1) {
|
|
129
|
+
return `${args.options.nameConflictBehavior} is not a valid nameConflictBehavior value. Allowed values: ${this.nameConflictBehaviorOptions.join(', ')}.`;
|
|
130
|
+
}
|
|
131
|
+
return validation.isValidSharePointUrl(args.options.webUrl);
|
|
132
|
+
});
|
|
133
|
+
};
|
|
134
|
+
export default new FileMoveCommand();
|
|
135
|
+
//# sourceMappingURL=file-move.js.map
|
|
@@ -33,13 +33,8 @@ class PaAppListCommand extends PowerAppsCommand {
|
|
|
33
33
|
apps.forEach(a => {
|
|
34
34
|
a.displayName = a.properties.displayName;
|
|
35
35
|
});
|
|
36
|
-
await logger.log(apps);
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
if (this.verbose) {
|
|
40
|
-
await logger.logToStderr('No apps found');
|
|
41
|
-
}
|
|
42
36
|
}
|
|
37
|
+
await logger.log(apps);
|
|
43
38
|
}
|
|
44
39
|
catch (err) {
|
|
45
40
|
this.handleRejectedODataJsonPromise(err);
|