@pnp/cli-microsoft365 5.1.0-beta.c8f5fd7 → 5.1.0-beta.efdacec
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.js +1 -0
- package/dist/cli/index.js +5 -1
- package/dist/m365/aad/commands/app/app-add.js +68 -10
- package/dist/m365/aad/commands/app/app-role-delete.js +1 -1
- package/dist/m365/base/PowerPlatformCommand.js +10 -0
- package/dist/m365/pp/commands/managementapp/managementapp-add.js +98 -0
- package/dist/m365/pp/commands.js +7 -0
- package/dist/m365/spfx/commands/project/model/index.js +5 -1
- package/dist/m365/spfx/commands/project/project-externalize/index.js +5 -1
- package/dist/m365/spfx/commands/project/project-externalize/rules/index.js +5 -1
- package/dist/m365/spfx/commands/project/project-upgrade/index.js +5 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN001033_DEP_tslib.js +14 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN023002_GITIGNORE_heft.js +40 -0
- package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.15.0-beta.1.js +63 -0
- package/dist/m365/spfx/commands/project/project-upgrade.js +24 -19
- package/dist/m365/spo/commands/site/site-recyclebinitem-restore.js +66 -0
- package/dist/m365/spo/commands.js +1 -0
- package/dist/m365/teams/commands/chat/chat-message-send.js +50 -58
- package/dist/utils/formatting.js +3 -0
- package/dist/utils/index.js +5 -1
- package/docs/docs/cmd/pp/managementapp/managementapp-add.md +50 -0
- package/docs/docs/cmd/spfx/project/project-upgrade.md +1 -1
- package/docs/docs/cmd/spo/site/site-recyclebinitem-restore.md +27 -0
- package/docs/docs/cmd/teams/chat/chat-message-send.md +4 -4
- package/npm-shrinkwrap.json +173 -188
- package/package.json +10 -10
|
@@ -20,21 +20,22 @@ class TeamsChatMessageSendCommand extends GraphCommand_1.default {
|
|
|
20
20
|
return commands_1.default.CHAT_MESSAGE_SEND;
|
|
21
21
|
}
|
|
22
22
|
get description() {
|
|
23
|
-
return '
|
|
23
|
+
return 'Sends a chat message to a Microsoft Teams chat conversation.';
|
|
24
|
+
}
|
|
25
|
+
getTelemetryProperties(args) {
|
|
26
|
+
const telemetryProps = super.getTelemetryProperties(args);
|
|
27
|
+
telemetryProps.chatId = typeof args.options.chatId !== 'undefined';
|
|
28
|
+
telemetryProps.userEmails = typeof args.options.userEmails !== 'undefined';
|
|
29
|
+
telemetryProps.chatName = typeof args.options.chatName !== 'undefined';
|
|
30
|
+
return telemetryProps;
|
|
24
31
|
}
|
|
25
32
|
commandAction(logger, args, cb) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
cb();
|
|
33
|
-
}
|
|
34
|
-
catch (error) {
|
|
35
|
-
this.handleRejectedODataJsonPromise(error, logger, cb);
|
|
36
|
-
}
|
|
37
|
-
});
|
|
33
|
+
this
|
|
34
|
+
.getChatId(logger, args)
|
|
35
|
+
.then(chatId => this.sendChatMessage(chatId, args))
|
|
36
|
+
.then(_ => {
|
|
37
|
+
cb();
|
|
38
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
38
39
|
}
|
|
39
40
|
options() {
|
|
40
41
|
const options = [
|
|
@@ -78,36 +79,44 @@ class TeamsChatMessageSendCommand extends GraphCommand_1.default {
|
|
|
78
79
|
return `${args.options.chatId} is not a valid Teams ChatId.`;
|
|
79
80
|
}
|
|
80
81
|
if (args.options.userEmails) {
|
|
81
|
-
const userEmails = args.options.userEmails
|
|
82
|
+
const userEmails = this.convertCommaSeparatedListToArray(args.options.userEmails);
|
|
82
83
|
if (!userEmails || userEmails.length === 0 || userEmails.some(e => !utils_1.validation.isValidUserPrincipalName(e))) {
|
|
83
84
|
return `${args.options.userEmails} contains one or more invalid email addresses.`;
|
|
84
85
|
}
|
|
85
86
|
}
|
|
86
87
|
return true;
|
|
87
88
|
}
|
|
88
|
-
|
|
89
|
+
getChatId(logger, args) {
|
|
89
90
|
return __awaiter(this, void 0, void 0, function* () {
|
|
90
|
-
|
|
91
|
+
if (args.options.chatId) {
|
|
92
|
+
return args.options.chatId;
|
|
93
|
+
}
|
|
94
|
+
return args.options.userEmails
|
|
95
|
+
? this.ensureChatIdByUserEmails(args.options.userEmails, logger)
|
|
96
|
+
: this.getChatIdByName(args.options.chatName, logger);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
ensureChatIdByUserEmails(userEmailsOption, logger) {
|
|
100
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
101
|
+
const userEmails = this.convertCommaSeparatedListToArray(userEmailsOption);
|
|
91
102
|
const currentUserEmail = utils_1.accessToken.getUserNameFromAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken).toLowerCase();
|
|
92
|
-
const existingChats = yield this.findExistingGroupChatsByMembers([currentUserEmail, ...userEmails]);
|
|
93
|
-
if (existingChats
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
return `- ${c.id}${c.topic && ' - '}${c.topic} - ${c.createdDateTime && new Date(c.createdDateTime).toLocaleString()}`;
|
|
97
|
-
}).join(os.EOL);
|
|
98
|
-
throw new Error(`Multiple chat conversations with this topic found. Please disambiguate:${os.EOL}${disambiguationText}`);
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
return existingChats[0].id;
|
|
102
|
-
}
|
|
103
|
+
const existingChats = yield this.findExistingGroupChatsByMembers([currentUserEmail, ...userEmails], logger);
|
|
104
|
+
if (!existingChats || existingChats.length === 0) {
|
|
105
|
+
const chat = yield this.createConversation([currentUserEmail, ...userEmails]);
|
|
106
|
+
return chat.id;
|
|
103
107
|
}
|
|
104
|
-
|
|
105
|
-
|
|
108
|
+
if (existingChats.length === 1) {
|
|
109
|
+
return existingChats[0].id;
|
|
110
|
+
}
|
|
111
|
+
const disambiguationText = existingChats.map(c => {
|
|
112
|
+
return `- ${c.id}${c.topic && ' - '}${c.topic} - ${c.createdDateTime && new Date(c.createdDateTime).toLocaleString()}`;
|
|
113
|
+
}).join(os.EOL);
|
|
114
|
+
throw new Error(`Multiple chat conversations with this name found. Please disambiguate:${os.EOL}${disambiguationText}`);
|
|
106
115
|
});
|
|
107
116
|
}
|
|
108
|
-
getChatIdByName(chatName) {
|
|
117
|
+
getChatIdByName(chatName, logger) {
|
|
109
118
|
return __awaiter(this, void 0, void 0, function* () {
|
|
110
|
-
const existingChats = yield this.
|
|
119
|
+
const existingChats = yield this.findExistingGroupChatsByName(chatName, logger);
|
|
111
120
|
if (!existingChats || existingChats.length === 0) {
|
|
112
121
|
throw new Error('No chat conversation was found with this name.');
|
|
113
122
|
}
|
|
@@ -118,7 +127,7 @@ class TeamsChatMessageSendCommand extends GraphCommand_1.default {
|
|
|
118
127
|
const memberstring = c.members.map(m => m.email).join(', ');
|
|
119
128
|
return `- ${c.id} - ${c.createdDateTime && new Date(c.createdDateTime).toLocaleString()} - ${memberstring}`;
|
|
120
129
|
}).join(os.EOL);
|
|
121
|
-
throw new Error(`Multiple chat conversations with this
|
|
130
|
+
throw new Error(`Multiple chat conversations with this name found. Please disambiguate:${os.EOL}${disambiguationText}`);
|
|
122
131
|
});
|
|
123
132
|
}
|
|
124
133
|
// This Microsoft Graph API request throws an intermittent 404 exception, saying that it cannot find the principal.
|
|
@@ -159,7 +168,7 @@ class TeamsChatMessageSendCommand extends GraphCommand_1.default {
|
|
|
159
168
|
}
|
|
160
169
|
});
|
|
161
170
|
}
|
|
162
|
-
sendChatMessage(chatId,
|
|
171
|
+
sendChatMessage(chatId, args) {
|
|
163
172
|
return __awaiter(this, void 0, void 0, function* () {
|
|
164
173
|
const requestOptions = {
|
|
165
174
|
url: `${this.resource}/v1.0/chats/${chatId}/messages`,
|
|
@@ -170,18 +179,18 @@ class TeamsChatMessageSendCommand extends GraphCommand_1.default {
|
|
|
170
179
|
responseType: 'json',
|
|
171
180
|
data: {
|
|
172
181
|
body: {
|
|
173
|
-
content: options.message
|
|
182
|
+
content: args.options.message
|
|
174
183
|
}
|
|
175
184
|
}
|
|
176
185
|
};
|
|
177
186
|
yield request_1.default.post(requestOptions);
|
|
178
187
|
});
|
|
179
188
|
}
|
|
180
|
-
findExistingGroupChatsByMembers(expectedMemberEmails) {
|
|
189
|
+
findExistingGroupChatsByMembers(expectedMemberEmails, logger) {
|
|
181
190
|
return __awaiter(this, void 0, void 0, function* () {
|
|
182
191
|
const endpoint = `${this.resource}/v1.0/chats?$filter=chatType eq 'group'&$expand=members&$select=id,topic,createdDateTime,members`;
|
|
183
192
|
const foundChats = [];
|
|
184
|
-
const chats = yield
|
|
193
|
+
const chats = yield utils_1.odata.getAllItems(endpoint, logger);
|
|
185
194
|
for (const chat of chats) {
|
|
186
195
|
const chatMembers = chat.members;
|
|
187
196
|
if (chatMembers.length === expectedMemberEmails.length) {
|
|
@@ -194,31 +203,14 @@ class TeamsChatMessageSendCommand extends GraphCommand_1.default {
|
|
|
194
203
|
return foundChats;
|
|
195
204
|
});
|
|
196
205
|
}
|
|
197
|
-
|
|
206
|
+
findExistingGroupChatsByName(name, logger) {
|
|
198
207
|
return __awaiter(this, void 0, void 0, function* () {
|
|
199
|
-
const endpoint = `${this.resource}/v1.0/chats?$filter=topic eq '${encodeURIComponent(
|
|
200
|
-
|
|
201
|
-
return chats;
|
|
208
|
+
const endpoint = `${this.resource}/v1.0/chats?$filter=topic eq '${encodeURIComponent(name)}'&$expand=members&$select=id,topic,createdDateTime,chatType`;
|
|
209
|
+
return utils_1.odata.getAllItems(endpoint, logger);
|
|
202
210
|
});
|
|
203
211
|
}
|
|
204
|
-
|
|
205
|
-
return
|
|
206
|
-
const requestOptions = {
|
|
207
|
-
url: url,
|
|
208
|
-
headers: {
|
|
209
|
-
accept: 'application/json;odata.metadata=none'
|
|
210
|
-
},
|
|
211
|
-
responseType: 'json'
|
|
212
|
-
};
|
|
213
|
-
const res = yield request_1.default.get(requestOptions);
|
|
214
|
-
items = items.concat(res.value);
|
|
215
|
-
if (res['@odata.nextLink']) {
|
|
216
|
-
return yield this.getAllChats(res['@odata.nextLink'], items);
|
|
217
|
-
}
|
|
218
|
-
else {
|
|
219
|
-
return items;
|
|
220
|
-
}
|
|
221
|
-
});
|
|
212
|
+
convertCommaSeparatedListToArray(userEmailsString) {
|
|
213
|
+
return userEmailsString.toLowerCase().replace(/\s/g, '').split(',').filter(e => e && e !== '');
|
|
222
214
|
}
|
|
223
215
|
}
|
|
224
216
|
module.exports = new TeamsChatMessageSendCommand();
|
package/dist/utils/formatting.js
CHANGED
package/dist/utils/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# pp managementapp add
|
|
2
|
+
|
|
3
|
+
Register management application for Power Platform
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
m365 pp managementapp add [options]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Options
|
|
12
|
+
|
|
13
|
+
`--appId [appId]`
|
|
14
|
+
: Application (client) ID of the Azure AD application registration to register as a management app. Specify either `appId`, `objectId` or `name`
|
|
15
|
+
|
|
16
|
+
`--objectId [objectId]`
|
|
17
|
+
: Object ID of the Azure AD application registration to register as a management app. Specify either `appId`, `objectId` or `name`
|
|
18
|
+
|
|
19
|
+
`--name [name]`
|
|
20
|
+
: Name of the Azure AD application registration to register as a management app. Specify either `appId`, `objectId` or `name`
|
|
21
|
+
|
|
22
|
+
--8<-- "docs/cmd/_global.md"
|
|
23
|
+
|
|
24
|
+
## Remarks
|
|
25
|
+
|
|
26
|
+
To execute this command the first time you'll need sign in using the Microsoft Azure PowerShell app registration. You can do this by executing `m365 login --appId 1950a258-227b-4e31-a9cf-717495945fc2`. To register the Azure AD app registration that CLI for Microsoft 365 uses by default, execute `m365 pp managementapp add--appId 31359c7f-bd7e-475c-86db-fdb8c937548e`.
|
|
27
|
+
|
|
28
|
+
For best performance use the `appId` option to reference the Azure AD application registration to update. If you use `objectId` or `name`, this command will first need to find the corresponding `appId` for that application.
|
|
29
|
+
|
|
30
|
+
If the command finds multiple Azure AD application registrations with the specified app name, it will prompt you to disambiguate which app it should use, listing the discovered object IDs.
|
|
31
|
+
|
|
32
|
+
## Examples
|
|
33
|
+
|
|
34
|
+
Register CLI for Microsoft 365 as a management application for the Power Platform
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
m365 pp managementapp add --appId 31359c7f-bd7e-475c-86db-fdb8c937548e
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Register Azure AD application with the specified object ID as a management application for the Power Platform
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
m365 pp managementapp add --objectId d75be2e1-0204-4f95-857d-51a37cf40be8
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Register Azure AD application named _My app_ as a management application for the Power Platform
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
m365 pp managementapp add --name "My app"
|
|
50
|
+
```
|
|
@@ -32,7 +32,7 @@ m365 spfx project upgrade [options]
|
|
|
32
32
|
|
|
33
33
|
## Remarks
|
|
34
34
|
|
|
35
|
-
The `spfx project upgrade` command helps you upgrade your SharePoint Framework project to the specified version. If no version is specified, the command will upgrade to the latest version of the SharePoint Framework it supports (v1.14.0).
|
|
35
|
+
The `spfx project upgrade` command helps you upgrade your SharePoint Framework project to the specified version. If no version is specified, the command will upgrade to the latest version of the SharePoint Framework it supports (v1.14.0). If you specify the `preview` option without a specific version, the command will upgrade your project to the latest preview version v1.15.0-beta.1.
|
|
36
36
|
|
|
37
37
|
This command doesn't change your project files. Instead, it gives you a report with all steps necessary to upgrade your project to the specified version of the SharePoint Framework. Changing project files is error-prone, especially when it comes to updating your solution's code. This is why at this moment, this command produces a report that you can use yourself to perform the necessary updates and verify that everything is working as expected.
|
|
38
38
|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# spo site recyclebinitem restore
|
|
2
|
+
|
|
3
|
+
Restores given items from the site recycle bin
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
m365 spo site recyclebinitem restore [options]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Options
|
|
12
|
+
|
|
13
|
+
`-u, --siteUrl <siteUrl>`
|
|
14
|
+
: URL of the site for which to restore the recycle bin items
|
|
15
|
+
|
|
16
|
+
`-i, --ids <ids>`
|
|
17
|
+
: List of ids of items which will be restored from the site recycle bin
|
|
18
|
+
|
|
19
|
+
--8<-- "docs/cmd/_global.md"
|
|
20
|
+
|
|
21
|
+
## Examples
|
|
22
|
+
|
|
23
|
+
Restore specific items by given ids from recycle bin for site _https://contoso.sharepoint.com/site_
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
m365 spo site recyclebinitem restore --siteUrl https://contoso.sharepoint.com/site --ids "ae6f97a7-280e-48d6-b481-0ea986c323da,aadbf916-1f71-42ee-abf2-8ee4802ae291"
|
|
27
|
+
```
|
|
@@ -33,23 +33,23 @@ A new chat conversation will be created if no existing conversation with the par
|
|
|
33
33
|
Send a message to a Microsoft Teams chat conversation by id
|
|
34
34
|
|
|
35
35
|
```sh
|
|
36
|
-
m365 teams chat message send --chatId 19:2da4c29f6d7041eca70b638b43d45437@thread.v2
|
|
36
|
+
m365 teams chat message send --chatId 19:2da4c29f6d7041eca70b638b43d45437@thread.v2 --message "Welcome to Teams"
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
Send a message to a single person
|
|
40
40
|
|
|
41
41
|
```sh
|
|
42
|
-
m365 teams chat message send --userEmails alexw@contoso.com
|
|
42
|
+
m365 teams chat message send --userEmails alexw@contoso.com --message "Welcome to Teams"
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
Send a message to a group of people
|
|
46
46
|
|
|
47
47
|
```sh
|
|
48
|
-
m365 teams chat message send --userEmails alexw@contoso.com,meganb@contoso.com
|
|
48
|
+
m365 teams chat message send --userEmails alexw@contoso.com,meganb@contoso.com --message "Welcome to Teams"
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
Send a message to a chat conversation finding it by display name
|
|
52
52
|
|
|
53
53
|
```sh
|
|
54
|
-
m365 teams chat message send --chatName "Just a conversation"
|
|
54
|
+
m365 teams chat message send --chatName "Just a conversation" --message "Welcome to Teams"
|
|
55
55
|
```
|