@pnp/cli-microsoft365 5.9.0-beta.21a8d94 → 5.9.0-beta.3de06bc

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.
Files changed (40) hide show
  1. package/dist/appInsights.js +2 -0
  2. package/dist/m365/pp/commands/tenant/tenant-settings-list.js +45 -0
  3. package/dist/m365/pp/commands.js +2 -1
  4. package/dist/m365/spfx/commands/spfx-doctor.js +15 -0
  5. package/dist/m365/spo/commands/file/file-roleassignment-remove.js +180 -0
  6. package/dist/m365/spo/commands/file/file-roleinheritance-reset.js +125 -0
  7. package/dist/m365/spo/commands/folder/folder-get.js +36 -6
  8. package/dist/m365/spo/commands/folder/folder-roleinheritance-reset.js +89 -0
  9. package/dist/m365/spo/commands.js +3 -0
  10. package/dist/m365/teams/commands/channel/channel-list.js +3 -3
  11. package/dist/utils/cache.js +81 -0
  12. package/dist/utils/pid.js +57 -0
  13. package/docs/docs/cmd/aad/o365group/o365group-recyclebinitem-restore.md +1 -1
  14. package/docs/docs/cmd/aad/user/user-signin-list.md +1 -1
  15. package/docs/docs/cmd/onedrive/report/report-activityusercounts.md +1 -1
  16. package/docs/docs/cmd/planner/task/task-checklistitem-list.md +1 -1
  17. package/docs/docs/cmd/planner/task/task-reference-add.md +1 -1
  18. package/docs/docs/cmd/pp/tenant/tenant-settings-list.md +26 -0
  19. package/docs/docs/cmd/search/externalconnection/externalconnection-remove.md +1 -1
  20. package/docs/docs/cmd/spo/file/file-roleassignment-remove.md +54 -0
  21. package/docs/docs/cmd/spo/file/file-roleinheritance-reset.md +39 -0
  22. package/docs/docs/cmd/spo/folder/folder-get.md +13 -4
  23. package/docs/docs/cmd/spo/folder/folder-roleinheritance-reset.md +36 -0
  24. package/docs/docs/cmd/spo/list/list-roleassignment-add.md +1 -1
  25. package/docs/docs/cmd/spo/list/list-roleassignment-remove.md +1 -1
  26. package/docs/docs/cmd/spo/listitem/listitem-roleassignment-remove.md +1 -1
  27. package/docs/docs/cmd/spo/roledefinition/roledefinition-add.md +1 -1
  28. package/docs/docs/cmd/spo/web/web-roleassignment-add.md +5 -5
  29. package/docs/docs/cmd/spo/web/web-roleassignment-remove.md +5 -5
  30. package/docs/docs/cmd/spo/web/web-roleinheritance-reset.md +1 -1
  31. package/docs/docs/cmd/teams/cache/cache-remove.md +1 -1
  32. package/docs/docs/cmd/teams/channel/channel-add.md +1 -1
  33. package/docs/docs/cmd/teams/channel/channel-list.md +1 -1
  34. package/docs/docs/cmd/teams/channel/channel-member-set.md +1 -1
  35. package/docs/docs/cmd/teams/funsettings/funsettings-set.md +6 -6
  36. package/docs/docs/cmd/tenant/security/security-alerts-list.md +1 -1
  37. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-health-get.md +1 -1
  38. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-health-list.md +1 -1
  39. package/npm-shrinkwrap.json +342 -357
  40. package/package.json +21 -18
@@ -10,6 +10,7 @@ const appInsights = require("applicationinsights");
10
10
  const crypto = require("crypto");
11
11
  const fs = require("fs");
12
12
  const path = require("path");
13
+ const pid_1 = require("./utils/pid");
13
14
  const config = appInsights.setup('6b908c80-d09f-4cf6-8274-e54349a0149a');
14
15
  config.setInternalLogging(false, false);
15
16
  // append -dev to the version number when ran locally
@@ -20,6 +21,7 @@ const env = process.env.CLIMICROSOFT365_ENV !== undefined ? process.env.CLIMICRO
20
21
  appInsights.defaultClient.commonProperties = {
21
22
  version: version,
22
23
  node: process.version,
24
+ shell: pid_1.pid.getProcessName(process.ppid) || '',
23
25
  env: env,
24
26
  ci: Boolean(process.env.CI).toString()
25
27
  };
