@pnp/cli-microsoft365 6.3.0-beta.3f7129c → 6.3.0-beta.a991329

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 (42) hide show
  1. package/dist/Command.js +12 -1
  2. package/dist/cli/Cli.js +4 -1
  3. package/dist/m365/aad/commands/group/group-list.js +2 -1
  4. package/dist/m365/graph/commands/changelog/changelog-list.js +3 -2
  5. package/dist/m365/onenote/commands/notebook/notebook-list.js +51 -40
  6. package/dist/m365/planner/commands/plan/plan-add.js +20 -6
  7. package/dist/m365/planner/commands/plan/plan-remove.js +1 -1
  8. package/dist/m365/planner/commands/task/task-checklistitem-add.js +2 -1
  9. package/dist/m365/planner/commands/task/task-checklistitem-list.js +2 -1
  10. package/dist/m365/pp/commands/solution/solution-get.js +2 -1
  11. package/dist/m365/pp/commands/solution/solution-list.js +2 -1
  12. package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-get.js +70 -0
  13. package/dist/m365/purview/commands.js +1 -0
  14. package/dist/m365/spfx/commands/project/WebApiPermissionRequests.js +3 -0
  15. package/dist/m365/spfx/commands/project/project-permissions-grant.js +81 -0
  16. package/dist/m365/spfx/commands.js +3 -2
  17. package/dist/m365/spo/commands/app/app-add.js +2 -1
  18. package/dist/m365/spo/commands/file/file-sharinginfo-get.js +2 -1
  19. package/dist/m365/spo/commands/file/file-sharinglink-list.js +2 -1
  20. package/dist/m365/spo/commands/group/group-list.js +2 -1
  21. package/dist/m365/spo/commands/hubsite/hubsite-get.js +1 -1
  22. package/dist/m365/spo/commands/listitem/listitem-list.js +2 -1
  23. package/dist/m365/spo/commands/page/page-column-get.js +2 -1
  24. package/dist/m365/spo/commands/page/page-column-list.js +2 -1
  25. package/dist/m365/spo/commands/page/page-section-get.js +2 -1
  26. package/dist/m365/spo/commands/page/page-section-list.js +2 -1
  27. package/dist/m365/spo/commands/spo-search.js +2 -1
  28. package/dist/m365/spo/commands/term/term-list.js +2 -1
  29. package/dist/m365/spo/commands/userprofile/userprofile-get.js +2 -2
  30. package/dist/m365/teams/commands/meeting/meeting-list.js +1 -1
  31. package/dist/m365/teams/commands/team/team-app-list.js +1 -1
  32. package/dist/m365/teams/commands/user/user-app-list.js +2 -1
  33. package/dist/m365/todo/commands/task/task-get.js +2 -1
  34. package/dist/m365/todo/commands/task/task-list.js +2 -1
  35. package/dist/m365/yammer/commands/yammer-search.js +2 -1
  36. package/dist/utils/planner.js +4 -4
  37. package/docs/docs/cmd/planner/plan/plan-add.md +17 -6
  38. package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-get.md +100 -0
  39. package/docs/docs/cmd/spfx/project/project-permissions-grant.md +65 -0
  40. package/docs/docs/cmd/spo/navigation/navigation-node-add.md +1 -1
  41. package/docs/docs/cmd/spo/navigation/navigation-node-set.md +1 -1
  42. package/package.json +1 -1
