@pnp/cli-microsoft365 5.4.0-beta.0f3627d → 5.4.0-beta.5d38887

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.
@@ -0,0 +1,129 @@
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
+ const cli_1 = require("../../../../cli");
13
+ const request_1 = require("../../../../request");
14
+ const utils_1 = require("../../../../utils");
15
+ const GraphCommand_1 = require("../../../base/GraphCommand");
16
+ const commands_1 = require("../../commands");
17
+ class AadO365GroupRecycleBinItemRemoveCommand extends GraphCommand_1.default {
18
+ get name() {
19
+ return commands_1.default.O365GROUP_RECYCLEBINITEM_REMOVE;
20
+ }
21
+ get description() {
22
+ return 'Permanently deletes a Microsoft 365 Group from the recycle bin in the current tenant';
23
+ }
24
+ getTelemetryProperties(args) {
25
+ const telemetryProps = super.getTelemetryProperties(args);
26
+ telemetryProps.id = typeof args.options.id !== 'undefined';
27
+ telemetryProps.displayName = typeof args.options.displayName !== 'undefined';
28
+ telemetryProps.mailNickname = typeof args.options.mailNickname !== 'undefined';
29
+ telemetryProps.confirm = !!args.options.confirm;
30
+ return telemetryProps;
31
+ }
32
+ commandAction(logger, args, cb) {
33
+ const removeGroup = () => __awaiter(this, void 0, void 0, function* () {
34
+ try {
35
+ const groupId = yield this.getGroupId(args.options);
36
+ const requestOptions = {
37
+ url: `${this.resource}/v1.0/directory/deletedItems/${groupId}`,
38
+ headers: {
39
+ accept: 'application/json;odata.metadata=none'
40
+ },
41
+ responseType: 'json'
42
+ };
43
+ yield request_1.default.delete(requestOptions);
44
+ cb();
45
+ }
46
+ catch (err) {
47
+ this.handleRejectedODataJsonPromise(err, logger, cb);
48
+ }
49
+ });
50
+ if (args.options.confirm) {
51
+ removeGroup();
52
+ }
53
+ else {
54
+ cli_1.Cli.prompt({
55
+ type: 'confirm',
56
+ name: 'continue',
57
+ default: false,
58
+ message: `Are you sure you want to remove the group '${args.options.id || args.options.displayName || args.options.mailNickname}'?`
59
+ }, (result) => {
60
+ if (!result.continue) {
61
+ cb();
62
+ }
63
+ else {
64
+ removeGroup();
65
+ }
66
+ });
67
+ }
68
+ }
69
+ getGroupId(options) {
70
+ return __awaiter(this, void 0, void 0, function* () {
71
+ const { id, displayName, mailNickname } = options;
72
+ if (id) {
73
+ return id;
74
+ }
75
+ let filterValue = '';
76
+ if (displayName) {
77
+ filterValue = `displayName eq '${utils_1.formatting.encodeQueryParameter(displayName)}'`;
78
+ }
79
+ if (mailNickname) {
80
+ filterValue = `mailNickname eq '${utils_1.formatting.encodeQueryParameter(mailNickname)}'`;
81
+ }
82
+ const requestOptions = {
83
+ url: `${this.resource}/v1.0/directory/deletedItems/Microsoft.Graph.Group?$filter=${filterValue}`,
84
+ headers: {
85
+ accept: 'application/json;odata.metadata=none'
86
+ },
87
+ responseType: 'json'
88
+ };
89
+ const response = yield request_1.default.get(requestOptions);
90
+ const groups = response.value;
91
+ if (groups.length === 0) {
92
+ throw Error(`The specified group '${displayName || mailNickname}' does not exist.`);
93
+ }
94
+ if (groups.length > 1) {
95
+ throw Error(`Multiple groups with name '${displayName || mailNickname}' found: ${groups.map(x => x.id).join(',')}.`);
96
+ }
97
+ return groups[0].id;
98
+ });
99
+ }
100
+ optionSets() {
101
+ return [['id', 'displayName', 'mailNickname']];
102
+ }
103
+ options() {
104
+ const options = [
105
+ {
106
+ option: '-i, --id [id]'
107
+ },
108
+ {
109
+ option: '-d, --displayName [displayName]'
110
+ },
111
+ {
112
+ option: '-m, --mailNickname [mailNickname]'
113
+ },
114
+ {
115
+ option: '--confirm'
116
+ }
117
+ ];
118
+ const parentOptions = super.options();
119
+ return options.concat(parentOptions);
120
+ }
121
+ validate(args) {
122
+ if (args.options.id && !utils_1.validation.isValidGuid(args.options.id)) {
123
+ return `${args.options.id} is not a valid GUID`;
124
+ }
125
+ return true;
126
+ }
127
+ }
128
+ module.exports = new AadO365GroupRecycleBinItemRemoveCommand();
129
+ //# sourceMappingURL=o365group-recyclebinitem-remove.js.map
@@ -29,6 +29,7 @@ exports.default = {
29
29
  O365GROUP_CONVERSATION_POST_LIST: `${prefix} o365group conversation post list`,
30
30
  O365GROUP_RECYCLEBINITEM_CLEAR: `${prefix} o365group recyclebinitem clear`,
31
31
  O365GROUP_RECYCLEBINITEM_LIST: `${prefix} o365group recyclebinitem list`,
32
+ O365GROUP_RECYCLEBINITEM_REMOVE: `${prefix} o365group recyclebinitem remove`,
32
33
  O365GROUP_RECYCLEBINITEM_RESTORE: `${prefix} o365group recyclebinitem restore`,
33
34
  O365GROUP_SET: `${prefix} o365group set`,
34
35
  O365GROUP_TEAMIFY: `${prefix} o365group teamify`,
@@ -42,7 +42,7 @@ class SpoHubSiteListCommand extends SpoCommand_1.default {
42
42
  })