@@ -0,0 +1,45 @@
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 request_1 = require("../../../../request");
13
+ const PowerPlatformCommand_1 = require("../../../base/PowerPlatformCommand");
14
+ const commands_1 = require("../../commands");
15
+ class PpTenantSettingsListCommand extends PowerPlatformCommand_1.default {
16
+ get name() {
17
+ return commands_1.default.TENANT_SETTINGS_LIST;
18
+ }
19
+ get description() {
20
+ return 'Lists the global Power Platform tenant settings';
21
+ }
22
+ defaultProperties() {
23
+ return ['disableCapacityAllocationByEnvironmentAdmins', 'disableEnvironmentCreationByNonAdminUsers', 'disableNPSCommentsReachout', 'disablePortalsCreationByNonAdminUsers', 'disableSupportTicketsVisibleByAllUsers', 'disableSurveyFeedback', 'disableTrialEnvironmentCreationByNonAdminUsers', 'walkMeOptOut'];
24
+ }
25
+ commandAction(logger) {
26
+ return __awaiter(this, void 0, void 0, function* () {
27
+ const requestOptions = {
28
+ url: `${this.resource}/providers/Microsoft.BusinessAppPlatform/listtenantsettings?api-version=2020-10-01`,
29
+ headers: {
30
+ accept: 'application/json'
31
+ },
32
+ responseType: 'json'
33
+ };
34
+ try {
35
+ const res = yield request_1.default.post(requestOptions);
36
+ logger.log(res);
37
+ }
38
+ catch (err) {
39
+ this.handleRejectedODataJsonPromise(err);
40
+ }
41
+ });
42
+ }
43
+ }
44
+ module.exports = new PpTenantSettingsListCommand();
45
+ //# sourceMappingURL=tenant-settings-list.js.map
@@ -5,6 +5,7 @@ exports.default = {
5
5
  ENVIRONMENT_LIST: `${prefix} environment list`,
6
6
  GATEWAY_LIST: `${prefix} gateway list`,
7
7
  MANAGEMENTAPP_ADD: `${prefix} managementapp add`,
8
- MANAGEMENTAPP_LIST: `${prefix} managementapp list`
8
+ MANAGEMENTAPP_LIST: `${prefix} managementapp list`,
9
+ TENANT_SETTINGS_LIST: `${prefix} tenant settings list`
9
10
  };
10
11
  //# sourceMappingURL=commands.js.map
@@ -428,6 +428,21 @@ class SpfxDoctorCommand extends AnonymousCommand_1.default {
428
428
  range: '^4',
429
429
  fix: 'npm i -g yo@4'
430
430
  }
431
+ },
432
+ '1.16.0-beta.1': {
433
+ gulpCli: {
434
+ range: '^1 || ^2',
435
+ fix: 'npm i -g gulp-cli@2'
436
+ },
437
+ node: {
438
+ range: '^16.13',
439
+ fix: 'Install Node.js v16.13 or higher'
440
+ },
441
+ sp: SharePointVersion.SPO,
442
+ yo: {
443
+ range: '^4',
444
+ fix: 'npm i -g yo@4'
445
+ }
431
446
  }
432
447
  };
433
448
  __classPrivateFieldGet(this, _SpfxDoctorCommand_instances, "m", _SpfxDoctorCommand_initTelemetry).call(this);
