@pnp/cli-microsoft365 4.4.0-beta.b34417c → 4.4.0-beta.f2c9817

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/dist/Utils.js CHANGED
@@ -51,6 +51,10 @@ class Utils {
51
51
  const guidRegEx = new RegExp(/^19:[0-9a-zA-Z-_]+@thread\.(skype|tacv2)$/i);
52
52
  return guidRegEx.test(guid);
53
53
  }
54
+ static isValidTeamsChatId(guid) {
55
+ const guidRegEx = new RegExp(/^19:[0-9a-zA-Z-_]+(@thread\.v2|@unq\.gbl\.spaces)$/i);
56
+ return guidRegEx.test(guid);
57
+ }
54
58
  static isValidUserPrincipalName(upn) {
55
59
  const upnRegEx = new RegExp(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/i);
56
60
  return upnRegEx.test(upn);
package/dist/cli/Cli.js CHANGED
@@ -447,16 +447,14 @@ class Cli {
447
447
  }
448
448
  if (options.output === 'csv') {
449
449
  const { stringify } = require('csv-stringify/sync');
450
- /*
451
- https://csv.js.org/stringify/options/
452
- header: Display the column names on the first line if the columns option is provided or discovered.
453
- escape: Single character used for escaping; only apply to characters matching the quote and the escape options default to ".
454
- quote: The quote characters surrounding a field, defaults to the " (double quotation marks), an empty quote value will preserve the original field, whether it contains quotation marks or not.
455
- quoted: Boolean, default to false, quote all the non-empty fields even if not required.
456
- quotedEmpty: Quote empty strings and overrides quoted_string on empty strings when defined; default is false.
457
- */
450
+ const cli = Cli.getInstance();
451
+ // https://csv.js.org/stringify/options/
458
452
  return stringify(logStatement, {
459
- header: true
453
+ header: cli.getSettingWithDefaultValue(settingsNames_1.settingsNames.csvHeader, true),
454
+ escape: cli.getSettingWithDefaultValue(settingsNames_1.settingsNames.csvEscape, '"'),
455
+ quote: cli.config.get(settingsNames_1.settingsNames.csvQuote),
456
+ quoted: cli.getSettingWithDefaultValue(settingsNames_1.settingsNames.csvQuoted, false),
457
+ quotedEmpty: cli.getSettingWithDefaultValue(settingsNames_1.settingsNames.csvQuotedEmpty, false)
460
458
  });
461
459
  }
462
460
  // display object as a list of key-value pairs
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const GraphItemsListCommand_1 = require("../../../base/GraphItemsListCommand");
4
+ const commands_1 = require("../../commands");
5
+ class AadGroupListCommand extends GraphItemsListCommand_1.GraphItemsListCommand {
6
+ get name() {
7
+ return commands_1.default.GROUP_LIST;
8
+ }
9
+ get description() {
10
+ return 'Lists all groups defined in Azure Active Directory.';
11
+ }
12
+ defaultProperties() {
13
+ return ['id', 'displayName', 'groupType'];
14
+ }
15
+ commandAction(logger, args, cb) {
16
+ this
17
+ .getAllItems(`${this.resource}/v1.0/groups`, logger, true)
18
+ .then(() => {
19
+ if (args.options.output === 'text') {
20
+ this.items.forEach((group) => {
21
+ if (group.groupTypes && group.groupTypes.length > 0 && group.groupTypes[0] === 'Unified') {
22
+ group.groupType = 'Microsoft 365';
23
+ }
24
+ else if (group.mailEnabled && group.securityEnabled) {
25
+ group.groupType = 'Mail enabled security';
26
+ }
27
+ else if (group.securityEnabled) {
28
+ group.groupType = 'Security';
29
+ }
30
+ else if (group.mailEnabled) {
31
+ group.groupType = 'Distribution';
32
+ }
33
+ });
34
+ }
35
+ logger.log(this.items);
36
+ cb();
37
+ }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
38
+ }
39
+ }
40
+ module.exports = new AadGroupListCommand();
41
+ //# sourceMappingURL=group-list.js.map
@@ -11,6 +11,7 @@ exports.default = {
11
11
  APPROLEASSIGNMENT_ADD: `${prefix} approleassignment add`,
12
12
  APPROLEASSIGNMENT_LIST: `${prefix} approleassignment list`,
13
13
  APPROLEASSIGNMENT_REMOVE: `${prefix} approleassignment remove`,
14
+ GROUP_LIST: `${prefix} group list`,
14
15
  GROUPSETTING_ADD: `${prefix} groupsetting add`,
15
16
  GROUPSETTING_GET: `${prefix} groupsetting get`,
16
17
  GROUPSETTING_LIST: `${prefix} groupsetting list`,
@@ -21,6 +21,9 @@ class CliConfigSetCommand extends AnonymousCommand_1.default {
21
21
  switch (args.options.key) {
22
22
  case settingsNames_1.settingsNames.showHelpOnFailure:
23
23
  case settingsNames_1.settingsNames.printErrorsAsPlainText:
24
+ case settingsNames_1.settingsNames.csvHeader:
25
+ case settingsNames_1.settingsNames.csvQuoted:
26
+ case settingsNames_1.settingsNames.csvQuotedEmpty:
24
27
  value = args.options.value === 'true';
25
28
  break;
26
29
  default:
@@ -47,7 +50,7 @@ class CliConfigSetCommand extends AnonymousCommand_1.default {
47
50
  if (CliConfigSetCommand.optionNames.indexOf(args.options.key) < 0) {
48
51
  return `${args.options.key} is not a valid setting. Allowed values: ${CliConfigSetCommand.optionNames.join(', ')}`;
49
52
  }
50
- const allowedOutputs = ['text', 'json'];
53
+ const allowedOutputs = ['text', 'json', 'csv'];
51
54
  if (args.options.key === settingsNames_1.settingsNames.output &&
52
55
  allowedOutputs.indexOf(args.options.value) === -1) {
53
56
  return `${args.options.value} is not a valid value for the option ${args.options.key}. Allowed values: ${allowedOutputs.join(', ')}`;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const path = require("path");
4
- const xmldom_1 = require("xmldom");
4
+ const xmldom_1 = require("@xmldom/xmldom");
5
5
  /*
6
6
  * Logic extracted from bolt.module.solution.dll
7
7
  * Version: 0.4.3
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const Utils_1 = require("../../../../Utils");
4
+ const GraphItemsListCommand_1 = require("../../../base/GraphItemsListCommand");
5
+ const commands_1 = require("../../commands");
6
+ class TeamsChatMemberListCommand extends GraphItemsListCommand_1.GraphItemsListCommand {
7
+ get name() {
8
+ return commands_1.default.CHAT_MEMBER_LIST;
9
+ }
10
+ get description() {
11
+ return 'Lists all members from a chat';
12
+ }
13
+ defaultProperties() {
14
+ return ['userId', 'displayName', 'email'];
15
+ }
16
+ commandAction(logger, args, cb) {
17
+ const endpoint = `${this.resource}/v1.0/chats/${args.options.chatId}/members`;
18
+ this
19
+ .getAllItems(endpoint, logger, true)
20
+ .then(() => {
21
+ logger.log(this.items);
22
+ cb();
23
+ }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
24
+ }
25
+ options() {
26
+ const options = [
27
+ {
28
+ option: '-i, --chatId <chatId>'
29
+ }
30
+ ];
31
+ const parentOptions = super.options();
32
+ return options.concat(parentOptions);
33
+ }
34
+ validate(args) {
35
+ if (!Utils_1.default.isValidTeamsChatId(args.options.chatId)) {
36
+ return `${args.options.chatId} is not a valid Teams ChatId`;
37
+ }
38
+ return true;
39
+ }
40
+ }
41
+ module.exports = new TeamsChatMemberListCommand();
42
+ //# sourceMappingURL=chat-member-list.js.map
@@ -13,6 +13,7 @@ exports.default = {
13
13
  CHANNEL_LIST: `${prefix} channel list`,
14
14
  CHANNEL_REMOVE: `${prefix} channel remove`,
15
15
  CHANNEL_SET: `${prefix} channel set`,
16
+ CHAT_MEMBER_LIST: `${prefix} chat member list`,
16
17
  CONVERSATIONMEMBER_ADD: `${prefix} conversationmember add`,
17
18
  CONVERSATIONMEMBER_LIST: `${prefix} conversationmember list`,
18
19
  FUNSETTINGS_LIST: `${prefix} funsettings list`,
@@ -5,7 +5,12 @@ const settingsNames = {
5
5
  errorOutput: 'errorOutput',
6
6
  output: 'output',
7
7
  printErrorsAsPlainText: 'printErrorsAsPlainText',
8
- showHelpOnFailure: 'showHelpOnFailure'
8
+ showHelpOnFailure: 'showHelpOnFailure',
9
+ csvHeader: 'csvHeader',
10
+ csvEscape: 'csvEscape',
11
+ csvQuote: 'csvQuote',
12
+ csvQuoted: 'csvQuoted',
13
+ csvQuotedEmpty: 'csvQuotedEmpty'
9
14
  };
10
15
  exports.settingsNames = settingsNames;
11
16
  //# sourceMappingURL=settingsNames.js.map
@@ -0,0 +1,21 @@
1
+ # aad group list
2
+
3
+ Lists Azure AD groups
4
+
5
+ ## Usage
6
+
7
+ ```sh
8
+ m365 aad group list [options]
9
+ ```
10
+
11
+ ## Options
12
+
13
+ --8<-- "docs/cmd/_global.md"
14
+
15
+ ## Examples
16
+
17
+ Lists all groups defined in Azure Active Directory.
18
+
19
+ ```sh
20
+ m365 aad group list
21
+ ```
@@ -0,0 +1,24 @@
1
+ # teams chat member list
2
+
3
+ Lists all members from a Microsoft Teams chat conversation.
4
+
5
+ ## Usage
6
+
7
+ ```sh
8
+ m365 teams chat member list [options]
9
+ ```
10
+
11
+ ## Options
12
+
13
+ `-i, --chatId <chatId>`
14
+ : The ID of the chat conversation
15
+
16
+ --8<-- "docs/cmd/_global.md"
17
+
18
+ ## Examples
19
+
20
+ List the members from a Microsoft Teams chat conversation
21
+
22
+ ```sh
23
+ m365 teams chat member list --chatId 19:8b081ef6-4792-4def-b2c9-c363a1bf41d5_5031bb31-22c0-4f6f-9f73-91d34ab2b32d@unq.gbl.spaces
24
+ ```