package/dist/Command.js CHANGED
@@ -481,7 +481,18 @@ class Command {
481
481
  if (!l) {
482
482
  return;
483
483
  }
484
- output.push(`## ${this.getLogItemTitle(l)} (${this.getLogItemId(l)})`, os.EOL, os.EOL, `Property | Value`, os.EOL, `---------|-------`, os.EOL);
484
+ const title = this.getLogItemTitle(l);
485
+ const id = this.getLogItemId(l);
486
+ if (title && id) {
487
+ output.push(`## ${title} (${id})`);
488
+ }
489
+ else if (title) {
490
+ output.push(`## ${title}`);
491
+ }
492
+ else if (id) {
493
+ output.push(`## ${id}`);
494
+ }
495
+ output.push(os.EOL, os.EOL, `Property | Value`, os.EOL, `---------|-------`, os.EOL);
485
496
  output.push(Object.keys(l).map(k => {
486
497
  const value = l[k];
487
498
  let stringValue = value;
package/dist/cli/Cli.js CHANGED
@@ -458,7 +458,7 @@ class Cli {
458
458
  // data so that returned objects contain only default properties specified
459
459
  // on the current command. If there is no current command or the
460
460
  // command doesn't specify default properties, return original data
461
- if (options.output === 'text' || options.output === 'csv') {
461
+ if (this.shouldTrimOutput(options.output)) {
462
462
  const cli = Cli.getInstance();
463
463
  const currentCommand = cli.commandToExecute;
464
464
  if (arrayType === 'object' &&
@@ -753,6 +753,9 @@ class Cli {
753
753
  }
754
754
  });
755
755
  }
756
+ static shouldTrimOutput(output) {
757
+ return output === 'text' || output === 'csv';
758
+ }
756
759
  }
757
760
  exports.Cli = Cli;
758
761
  Cli.defaultHelpMode = 'full';
@@ -15,6 +15,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
15
15
  };
16
16
  var _AadGroupListCommand_instances, _AadGroupListCommand_initTelemetry, _AadGroupListCommand_initOptions;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
+ const Cli_1 = require("../../../../cli/Cli");
18
19
  const odata_1 = require("../../../../utils/odata");
19
20
  const GraphCommand_1 = require("../../../base/GraphCommand");
20
21
  const commands_1 = require("../../commands");
@@ -39,7 +40,7 @@ class AadGroupListCommand extends GraphCommand_1.default {
39
40
  const endpoint = args.options.deleted ? 'directory/deletedItems/microsoft.graph.group' : 'groups';
40
41
  try {
41
42
  const groups = yield odata_1.odata.getAllItems(`${this.resource}/v1.0/${endpoint}`);
42
- if (args.options.output === 'text') {
43
+ if (Cli_1.Cli.shouldTrimOutput(args.options.output)) {
43
44
  groups.forEach((group) => {
44
45
  if (group.groupTypes && group.groupTypes.length > 0 && group.groupTypes[0] === 'Unified') {
45
46
  group.groupType = 'Microsoft 365';
@@ -21,6 +21,7 @@ const AnonymousCommand_1 = require("../../../base/AnonymousCommand");
21
21
  const commands_1 = require("../../commands");
22
22
  const request_1 = require("../../../../request");
23
23
  const xmldom_1 = require("@xmldom/xmldom");
24
+ const Cli_1 = require("../../../../cli/Cli");
24
25
  class GraphChangelogListCommand extends AnonymousCommand_1.default {
25
26
  get name() {
26
27
  return commands_1.default.CHANGELOG_LIST;
@@ -106,14 +107,14 @@ class GraphChangelogListCommand extends AnonymousCommand_1.default {
106
107
  items: []
107
108
  };
108
109
  Array.from(xmlDoc.getElementsByTagName('item')).forEach((item) => {
109
- const description = args.options.output === 'text' ?
110
+ const description = Cli_1.Cli.shouldTrimOutput(args.options.output) ?
110
111
  md_1.md.md2plain(item.getElementsByTagName('description').item(0).textContent, '') :
111
112
  item.getElementsByTagName('description').item(0).textContent;
112
113
  changelog.items.push({
113
114
  guid: item.getElementsByTagName('guid').item(0).textContent,
114
115
  category: item.getElementsByTagName('category').item(1).textContent,
115
116
  title: item.getElementsByTagName('title').item(0).textContent,
116
- description: args.options.output === 'text' ?
117
+ description: Cli_1.Cli.shouldTrimOutput(args.options.output) ?
117
118
  description.length > 50 ? `${description.substring(0, 47)}...` : description :
118
119
  description,
119
120
  pubDate: new Date(item.getElementsByTagName('pubDate').item(0).textContent)
@@ -13,14 +13,14 @@ 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 _OneNoteNotebookListCommand_instances, _OneNoteNotebookListCommand_initTelemetry, _OneNoteNotebookListCommand_initOptions, _OneNoteNotebookListCommand_initValidators;
16
+ var _OneNoteNotebookListCommand_instances, _OneNoteNotebookListCommand_initTelemetry, _OneNoteNotebookListCommand_initOptions, _OneNoteNotebookListCommand_initValidators, _OneNoteNotebookListCommand_initOptionSets;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
+ const request_1 = require("../../../../request");
18
19
  const odata_1 = require("../../../../utils/odata");
19
20
  const validation_1 = require("../../../../utils/validation");
20
21
  const aadGroup_1 = require("../../../../utils/aadGroup");
21
22
  const GraphCommand_1 = require("../../../base/GraphCommand");
22
23
  const commands_1 = require("../../commands");
23
- const spo_1 = require("../../../../utils/spo");
24
24
  class OneNoteNotebookListCommand extends GraphCommand_1.default {
25
25
  get name() {
26
26
  return commands_1.default.NOTEBOOK_LIST;
@@ -28,61 +28,63 @@ class OneNoteNotebookListCommand extends GraphCommand_1.default {
28
28
  get description() {
29
29
  return 'Retrieve a list of notebooks';
30
30
  }
31
+ defaultProperties() {
32
+ return ['createdDateTime', 'displayName', 'id'];
33
+ }
31
34
  constructor() {
32
35
  super();
33
36
  _OneNoteNotebookListCommand_instances.add(this);
34
37
  __classPrivateFieldGet(this, _OneNoteNotebookListCommand_instances, "m", _OneNoteNotebookListCommand_initTelemetry).call(this);
35
38
  __classPrivateFieldGet(this, _OneNoteNotebookListCommand_instances, "m", _OneNoteNotebookListCommand_initOptions).call(this);
36
39
  __classPrivateFieldGet(this, _OneNoteNotebookListCommand_instances, "m", _OneNoteNotebookListCommand_initValidators).call(this);
40
+ __classPrivateFieldGet(this, _OneNoteNotebookListCommand_instances, "m", _OneNoteNotebookListCommand_initOptionSets).call(this);
37
41
  }
38
42
  getEndpointUrl(args) {
39
- return new Promise((resolve, reject) => {
40
- let endpoint = `${this.resource}/v1.0/me/onenote/notebooks`;
43
+ return __awaiter(this, void 0, void 0, function* () {
44
+ let endpoint = `${this.resource}/v1.0/`;
41
45
  if (args.options.userId) {
42
- endpoint = `${this.resource}/v1.0/users/${args.options.userId}/onenote/notebooks`;
43
- return resolve(endpoint);
46
+ endpoint += `users/${args.options.userId}`;
44
47
  }
45
48
  else if (args.options.userName) {
46
- endpoint = `${this.resource}/v1.0/users/${args.options.userName}/onenote/notebooks`;
47
- return resolve(endpoint);
49
+ endpoint += `users/${args.options.userName}`;
48
50
  }
49
51
  else if (args.options.groupId) {
50
- endpoint = `${this.resource}/v1.0/groups/${args.options.groupId}/onenote/notebooks`;
51
- return resolve(endpoint);
52
+ endpoint += `groups/${args.options.groupId}`;
52
53
  }
53
54
  else if (args.options.groupName) {
54
- this
55
- .getGroupId(args)
56
- .then((retrievedgroupId) => {
57
- endpoint = `${this.resource}/v1.0/groups/${retrievedgroupId}/onenote/notebooks`;
58
- return resolve(endpoint);
59
- })
60
- .catch((err) => {
61
- reject(err);
62
- });
55
+ const groupId = yield this.getGroupId(args.options.groupName);
56
+ endpoint += `groups/${groupId}`;
63
57
  }
64
58
  else if (args.options.webUrl) {
65
- spo_1.spo.getSpoGraphSiteId(args.options.webUrl)
66
- .then((siteId) => {
67
- endpoint = `${this.resource}/v1.0/sites/${siteId}/onenote/notebooks`;
68
- return resolve(endpoint);
69
- })
70
- .catch((err) => {
71
- reject(err);
72
- });
59
+ const siteId = yield this.getSpoSiteId(args.options.webUrl);
60
+ endpoint += `sites/${siteId}`;
73
61
  }
74
62
  else {
75
- return resolve(endpoint);
63
+ endpoint += 'me';
76
64
  }
65
+ endpoint += '/onenote/notebooks';
66
+ return endpoint;
77
67
  });
78
68
  }
79
- defaultProperties() {
80
- return ['createdDateTime', 'displayName', 'id'];
69
+ getGroupId(groupName) {
70
+ return __awaiter(this, void 0, void 0, function* () {
71
+ const group = yield aadGroup_1.aadGroup.getGroupByDisplayName(groupName);
72
+ return group.id;
73
+ });
81
74
  }
82
- getGroupId(args) {
83
- return aadGroup_1.aadGroup
84
- .getGroupByDisplayName(args.options.groupName)
85
- .then(group => group.id);
75
+ getSpoSiteId(webUrl) {
76
+ return __awaiter(this, void 0, void 0, function* () {
77
+ const url = new URL(webUrl);
78
+ const requestOptions = {
79
+ url: `${this.resource}/v1.0/sites/${url.hostname}:${url.pathname}`,
80
+ headers: {
81
+ accept: 'application/json;odata.metadata=none'
82
+ },
83
+ responseType: 'json'
84
+ };
85
+ const site = yield request_1.default.get(requestOptions);
86
+ return site.id;
87
+ });
86
88
  }
87
89
  commandAction(logger, args) {
88
90
  return __awaiter(this, void 0, void 0, function* () {
@@ -100,7 +102,11 @@ class OneNoteNotebookListCommand extends GraphCommand_1.default {
100
102
  _OneNoteNotebookListCommand_instances = new WeakSet(), _OneNoteNotebookListCommand_initTelemetry = function _OneNoteNotebookListCommand_initTelemetry() {
101
103
  this.telemetry.push((args) => {
102
104
  Object.assign(this.telemetryProperties, {
103
- joined: args.options.joined
105
+ userId: typeof args.options.userId !== 'undefined',
106
+ userName: typeof args.options.userName !== 'undefined',
107
+ groupId: typeof args.options.groupId !== 'undefined',
108
+ groupName: typeof args.options.groupName !== 'undefined',
109
+ webUrl: typeof args.options.webUrl !== 'undefined'
104
110
  });
105
111
  });
106
112
  }, _OneNoteNotebookListCommand_initOptions = function _OneNoteNotebookListCommand_initOptions() {
@@ -113,14 +119,19 @@ _OneNoteNotebookListCommand_instances = new WeakSet(), _OneNoteNotebookListComma
113
119
  if (args.options.groupId && !validation_1.validation.isValidGuid(args.options.groupId)) {
114
120
  return `${args.options.groupId} is not a valid GUID`;
115
121
  }
116
- if (args.options.userId && args.options.userName) {
117
- return 'Specify either userId or userName, but not both';
118
- }
119
- if (args.options.groupId && args.options.groupName) {
120
- return 'Specify either groupId or groupName, but not both';
122
+ if (args.options.webUrl) {
123
+ return validation_1.validation.isValidSharePointUrl(args.options.webUrl);
121
124
  }
122
125
  return true;
123
126
  }));
127
+ }, _OneNoteNotebookListCommand_initOptionSets = function _OneNoteNotebookListCommand_initOptionSets() {
128
+ this.optionSets.push({
129
+ options: ['userId', 'userName', 'groupId', 'groupName', 'webUrl'],
130
+ runsWhen: (args) => {
131
+ const options = [args.options.userId, args.options.userName, args.options.groupId, args.options.groupName, args.options.webUrl];
132
+ return options.some(item => item !== undefined);
133
+ }
134
+ });
124
135
  };
125
136
  module.exports = new OneNoteNotebookListCommand();
126
137
  //# sourceMappingURL=notebook-list.js.map
@@ -15,6 +15,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
15
15
  };
16
16
  var _PlannerPlanAddCommand_instances, _PlannerPlanAddCommand_initTelemetry, _PlannerPlanAddCommand_initOptions, _PlannerPlanAddCommand_initValidators, _PlannerPlanAddCommand_initOptionSets;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
+ const Command_1 = require("../../../../Command");
18
19
  const request_1 = require("../../../../request");
19
20
  const aadGroup_1 = require("../../../../utils/aadGroup");
20
21
  const formatting_1 = require("../../../../utils/formatting");
@@ -42,23 +43,34 @@ class PlannerPlanAddCommand extends GraphCommand_1.default {
42
43
  commandAction(logger, args) {
43
44
  return __awaiter(this, void 0, void 0, function* () {
44
45
  try {
45
- const groupId = yield this.getGroupId(args);
46
+ const data = {
47
+ title: args.options.title
48
+ };
49
+ if (args.options.rosterId) {
50
+ data.container = {
51
+ "url": `https://graph.microsoft.com/v1.0/planner/rosters/${args.options.rosterId}`
52
+ };
53
+ }
54
+ else {
55
+ const groupId = yield this.getGroupId(args);
56
+ data.owner = groupId;
57
+ }
46
58
  const requestOptions = {
47
59
  url: `${this.resource}/v1.0/planner/plans`,
48
60
  headers: {
49
61
  'accept': 'application/json;odata.metadata=none'
50
62
  },
51
63
  responseType: 'json',
52
- data: {
53
- owner: groupId,
54
- title: args.options.title
55
- }
64
+ data: data
56
65
  };
57
66
  const newPlan = yield request_1.default.post(requestOptions);
58
67
  const result = yield this.updatePlanDetails(args.options, newPlan);
59
68
  logger.log(result);
60
69
  }
61
70
  catch (err) {
71
+ if (err.error && err.error.error.message === "You do not have the required permissions to access this item, or the item may not exist.") {
72
+ throw new Command_1.CommandError("You can only add 1 plan to a Roster");
73
+ }
62
74
  this.handleRejectedODataJsonPromise(err);
63
75
  }
64
76
  });
@@ -167,6 +179,8 @@ _PlannerPlanAddCommand_instances = new WeakSet(), _PlannerPlanAddCommand_initTel
167
179
  option: "--ownerGroupId [ownerGroupId]"
168
180
  }, {
169
181
  option: "--ownerGroupName [ownerGroupName]"
182
+ }, {
183
+ option: "--rosterId [rosterId]"
170
184
  }, {
171
185
  option: '--shareWithUserIds [shareWithUserIds]'
172
186
  }, {
@@ -186,7 +200,7 @@ _PlannerPlanAddCommand_instances = new WeakSet(), _PlannerPlanAddCommand_initTel
186
200
  return true;
187
201
  }));
188
202
  }, _PlannerPlanAddCommand_initOptionSets = function _PlannerPlanAddCommand_initOptionSets() {
189
- this.optionSets.push({ options: ['ownerGroupId', 'ownerGroupName'] });
203
+ this.optionSets.push({ options: ['ownerGroupId', 'ownerGroupName', 'rosterId'] });
190
204
  };
191
205
  module.exports = new PlannerPlanAddCommand();
192
206
  //# sourceMappingURL=plan-add.js.map
@@ -79,7 +79,7 @@ class PlannerPlanRemoveCommand extends GraphCommand_1.default {
79
79
  return planner_1.planner.getPlanById(id, 'minimal');
80
80
  }
81
81
  const groupId = yield this.getGroupId(args);
82
- return yield planner_1.planner.getPlanByTitle(title, groupId);
82
+ return yield planner_1.planner.getPlanByTitle(title, groupId, 'minimal');
83
83
  });
84
84
  }
85
85
  getGroupId(args) {
@@ -16,6 +16,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
16
16
  var _PlannerTaskChecklistItemAddCommand_instances, _PlannerTaskChecklistItemAddCommand_initTelemetry, _PlannerTaskChecklistItemAddCommand_initOptions;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  const uuid_1 = require("uuid");
19
+ const Cli_1 = require("../../../../cli/Cli");
19
20
  const request_1 = require("../../../../request");
20
21
  const formatting_1 = require("../../../../utils/formatting");
21
22
  const GraphCommand_1 = require("../../../base/GraphCommand");
@@ -61,7 +62,7 @@ class PlannerTaskChecklistItemAddCommand extends GraphCommand_1.default {
61
62
  data: body
62
63
  };
63
64
  const result = yield request_1.default.patch(requestOptions);
64
- if (args.options.output === 'json') {
65
+ if (!Cli_1.Cli.shouldTrimOutput(args.options.output)) {
65
66
  logger.log(result.checklist);
66
67
  }
67
68
  else {
@@ -15,6 +15,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
15
15
  };
16
16
  var _PlannerTaskChecklistItemListCommand_instances, _PlannerTaskChecklistItemListCommand_initOptions;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
+ const Cli_1 = require("../../../../cli/Cli");
18
19
  const request_1 = require("../../../../request");
19
20
  const formatting_1 = require("../../../../utils/formatting");
20
21
  const GraphCommand_1 = require("../../../base/GraphCommand");
@@ -45,7 +46,7 @@ class PlannerTaskChecklistItemListCommand extends GraphCommand_1.default {
45
46
  };
46
47
  try {
47
48
  const res = yield request_1.default.get(requestOptions);
48
- if (!args.options.output || args.options.output === 'json') {
49
+ if (!args.options.output || !Cli_1.Cli.shouldTrimOutput(args.options.output)) {
49
50
  logger.log(res.checklist);
50
51
  }
51
52
  else {
@@ -15,6 +15,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
15
15
  };
16
16
  var _PpSolutionGetCommand_instances, _PpSolutionGetCommand_initTelemetry, _PpSolutionGetCommand_initOptions, _PpSolutionGetCommand_initOptionSets, _PpSolutionGetCommand_initValidators;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
+ const Cli_1 = require("../../../../cli/Cli");
18
19
  const request_1 = require("../../../../request");
19
20
  const powerPlatform_1 = require("../../../../utils/powerPlatform");
20
21
  const validation_1 = require("../../../../utils/validation");
@@ -46,7 +47,7 @@ class PpSolutionGetCommand extends PowerPlatformCommand_1.default {
46
47
  try {
47
48
  const dynamicsApiUrl = yield powerPlatform_1.powerPlatform.getDynamicsInstanceApiUrl(args.options.environment, args.options.asAdmin);
48
49
  const res = yield this.getSolution(dynamicsApiUrl, args.options);
49
- if (!args.options.output || args.options.output === 'json') {
50
+ if (!args.options.output || !Cli_1.Cli.shouldTrimOutput(args.options.output)) {
50
51
  logger.log(res);
51
52
  }
52
53
  else {
@@ -15,6 +15,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
15
15
  };
16
16
  var _PpSolutionListCommand_instances, _PpSolutionListCommand_initTelemetry, _PpSolutionListCommand_initOptions;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
+ const Cli_1 = require("../../../../cli/Cli");
18
19
  const odata_1 = require("../../../../utils/odata");
19
20
  const powerPlatform_1 = require("../../../../utils/powerPlatform");
20
21
  const PowerPlatformCommand_1 = require("../../../base/PowerPlatformCommand");
@@ -44,7 +45,7 @@ class PpSolutionListCommand extends PowerPlatformCommand_1.default {
44
45
  const dynamicsApiUrl = yield powerPlatform_1.powerPlatform.getDynamicsInstanceApiUrl(args.options.environment, args.options.asAdmin);
45
46
  const requestUrl = `${dynamicsApiUrl}/api/data/v9.0/solutions?$filter=isvisible eq true&$expand=publisherid($select=friendlyname)&$select=solutionid,uniquename,version,publisherid,installedon,solutionpackageversion,friendlyname,versionnumber&api-version=9.1`;
46
47
  const res = yield odata_1.odata.getAllItems(requestUrl);
47
- if (!args.options.output || args.options.output === 'json') {
48
+ if (!args.options.output || !Cli_1.Cli.shouldTrimOutput(args.options.output)) {
48
49
  logger.log(res);
49
50
  }
50
51
  else {
@@ -0,0 +1,70 @@
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 _PurviewRetentionEventtypeGetCommand_instances, _PurviewRetentionEventtypeGetCommand_initOptions, _PurviewRetentionEventtypeGetCommand_initValidators;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const GraphCommand_1 = require("../../../base/GraphCommand");
19
+ const commands_1 = require("../../commands");
20
+ const request_1 = require("../../../../request");
21
+ const validation_1 = require("../../../../utils/validation");
22
+ class PurviewRetentionEventtypeGetCommand extends GraphCommand_1.default {
23
+ get name() {
24
+ return commands_1.default.RETENTIONEVENTTYPE_GET;
25
+ }
26
+ get description() {
27
+ return 'Retrieve the specified retention event type';
28
+ }
29
+ constructor() {
30
+ super();
31
+ _PurviewRetentionEventtypeGetCommand_instances.add(this);
32
+ __classPrivateFieldGet(this, _PurviewRetentionEventtypeGetCommand_instances, "m", _PurviewRetentionEventtypeGetCommand_initOptions).call(this);
33
+ __classPrivateFieldGet(this, _PurviewRetentionEventtypeGetCommand_instances, "m", _PurviewRetentionEventtypeGetCommand_initValidators).call(this);
34
+ }
35
+ commandAction(logger, args) {
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ try {
38
+ if (this.verbose) {
39
+ logger.logToStderr(`Retrieving retention event type with id ${args.options.id}`);
40
+ }
41
+ const requestOptions = {
42
+ url: `${this.resource}/beta/security/triggerTypes/retentionEventTypes/${args.options.id}`,
43
+ headers: {
44
+ accept: 'application/json;odata.metadata=none'
45
+ },
46
+ responseType: 'json'
47
+ };
48
+ const res = yield request_1.default.get(requestOptions);
49
+ logger.log(res);
50
+ }
51
+ catch (err) {
52
+ this.handleRejectedODataJsonPromise(err);
53
+ }
54
+ });
55
+ }
56
+ }
57
+ _PurviewRetentionEventtypeGetCommand_instances = new WeakSet(), _PurviewRetentionEventtypeGetCommand_initOptions = function _PurviewRetentionEventtypeGetCommand_initOptions() {
58
+ this.options.unshift({
59
+ option: '-i, --id <id>'
60
+ });
61
+ }, _PurviewRetentionEventtypeGetCommand_initValidators = function _PurviewRetentionEventtypeGetCommand_initValidators() {
62
+ this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
63
+ if (!validation_1.validation.isValidGuid(args.options.id)) {
64
+ return `'${args.options.id}' is not a valid GUID.`;
65
+ }
66
+ return true;
67
+ }));
68
+ };
69
+ module.exports = new PurviewRetentionEventtypeGetCommand();
70
+ //# sourceMappingURL=retentioneventtype-get.js.map
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const prefix = 'purview';
4
4
  exports.default = {
5
+ RETENTIONEVENTTYPE_GET: `${prefix} retentioneventtype get`,
5
6
  RETENTIONLABEL_ADD: `${prefix} retentionlabel add`,
6
7
  RETENTIONLABEL_GET: `${prefix} retentionlabel get`,
7
8
  RETENTIONLABEL_LIST: `${prefix} retentionlabel list`,
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=WebApiPermissionRequests.js.map
@@ -0,0 +1,81 @@
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 path = require("path");
13
+ const fs = require("fs");
14
+ const Command_1 = require("../../../../Command");
15
+ const commands_1 = require("../../commands");
16
+ const base_project_command_1 = require("./base-project-command");
17
+ const SpoServicePrincipalGrantAddCommand = require("../../../spo/commands/serviceprincipal/serviceprincipal-grant-add");
18
+ const Cli_1 = require("../../../../cli/Cli");
19
+ class SpfxProjectPermissionSGrantCommand extends base_project_command_1.BaseProjectCommand {
20
+ get name() {
21
+ return commands_1.default.PROJECT_PERMISSIONS_GRANT;
22
+ }
23
+ get description() {
24
+ return 'Grant API permissions defined in the current SPFx project';
25
+ }
26
+ constructor() {
27
+ super();
28
+ }
29
+ commandAction(logger) {
30
+ return __awaiter(this, void 0, void 0, function* () {
31
+ this.projectRootPath = this.getProjectRoot(process.cwd());
32
+ if (this.projectRootPath === null) {
33
+ throw new Command_1.CommandError(`Couldn't find project root folder`, SpfxProjectPermissionSGrantCommand.ERROR_NO_PROJECT_ROOT_FOLDER);
34
+ }
35
+ if (this.debug) {
36
+ logger.logToStderr(`Granting API permissions defined in the current SPFx project`);
37
+ }
38
+ try {
39
+ const webApiPermissionsRequest = this.getWebApiPermissionRequest(path.join(this.projectRootPath, 'config', 'package-solution.json'));
40
+ for (const permission of webApiPermissionsRequest) {
41
+ const options = {
42
+ resource: permission.resource,
43
+ scope: permission.scope,
44
+ output: 'json',
45
+ debug: this.debug,
46
+ verbose: this.verbose
47
+ };
48
+ let output = null;
49
+ try {
50
+ output = yield Cli_1.Cli.executeCommandWithOutput(SpoServicePrincipalGrantAddCommand, { options: Object.assign(Object.assign({}, options), { _: [] }) });
51
+ }
52
+ catch (err) {
53
+ if (err.error && err.error.message.indexOf('already exists') > -1) {
54
+ this.warn(logger, err.error.message);
55
+ continue;
56
+ }
57
+ else {
58
+ throw err;
59
+ }
60
+ }
61
+ const getGrantOutput = JSON.parse(output.stdout);
62
+ logger.log(getGrantOutput);
63
+ }
64
+ }
65
+ catch (error) {
66
+ throw new Command_1.CommandError(error);
67
+ }
68
+ });
69
+ }
70
+ getWebApiPermissionRequest(filePath) {
71
+ if (!fs.existsSync(filePath)) {
72
+ throw (`The package-solution.json file could not be found`);
73
+ }
74
+ const existingContent = fs.readFileSync(filePath, 'utf-8');
75
+ const solutionContent = JSON.parse(existingContent);
76
+ return solutionContent.solution.webApiPermissionRequests;
77
+ }
78
+ }
79
+ SpfxProjectPermissionSGrantCommand.ERROR_NO_PROJECT_ROOT_FOLDER = 1;
80
+ module.exports = new SpfxProjectPermissionSGrantCommand();
81
+ //# sourceMappingURL=project-permissions-grant.js.map
@@ -5,8 +5,9 @@ exports.default = {
5
5
  DOCTOR: `${prefix} doctor`,
6
6
  PACKAGE_GENERATE: `${prefix} package generate`,
7
7
  PROJECT_DOCTOR: `${prefix} project doctor`,
8
- PROJECT_UPGRADE: `${prefix} project upgrade`,
9
8
  PROJECT_EXTERNALIZE: `${prefix} project externalize`,
10
- PROJECT_RENAME: `${prefix} project rename`
9
+ PROJECT_PERMISSIONS_GRANT: `${prefix} project permissions grant`,
10
+ PROJECT_RENAME: `${prefix} project rename`,
11
+ PROJECT_UPGRADE: `${prefix} project upgrade`
11
12
  };
12
13
  //# sourceMappingURL=commands.js.map
@@ -17,6 +17,7 @@ var _SpoAppAddCommand_instances, _SpoAppAddCommand_initTelemetry, _SpoAppAddComm
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  const fs = require("fs");
19
19
  const path = require("path");
20
+ const Cli_1 = require("../../../../cli/Cli");
20
21
  const request_1 = require("../../../../request");
21
22
  const spo_1 = require("../../../../utils/spo");
22
23
  const validation_1 = require("../../../../utils/validation");
@@ -58,7 +59,7 @@ class SpoAppAddCommand extends SpoAppBaseCommand_1.SpoAppBaseCommand {
58
59
  };
59
60
  const res = yield request_1.default.post(requestOptions);
60
61
  const json = JSON.parse(res);
61
- if (args.options.output === 'json') {
62
+ if (!Cli_1.Cli.shouldTrimOutput(args.options.output)) {
62
63
  logger.log(json);
63
64
  }
64
65
  else {
@@ -15,6 +15,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
15
15
  };
16
16
  var _SpoFileSharingInfoGetCommand_instances, _SpoFileSharingInfoGetCommand_initTelemetry, _SpoFileSharingInfoGetCommand_initOptions, _SpoFileSharingInfoGetCommand_initValidators, _SpoFileSharingInfoGetCommand_initOptionSets;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
+ const Cli_1 = require("../../../../cli/Cli");
18
19
  const request_1 = require("../../../../request");
19
20
  const formatting_1 = require("../../../../utils/formatting");
20
21
  const validation_1 = require("../../../../utils/validation");
@@ -60,7 +61,7 @@ class SpoFileSharingInfoGetCommand extends SpoCommand_1.default {
60
61
  // typically, we don't do this, but in this case, we need to due to
61
62
  // the complexity of the retrieved object and the fact that we can't
62
63
  // use the generic way of simplifying the output
63
- if (args.options.output === 'json') {
64
+ if (!Cli_1.Cli.shouldTrimOutput(args.options.output)) {
64
65
  logger.log(res);
65
66
  }
66
67
  else {
@@ -15,6 +15,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
15
15
  };
16
16
  var _SpoFileSharingLinkListCommand_instances, _SpoFileSharingLinkListCommand_initTelemetry, _SpoFileSharingLinkListCommand_initOptions, _SpoFileSharingLinkListCommand_initValidators, _SpoFileSharingLinkListCommand_initOptionSets;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
+ const Cli_1 = require("../../../../cli/Cli");
18
19
  const request_1 = require("../../../../request");
19
20
  const formatting_1 = require("../../../../utils/formatting");
20
21
  const odata_1 = require("../../../../utils/odata");
@@ -51,7 +52,7 @@ class SpoFileSharingLinkListCommand extends SpoCommand_1.default {
51
52
  url += ` and Link/Scope eq '${args.options.scope}'`;
52
53
  }
53
54
  const sharingLinks = yield odata_1.odata.getAllItems(url);
54
- if (!args.options.output || args.options.output === 'json' || args.options.output === 'md') {
55
+ if (!args.options.output || !Cli_1.Cli.shouldTrimOutput(args.options.output)) {
55
56
  logger.log(sharingLinks);
56
57
  }
57
58
  else {
@@ -15,6 +15,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
15
15
  };
16
16
  var _SpoGroupListCommand_instances, _SpoGroupListCommand_initTelemetry, _SpoGroupListCommand_initOptions, _SpoGroupListCommand_initValidators;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
+ const Cli_1 = require("../../../../cli/Cli");
18
19
  const request_1 = require("../../../../request");
19
20
  const odata_1 = require("../../../../utils/odata");
20
21
  const validation_1 = require("../../../../utils/validation");
@@ -73,7 +74,7 @@ class SpoGroupListCommand extends SpoCommand_1.default {
73
74
  };
74
75
  const groupProperties = yield request_1.default.get(requestOptions);
75
76
  logger.log(groupProperties);
76
- if (!options.output || options.output === 'json') {
77
+ if (!options.output || !Cli_1.Cli.shouldTrimOutput(options.output)) {
77
78
  logger.log(groupProperties);
78
79
  }
79
80
  else {
@@ -45,7 +45,7 @@ class SpoHubSiteGetCommand extends SpoCommand_1.default {
45
45
  if (args.options.includeAssociatedSites && (args.options.output && args.options.output !== 'json')) {
46
46
  throw 'includeAssociatedSites option is only allowed with json output mode';
47
47
  }
48
- if (args.options.includeAssociatedSites === true && args.options.output && args.options.output === 'json') {
48
+ if (args.options.includeAssociatedSites === true && args.options.output && !Cli_1.Cli.shouldTrimOutput(args.options.output)) {
49
49
  const spoAdminUrl = yield spo_1.spo.getSpoAdminUrl(logger, this.debug);
50
50
  const associatedSitesCommandOutput = yield this.getAssociatedSites(spoAdminUrl, hubSite.SiteId, logger, args);
51
51
  const associatedSites = JSON.parse(associatedSitesCommandOutput.stdout);
@@ -15,6 +15,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
15
15
  };
16
16
  var _SpoListItemListCommand_instances, _SpoListItemListCommand_initTelemetry, _SpoListItemListCommand_initOptions, _SpoListItemListCommand_initValidators, _SpoListItemListCommand_initOptionSets, _SpoListItemListCommand_initTypes;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
+ const Cli_1 = require("../../../../cli/Cli");
18
19
  const request_1 = require("../../../../request");
19
20
  const formatting_1 = require("../../../../utils/formatting");
20
21
  const spo_1 = require("../../../../utils/spo");
@@ -53,7 +54,7 @@ class SpoListItemListCommand extends SpoCommand_1.default {
53
54
  }
54
55
  let formDigestValue = '';
55
56
  const fieldsArray = args.options.fields ? args.options.fields.split(",")
56
- : (!args.options.output || args.options.output === "text") ? ["Title", "Id"] : [];
57
+ : (!args.options.output || Cli_1.Cli.shouldTrimOutput(args.options.output)) ? ["Title", "Id"] : [];
57
58
  const fieldsWithSlash = fieldsArray.filter(item => item.includes('/'));
58
59
  const fieldsToExpand = fieldsWithSlash.map(e => e.split('/')[0]);
59
60
  const expandFieldsArray = fieldsToExpand.filter((item, pos) => fieldsToExpand.indexOf(item) === pos);
@@ -15,6 +15,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
15
15
  };
16
16
  var _SpoPageColumnGetCommand_instances, _SpoPageColumnGetCommand_initOptions, _SpoPageColumnGetCommand_initValidators;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
+ const Cli_1 = require("../../../../cli/Cli");
18
19
  const validation_1 = require("../../../../utils/validation");
19
20
  const SpoCommand_1 = require("../../../base/SpoCommand");
20
21
  const commands_1 = require("../../commands");
@@ -39,7 +40,7 @@ class SpoPageColumnGetCommand extends SpoCommand_1.default {
39
40
  const sections = clientSidePage.sections
40
41
  .filter(section => section.order === args.options.section);
41
42
  if (sections.length) {
42
- const isJSONOutput = args.options.output === 'json';
43
+ const isJSONOutput = !Cli_1.Cli.shouldTrimOutput(args.options.output);
43
44
  const columns = sections[0].columns.filter(col => col.order === args.options.column);
44
45
  if (columns.length) {
45
46
  const column = Page_1.Page.getColumnsInformation(columns[0], isJSONOutput);
@@ -15,6 +15,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
15
15
  };
16
16
  var _SpoPageColumnListCommand_instances, _SpoPageColumnListCommand_initOptions, _SpoPageColumnListCommand_initValidators;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
+ const Cli_1 = require("../../../../cli/Cli");
18
19
  const validation_1 = require("../../../../utils/validation");
19
20
  const SpoCommand_1 = require("../../../base/SpoCommand");
20
21
  const commands_1 = require("../../commands");
@@ -39,7 +40,7 @@ class SpoPageColumnListCommand extends SpoCommand_1.default {
39
40
  const sections = clientSidePage.sections
40
41
  .filter(section => section.order === args.options.section);
41
42
  if (sections.length) {
42
- const isJSONOutput = args.options.output === 'json';
43
+ const isJSONOutput = !Cli_1.Cli.shouldTrimOutput(args.options.output);
43
44
  logger.log(sections[0].columns.map(c => {
44
45
  const column = Page_1.Page.getColumnsInformation(c, isJSONOutput);
45
46
  column.controls = c.controls.length;
@@ -15,6 +15,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
15
15
  };
16
16
  var _SpoPageSectionGetCommand_instances, _SpoPageSectionGetCommand_initOptions, _SpoPageSectionGetCommand_initValidators;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
+ const Cli_1 = require("../../../../cli/Cli");
18
19
  const validation_1 = require("../../../../utils/validation");
19
20
  const SpoCommand_1 = require("../../../base/SpoCommand");
20
21
  const commands_1 = require("../../commands");
@@ -38,7 +39,7 @@ class SpoPageSectionGetCommand extends SpoCommand_1.default {
38
39
  const clientSidePage = yield Page_1.Page.getPage(args.options.pageName, args.options.webUrl, logger, this.debug, this.verbose);
39
40
  const sections = clientSidePage.sections
40
41
  .filter(section => section.order === args.options.section);
41
- const isJSONOutput = args.options.output === 'json';
42
+ const isJSONOutput = !Cli_1.Cli.shouldTrimOutput(args.options.output);
42
43
  if (sections.length) {
43
44
  logger.log(Page_1.Page.getSectionInformation(sections[0], isJSONOutput));
44
45
  }
@@ -15,6 +15,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
15
15
  };
16
16
  var _SpoPageSectionListCommand_instances, _SpoPageSectionListCommand_initOptions, _SpoPageSectionListCommand_initValidators;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
+ const Cli_1 = require("../../../../cli/Cli");
18
19
  const validation_1 = require("../../../../utils/validation");
19
20
  const SpoCommand_1 = require("../../../base/SpoCommand");
20
21
  const commands_1 = require("../../commands");
@@ -37,7 +38,7 @@ class SpoPageSectionListCommand extends SpoCommand_1.default {
37
38
  try {
38
39
  const clientSidePage = yield Page_1.Page.getPage(args.options.pageName, args.options.webUrl, logger, this.debug, this.verbose);
39
40
  const sections = clientSidePage.sections;
40
- const isJSONOutput = args.options.output === 'json';
41
+ const isJSONOutput = !Cli_1.Cli.shouldTrimOutput(args.options.output);
41
42
  if (sections.length) {
42
43
  const output = sections.map(section => Page_1.Page.getSectionInformation(section, isJSONOutput));
43
44
  if (isJSONOutput) {
@@ -16,6 +16,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
16
16
  var _SpoSearchCommand_instances, _SpoSearchCommand_initTelemetry, _SpoSearchCommand_initOptions, _SpoSearchCommand_initValidators;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  const util_1 = require("util");
19
+ const Cli_1 = require("../../../cli/Cli");
19
20
  const request_1 = require("../../../request");
20
21
  const formatting_1 = require("../../../utils/formatting");
21
22
  const spo_1 = require("../../../utils/spo");
@@ -137,7 +138,7 @@ class SpoSearchCommand extends SpoCommand_1.default {
137
138
  else {
138
139
  logger.log(this.getParsedOutput(args, results));
139
140
  }
140
- if (!args.options.output || args.options.output === 'text') {
141
+ if (!args.options.output || Cli_1.Cli.shouldTrimOutput(args.options.output)) {
141
142
  logger.log("# Rows: " + results[results.length - 1].PrimaryQueryResult.RelevantResults.TotalRows);
142
143
  logger.log("# Rows (Including duplicates): " + results[results.length - 1].PrimaryQueryResult.RelevantResults.TotalRowsIncludingDuplicates);
143
144
  logger.log("Elapsed Time: " + this.getElapsedTime(results));
@@ -15,6 +15,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
15
15
  };
16
16
  var _SpoTermListCommand_instances, _SpoTermListCommand_initTelemetry, _SpoTermListCommand_initOptions, _SpoTermListCommand_initValidators, _SpoTermListCommand_initOptionSets;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
+ const Cli_1 = require("../../../../cli/Cli");
18
19
  const config_1 = require("../../../../config");
19
20
  const request_1 = require("../../../../request");
20
21
  const formatting_1 = require("../../../../utils/formatting");
@@ -62,7 +63,7 @@ class SpoTermListCommand extends SpoCommand_1.default {
62
63
  }
63
64
  }
64
65
  }
65
- if (!args.options.output || args.options.output === 'json') {
66
+ if (!args.options.output || !Cli_1.Cli.shouldTrimOutput(args.options.output)) {
66
67
  logger.log(terms);
67
68
  }
68
69
  else if (!args.options.includeChildTerms) {
@@ -15,6 +15,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
15
15
  };
16
16
  var _SpoUserProfileGetCommand_instances, _SpoUserProfileGetCommand_initOptions, _SpoUserProfileGetCommand_initValidators;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
+ const Cli_1 = require("../../../../cli/Cli");
18
19
  const request_1 = require("../../../../request");
19
20
  const formatting_1 = require("../../../../utils/formatting");
20
21
  const spo_1 = require("../../../../utils/spo");
@@ -47,8 +48,7 @@ class SpoUserProfileGetCommand extends SpoCommand_1.default {
47
48
  responseType: 'json'
48
49
  };
49
50
  const res = yield request_1.default.get(requestOptions);
50
- if (!args.options.output ||
51
- args.options.output === 'text') {
51
+ if (!args.options.output || Cli_1.Cli.shouldTrimOutput(args.options.output)) {
52
52
  res.UserProfileProperties = JSON.stringify(res.UserProfileProperties);
53
53
  }
54
54
  logger.log(res);
@@ -79,7 +79,7 @@ class TeamsMeetingListCommand extends GraphCommand_1.default {
79
79
  }
80
80
  const res = yield odata_1.odata.getAllItems(requestUrl);
81
81
  const resFiltered = res.filter(y => y.isOnlineMeeting);
82
- if (!args.options.output || args.options.output === 'json') {
82
+ if (!args.options.output || !Cli_1.Cli.shouldTrimOutput(args.options.output)) {
83
83
  logger.log(resFiltered);
84
84
  }
85
85
  else {
@@ -47,7 +47,7 @@ class TeamsTeamAppListCommand extends GraphCommand_1.default {
47
47
  }
48
48
  const teamId = yield this.getTeamId(args);
49
49
  const res = yield odata_1.odata.getAllItems(`${this.resource}/v1.0/teams/${teamId}/installedApps?$expand=teamsApp,teamsAppDefinition`);
50
- if (args.options.output === 'json') {
50
+ if (!Cli_1.Cli.shouldTrimOutput(args.options.output)) {
51
51
  logger.log(res);
52
52
  }
53
53
  else {
@@ -15,6 +15,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
15
15
  };
16
16
  var _TeamsUserAppListCommand_instances, _TeamsUserAppListCommand_initTelemetry, _TeamsUserAppListCommand_initOptions, _TeamsUserAppListCommand_initValidators, _TeamsUserAppListCommand_initOptionSets;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
+ const Cli_1 = require("../../../../cli/Cli");
18
19
  const request_1 = require("../../../../request");
19
20
  const formatting_1 = require("../../../../utils/formatting");
20
21
  const odata_1 = require("../../../../utils/odata");
@@ -47,7 +48,7 @@ class TeamsUserAppListCommand extends GraphCommand_1.default {
47
48
  const appId = userAppId.substr(userAppId.indexOf("##") + 2, userAppId.length - userId.length - 2);
48
49
  i.appId = appId;
49
50
  });
50
- if (args.options.output === 'json') {
51
+ if (!Cli_1.Cli.shouldTrimOutput(args.options.output)) {
51
52
  logger.log(items);
52
53
  }
53
54
  else {
@@ -15,6 +15,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
15
15
  };
16
16
  var _TodoTaskGetCommand_instances, _TodoTaskGetCommand_initTelemetry, _TodoTaskGetCommand_initOptions, _TodoTaskGetCommand_initOptionSets;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
+ const Cli_1 = require("../../../../cli/Cli");
18
19
  const request_1 = require("../../../../request");
19
20
  const GraphCommand_1 = require("../../../base/GraphCommand");
20
21
  const commands_1 = require("../../commands");
@@ -67,7 +68,7 @@ class TodoTaskGetCommand extends GraphCommand_1.default {
67
68
  responseType: 'json'
68
69
  };
69
70
  const item = yield request_1.default.get(requestOptions);
70
- if (args.options.output === 'json') {
71
+ if (!Cli_1.Cli.shouldTrimOutput(args.options.output)) {
71
72
  logger.log(item);
72
73
  }
73
74
  else {
@@ -15,6 +15,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
15
15
  };
16
16
  var _TodoTaskListCommand_instances, _TodoTaskListCommand_initTelemetry, _TodoTaskListCommand_initOptions, _TodoTaskListCommand_initOptionSets;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
+ const Cli_1 = require("../../../../cli/Cli");
18
19
  const request_1 = require("../../../../request");
19
20
  const odata_1 = require("../../../../utils/odata");
20
21
  const GraphCommand_1 = require("../../../base/GraphCommand");
@@ -62,7 +63,7 @@ class TodoTaskListCommand extends GraphCommand_1.default {
62
63
  const listId = yield this.getTodoListId(args);
63
64
  const endpoint = `${this.resource}/v1.0/me/todo/lists/${listId}/tasks`;
64
65
  const items = yield odata_1.odata.getAllItems(endpoint);
65
- if (args.options.output === 'json') {
66
+ if (!Cli_1.Cli.shouldTrimOutput(args.options.output)) {
66
67
  logger.log(items);
67
68
  }
68
69
  else {
@@ -15,6 +15,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
15
15
  };
16
16
  var _YammerSearchCommand_instances, _YammerSearchCommand_initTelemetry, _YammerSearchCommand_initOptions, _YammerSearchCommand_initValidators;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
+ const Cli_1 = require("../../../cli/Cli");
18
19
  const request_1 = require("../../../request");
19
20
  const formatting_1 = require("../../../utils/formatting");
20
21
  const YammerCommand_1 = require("../../base/YammerCommand");
@@ -129,7 +130,7 @@ class YammerSearchCommand extends YammerCommand_1.default {
129
130
  this.users = [];
130
131
  try {
131
132
  yield this.getAllItems(logger, args, 1);
132
- if (args.options.output === 'json') {
133
+ if (!Cli_1.Cli.shouldTrimOutput(args.options.output)) {
133
134
  logger.log({
134
135
  summary: this.summary,
135
136
  messages: this.messages,
@@ -41,17 +41,17 @@ exports.planner = {
41
41
  * Get all Planner plans for a specific group.
42
42
  * @param groupId Group ID.
43
43
  */
44
- getPlansByGroupId(groupId) {
45
- return odata_1.odata.getAllItems(`${graphResource}/v1.0/groups/${groupId}/planner/plans`, 'none');
44
+ getPlansByGroupId(groupId, metadata = 'none') {
45
+ return odata_1.odata.getAllItems(`${graphResource}/v1.0/groups/${groupId}/planner/plans`, metadata);
46
46
  },
47
47
  /**
48
48
  * Get Planner plan by title in a specific group.
49
49
  * @param title Title of the Planner plan. Case insensitive.
50
50
  * @param groupId Owner group ID .
51
51
  */
52
- getPlanByTitle(title, groupId) {
52
+ getPlanByTitle(title, groupId, metadata = 'none') {
53
53
  return __awaiter(this, void 0, void 0, function* () {
54
- const plans = yield this.getPlansByGroupId(groupId);
54
+ const plans = yield this.getPlansByGroupId(groupId, metadata);
55
55
  const filteredPlans = plans.filter(p => p.title && p.title.toLowerCase() === title.toLowerCase());
56
56
  if (!filteredPlans.length) {
57
57
  throw Error(`The specified plan '${title}' does not exist.`);
@@ -14,10 +14,13 @@ m365 planner plan add [options]
14
14
  : Title of the plan to add.
15
15
 
16
16
  `--ownerGroupId [ownerGroupId]`
17
- : ID of the Group that owns the plan. A valid group must exist before this option can be set. Specify either `ownerGroupId` or `ownerGroupName` but not both.
17
+ : ID of the Group that owns the plan. A valid group must exist before this option can be set. Specify either `ownerGroupId`, `ownerGroupName` or `rosterId`.
18
18
 
19
19
  `--ownerGroupName [ownerGroupName]`
20
- : Name of the Group that owns the plan. A valid group must exist before this option can be set. Specify either `ownerGroupId` or `ownerGroupName` but not both.
20
+ : Name of the Group that owns the plan. A valid group must exist before this option can be set. Specify either `ownerGroupId`, `ownerGroupName` or `rosterId`.
21
+
22
+ `--rosterId [rosterId]`
23
+ : ID of the Planner Roster. Specify either `ownerGroupId`, `ownerGroupName` or `rosterId`.
21
24
 
22
25
  `--shareWithUserIds [shareWithUserIds]`
23
26
  : The comma-separated IDs of the users with whom you want to share the plan. Specify either `shareWithUserIds` or `shareWithUserNames` but not both.
@@ -29,23 +32,31 @@ m365 planner plan add [options]
29
32
 
30
33
  ## Remarks
31
34
 
32
- Related to the options `--shareWithUserIds` and `--shareWithUserNames`. If you are leveraging Microsoft 365 groups, use the `aad o365group user` commands to manage group membership to share the [group's](https://pnp.github.io/cli-microsoft365/cmd/aad/o365group/o365group-user-add/) plan. You can also add existing members of the group to this collection though it is not required for them to access the plan owned by the group.
35
+ - Related to the options `--shareWithUserIds` and `--shareWithUserNames`. If you are leveraging Microsoft 365 groups, use the `aad o365group user` commands to manage group membership to share the [group's](https://pnp.github.io/cli-microsoft365/cmd/aad/o365group/o365group-user-add/) plan. You can also add existing members of the group to this collection though it is not required for them to access the plan owned by the group.
36
+
37
+ - Hint: Unlike for groups, a Planner Roster can contain only 1 plan.
33
38
 
34
39
  ## Examples
35
40
 
36
- Adds a Microsoft Planner plan with the name _My Planner Plan_ for Group _233e43d0-dc6a-482e-9b4e-0de7a7bce9b4_
41
+ Adds a Microsoft Planner plan with a Group by id
37
42
 
38
43
  ```sh
39
44
  m365 planner plan add --title 'My Planner Plan' --ownerGroupId '233e43d0-dc6a-482e-9b4e-0de7a7bce9b4'
40
45
  ```
41
46
 
42
- Adds a Microsoft Planner plan with the name _My Planner Plan_ for Group _My Planner Group_
47
+ Adds a Microsoft Planner plan with with a Group by name
43
48
 
44
49
  ```sh
45
50
  m365 planner plan add --title 'My Planner Plan' --ownerGroupName 'My Planner Group'
46
51
  ```
47
52
 
48
- Adds a Microsoft Planner plan with the name _My Planner Plan_ for Group _My Planner Group_ and share it with the users _Allan.Carroll@contoso.com_ and _Ida.Stevens@contoso.com_
53
+ Adds a Microsoft Planner plan with a Roster by id
54
+
55
+ ```sh
56
+ m365 planner plan add --title 'My Planner Plan' --rosterId 'tYqYlNd6eECmsNhN_fcq85cAGAnd'
57
+ ```
58
+
59
+ Adds a Microsoft Planner plan with with a Group by name and share it with the given users
49
60
 
50
61
  ```sh
51
62
  m365 planner plan add --title 'My Planner Plan' --ownerGroupName 'My Planner Group' --shareWithUserNames 'Allan.Carroll@contoso.com,Ida.Stevens@contoso.com'
@@ -0,0 +1,100 @@
1
+ # purview retentioneventtype get
2
+
3
+ Get a retention event type
4
+
5
+ ## Usage
6
+
7
+ ```sh
8
+ m365 purview retentioneventtype get [options]
9
+ ```
10
+
11
+ ## Options
12
+
13
+ `-i, --id <id>`
14
+ : The Id of the retention event type.
15
+
16
+ --8<-- "docs/cmd/_global.md"
17
+
18
+ ## Examples
19
+
20
+ Get a retention event type by id
21
+
22
+ ```sh
23
+ m365 purview retentioneventtype get --id c37d695e-d581-4ae9-82a0-9364eba4291e
24
+ ```
25
+
26
+ ## Remarks
27
+
28
+ !!! attention
29
+ This command is based on an API that is currently in preview and is subject to change once the API reached general availability.
30
+
31
+ ## More information
32
+
33
+ This command is part of a series of commands that have to do with event-based retention. Event-based retention is about starting a retention period when a specific event occurs, instead of the moment a document was labeled or created.
34
+
35
+ [Read more on event-based retention here](https://learn.microsoft.com/en-us/microsoft-365/compliance/event-driven-retention?view=o365-worldwide)
36
+
37
+ ## Response
38
+
39
+ === "JSON"
40
+
41
+ ```json
42
+ {
43
+ "displayName": "Test retention event type",
44
+ "description": "Description for the retention event type",
45
+ "createdDateTime": "2023-01-29T09:30:42Z",
46
+ "lastModifiedDateTime": "2023-01-29T09:30:42Z",
47
+ "id": "c37d695e-d581-4ae9-82a0-9364eba4291e",
48
+ "createdBy": {
49
+ "user": {
50
+ "id": null,
51
+ "displayName": "John Doe"
52
+ }
53
+ },
54
+ "lastModifiedBy": {
55
+ "user": {
56
+ "id": null,
57
+ "displayName": "John Doe"
58
+ }
59
+ }
60
+ }
61
+ ```
62
+
63
+ === "Text"
64
+
65
+ ```text
66
+ createdBy : {"user":{"id":null,"displayName":"John Doe"}}
67
+ createdDateTime : 2023-01-29T09:30:42Z
68
+ description : Description for the retention event type
69
+ displayName : Test retention event type
70
+ id : c37d695e-d581-4ae9-82a0-9364eba4291e
71
+ lastModifiedBy : {"user":{"id":null,"displayName":"John Doe"}}
72
+ lastModifiedDateTime: 2023-01-29T09:30:42Z
73
+ ```
74
+
75
+ === "CSV"
76
+
77
+ ```csv
78
+ displayName,description,createdDateTime,lastModifiedDateTime,id,createdBy,lastModifiedBy
79
+ Test retention event type,Description for the retention event type,2023-01-29T09:30:42Z,2023-01-29T09:30:42Z,c37d695e-d581-4ae9-82a0-9364eba4291e,"{""user"":{""id"":null,""displayName"":""John Doe""}}","{""user"":{""id"":null,""displayName"":""John Doe""}}"
80
+ ```
81
+
82
+ === "Markdown"
83
+
84
+ ```md
85
+ # purview retentioneventtype get --id "c37d695e-d581-4ae9-82a0-9364eba4291e"
86
+
87
+ Date: 1/29/2023
88
+
89
+ ## Test retention event type (c37d695e-d581-4ae9-82a0-9364eba4291e)
90
+
91
+ Property | Value
92
+ ---------|-------
93
+ displayName | Test retention event type
94
+ description | Description for the retention event type
95
+ createdDateTime | 2023-01-29T09:30:42Z
96
+ lastModifiedDateTime | 2023-01-29T09:30:42Z
97
+ id | c37d695e-d581-4ae9-82a0-9364eba4291e
98
+ createdBy | {"user":{"id":null,"displayName":"John Doe"}}
99
+ lastModifiedBy | {"user":{"id":null,"displayName":"John Doe"}}
100
+ ```
@@ -0,0 +1,65 @@
1
+ # spfx project permissions grant
2
+
3
+ Grant API permissions defined in the current SPFx project
4
+
5
+ ## Usage
6
+
7
+ ```sh
8
+ m365 spfx project permissions grant [options]
9
+ ```
10
+
11
+ ## Options
12
+
13
+ --8<-- "docs/cmd/_global.md"
14
+
15
+ ## Remarks
16
+
17
+ !!! important
18
+ Run this command in the folder where the project is located from where you want to grant the permissions.
19
+
20
+ This command grant the permissions defined in: _package-solution.json_.
21
+
22
+ ## Examples
23
+
24
+ Grant API permissions requested in the current SPFx project
25
+
26
+ ```sh
27
+ m365 spfx project permissions grant
28
+ ```
29
+
30
+ ## Response
31
+
32
+ === "JSON"
33
+
34
+ ```json
35
+ {
36
+ "ClientId": "6004a642-185c-479a-992a-15d1c23e2229",
37
+ "ConsentType": "AllPrincipals",
38
+ "IsDomainIsolated": false,
39
+ "ObjectId": "QqYEYFwYmkeZKhXRwj4iKRcAa6TiIbFNvGnKY1dqONY",
40
+ "PackageName": null,
41
+ "Resource": "Microsoft Graph",
42
+ "ResourceId": "a46b0017-21e2-4db1-bc69-ca63576a38d6",
43
+ "Scope": "Mail.Read"
44
+ }
45
+ ```
46
+
47
+ === "Text"
48
+
49
+ ```text
50
+ ClientId : 6004a642-185c-479a-992a-15d1c23e2229
51
+ ConsentType : AllPrincipals
52
+ IsDomainIsolated: false
53
+ ObjectId : QqYEYFwYmkeZKhXRwj4iKRcAa6TiIbFNvGnKY1dqONY
54
+ PackageName : null
55
+ Resource : Microsoft Graph
56
+ ResourceId : a46b0017-21e2-4db1-bc69-ca63576a38d6
57
+ Scope : Mail.Read
58
+ ```
59
+
60
+ === "CSV"
61
+
62
+ ```csv
63
+ ClientId,ConsentType,IsDomainIsolated,ObjectId,PackageName,Resource,ResourceId,Scope
64
+ 6004a642-185c-479a-992a-15d1c23e2229,AllPrincipals,,QqYEYFwYmkeZKhXRwj4iKRcAa6TiIbFNvGnKY1dqONY,,Microsoft Graph,a46b0017-21e2-4db1-bc69-ca63576a38d6,Mail.Read
65
+ ```
@@ -35,7 +35,7 @@ m365 spo navigation node add [options]
35
35
 
36
36
  ## Remarks
37
37
 
38
- In order to use option `audienceIds`, make sure that audience targeted navigation is enabled using command [spo web set](../web/web-set.md).
38
+ To enable/disable audience targeting for the navigation bar, use the [`spo web set`](../web/web-set.md) command.
39
39
 
40
40
  ## Examples
41
41
 
@@ -32,7 +32,7 @@ m365 spo navigation node set [options]
32
32
 
33
33
  ## Remarks
34
34
 
35
- To enable/disable audience targeting for the nsavigation bar, use command [`spo web set`](../web/web-set.md).
35
+ To enable/disable audience targeting for the navigation bar, use the [`spo web set`](../web/web-set.md) command.
36
36
 
37
37
  ## Examples
38
38
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnp/cli-microsoft365",
3
- "version": "6.3.0-beta.3f7129c",
3
+ "version": "6.3.0-beta.a991329",
4
4
  "description": "Manage Microsoft 365 and SharePoint Framework projects on any platform",
5
5
  "license": "MIT",
6
6
  "main": "./dist/api.js",