@@ -0,0 +1,180 @@
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
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
12
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
13
+ 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");
14
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
15
+ };
16
+ var _SpoFileRoleAssignmentRemoveCommand_instances, _SpoFileRoleAssignmentRemoveCommand_initTelemetry, _SpoFileRoleAssignmentRemoveCommand_initOptions, _SpoFileRoleAssignmentRemoveCommand_initValidators, _SpoFileRoleAssignmentRemoveCommand_initOptionSets;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const Cli_1 = require("../../../../cli/Cli");
19
+ const request_1 = require("../../../../request");
20
+ const urlUtil_1 = require("../../../../utils/urlUtil");
21
+ const formatting_1 = require("../../../../utils/formatting");
22
+ const validation_1 = require("../../../../utils/validation");
23
+ const SpoCommand_1 = require("../../../base/SpoCommand");
24
+ const commands_1 = require("../../commands");
25
+ const SpoFileGetCommand = require("./file-get");
26
+ const SpoUserGetCommand = require("../user/user-get");
27
+ const SpoGroupGetCommand = require("../group/group-get");
28
+ class SpoFileRoleAssignmentRemoveCommand extends SpoCommand_1.default {
29
+ constructor() {
30
+ super();
31
+ _SpoFileRoleAssignmentRemoveCommand_instances.add(this);
32
+ __classPrivateFieldGet(this, _SpoFileRoleAssignmentRemoveCommand_instances, "m", _SpoFileRoleAssignmentRemoveCommand_initTelemetry).call(this);
33
+ __classPrivateFieldGet(this, _SpoFileRoleAssignmentRemoveCommand_instances, "m", _SpoFileRoleAssignmentRemoveCommand_initOptions).call(this);
34
+ __classPrivateFieldGet(this, _SpoFileRoleAssignmentRemoveCommand_instances, "m", _SpoFileRoleAssignmentRemoveCommand_initValidators).call(this);
35
+ __classPrivateFieldGet(this, _SpoFileRoleAssignmentRemoveCommand_instances, "m", _SpoFileRoleAssignmentRemoveCommand_initOptionSets).call(this);
36
+ }
37
+ get name() {
38
+ return commands_1.default.FILE_ROLEASSIGNMENT_REMOVE;
39
+ }
40
+ get description() {
41
+ return 'Removes a role assignment from a file.';
42
+ }
43
+ commandAction(logger, args) {
44
+ return __awaiter(this, void 0, void 0, function* () {
45
+ const removeRoleAssignment = () => __awaiter(this, void 0, void 0, function* () {
46
+ try {
47
+ const fileURL = yield this.getFileURL(args);
48
+ let principalId;
49
+ if (args.options.groupName) {
50
+ principalId = yield this.getGroupPrincipalId(args.options);
51
+ }
52
+ else if (args.options.upn) {
53
+ principalId = yield this.getUserPrincipalId(args.options);
54
+ }
55
+ else {
56
+ principalId = args.options.principalId;
57
+ }
58
+ const serverRelativeUrl = urlUtil_1.urlUtil.getServerRelativePath(args.options.webUrl, fileURL);
59
+ const requestOptions = {
60
+ url: `${args.options.webUrl}/_api/web/GetFileByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(serverRelativeUrl)}')/ListItemAllFields/roleassignments/removeroleassignment(principalid='${principalId}')`,
61
+ headers: {
62
+ accept: 'application/json;odata=nometadata'
63
+ },
64
+ responseType: 'json'
65
+ };
66
+ yield request_1.default.post(requestOptions);
67
+ }
68
+ catch (err) {
69
+ this.handleRejectedODataJsonPromise(err);
70
+ }
71
+ });
72
+ if (args.options.confirm) {
73
+ yield removeRoleAssignment();
74
+ }
75
+ else {
76
+ const result = yield Cli_1.Cli.prompt({
77
+ type: 'confirm',
78
+ name: 'continue',
79
+ default: false,
80
+ message: `Are you sure you want to remove role assignment from file ${args.options.fileUrl || args.options.fileId} from site ${args.options.webUrl}?`
81
+ });
82
+ if (result.continue) {
83
+ yield removeRoleAssignment();
84
+ }
85
+ }
86
+ });
87
+ }
88
+ getFileURL(args) {
89
+ return __awaiter(this, void 0, void 0, function* () {
90
+ if (args.options.fileUrl) {
91
+ return args.options.fileUrl;
92
+ }
93
+ const options = {
94
+ webUrl: args.options.webUrl,
95
+ id: args.options.fileId,
96
+ output: 'json',
97
+ debug: this.debug,
98
+ verbose: this.verbose
99
+ };
100
+ const output = yield Cli_1.Cli.executeCommandWithOutput(SpoFileGetCommand, { options: Object.assign(Object.assign({}, options), { _: [] }) });
101
+ const getFileOutput = JSON.parse(output.stdout);
102
+ return getFileOutput.ServerRelativeUrl;
103
+ });
104
+ }
105
+ getUserPrincipalId(options) {
106
+ return __awaiter(this, void 0, void 0, function* () {
107
+ const userGetCommandOptions = {
108
+ webUrl: options.webUrl,
109
+ email: options.upn,
110
+ id: undefined,
111
+ output: 'json',
112
+ debug: this.debug,
113
+ verbose: this.verbose
114
+ };
115
+ const output = yield Cli_1.Cli.executeCommandWithOutput(SpoUserGetCommand, { options: Object.assign(Object.assign({}, userGetCommandOptions), { _: [] }) });
116
+ const getUserOutput = JSON.parse(output.stdout);
117
+ return getUserOutput.Id;
118
+ });
119
+ }
120
+ getGroupPrincipalId(options) {
121
+ return __awaiter(this, void 0, void 0, function* () {
122
+ const groupGetCommandOptions = {
123
+ webUrl: options.webUrl,
124
+ name: options.groupName,
125
+ output: 'json',
126
+ debug: this.debug,
127
+ verbose: this.verbose
128
+ };
129
+ const output = yield Cli_1.Cli.executeCommandWithOutput(SpoGroupGetCommand, { options: Object.assign(Object.assign({}, groupGetCommandOptions), { _: [] }) });
130
+ const getGroupOutput = JSON.parse(output.stdout);
131
+ return getGroupOutput.Id;
132
+ });
133
+ }
134
+ }
135
+ _SpoFileRoleAssignmentRemoveCommand_instances = new WeakSet(), _SpoFileRoleAssignmentRemoveCommand_initTelemetry = function _SpoFileRoleAssignmentRemoveCommand_initTelemetry() {
136
+ this.telemetry.push((args) => {
137
+ Object.assign(this.telemetryProperties, {
138
+ fileUrl: typeof args.options.fileUrl !== 'undefined',
139
+ fileId: typeof args.options.fileId !== 'undefined',
140
+ principalId: typeof args.options.principalId !== 'undefined',
141
+ upn: typeof args.options.upn !== 'undefined',
142
+ groupName: typeof args.options.groupName !== 'undefined',
143
+ confirm: !!args.options.confirm
144
+ });
145
+ });
146
+ }, _SpoFileRoleAssignmentRemoveCommand_initOptions = function _SpoFileRoleAssignmentRemoveCommand_initOptions() {
147
+ this.options.unshift({
148
+ option: '-u, --webUrl <webUrl>'
149
+ }, {
150
+ option: '--fileUrl [fileUrl]'
151
+ }, {
152
+ option: '-i, --fileId [fileId]'
153
+ }, {
154
+ option: '--principalId [principalId]'
155
+ }, {
156
+ option: '--upn [upn]'
157
+ }, {
158
+ option: '--groupName [groupName]'
159
+ }, {
160
+ option: '--confirm'
161
+ });
162
+ }, _SpoFileRoleAssignmentRemoveCommand_initValidators = function _SpoFileRoleAssignmentRemoveCommand_initValidators() {
163
+ this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
164
+ const isValidSharePointUrl = validation_1.validation.isValidSharePointUrl(args.options.webUrl);
165
+ if (isValidSharePointUrl !== true) {
166
+ return isValidSharePointUrl;
167
+ }
168
+ if (args.options.principalId && isNaN(args.options.principalId)) {
169
+ return `Specified principalId ${args.options.principalId} is not a number`;
170
+ }
171
+ if (args.options.fileId && !validation_1.validation.isValidGuid(args.options.fileId)) {
172
+ return `${args.options.fileId} is not a valid GUID`;
173
+ }
174
+ return true;
175
+ }));
176
+ }, _SpoFileRoleAssignmentRemoveCommand_initOptionSets = function _SpoFileRoleAssignmentRemoveCommand_initOptionSets() {
177
+ this.optionSets.push(['fileUrl', 'fileId'], ['upn', 'groupName', 'principalId']);
178
+ };
179
+ module.exports = new SpoFileRoleAssignmentRemoveCommand();
180
+ //# sourceMappingURL=file-roleassignment-remove.js.map
@@ -0,0 +1,125 @@
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
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
12
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
13
+ 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");
14
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
15
+ };
16
+ var _SpoFileRoleInheritanceResetCommand_instances, _SpoFileRoleInheritanceResetCommand_initTelemetry, _SpoFileRoleInheritanceResetCommand_initOptions, _SpoFileRoleInheritanceResetCommand_initValidators, _SpoFileRoleInheritanceResetCommand_initOptionSets;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const Cli_1 = require("../../../../cli/Cli");
19
+ const request_1 = require("../../../../request");
20
+ const validation_1 = require("../../../../utils/validation");
21
+ const formatting_1 = require("../../../../utils/formatting");
22
+ const SpoCommand_1 = require("../../../base/SpoCommand");
23
+ const commands_1 = require("../../commands");
24
+ const SpoFileGetCommand = require("./file-get");
25
+ class SpoFileRoleInheritanceResetCommand extends SpoCommand_1.default {
26
+ constructor() {
27
+ super();
28
+ _SpoFileRoleInheritanceResetCommand_instances.add(this);
29
+ __classPrivateFieldGet(this, _SpoFileRoleInheritanceResetCommand_instances, "m", _SpoFileRoleInheritanceResetCommand_initTelemetry).call(this);
30
+ __classPrivateFieldGet(this, _SpoFileRoleInheritanceResetCommand_instances, "m", _SpoFileRoleInheritanceResetCommand_initOptions).call(this);
31
+ __classPrivateFieldGet(this, _SpoFileRoleInheritanceResetCommand_instances, "m", _SpoFileRoleInheritanceResetCommand_initValidators).call(this);
32
+ __classPrivateFieldGet(this, _SpoFileRoleInheritanceResetCommand_instances, "m", _SpoFileRoleInheritanceResetCommand_initOptionSets).call(this);
33
+ }
34
+ get name() {
35
+ return commands_1.default.FILE_ROLEINHERITANCE_RESET;
36
+ }
37
+ get description() {
38
+ return 'Restores the role inheritance of a file';
39
+ }
40
+ commandAction(logger, args) {
41
+ return __awaiter(this, void 0, void 0, function* () {
42
+ const resetFileRoleInheritance = () => __awaiter(this, void 0, void 0, function* () {
43
+ try {
44
+ const fileURL = yield this.getFileURL(args);
45
+ const requestOptions = {
46
+ url: `${args.options.webUrl}/_api/web/GetFileByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(fileURL)}')/ListItemAllFields/resetroleinheritance`,
47
+ headers: {
48
+ accept: 'application/json;odata.metadata=none'
49
+ },
50
+ responseType: 'json'
51
+ };
52
+ yield request_1.default.post(requestOptions);
53
+ }
54
+ catch (err) {
55
+ this.handleRejectedODataJsonPromise(err);
56
+ }
57
+ });
58
+ if (args.options.confirm) {
59
+ yield resetFileRoleInheritance();
60
+ }
61
+ else {
62
+ const result = yield Cli_1.Cli.prompt({
63
+ type: 'confirm',
64
+ name: 'continue',
65
+ default: false,
66
+ message: `Are you sure you want to reset the role inheritance of file ${args.options.fileUrl || args.options.fileId} located in site ${args.options.webUrl}?`
67
+ });
68
+ if (result.continue) {
69
+ yield resetFileRoleInheritance();
70
+ }
71
+ }
72
+ });
73
+ }
74
+ getFileURL(args) {
75
+ return __awaiter(this, void 0, void 0, function* () {
76
+ if (args.options.fileUrl) {
77
+ return args.options.fileUrl;
78
+ }
79
+ const options = {
80
+ webUrl: args.options.webUrl,
81
+ id: args.options.fileId,
82
+ output: 'json',
83
+ debug: this.debug,
84
+ verbose: this.verbose
85
+ };
86
+ const output = yield Cli_1.Cli.executeCommandWithOutput(SpoFileGetCommand, { options: Object.assign(Object.assign({}, options), { _: [] }) });
87
+ const getFileOutput = JSON.parse(output.stdout);
88
+ return getFileOutput.ServerRelativeUrl;
89
+ });
90
+ }
91
+ }
92
+ _SpoFileRoleInheritanceResetCommand_instances = new WeakSet(), _SpoFileRoleInheritanceResetCommand_initTelemetry = function _SpoFileRoleInheritanceResetCommand_initTelemetry() {
93
+ this.telemetry.push((args) => {
94
+ Object.assign(this.telemetryProperties, {
95
+ fileUrl: typeof args.options.fileUrl !== 'undefined',
96
+ fileId: typeof args.options.fileId !== 'undefined',
97
+ confirm: !!args.options.confirm
98
+ });
99
+ });
100
+ }, _SpoFileRoleInheritanceResetCommand_initOptions = function _SpoFileRoleInheritanceResetCommand_initOptions() {
101
+ this.options.unshift({
102
+ option: '-u, --webUrl <webUrl>'
103
+ }, {
104
+ option: '--fileUrl [fileUrl]'
105
+ }, {
106
+ option: 'i, --fileId [fileId]'
107
+ }, {
108
+ option: '--confirm'
109
+ });
110
+ }, _SpoFileRoleInheritanceResetCommand_initValidators = function _SpoFileRoleInheritanceResetCommand_initValidators() {
111
+ this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
112
+ const isValidSharePointUrl = validation_1.validation.isValidSharePointUrl(args.options.webUrl);
113
+ if (isValidSharePointUrl !== true) {
114
+ return isValidSharePointUrl;
115
+ }
116
+ if (args.options.fileId && !validation_1.validation.isValidGuid(args.options.fileId)) {
117
+ return `${args.options.fileId} is not a valid GUID`;
118
+ }
119
+ return true;
120
+ }));
121
+ }, _SpoFileRoleInheritanceResetCommand_initOptionSets = function _SpoFileRoleInheritanceResetCommand_initOptionSets() {
122
+ this.optionSets.push(['fileId', 'fileUrl']);
123
+ };
124
+ module.exports = new SpoFileRoleInheritanceResetCommand();
125
+ //# sourceMappingURL=file-roleinheritance-reset.js.map
@@ -13,7 +13,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
13
13
  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");
