@pnp/cli-microsoft365 6.3.0-beta.655c566 → 6.3.0-beta.80fcd21

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 (127) hide show
  1. package/dist/appInsights.js +2 -1
  2. package/dist/cli/Cli.js +58 -1
  3. package/dist/m365/aad/commands/license/license-list.js +41 -0
  4. package/dist/m365/aad/commands/user/user-add.js +223 -0
  5. package/dist/m365/aad/commands/user/user-license-add.js +88 -0
  6. package/dist/m365/aad/commands/user/user-license-list.js +99 -0
  7. package/dist/m365/aad/commands/user/user-license-remove.js +114 -0
  8. package/dist/m365/aad/commands/user/user-recyclebinitem-clear.js +103 -0
  9. package/dist/m365/aad/commands/user/user-recyclebinitem-list.js +41 -0
  10. package/dist/m365/aad/commands/user/user-recyclebinitem-remove.js +92 -0
  11. package/dist/m365/aad/commands/user/user-recyclebinitem-restore.js +77 -0
  12. package/dist/m365/aad/commands/user/user-remove.js +107 -0
  13. package/dist/m365/aad/commands.js +10 -0
  14. package/dist/m365/flow/commands/environment/FlowEnvironmentDetails.js +3 -0
  15. package/dist/m365/flow/commands/environment/environment-get.js +26 -11
  16. package/dist/m365/pa/commands/environment/environment-get.js +13 -5
  17. package/dist/m365/planner/commands/plan/plan-get.js +17 -10
  18. package/dist/m365/planner/commands/plan/plan-remove.js +1 -1
  19. package/dist/m365/planner/commands/roster/roster-member-remove.js +140 -0
  20. package/dist/m365/planner/commands.js +1 -0
  21. package/dist/m365/pp/commands/environment/environment-get.js +18 -9
  22. package/dist/m365/purview/commands/retentionevent/retentionevent-get.js +3 -4
  23. package/dist/m365/purview/commands/retentionevent/retentionevent-list.js +3 -4
  24. package/dist/m365/purview/commands/retentionevent/retentionevent-remove.js +97 -0
  25. package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-get.js +5 -0
  26. package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-list.js +3 -4
  27. package/dist/m365/purview/commands/retentionlabel/retentionlabel-add.js +5 -0
  28. package/dist/m365/purview/commands/retentionlabel/retentionlabel-get.js +5 -0
  29. package/dist/m365/purview/commands/retentionlabel/retentionlabel-list.js +5 -0
  30. package/dist/m365/purview/commands/retentionlabel/retentionlabel-remove.js +5 -0
  31. package/dist/m365/purview/commands/retentionlabel/retentionlabel-set.js +11 -1
  32. package/dist/m365/purview/commands.js +1 -0
  33. package/dist/m365/spo/commands/customaction/customaction-get.js +17 -66
  34. package/dist/m365/spo/commands/customaction/customaction-list.js +2 -36
  35. package/dist/m365/spo/commands/customaction/customaction-remove.js +11 -18
  36. package/dist/m365/spo/commands/file/file-move.js +0 -2
  37. package/dist/m365/spo/commands/folder/folder-copy.js +0 -2
  38. package/dist/m365/spo/commands/folder/folder-move.js +0 -2
  39. package/dist/m365/spo/commands/site/site-add.js +0 -3
  40. package/dist/m365/spo/commands/site/site-remove.js +0 -3
  41. package/dist/m365/spo/commands/site/site-set.js +0 -2
  42. package/dist/m365/spo/commands/tenant/tenant-recyclebinitem-remove.js +0 -1
  43. package/dist/m365/teams/commands/team/team-add.js +3 -8
  44. package/dist/utils/aadUser.js +38 -0
  45. package/dist/utils/planner.js +1 -4
  46. package/dist/utils/session.js +18 -0
  47. package/dist/utils/spo.js +64 -12
  48. package/docs/docs/cmd/aad/license/license-list.md +87 -0
  49. package/docs/docs/cmd/aad/user/user-add.md +168 -0
  50. package/docs/docs/cmd/aad/user/user-license-add.md +108 -0
  51. package/docs/docs/cmd/aad/user/user-license-list.md +98 -0
  52. package/docs/docs/cmd/aad/user/user-license-remove.md +43 -0
  53. package/docs/docs/cmd/aad/user/user-recyclebinitem-clear.md +42 -0
  54. package/docs/docs/cmd/aad/user/user-recyclebinitem-list.md +82 -0
  55. package/docs/docs/cmd/aad/user/user-recyclebinitem-remove.md +45 -0
  56. package/docs/docs/cmd/aad/user/user-recyclebinitem-restore.md +99 -0
  57. package/docs/docs/cmd/aad/user/user-remove.md +51 -0
  58. package/docs/docs/cmd/aad/user/user-set.md +1 -1
  59. package/docs/docs/cmd/flow/environment/environment-get.md +31 -3
  60. package/docs/docs/cmd/login.md +26 -0
  61. package/docs/docs/cmd/logout.md +4 -0
  62. package/docs/docs/cmd/pa/environment/environment-get.md +8 -2
  63. package/docs/docs/cmd/planner/plan/plan-get.md +12 -12
  64. package/docs/docs/cmd/planner/roster/roster-member-remove.md +51 -0
  65. package/docs/docs/cmd/purview/retentionevent/retentionevent-list.md +1 -1
  66. package/docs/docs/cmd/purview/retentionevent/retentionevent-remove.md +45 -0
  67. package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-get.md +3 -0
  68. package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-list.md +1 -1
  69. package/docs/docs/cmd/purview/retentionlabel/retentionlabel-add.md +3 -0
  70. package/docs/docs/cmd/purview/retentionlabel/retentionlabel-get.md +3 -0
  71. package/docs/docs/cmd/purview/retentionlabel/retentionlabel-list.md +3 -0
  72. package/docs/docs/cmd/purview/retentionlabel/retentionlabel-remove.md +3 -0
  73. package/docs/docs/cmd/purview/retentionlabel/retentionlabel-set.md +3 -0
  74. package/docs/docs/cmd/request.md +74 -0
  75. package/docs/docs/cmd/spo/homesite/homesite-get.md +20 -1
  76. package/docs/docs/cmd/spo/homesite/homesite-remove.md +8 -2
  77. package/docs/docs/cmd/spo/homesite/homesite-set.md +8 -2
  78. package/docs/docs/cmd/spo/hubsite/hubsite-connect.md +9 -9
  79. package/docs/docs/cmd/spo/hubsite/hubsite-data-get.md +34 -5
  80. package/docs/docs/cmd/spo/hubsite/hubsite-disconnect.md +6 -6
  81. package/docs/docs/cmd/spo/hubsite/hubsite-get.md +36 -19
  82. package/docs/docs/cmd/spo/hubsite/hubsite-list.md +59 -1
  83. package/docs/docs/cmd/spo/hubsite/hubsite-register.md +30 -1
  84. package/docs/docs/cmd/spo/hubsite/hubsite-rights-grant.md +6 -6
  85. package/docs/docs/cmd/spo/hubsite/hubsite-rights-revoke.md +4 -4
  86. package/docs/docs/cmd/spo/hubsite/hubsite-set.md +40 -15
  87. package/docs/docs/cmd/spo/hubsite/hubsite-unregister.md +4 -4
  88. package/docs/docs/cmd/spo/knowledgehub/knowledgehub-get.md +7 -1
  89. package/docs/docs/cmd/spo/knowledgehub/knowledgehub-remove.md +9 -3
  90. package/docs/docs/cmd/spo/knowledgehub/knowledgehub-set.md +8 -2
  91. package/docs/docs/cmd/spo/list/list-add.md +123 -57
  92. package/docs/docs/cmd/spo/list/list-contenttype-add.md +50 -5
  93. package/docs/docs/cmd/spo/list/list-contenttype-default-set.md +4 -4
  94. package/docs/docs/cmd/spo/list/list-contenttype-list.md +49 -4
  95. package/docs/docs/cmd/spo/list/list-contenttype-remove.md +6 -6
  96. package/docs/docs/cmd/spo/list/list-get.md +70 -4
  97. package/docs/docs/cmd/spo/list/list-list.md +70 -2
  98. package/docs/docs/cmd/spo/list/list-remove.md +6 -6
  99. package/docs/docs/cmd/spo/list/list-retentionlabel-ensure.md +2 -2
  100. package/docs/docs/cmd/spo/list/list-retentionlabel-get.md +36 -3
  101. package/docs/docs/cmd/spo/list/list-retentionlabel-remove.md +3 -3
  102. package/docs/docs/cmd/spo/list/list-roleassignment-add.md +6 -6
  103. package/docs/docs/cmd/spo/list/list-roleassignment-remove.md +3 -3
  104. package/docs/docs/cmd/spo/list/list-roleinheritance-break.md +9 -9
  105. package/docs/docs/cmd/spo/list/list-roleinheritance-reset.md +7 -7
  106. package/docs/docs/cmd/spo/list/list-set.md +61 -61
  107. package/docs/docs/cmd/spo/list/list-sitescript-get.md +35 -3
  108. package/docs/docs/cmd/spo/list/list-view-add.md +66 -5
  109. package/docs/docs/cmd/spo/list/list-view-field-add.md +10 -10
  110. package/docs/docs/cmd/spo/list/list-view-get.md +61 -0
  111. package/docs/docs/cmd/spo/list/list-view-list.md +61 -0
  112. package/docs/docs/cmd/spo/list/list-view-set.md +1 -1
  113. package/docs/docs/cmd/spo/list/list-webhook-add.md +19 -0
  114. package/docs/docs/cmd/spo/list/list-webhook-get.md +19 -0
  115. package/docs/docs/cmd/spo/list/list-webhook-list.md +19 -0
  116. package/docs/docs/cmd/spo/listitem/listitem-add.md +29 -0
  117. package/docs/docs/cmd/spo/listitem/listitem-attachment-list.md +17 -2
  118. package/docs/docs/cmd/spo/listitem/listitem-get.md +57 -0
  119. package/docs/docs/cmd/spo/listitem/listitem-isrecord.md +6 -0
  120. package/docs/docs/cmd/spo/listitem/listitem-list.md +28 -0
  121. package/docs/docs/cmd/spo/listitem/listitem-record-declare.md +15 -0
  122. package/docs/docs/cmd/spo/listitem/listitem-set.md +30 -0
  123. package/docs/docs/cmd/spo/navigation/navigation-node-add.md +22 -0
  124. package/docs/docs/cmd/status.md +46 -0
  125. package/docs/docs/cmd/version.md +26 -0
  126. package/npm-shrinkwrap.json +912 -876
  127. package/package.json +13 -12
