@pnp/cli-microsoft365 5.2.0-beta.0f1c454 → 5.2.0-beta.a814a27
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/.mocharc.json +1 -0
- package/dist/Auth.js +2 -1
- package/dist/Command.js +6 -1
- package/dist/cli/Cli.js +2 -18
- package/dist/m365/app/commands/app-get.js +3 -0
- package/dist/m365/cli/commands/cli-reconsent.js +20 -2
- package/dist/m365/cli/commands/config/config-set.js +1 -0
- package/dist/m365/spfx/commands/project/project-upgrade.js +4 -1
- package/dist/m365/spo/commands/site/site-remove.js +4 -3
- package/dist/m365/spo/commands/tenant/tenant-recyclebinitem-restore.js +10 -44
- package/dist/m365/teams/commands/channel/channel-membership-list.js +150 -0
- package/dist/m365/teams/commands/chat/chat-get.js +143 -0
- package/dist/m365/teams/commands/chat/chat-message-send.js +5 -30
- package/dist/m365/teams/commands/chat/chatUtil.js +62 -0
- package/dist/m365/teams/commands.js +2 -0
- package/dist/settingsNames.js +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/md.js +81 -0
- package/docs/docs/cmd/teams/channel/channel-membership-list.md +48 -0
- package/docs/docs/cmd/teams/chat/chat-get.md +53 -0
- package/npm-shrinkwrap.json +22 -736
- package/package.json +2 -3
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.chatUtil = void 0;
|
|
13
|
+
const odata_1 = require("../../../../utils/odata");
|
|
14
|
+
exports.chatUtil = {
|
|
15
|
+
/**
|
|
16
|
+
* Finds existing Microsoft Teams chats by participants, using the Microsoft Graph
|
|
17
|
+
* @param expectedMemberEmails a string array of participant emailaddresses
|
|
18
|
+
* @param logger a logger to pipe into the graph request odata helper.
|
|
19
|
+
*/
|
|
20
|
+
findExistingChatsByParticipants(expectedMemberEmails, logger) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const chatType = expectedMemberEmails.length === 2 ? 'oneOnOne' : 'group';
|
|
23
|
+
const endpoint = `https://graph.microsoft.com/v1.0/chats?$filter=chatType eq '${chatType}'&$expand=members&$select=id,topic,createdDateTime,members`;
|
|
24
|
+
const foundChats = [];
|
|
25
|
+
const chats = yield odata_1.odata.getAllItems(endpoint, logger);
|
|
26
|
+
for (const chat of chats) {
|
|
27
|
+
const chatMembers = chat.members;
|
|
28
|
+
if (chatMembers.length === expectedMemberEmails.length) {
|
|
29
|
+
const chatMemberEmails = chatMembers.map(member => { var _a; return (_a = member.email) === null || _a === void 0 ? void 0 : _a.toLowerCase(); });
|
|
30
|
+
if (expectedMemberEmails.every(email => chatMemberEmails.some(memberEmail => memberEmail === email))) {
|
|
31
|
+
foundChats.push(chat);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return foundChats;
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
/**
|
|
39
|
+
* Finds existing Microsoft Teams chats by name, using the Microsoft Graph
|
|
40
|
+
* @param name the name of the chat conversation to find
|
|
41
|
+
* @param logger a logger to pipe into the graph request odata helper.
|
|
42
|
+
*/
|
|
43
|
+
findExistingGroupChatsByName(name, logger) {
|
|
44
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
const endpoint = `https://graph.microsoft.com/v1.0/chats?$filter=topic eq '${encodeURIComponent(name).replace("'", "''")}'&$expand=members&$select=id,topic,createdDateTime,chatType`;
|
|
46
|
+
return odata_1.odata.getAllItems(endpoint, logger);
|
|
47
|
+
});
|
|
48
|
+
},
|
|
49
|
+
/**
|
|
50
|
+
* Converts a comma or space separated string into an array.
|
|
51
|
+
* @param value the string to convert
|
|
52
|
+
*/
|
|
53
|
+
convertParticipantStringToArray(value) {
|
|
54
|
+
if (value.indexOf(',') === -1) {
|
|
55
|
+
return value.trim().toLowerCase().split(' ').filter(e => e && e !== '');
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
return value.trim().toLowerCase().split(',').filter(e => e && e !== '');
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=chatUtil.js.map
|
|
@@ -11,8 +11,10 @@ exports.default = {
|
|
|
11
11
|
CHANNEL_ADD: `${prefix} channel add`,
|
|
12
12
|
CHANNEL_GET: `${prefix} channel get`,
|
|
13
13
|
CHANNEL_LIST: `${prefix} channel list`,
|
|
14
|
+
CHANNEL_MEMBERSHIP_LIST: `${prefix} channel membership list`,
|
|
14
15
|
CHANNEL_REMOVE: `${prefix} channel remove`,
|
|
15
16
|
CHANNEL_SET: `${prefix} channel set`,
|
|
17
|
+
CHAT_GET: `${prefix} chat get`,
|
|
16
18
|
CHAT_LIST: `${prefix} chat list`,
|
|
17
19
|
CHAT_MEMBER_LIST: `${prefix} chat member list`,
|
|
18
20
|
CHAT_MESSAGE_LIST: `${prefix} chat message list`,
|
package/dist/settingsNames.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.settingsNames = void 0;
|
|
4
4
|
const settingsNames = {
|
|
5
5
|
autoOpenBrowserOnLogin: 'autoOpenBrowserOnLogin',
|
|
6
|
+
autoOpenLinksInBrowser: 'autoOpenLinksInBrowser',
|
|
6
7
|
copyDeviceCodeToClipboard: 'copyDeviceCodeToClipboard',
|
|
7
8
|
csvEscape: 'csvEscape',
|
|
8
9
|
csvHeader: 'csvHeader',
|
package/dist/utils/index.js
CHANGED
|
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./accessToken"), exports);
|
|
18
18
|
__exportStar(require("./formatting"), exports);
|
|
19
19
|
__exportStar(require("./fsUtil"), exports);
|
|
20
|
+
__exportStar(require("./md"), exports);
|
|
20
21
|
__exportStar(require("./odata"), exports);
|
|
21
22
|
__exportStar(require("./packageManager"), exports);
|
|
22
23
|
__exportStar(require("./sinonUtil"), exports);
|
package/dist/utils/md.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.md = void 0;
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const os_1 = require("os");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
function convertTitle(md) {
|
|
8
|
+
return md.replace(/^#\s+(.*)/gm, (match, title) => {
|
|
9
|
+
return title.toLocaleUpperCase() + os_1.EOL + Array(title.length + 1).join('=');
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
function convertHeadings(md) {
|
|
13
|
+
return md.replace(/^(#+)\s+(.*)/gm, (match, level, content) => {
|
|
14
|
+
return `${os_1.EOL}${content.toLocaleUpperCase()}`;
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function convertAdmonitions(md) {
|
|
18
|
+
const regex = new RegExp('^!!!\\s(.*)' + os_1.EOL + '\\s+', 'gm');
|
|
19
|
+
return md.replace(regex, (match, content) => {
|
|
20
|
+
return content.toLocaleUpperCase() + os_1.EOL + os_1.EOL;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function includeContent(md, rootFolder) {
|
|
24
|
+
return md.replace(/^--8<-- "([^"]+)"/gm, (match, filePath) => {
|
|
25
|
+
return fs.readFileSync(path.join(rootFolder, filePath), 'utf8');
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function convertDd(md) {
|
|
29
|
+
return md.replace(/^:\s(.*)/gm, (match, content) => {
|
|
30
|
+
return ` ${content}`;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function convertHyperlinks(md) {
|
|
34
|
+
return md.replace(/\[([^\]]+)\]\(([^\)]+)\)/gm, (match, label, url) => {
|
|
35
|
+
// if the link is the same as the content, return just the link
|
|
36
|
+
if (label === url) {
|
|
37
|
+
return url;
|
|
38
|
+
}
|
|
39
|
+
// if the link is relative, remove it because there's no way to open it
|
|
40
|
+
// from the terminal anyway. In the future, we could convert it to the
|
|
41
|
+
// actual link of the docs.
|
|
42
|
+
if (!url.startsWith('http:') && !url.startsWith('https:')) {
|
|
43
|
+
return label;
|
|
44
|
+
}
|
|
45
|
+
return `${label} (${url})`;
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function convertCodeFences(md) {
|
|
49
|
+
const regex = new RegExp('^```.*?' + os_1.EOL + '(.*?)```' + os_1.EOL, 'gms');
|
|
50
|
+
return md.replace(regex, (match, code) => {
|
|
51
|
+
return ` ${code}${os_1.EOL}`;
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function removeInlineMarkup(md) {
|
|
55
|
+
// from https://stackoverflow.com/a/70064453
|
|
56
|
+
return md.replace(/(?<marks>[`]|\*{1,3}|_{1,3}|~{2})(?<inmarks>.*?)\1/g, '$<inmarks>$<link_text>');
|
|
57
|
+
}
|
|
58
|
+
function removeTooManyEmptyLines(md) {
|
|
59
|
+
const regex = new RegExp('(' + os_1.EOL + '){4,}', 'g');
|
|
60
|
+
return md.replace(regex, Array(4).join(os_1.EOL));
|
|
61
|
+
}
|
|
62
|
+
const convertFunctions = [
|
|
63
|
+
convertTitle,
|
|
64
|
+
convertHeadings,
|
|
65
|
+
convertAdmonitions,
|
|
66
|
+
convertDd,
|
|
67
|
+
convertHyperlinks,
|
|
68
|
+
convertCodeFences,
|
|
69
|
+
removeInlineMarkup,
|
|
70
|
+
removeTooManyEmptyLines
|
|
71
|
+
];
|
|
72
|
+
exports.md = {
|
|
73
|
+
md2plain(md, rootFolderDocs) {
|
|
74
|
+
md = includeContent(md, rootFolderDocs);
|
|
75
|
+
convertFunctions.forEach(convert => {
|
|
76
|
+
md = convert(md);
|
|
77
|
+
});
|
|
78
|
+
return md;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
//# sourceMappingURL=md.js.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# teams channel membership list
|
|
2
|
+
|
|
3
|
+
Lists memberships in the specified Microsoft Teams team channel
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
m365 teams channel membership list [options]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Options
|
|
12
|
+
|
|
13
|
+
`--teamId [teamId]`
|
|
14
|
+
: The Id of the Microsoft Teams team. Specify either `teamId` or `teamName` but not both
|
|
15
|
+
|
|
16
|
+
`--teamName [teamName]`
|
|
17
|
+
: The display name of the Microsoft Teams team. Specify either `teamId` or `teamName` but not both
|
|
18
|
+
|
|
19
|
+
`--channelId [channelId]`
|
|
20
|
+
: The Id of the Microsoft Teams team channel. Specify either `channelId` or `channelName` but not both
|
|
21
|
+
|
|
22
|
+
`channelName [channelName]`
|
|
23
|
+
: The display name of the Microsoft Teams team channel. Specify either `channelId` or `channelName` but not both
|
|
24
|
+
|
|
25
|
+
`-r, --role [role]`
|
|
26
|
+
: Filter the results to only users with the given role: owner, member, guest
|
|
27
|
+
|
|
28
|
+
--8<-- "docs/cmd/_global.md"
|
|
29
|
+
|
|
30
|
+
## Examples
|
|
31
|
+
|
|
32
|
+
List the memberships in a specified Microsoft Teams team with id 00000000-0000-0000-0000-000000000000 and channel id 00:00000000000000000000000000000000@thread.skype
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
m365 teams channel membership list --teamId 00000000-0000-0000-0000-000000000000 --channelId 00:00000000000000000000000000000000@thread.skype
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
List the memberships in a specified Microsoft Teams team with name _Team Name_ and channel with name _Channel Name_
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
m365 teams channel membership list --teamName "Team Name" --channelName "Channel Name"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
List all owner memberships in the specified Microsoft Teams team with id 00000000-0000-0000-0000-000000000000 and channel id 00:00000000000000000000000000000000@thread.skype
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
m365 teams channel membership list --teamId 00000000-0000-0000-0000-000000000000 --channelId 00:00000000000000000000000000000000@thread.skype --role owner
|
|
48
|
+
```
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# teams chat get
|
|
2
|
+
|
|
3
|
+
Get a Microsoft Teams chat conversation by id, participants or chat name.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
m365 teams chat get [options]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Options
|
|
12
|
+
|
|
13
|
+
`-i, --id [id]`
|
|
14
|
+
: The ID of the chat conversation. Specify either `id`, `name` or `participants`, but not multiple.
|
|
15
|
+
|
|
16
|
+
`-n, --name [name]`
|
|
17
|
+
: The display name of the chat conversation. Specify either `id`, `name` or `participants`, but not multiple.
|
|
18
|
+
|
|
19
|
+
`-p, --participants [participants]`
|
|
20
|
+
: A comma-separated list of one or more e-mail addresses. Specify either `id`, `name` or `participants`, but not multiple.
|
|
21
|
+
|
|
22
|
+
--8<-- "docs/cmd/_global.md"
|
|
23
|
+
|
|
24
|
+
## Remarks
|
|
25
|
+
|
|
26
|
+
The output will not include the chat conversation members or messages. It will just retrieve the conversation details.
|
|
27
|
+
When using the `participants` option, the signed-in user will automatically be included as a participant. There's no need to add it to the list manually.
|
|
28
|
+
|
|
29
|
+
## Examples
|
|
30
|
+
|
|
31
|
+
Get a Microsoft Teams chat conversation by id
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
m365 teams chat get --id 19:2da4c29f6d7041eca70b638b43d45437@thread.v2
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Get a Microsoft Teams one on one chat conversation, finding it by participant.
|
|
38
|
+
|
|
39
|
+
```sh
|
|
40
|
+
m365 teams chat get --participants alexw@contoso.com
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Get a Microsoft Teams group chat conversation, finding it by participants.
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
m365 teams chat get --participants alexw@contoso.com,meganb@contoso.com
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Get a Microsoft Teams chat conversation, finding it by display name
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
m365 teams chat get --name "Just a conversation"
|
|
53
|
+
```
|