14
14
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
15
15
  };
16
- var _SpoFolderGetCommand_instances, _SpoFolderGetCommand_initOptions, _SpoFolderGetCommand_initValidators;
16
+ var _SpoFolderGetCommand_instances, _SpoFolderGetCommand_initTelemetry, _SpoFolderGetCommand_initOptions, _SpoFolderGetCommand_initValidators, _SpoFolderGetCommand_initOptionSets;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  const Command_1 = require("../../../../Command");
19
19
  const request_1 = require("../../../../request");
@@ -25,8 +25,10 @@ class SpoFolderGetCommand extends SpoCommand_1.default {
25
25
  constructor() {
26
26
  super();
27
27
  _SpoFolderGetCommand_instances.add(this);
28
+ __classPrivateFieldGet(this, _SpoFolderGetCommand_instances, "m", _SpoFolderGetCommand_initTelemetry).call(this);
28
29
  __classPrivateFieldGet(this, _SpoFolderGetCommand_instances, "m", _SpoFolderGetCommand_initOptions).call(this);
29
30
  __classPrivateFieldGet(this, _SpoFolderGetCommand_instances, "m", _SpoFolderGetCommand_initValidators).call(this);
31
+ __classPrivateFieldGet(this, _SpoFolderGetCommand_instances, "m", _SpoFolderGetCommand_initOptionSets).call(this);
30
32
  }
31
33
  get name() {
32
34
  return commands_1.default.FOLDER_GET;
@@ -39,8 +41,14 @@ class SpoFolderGetCommand extends SpoCommand_1.default {
39
41
  if (this.verbose) {
40
42
  logger.logToStderr(`Retrieving folder from site ${args.options.webUrl}...`);
41
43
  }
42
- const serverRelativeUrl = urlUtil_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.folderUrl);
43
- const requestUrl = `${args.options.webUrl}/_api/web/GetFolderByServerRelativeUrl('${encodeURIComponent(serverRelativeUrl)}')`;
44
+ let requestUrl = '';
45
+ if (args.options.id) {
46
+ requestUrl = `${args.options.webUrl}/_api/web/GetFolderById('${encodeURIComponent(args.options.id)}')`;
47
+ }
48
+ else if (args.options.folderUrl) {
49
+ const serverRelativeUrl = urlUtil_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.folderUrl);
50
+ requestUrl = `${args.options.webUrl}/_api/web/GetFolderByServerRelativeUrl('${encodeURIComponent(serverRelativeUrl)}')`;
51
+ }
44
52
  const requestOptions = {
45
53
  url: requestUrl,
46
54
  headers: {
@@ -61,14 +69,36 @@ class SpoFolderGetCommand extends SpoCommand_1.default {
61
69
  });
62
70
  }
63
71
  }