@@ -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 _PaEnvironmentGetCommand_instances, _PaEnvironmentGetCommand_initOptions;
16
+ var _PaEnvironmentGetCommand_instances, _PaEnvironmentGetCommand_initTelemetry, _PaEnvironmentGetCommand_initOptions;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  const request_1 = require("../../../../request");
19
19
  const formatting_1 = require("../../../../utils/formatting");
@@ -32,15 +32,17 @@ class PaEnvironmentGetCommand extends PowerAppsCommand_1.default {
32
32
  constructor() {
33
33
  super();
34
34
  _PaEnvironmentGetCommand_instances.add(this);
35
+ __classPrivateFieldGet(this, _PaEnvironmentGetCommand_instances, "m", _PaEnvironmentGetCommand_initTelemetry).call(this);
35
36
  __classPrivateFieldGet(this, _PaEnvironmentGetCommand_instances, "m", _PaEnvironmentGetCommand_initOptions).call(this);
36
37
  }
37
38
  commandAction(logger, args) {
38
39
  return __awaiter(this, void 0, void 0, function* () {
39
40
  if (this.verbose) {
40
- logger.logToStderr(`Retrieving information about Microsoft Power Apps environment ${args.options.name}...`);
41
+ logger.logToStderr(`Retrieving information about Microsoft Power Apps environment ${args.options.name || 'default'}...`);
41
42
  }
43
+ const environmentName = args.options.name ? formatting_1.formatting.encodeQueryParameter(args.options.name) : '~default';
42
44
  const requestOptions = {
43
- url: `${this.resource}/providers/Microsoft.PowerApps/environments/${formatting_1.formatting.encodeQueryParameter(args.options.name)}?api-version=2016-11-01`,
45
+ url: `${this.resource}/providers/Microsoft.PowerApps/environments/${environmentName}?api-version=2016-11-01`,
44
46
  headers: {
45
47
  accept: 'application/json'
46
48
  },
@@ -61,9 +63,15 @@ class PaEnvironmentGetCommand extends PowerAppsCommand_1.default {
61
63
  });
62
64
  }
63
65
  }
64
- _PaEnvironmentGetCommand_instances = new WeakSet(), _PaEnvironmentGetCommand_initOptions = function _PaEnvironmentGetCommand_initOptions() {
66
+ _PaEnvironmentGetCommand_instances = new WeakSet(), _PaEnvironmentGetCommand_initTelemetry = function _PaEnvironmentGetCommand_initTelemetry() {
67
+ this.telemetry.push((args) => {
68
+ Object.assign(this.telemetryProperties, {
69
+ name: typeof args.options.name !== 'undefined'
70
+ });
71
+ });
72
+ }, _PaEnvironmentGetCommand_initOptions = function _PaEnvironmentGetCommand_initOptions() {
65
73
  this.options.unshift({
66
- option: '-n, --name <name>'
74
+ option: '-n, --name [name]'
67
75
  });
68
76
  };
69
77
  module.exports = new PaEnvironmentGetCommand();
@@ -48,11 +48,18 @@ class PlannerPlanGetCommand extends GraphCommand_1.default {
48
48
  logger.log(result);
49
49
  }
50
50
  else {
51
- let groupId = undefined;
52
- if (args.options.ownerGroupId || args.options.ownerGroupName) {
53
- groupId = yield this.getGroupId(args);
51
+ let plan = {};
52
+ if (args.options.rosterId) {
53
+ const plans = yield planner_1.planner.getPlansByRosterId(args.options.rosterId);
54
+ plan = plans[0];
55
+ }
56
+ else {
57
+ let groupId = undefined;
58
+ if (args.options.ownerGroupId || args.options.ownerGroupName) {
59
+ groupId = yield this.getGroupId(args);
60
+ }
61
+ plan = yield planner_1.planner.getPlanByTitle(args.options.title, groupId);
54
62
  }
55
- const plan = yield planner_1.planner.getPlanByTitle(args.options.title, groupId, args.options.rosterId);
56
63
  const result = yield this.getPlanDetails(plan);
57
64
  if (result) {
58
65
  logger.log(result);
@@ -93,9 +100,9 @@ _PlannerPlanGetCommand_instances = new WeakSet(), _PlannerPlanGetCommand_initTel
93
100
  Object.assign(this.telemetryProperties, {
94
101
  id: typeof args.options.id !== 'undefined',
95
102
  title: typeof args.options.title !== 'undefined',
103
+ rosterId: typeof args.options.rosterId !== 'undefined',
96
104
  ownerGroupId: typeof args.options.ownerGroupId !== 'undefined',
97
- ownerGroupName: typeof args.options.ownerGroupName !== 'undefined',
98
- rosterId: typeof args.options.rosterId !== 'undefined'
105
+ ownerGroupName: typeof args.options.ownerGroupName !== 'undefined'
99
106
  });
100
107
  });
101
108
  }, _PlannerPlanGetCommand_initOptions = function _PlannerPlanGetCommand_initOptions() {
@@ -103,12 +110,12 @@ _PlannerPlanGetCommand_instances = new WeakSet(), _PlannerPlanGetCommand_initTel
103
110
  option: '-i, --id [id]'
104
111
  }, {
105
112
  option: '-t, --title [title]'
113
+ }, {
114
+ option: '--rosterId [rosterId]'
106
115
  }, {
107
116
  option: '--ownerGroupId [ownerGroupId]'
108
117
  }, {
109
118
  option: '--ownerGroupName [ownerGroupName]'
110
- }, {
111
- option: '--rosterId [rosterId]'
112
119
  });
113
120
  }, _PlannerPlanGetCommand_initValidators = function _PlannerPlanGetCommand_initValidators() {
114
121
  this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
@@ -119,9 +126,9 @@ _PlannerPlanGetCommand_instances = new WeakSet(), _PlannerPlanGetCommand_initTel
119
126
  }));