43
43
  .then((res) => {
44
44
  hubSites = res.value;
45
- if (args.options.includeAssociatedSites !== true || args.options.output !== 'json') {
45
+ if (args.options.includeAssociatedSites !== true || args.options.output && args.options.output !== 'json') {
46
46
  return Promise.resolve();
47
47
  }
48
48
  else {
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ListPrincipalType = void 0;
4
+ var ListPrincipalType;
5
+ (function (ListPrincipalType) {
6
+ ListPrincipalType[ListPrincipalType["None"] = 0] = "None";
7
+ ListPrincipalType[ListPrincipalType["User"] = 1] = "User";
8
+ ListPrincipalType[ListPrincipalType["DistributionList"] = 2] = "DistributionList";
9
+ ListPrincipalType[ListPrincipalType["SecurityGroup"] = 4] = "SecurityGroup";
10
+ ListPrincipalType[ListPrincipalType["SharePointGroup"] = 8] = "SharePointGroup";
11
+ ListPrincipalType[ListPrincipalType["All"] = 15] = "All";
12
+ })(ListPrincipalType = exports.ListPrincipalType || (exports.ListPrincipalType = {}));
13
+ //# sourceMappingURL=ListPrincipalType.js.map
@@ -4,6 +4,7 @@ const request_1 = require("../../../../request");
4
4
  const utils_1 = require("../../../../utils");
5
5
  const SpoCommand_1 = require("../../../base/SpoCommand");
6
6
  const commands_1 = require("../../commands");
7
+ const ListPrincipalType_1 = require("./ListPrincipalType");
7
8
  class SpoListGetCommand extends SpoCommand_1.default {
8
9
  get name() {
9
10
  return commands_1.default.LIST_GET;
@@ -42,6 +43,11 @@ class SpoListGetCommand extends SpoCommand_1.default {
42
43
  request_1.default
43
44
  .get(requestOptions)
44
45
  .then((listInstance) => {
46
+ if (args.options.withPermissions) {
47
+ listInstance.RoleAssignments.forEach(r => {
48
+ r.Member.PrincipalTypeString = ListPrincipalType_1.ListPrincipalType[r.Member.PrincipalType];
49
+ });
50
+ }
45
51
  logger.log(listInstance);
46
52
  cb();
47
53
  }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
@@ -0,0 +1,45 @@
1
+ # aad o365group recyclebinitem remove
2
+
3
+ Permanently deletes a Microsoft 365 Group from the recycle bin in the current tenant
4
+
5
+ ## Usage
6
+
7
+ ```sh
8
+ m365 aad o365group recyclebinitem remove [options]
9
+ ```
10
+
11
+ ## Options
12
+
13
+ `-i, --id [id]`
14
+ : The ID of the Microsoft 365 Group to remove. Specify either `id`, `displayName` or `mailNickname` but not multiple.
15
+
16
+ `-d, --displayName [displayName]`
17
+ : Display name for the Microsoft 365 Group to remove. Specify either `id`, `displayName` or `mailNickname` but not multiple.
18
+
19
+ `-m, --mailNickname [mailNickname]`
20
+ : Name of the group e-mail (part before the @). Specify either `id`, `displayName` or `mailNickname` but not multiple.
21
+
22
+ `--confirm`
23
+ : Don't prompt for confirmation.
24
+
25
+ --8<-- "docs/cmd/_global.md"
26
+
27
+ ## Examples
28
+
29
+ Removes the Microsoft 365 Group with specific ID
30
+
31
+ ```sh
32
+ m365 aad o365group recyclebinitem remove --id "00000000-0000-0000-0000-000000000000"
33
+ ```
34
+
35
+ Removes the Microsoft 365 Group with specific name
36
+
37
+ ```sh
38
+ m365 aad o365group recyclebinitem remove --displayName "My Group"
39
+ ```
40
+
41
+ Remove the Microsoft 365 Group with specific mail nickname without confirmation
42
+
43
+ ```sh
44
+ m365 aad o365group recyclebinitem remove --mailNickname "Mygroup" --confirm
45
+ ```
@@ -17,10 +17,7 @@ m365 spo hubsite list [options]
17
17
 
18
18
  ## Remarks
19
19
 
20
- !!! attention
21
- This command is based on a SharePoint API that is currently in preview and is subject to change once the API reached general availability.
22
-
23
- When using the text output type (default), the command lists only the values of the `ID`, `SiteUrl` and `Title` properties of the hub site. When setting the output type to JSON, all available properties are included in the command output.
20
+ When using the text or csv output type, the command lists only the values of the `ID`, `SiteUrl` and `Title` properties of the hub site. With the output type as JSON, all available properties are included in the command output.
24
21
 
25
22
  ## Examples
26
23
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnp/cli-microsoft365",
3
- "version": "5.4.0-beta.0f3627d",
3
+ "version": "5.4.0-beta.5d38887",
4
4
  "description": "Manage Microsoft 365 and SharePoint Framework projects on any platform",
5
5
  "license": "MIT",
6
6
  "main": "./dist/api.js",