64
- _SpoFolderGetCommand_instances = new WeakSet(), _SpoFolderGetCommand_initOptions = function _SpoFolderGetCommand_initOptions() {
72
+ _SpoFolderGetCommand_instances = new WeakSet(), _SpoFolderGetCommand_initTelemetry = function _SpoFolderGetCommand_initTelemetry() {
73
+ this.telemetry.push((args) => {
74
+ Object.assign(this.telemetryProperties, {
75
+ id: (!(!args.options.id)).toString(),
76
+ folderUrl: (!(!args.options.folderUrl)).toString()
77
+ });
78
+ });
79
+ }, _SpoFolderGetCommand_initOptions = function _SpoFolderGetCommand_initOptions() {
65
80
  this.options.unshift({
66
81
  option: '-u, --webUrl <webUrl>'
67
82
  }, {
68
- option: '-f, --folderUrl <folderUrl>'
83
+ option: '-f, --folderUrl [folderUrl]'
84
+ }, {
85
+ option: '-i, --id [id]'
69
86
  });
70
87
  }, _SpoFolderGetCommand_initValidators = function _SpoFolderGetCommand_initValidators() {
71
- this.validators.push((args) => __awaiter(this, void 0, void 0, function* () { return validation_1.validation.isValidSharePointUrl(args.options.webUrl); }));
88
+ this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
89
+ const isValidSharePointUrl = validation_1.validation.isValidSharePointUrl(args.options.webUrl);
90
+ if (isValidSharePointUrl !== true) {
91
+ return isValidSharePointUrl;
92
+ }
93
+ if (args.options.id) {
94
+ if (!validation_1.validation.isValidGuid(args.options.id)) {
95
+ return `${args.options.id} is not a valid GUID`;
96
+ }
97
+ }
98
+ return true;
99
+ }));
100
+ }, _SpoFolderGetCommand_initOptionSets = function _SpoFolderGetCommand_initOptionSets() {
101
+ this.optionSets.push(['folderUrl', 'id']);
72
102
  };