120
127
  }, _PlannerPlanGetCommand_initOptionSets = function _PlannerPlanGetCommand_initOptionSets() {
121
128
  this.optionSets.push({
122
- options: ['id', 'title']
129
+ options: ['id', 'title', 'rosterId']
123
130
  }, {
124
- options: ['ownerGroupId', 'ownerGroupName', 'rosterId'],
131
+ options: ['ownerGroupId', 'ownerGroupName'],
125
132
  runsWhen: (args) => {
126
133
  return args.options.title !== undefined;
127
134
  }
@@ -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, undefined, 'minimal');
82
+ return yield planner_1.planner.getPlanByTitle(title, groupId, 'minimal');
83
83
  });
84
84
  }
85
85
  getGroupId(args) {
@@ -0,0 +1,140 @@
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 _PlannerRosterMemberRemoveCommand_instances, _PlannerRosterMemberRemoveCommand_initTelemetry, _PlannerRosterMemberRemoveCommand_initOptions, _PlannerRosterMemberRemoveCommand_initOptionSets, _PlannerRosterMemberRemoveCommand_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 GraphCommand_1 = require("../../../base/GraphCommand");
22
+ const commands_1 = require("../../commands");
23
+ const odata_1 = require("../../../../utils/odata");
24
+ const aadUser_1 = require("../../../../utils/aadUser");
25
+ class PlannerRosterMemberRemoveCommand extends GraphCommand_1.default {
26
+ get name() {
27
+ return commands_1.default.ROSTER_MEMBER_REMOVE;
28
+ }
29
+ get description() {
30
+ return 'Removes a member from a Microsoft Planner Roster';
31
+ }
32
+ constructor() {
33
+ super();
34
+ _PlannerRosterMemberRemoveCommand_instances.add(this);
35
+ __classPrivateFieldGet(this, _PlannerRosterMemberRemoveCommand_instances, "m", _PlannerRosterMemberRemoveCommand_initTelemetry).call(this);
36
+ __classPrivateFieldGet(this, _PlannerRosterMemberRemoveCommand_instances, "m", _PlannerRosterMemberRemoveCommand_initOptions).call(this);
37
+ __classPrivateFieldGet(this, _PlannerRosterMemberRemoveCommand_instances, "m", _PlannerRosterMemberRemoveCommand_initValidators).call(this);
38
+ __classPrivateFieldGet(this, _PlannerRosterMemberRemoveCommand_instances, "m", _PlannerRosterMemberRemoveCommand_initOptionSets).call(this);
39
+ }
40
+ commandAction(logger, args) {
41
+ return __awaiter(this, void 0, void 0, function* () {
42
+ if (this.verbose) {
43
+ logger.logToStderr(`Removing member ${args.options.userName || args.options.userId} from the Microsoft Planner Roster`);
44
+ }
45
+ if (args.options.confirm) {
46
+ yield this.removeRosterMember(args);
47
+ }
48
+ else {
49
+ const result = yield Cli_1.Cli.prompt({
50
+ type: 'confirm',
51
+ name: 'continue',
52
+ default: false,
53
+ message: `Are you sure you want to remove member '${args.options.userId || args.options.userName}'?`
54
+ });
55
+ if (result.continue) {
56
+ yield this.removeRosterMember(args);
57
+ }
58
+ }
59
+ });
60
+ }
61
+ getUserId(args) {
62
+ return __awaiter(this, void 0, void 0, function* () {
63
+ if (args.options.userId) {
64
+ return args.options.userId;
65
+ }
66
+ return aadUser_1.aadUser.getUserIdByUpn(args.options.userName);
67
+ });
68
+ }
69
+ removeRosterMember(args) {
70
+ return __awaiter(this, void 0, void 0, function* () {
71
+ try {
72
+ const rosterMembersContinue = yield this.removeLastMemberConfirmation(args);
73
+ if (rosterMembersContinue) {
74
+ const userId = yield this.getUserId(args);
75
+ const requestOptions = {
76
+ url: `${this.resource}/beta/planner/rosters/${args.options.rosterId}/members/${userId}`,
77
+ headers: {
78
+ accept: 'application/json;odata.metadata=none'
79
+ },
80
+ responseType: 'json'
81
+ };
82
+ yield request_1.default.delete(requestOptions);
83
+ }
84
+ }
85
+ catch (err) {
86
+ this.handleRejectedODataJsonPromise(err);
87
+ }
88
+ });
89
+ }
90
+ removeLastMemberConfirmation(args) {
91
+ return __awaiter(this, void 0, void 0, function* () {
92
+ if (!args.options.confirm) {
93
+ const rosterMembers = yield odata_1.odata.getAllItems(`${this.resource}/beta/planner/rosters/${args.options.rosterId}/members?$select=Id`);
94
+ if (rosterMembers.length === 1) {
95
+ const result = yield Cli_1.Cli.prompt({
96
+ type: 'confirm',
97
+ name: 'continue',
98
+ default: false,
99
+ message: `You are about to remove the last member of this Roster. When this happens, the Roster and all its contents will be deleted within 30 days. Are you sure you want to proceed?`
100
+ });
101
+ return result.continue;
102
+ }
103
+ }
104
+ return true;
105
+ });
106
+ }
107
+ }
108
+ _PlannerRosterMemberRemoveCommand_instances = new WeakSet(), _PlannerRosterMemberRemoveCommand_initTelemetry = function _PlannerRosterMemberRemoveCommand_initTelemetry() {
109
+ this.telemetry.push((args) => {
110
+ Object.assign(this.telemetryProperties, {
111
+ userId: typeof args.options.userId !== 'undefined',
112
+ userName: typeof args.options.userName !== 'undefined',
113
+ confirm: !!args.options.confirm
114
+ });
115
+ });
116
+ }, _PlannerRosterMemberRemoveCommand_initOptions = function _PlannerRosterMemberRemoveCommand_initOptions() {
117
+ this.options.unshift({
118
+ option: '--rosterId <rosterId>'
119
+ }, {
120
+ option: '--userId [userId]'
121
+ }, {
122
+ option: '--userName [userName]'
123
+ }, {
124
+ option: '--confirm'
125
+ });
126
+ }, _PlannerRosterMemberRemoveCommand_initOptionSets = function _PlannerRosterMemberRemoveCommand_initOptionSets() {
127
+ this.optionSets.push({ options: ['userId', 'userName'] });
128
+ }, _PlannerRosterMemberRemoveCommand_initValidators = function _PlannerRosterMemberRemoveCommand_initValidators() {
129
+ this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
130
+ if (args.options.userId && !validation_1.validation.isValidGuid(args.options.userId)) {
131
+ return `${args.options.userId} is not a valid GUID`;
132
+ }
133
+ if (args.options.userName && !validation_1.validation.isValidUserPrincipalName(args.options.userName)) {
134
+ return `${args.options.userName} is not a valid userName`;
135
+ }
136
+ return true;
137
+ }));
138
+ };
139
+ module.exports = new PlannerRosterMemberRemoveCommand();
140
+ //# sourceMappingURL=roster-member-remove.js.map
@@ -16,6 +16,7 @@ exports.default = {
16
16
  ROSTER_GET: `${prefix} roster get`,
17
17
  ROSTER_MEMBER_ADD: `${prefix} roster member add`,
18
18
  ROSTER_MEMBER_LIST: `${prefix} roster member list`,
19
+ ROSTER_MEMBER_REMOVE: `${prefix} roster member remove`,
19
20
  ROSTER_REMOVE: `${prefix} roster remove`,
20
21
  TASK_ADD: `${prefix} task add`,
21
22
  TASK_CHECKLISTITEM_ADD: `${prefix} task checklistitem add`,
@@ -15,9 +15,10 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
15
15
  };