73
103
  module.exports = new SpoFolderGetCommand();
74
104
  //# sourceMappingURL=folder-get.js.map
@@ -0,0 +1,89 @@
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
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
12
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
13
+ 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");
14
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
15
+ };
16
+ var _SpoFolderRoleInheritanceResetCommand_instances, _SpoFolderRoleInheritanceResetCommand_initTelemetry, _SpoFolderRoleInheritanceResetCommand_initOptions, _SpoFolderRoleInheritanceResetCommand_initValidators;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const Cli_1 = require("../../../../cli/Cli");
19
+ const request_1 = require("../../../../request");
20
+ const validation_1 = require("../../../../utils/validation");
21
+ const SpoCommand_1 = require("../../../base/SpoCommand");
22
+ const commands_1 = require("../../commands");
23
+ class SpoFolderRoleInheritanceResetCommand extends SpoCommand_1.default {
24
+ constructor() {
25
+ super();
26
+ _SpoFolderRoleInheritanceResetCommand_instances.add(this);
27
+ __classPrivateFieldGet(this, _SpoFolderRoleInheritanceResetCommand_instances, "m", _SpoFolderRoleInheritanceResetCommand_initTelemetry).call(this);
28
+ __classPrivateFieldGet(this, _SpoFolderRoleInheritanceResetCommand_instances, "m", _SpoFolderRoleInheritanceResetCommand_initOptions).call(this);
29
+ __classPrivateFieldGet(this, _SpoFolderRoleInheritanceResetCommand_instances, "m", _SpoFolderRoleInheritanceResetCommand_initValidators).call(this);
30
+ }
31
+ get name() {
32
+ return commands_1.default.FOLDER_ROLEINHERITANCE_RESET;
33
+ }
34
+ get description() {
35
+ return 'Restores the role inheritance of a folder';
36
+ }
37
+ commandAction(logger, args) {
38
+ return __awaiter(this, void 0, void 0, function* () {
39
+ const resetFolderRoleInheritance = () => __awaiter(this, void 0, void 0, function* () {
40
+ try {
41
+ const requestOptions = {
42
+ url: `${args.options.webUrl}/_api/web/GetFolderByServerRelativeUrl('${args.options.folderUrl}')/ListItemAllFields/resetroleinheritance`,
43
+ headers: {
44
+ accept: 'application/json;odata.metadata=none'
45
+ },
46
+ responseType: 'json'
47
+ };
48
+ yield request_1.default.post(requestOptions);
49
+ }
50
+ catch (err) {
51
+ this.handleRejectedODataJsonPromise(err);
52
+ }
53
+ });
54
+ if (args.options.confirm) {
55
+ yield resetFolderRoleInheritance();
56
+ }
57
+ else {
58
+ const result = yield Cli_1.Cli.prompt({
59
+ type: 'confirm',
60
+ name: 'continue',
61
+ default: false,
62
+ message: `Are you sure you want to reset the role inheritance of folder ${args.options.folderUrl} located in site ${args.options.webUrl}?`
63
+ });
64
+ if (result.continue) {
65
+ yield resetFolderRoleInheritance();
66
+ }
67
+ }
68
+ });
69
+ }
70
+ }
71
+ _SpoFolderRoleInheritanceResetCommand_instances = new WeakSet(), _SpoFolderRoleInheritanceResetCommand_initTelemetry = function _SpoFolderRoleInheritanceResetCommand_initTelemetry() {
72
+ this.telemetry.push((args) => {
73
+ Object.assign(this.telemetryProperties, {
74
+ confirm: !!args.options.confirm
75
+ });
76
+ });
77
+ }, _SpoFolderRoleInheritanceResetCommand_initOptions = function _SpoFolderRoleInheritanceResetCommand_initOptions() {
78
+ this.options.unshift({
79
+ option: '-u, --webUrl <webUrl>'
80
+ }, {
81
+ option: '-f, --folderUrl <folderUrl>'
82
+ }, {
83
+ option: '--confirm'
84
+ });
85
+ }, _SpoFolderRoleInheritanceResetCommand_initValidators = function _SpoFolderRoleInheritanceResetCommand_initValidators() {
86
+ this.validators.push((args) => __awaiter(this, void 0, void 0, function* () { return validation_1.validation.isValidSharePointUrl(args.options.webUrl); }));
87
+ };
88
+ module.exports = new SpoFolderRoleInheritanceResetCommand();
89
+ //# sourceMappingURL=folder-roleinheritance-reset.js.map
@@ -56,6 +56,8 @@ exports.default = {
56
56
  FILE_MOVE: `${prefix} file move`,
57
57
  FILE_REMOVE: `${prefix} file remove`,
58
58
  FILE_RENAME: `${prefix} file rename`,
59
+ FILE_ROLEASSIGNMENT_REMOVE: `${prefix} file roleassignment remove`,
60
+ FILE_ROLEINHERITANCE_RESET: `${prefix} file roleinheritance reset`,
59
61
  FILE_SHARINGINFO_GET: `${prefix} file sharinginfo get`,
60
62
  FOLDER_ADD: `${prefix} folder add`,
61
63
  FOLDER_COPY: `${prefix} folder copy`,
@@ -64,6 +66,7 @@ exports.default = {
64
66
  FOLDER_MOVE: `${prefix} folder move`,
65
67
  FOLDER_REMOVE: `${prefix} folder remove`,
66
68
  FOLDER_RENAME: `${prefix} folder rename`,
69
+ FOLDER_ROLEINHERITANCE_RESET: `${prefix} folder roleinheritance reset`,
67
70
  GET: `${prefix} get`,
68
71
  GROUP_ADD: `${prefix} group add`,
69
72
  GROUP_GET: `${prefix} group get`,
@@ -82,15 +82,15 @@ _TeamsChannelListCommand_instances = new WeakSet(), _TeamsChannelListCommand_ini
82
82
  option: '--teamName [teamName]'
83
83
  }, {
84
84
  option: '--type [type]',
85
- autocomplete: ['standard', 'private']
85
+ autocomplete: ['standard', 'private', 'shared']
86
86
  });
87
87
  }, _TeamsChannelListCommand_initValidators = function _TeamsChannelListCommand_initValidators() {
88
88
  this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
89
89
  if (args.options.teamId && !validation_1.validation.isValidGuid(args.options.teamId)) {
90
90
  return `${args.options.teamId} is not a valid GUID`;
91
91
  }
92
- if (args.options.type && ['standard', 'private'].indexOf(args.options.type.toLowerCase()) === -1) {
93
- return `${args.options.type} is not a valid type value. Allowed values standard|private`;
92
+ if (args.options.type && ['standard', 'private', 'shared'].indexOf(args.options.type.toLowerCase()) === -1) {
93
+ return `${args.options.type} is not a valid type value. Allowed values standard|private|shared`;
94
94
  }
95
95
  return true;
96
96
  }));