16
16
  var _PpEnvironmentGetCommand_instances, _PpEnvironmentGetCommand_initTelemetry, _PpEnvironmentGetCommand_initOptions;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- const odata_1 = require("../../../../utils/odata");
19
18
  const PowerPlatformCommand_1 = require("../../../base/PowerPlatformCommand");
20
19
  const commands_1 = require("../../commands");
20
+ const request_1 = require("../../../../request");
21
+ const formatting_1 = require("../../../../utils/formatting");
21
22
  class PpEnvironmentGetCommand extends PowerPlatformCommand_1.default {
22
23
  get name() {
23
24
  return commands_1.default.ENVIRONMENT_GET;
@@ -36,16 +37,24 @@ class PpEnvironmentGetCommand extends PowerPlatformCommand_1.default {
36
37
  }
37
38
  commandAction(logger, args) {
38
39
  return __awaiter(this, void 0, void 0, function* () {
39
- let url = `${this.resource}/providers/Microsoft.BusinessAppPlatform/environments`;
40
- if (args.options.asAdmin) {
41
- url = `${this.resource}/providers/Microsoft.BusinessAppPlatform/scopes/admin/environments`;
40
+ if (this.verbose) {
41
+ logger.logToStderr(`Retrieving environment: ${args.options.name || 'default'}`);
42
42
  }
43
- const res = yield odata_1.odata.getAllItems(`${url}?api-version=2020-10-01`);
44
- const environmentItem = res.filter((env) => args.options.name ? env.name === args.options.name : env.properties.isDefault === true)[0];
45
- if (!environmentItem) {
46
- throw `The specified Power Platform environment does not exist`;
43
+ let url = `${this.resource}/providers/Microsoft.BusinessAppPlatform`;
44
+ if (args.options.asAdmin) {
45
+ url += '/scopes/admin';
47
46
  }
48
- logger.log(environmentItem);
47
+ const envName = args.options.name ? formatting_1.formatting.encodeQueryParameter(args.options.name) : '~Default';
48
+ url += `/environments/${envName}?api-version=2020-10-01`;
49
+ const requestOptions = {
50
+ url: url,
51
+ headers: {
52
+ accept: 'application/json;odata.metadata=none'
53
+ },
54
+ responseType: 'json'
55
+ };
56
+ const response = yield request_1.default.get(requestOptions);
57
+ logger.log(response);
49
58
  });
50
59
  }
51
60
  }
@@ -36,14 +36,13 @@ class PurviewRetentionEventGetCommand extends GraphCommand_1.default {
36
36
  }
37
37
  commandAction(logger, args) {
38
38
  return __awaiter(this, void 0, void 0, function* () {
39
+ if (accessToken_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
40
+ this.handleError('This command does not support application permissions.');
41
+ }
39
42
  if (this.verbose) {
40
43
  logger.logToStderr(`Retrieving retention event with id ${args.options.id}`);
41
44
  }
42
45
  try {
43
- const isAppOnlyAccessToken = accessToken_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken);
44
- if (isAppOnlyAccessToken) {
45
- throw 'This command currently does not support app only permissions.';
46
- }
47
46
  const requestOptions = {
48
47
  url: `${this.resource}/beta/security/triggers/retentionEvents/${args.options.id}`,
49
48
  headers: {
@@ -26,11 +26,10 @@ class PurviewRetentionEventListCommand extends GraphCommand_1.default {
26
26
  }
27
27
  commandAction(logger) {
28
28
  return __awaiter(this, void 0, void 0, function* () {
29
+ if (accessToken_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
30
+ this.handleError('This command does not support application permissions.');
31
+ }
29
32
  try {
30
- const isAppOnlyAccessToken = accessToken_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken);
31
- if (isAppOnlyAccessToken) {
32
- throw 'This command currently does not support app only permissions.';
33
- }
34
33
  if (this.verbose) {
35
34
  logger.logToStderr('Retrieving Purview retention events');
36
35
  }
@@ -0,0 +1,97 @@
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 _PurviewRetentionEventRemoveCommand_instances, _PurviewRetentionEventRemoveCommand_initTelemetry, _PurviewRetentionEventRemoveCommand_initOptions, _PurviewRetentionEventRemoveCommand_initValidators;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const Auth_1 = require("../../../../Auth");
19
+ const Cli_1 = require("../../../../cli/Cli");
20
+ const validation_1 = require("../../../../utils/validation");
21
+ const request_1 = require("../../../../request");
22
+ const GraphCommand_1 = require("../../../base/GraphCommand");
23
+ const commands_1 = require("../../commands");
24
+ const accessToken_1 = require("../../../../utils/accessToken");
25
+ class PurviewRetentionEventRemoveCommand extends GraphCommand_1.default {
26
+ get name() {
27
+ return commands_1.default.RETENTIONEVENT_REMOVE;
28
+ }
29
+ get description() {
30
+ return 'Delete a retention event';
31
+ }
32
+ constructor() {
33
+ super();
34
+ _PurviewRetentionEventRemoveCommand_instances.add(this);
35
+ __classPrivateFieldGet(this, _PurviewRetentionEventRemoveCommand_instances, "m", _PurviewRetentionEventRemoveCommand_initTelemetry).call(this);
36
+ __classPrivateFieldGet(this, _PurviewRetentionEventRemoveCommand_instances, "m", _PurviewRetentionEventRemoveCommand_initOptions).call(this);
37
+ __classPrivateFieldGet(this, _PurviewRetentionEventRemoveCommand_instances, "m", _PurviewRetentionEventRemoveCommand_initValidators).call(this);
38
+ }
39
+ commandAction(logger, args) {
40
+ return __awaiter(this, void 0, void 0, function* () {
41
+ if (accessToken_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
42
+ this.handleError('This command does not support application permissions.');
43
+ }
44
+ const removeRetentionEvent = () => __awaiter(this, void 0, void 0, function* () {
45
+ try {
46
+ const requestOptions = {
47
+ url: `${this.resource}/beta/security/triggers/retentionEvents/${args.options.id}`,
48
+ headers: {
49
+ accept: 'application/json;odata.metadata=none'
50
+ },
51
+ responseType: 'json'
52
+ };
53
+ yield request_1.default.delete(requestOptions);
54
+ }
55
+ catch (err) {
56
+ this.handleRejectedODataJsonPromise(err);
57
+ }
58
+ });
59
+ if (args.options.confirm) {
60
+ yield removeRetentionEvent();
61
+ }
62
+ else {
63
+ const result = yield Cli_1.Cli.prompt({
64
+ type: 'confirm',
65
+ name: 'continue',
66
+ default: false,
67
+ message: `Are you sure you want to remove the retention event ${args.options.id}?`
68
+ });
69
+ if (result.continue) {
70
+ yield removeRetentionEvent();
71
+ }
72
+ }
73
+ });
74
+ }
75
+ }
76
+ _PurviewRetentionEventRemoveCommand_instances = new WeakSet(), _PurviewRetentionEventRemoveCommand_initTelemetry = function _PurviewRetentionEventRemoveCommand_initTelemetry() {
77
+ this.telemetry.push((args) => {
78
+ Object.assign(this.telemetryProperties, {
79
+ confirm: !!args.options.confirm
80
+ });
81
+ });
82
+ }, _PurviewRetentionEventRemoveCommand_initOptions = function _PurviewRetentionEventRemoveCommand_initOptions() {
83
+ this.options.unshift({
84
+ option: '-i, --id <id>'
85
+ }, {
86
+ option: '--confirm'
87
+ });
88
+ }, _PurviewRetentionEventRemoveCommand_initValidators = function _PurviewRetentionEventRemoveCommand_initValidators() {
89
+ this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
90
+ if (!validation_1.validation.isValidGuid(args.options.id)) {
91
+ return `'${args.options.id}' is not a valid GUID.`;
92
+ }
93
+ return true;
94
+ }));
95
+ };
96
+ module.exports = new PurviewRetentionEventRemoveCommand();
97
+ //# sourceMappingURL=retentionevent-remove.js.map
@@ -15,10 +15,12 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
15
15
  };
16
16
  var _PurviewRetentionEventTypeGetCommand_instances, _PurviewRetentionEventTypeGetCommand_initOptions, _PurviewRetentionEventTypeGetCommand_initValidators;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
+ const Auth_1 = require("../../../../Auth");
18
19
  const GraphCommand_1 = require("../../../base/GraphCommand");
19
20
  const commands_1 = require("../../commands");
20
21
  const request_1 = require("../../../../request");
21
22
  const validation_1 = require("../../../../utils/validation");
23
+ const accessToken_1 = require("../../../../utils/accessToken");
22
24
  class PurviewRetentionEventTypeGetCommand extends GraphCommand_1.default {
23
25
  get name() {
24
26
  return commands_1.default.RETENTIONEVENTTYPE_GET;
@@ -34,6 +36,9 @@ class PurviewRetentionEventTypeGetCommand extends GraphCommand_1.default {
34
36
  }
35
37
  commandAction(logger, args) {
36
38
  return __awaiter(this, void 0, void 0, function* () {
39
+ if (accessToken_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
40
+ this.handleError('This command does not support application permissions.');
41
+ }
37
42
  try {
38
43
  if (this.verbose) {
39
44
  logger.logToStderr(`Retrieving retention event type with id ${args.options.id}`);
@@ -26,11 +26,10 @@ class PurviewRetentionEventTypeListCommand extends GraphCommand_1.default {
26
26
  }
27
27
  commandAction(logger) {
28
28
  return __awaiter(this, void 0, void 0, function* () {
29
+ if (accessToken_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
30
+ this.handleError('This command does not support application permissions.');
31
+ }
29
32
  try {
30
- const isAppOnlyAccessToken = accessToken_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken);
31
- if (isAppOnlyAccessToken) {
32
- throw 'This command currently does not support app only permissions.';
33
- }
34
33
  const items = yield odata_1.odata.getAllItems(`${this.resource}/beta/security/triggerTypes/retentionEventTypes`);
35
34
  logger.log(items);
36
35
  }
@@ -15,7 +15,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
15
15
  };
16
16
  var _PurviewRetentionLabelAddCommand_instances, _PurviewRetentionLabelAddCommand_initTelemetry, _PurviewRetentionLabelAddCommand_initOptions, _PurviewRetentionLabelAddCommand_initValidators;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
+ const Auth_1 = require("../../../../Auth");
18
19
  const request_1 = require("../../../../request");
20
+ const accessToken_1 = require("../../../../utils/accessToken");
19
21
  const GraphCommand_1 = require("../../../base/GraphCommand");
20
22
  const commands_1 = require("../../commands");
21
23
  class PurviewRetentionLabelAddCommand extends GraphCommand_1.default {
@@ -34,6 +36,9 @@ class PurviewRetentionLabelAddCommand extends GraphCommand_1.default {
34
36
  }
35
37
  commandAction(logger, args) {
36
38
  return __awaiter(this, void 0, void 0, function* () {
39
+ if (accessToken_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
40
+ this.handleError('This command does not support application permissions.');
41
+ }
37
42
  const retentionTrigger = args.options.retentionTrigger ? args.options.retentionTrigger : 'dateLabeled';
38
43
  const defaultRecordBehavior = args.options.defaultRecordBehavior ? args.options.defaultRecordBehavior : 'startLocked';
39
44
  const requestBody = {
@@ -15,10 +15,12 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
15
15
  };
16
16
  var _PurviewRetentionLabelGetCommand_instances, _PurviewRetentionLabelGetCommand_initOptions, _PurviewRetentionLabelGetCommand_initValidators;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
+ const Auth_1 = require("../../../../Auth");
18
19
  const GraphCommand_1 = require("../../../base/GraphCommand");
19
20
  const commands_1 = require("../../commands");
20
21
  const request_1 = require("../../../../request");
21
22
  const validation_1 = require("../../../../utils/validation");
23
+ const accessToken_1 = require("../../../../utils/accessToken");
22
24
  class PurviewRetentionLabelGetCommand extends GraphCommand_1.default {
23
25
  get name() {
24
26
  return commands_1.default.RETENTIONLABEL_GET;
@@ -34,6 +36,9 @@ class PurviewRetentionLabelGetCommand extends GraphCommand_1.default {
34
36
  }
35
37
  commandAction(logger, args) {
36
38
  return __awaiter(this, void 0, void 0, function* () {
39
+ if (accessToken_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
40
+ this.handleError('This command does not support application permissions.');
41
+ }
37
42
  try {
38
43
  if (this.verbose) {
39
44
  logger.logToStderr(`Retrieving retention label with id ${args.options.id}`);
@@ -9,6 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
+ const Auth_1 = require("../../../../Auth");
13
+ const accessToken_1 = require("../../../../utils/accessToken");
12
14
  const odata_1 = require("../../../../utils/odata");
13
15
  const GraphCommand_1 = require("../../../base/GraphCommand");
14
16
  const commands_1 = require("../../commands");
@@ -24,6 +26,9 @@ class PurviewRetentionLabelListCommand extends GraphCommand_1.default {
24
26
  }
25
27
  commandAction(logger) {
26
28
  return __awaiter(this, void 0, void 0, function* () {
29
+ if (accessToken_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
30
+ this.handleError('This command does not support application permissions.');
31
+ }
27
32
  try {
28
33
  const items = yield odata_1.odata.getAllItems(`${this.resource}/beta/security/labels/retentionLabels`);
29
34
  logger.log(items);
@@ -15,11 +15,13 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
15
15
  };
16
16
  var _PurviewRetentionLabelRemoveCommand_instances, _PurviewRetentionLabelRemoveCommand_initTelemetry, _PurviewRetentionLabelRemoveCommand_initOptions, _PurviewRetentionLabelRemoveCommand_initValidators;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
+ const Auth_1 = require("../../../../Auth");
18
19
  const Cli_1 = require("../../../../cli/Cli");
19
20
  const validation_1 = require("../../../../utils/validation");
20
21
  const request_1 = require("../../../../request");
21
22
  const GraphCommand_1 = require("../../../base/GraphCommand");
22
23
  const commands_1 = require("../../commands");
24
+ const accessToken_1 = require("../../../../utils/accessToken");
23
25
  class PurviewRetentionLabelRemoveCommand extends GraphCommand_1.default {
24
26
  get name() {
25
27
  return commands_1.default.RETENTIONLABEL_REMOVE;
@@ -36,6 +38,9 @@ class PurviewRetentionLabelRemoveCommand extends GraphCommand_1.default {
36
38
  }
37
39
  commandAction(logger, args) {
38
40
  return __awaiter(this, void 0, void 0, function* () {
41
+ if (accessToken_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
42
+ this.handleError('This command does not support application permissions.');
43
+ }
39
44
  const removeRetentionLabel = () => __awaiter(this, void 0, void 0, function* () {
40
45
  try {
41
46
  const requestOptions = {
@@ -15,10 +15,12 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
15
15
  };
16
16
  var _PurviewRetentionLabelSetCommand_instances, _PurviewRetentionLabelSetCommand_initTelemetry, _PurviewRetentionLabelSetCommand_initOptions, _PurviewRetentionLabelSetCommand_initValidators;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
+ const Auth_1 = require("../../../../Auth");
18
19
  const validation_1 = require("../../../../utils/validation");
19
20
  const request_1 = require("../../../../request");
20
21
  const GraphCommand_1 = require("../../../base/GraphCommand");
21
22
  const commands_1 = require("../../commands");
23
+ const accessToken_1 = require("../../../../utils/accessToken");
22
24
  class PurviewRetentionLabelSetCommand extends GraphCommand_1.default {
23
25
  get name() {
24
26
  return commands_1.default.RETENTIONLABEL_SET;
@@ -39,6 +41,9 @@ class PurviewRetentionLabelSetCommand extends GraphCommand_1.default {
39
41
  }
40
42
  commandAction(logger, args) {
41
43
  return __awaiter(this, void 0, void 0, function* () {
44
+ if (accessToken_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
45
+ this.handleError('This command does not support application permissions.');
46
+ }
42
47
  if (this.verbose) {
43
48
  logger.log(`Starting to update retention label with id ${args.options.id}`);
44
49
  }
@@ -51,7 +56,12 @@ class PurviewRetentionLabelSetCommand extends GraphCommand_1.default {
51
56
  responseType: 'json',
52
57
  data: requestBody
53
58
  };
54
- yield request_1.default.patch(requestOptions);
59
+ try {
60
+ yield request_1.default.patch(requestOptions);
61
+ }
62
+ catch (err) {
63
+ this.handleRejectedODataJsonPromise(err);
64
+ }
55
65
  });
56
66
  }
57
67
  mapRequestBody(options) {
@@ -5,6 +5,7 @@ exports.default = {
5
5
  AUDITLOG_LIST: `${prefix} auditlog list`,
6
6
  RETENTIONEVENT_GET: `${prefix} retentionevent get`,
7
7
  RETENTIONEVENT_LIST: `${prefix} retentionevent list`,
8
+ RETENTIONEVENT_REMOVE: `${prefix} retentionevent remove`,
8
9
  RETENTIONEVENTTYPE_ADD: `${prefix} retentioneventtype add`,
9
10
  RETENTIONEVENTTYPE_GET: `${prefix} retentioneventtype get`,
10
11
  RETENTIONEVENTTYPE_LIST: `${prefix} retentioneventtype list`,