@pnp/cli-microsoft365 7.0.0-beta.4bb805e → 7.0.0-beta.68fea7b

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 (27) hide show
  1. package/dist/m365/aad/commands/user/user-get.js +7 -1
  2. package/dist/m365/pa/commands/app/app-owner-set.js +115 -0
  3. package/dist/m365/pa/commands/app/app-permission-list.js +104 -0
  4. package/dist/m365/pa/commands.js +2 -0
  5. package/dist/m365/planner/commands/bucket/bucket-add.js +14 -10
  6. package/dist/m365/planner/commands/bucket/bucket-get.js +25 -19
  7. package/dist/m365/planner/commands/bucket/bucket-list.js +14 -10
  8. package/dist/m365/planner/commands/bucket/bucket-remove.js +26 -20
  9. package/dist/m365/planner/commands/bucket/bucket-set.js +26 -28
  10. package/dist/m365/purview/commands/retentionevent/retentionevent-remove.js +19 -17
  11. package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-remove.js +19 -17
  12. package/dist/m365/spo/commands/site/site-commsite-enable.js +9 -18
  13. package/dist/m365/spo/commands/theme/theme-get.js +1 -2
  14. package/dist/m365/teams/commands/chat/chat-member-add.js +117 -0
  15. package/dist/m365/teams/commands/team/team-app-list.js +1 -1
  16. package/dist/m365/teams/commands.js +1 -0
  17. package/docs/docs/cmd/aad/user/user-get.mdx +118 -25
  18. package/docs/docs/cmd/pa/app/app-owner-set.mdx +60 -0
  19. package/docs/docs/cmd/pa/app/app-permission-list.mdx +132 -0
  20. package/docs/docs/cmd/planner/bucket/bucket-add.mdx +21 -4
  21. package/docs/docs/cmd/planner/bucket/bucket-get.mdx +22 -5
  22. package/docs/docs/cmd/planner/bucket/bucket-list.mdx +21 -4
  23. package/docs/docs/cmd/planner/bucket/bucket-remove.mdx +21 -4
  24. package/docs/docs/cmd/planner/bucket/bucket-set.mdx +22 -5
  25. package/docs/docs/cmd/spo/site/site-commsite-enable.mdx +11 -1
  26. package/docs/docs/cmd/teams/chat/chat-member-add.mdx +66 -0
  27. package/package.json +1 -1
@@ -50,6 +50,9 @@ class AadUserGetCommand extends GraphCommand_1.default {
50
50
  else if (args.options.email) {
51
51
  requestUrl += `?$filter=mail eq '${formatting_1.formatting.encodeQueryParameter(args.options.email)}'${properties}`;
52
52
  }
53
+ if (args.options.withManager) {
54
+ requestUrl += '&$expand=manager($select=displayName,userPrincipalName,id,mail)';
55
+ }
53
56
  const requestOptions = {
54
57
  url: requestUrl,
55
58
  headers: {
@@ -82,7 +85,8 @@ _AadUserGetCommand_instances = new WeakSet(), _AadUserGetCommand_initTelemetry =
82
85
  id: typeof args.options.id !== 'undefined',
83
86
  userName: typeof args.options.userName !== 'undefined',
84
87
  email: typeof args.options.email !== 'undefined',
85
- properties: args.options.properties
88
+ properties: args.options.properties,
89
+ withManager: typeof args.options.withManager !== 'undefined'
86
90
  });
87
91
  });
88
92
  }, _AadUserGetCommand_initOptions = function _AadUserGetCommand_initOptions() {
@@ -94,6 +98,8 @@ _AadUserGetCommand_instances = new WeakSet(), _AadUserGetCommand_initTelemetry =
94
98
  option: '--email [email]'
95
99
  }, {
96
100
  option: '-p, --properties [properties]'
101
+ }, {
102
+ option: '--withManager'
97
103
  });
98
104
  }, _AadUserGetCommand_initValidators = function _AadUserGetCommand_initValidators() {
99
105
  this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
@@ -0,0 +1,115 @@
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 _PaAppOwnerSetCommand_instances, _PaAppOwnerSetCommand_initTelemetry, _PaAppOwnerSetCommand_initOptions, _PaAppOwnerSetCommand_initValidators, _PaAppOwnerSetCommand_initOptionSets;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const request_1 = require("../../../../request");
19
+ const aadUser_1 = require("../../../../utils/aadUser");
20
+ const validation_1 = require("../../../../utils/validation");
21
+ const PowerAppsCommand_1 = require("../../../base/PowerAppsCommand");
22
+ const commands_1 = require("../../commands");
23
+ class PaAppOwnerSetCommand extends PowerAppsCommand_1.default {
24
+ get name() {
25
+ return commands_1.default.APP_OWNER_SET;
26
+ }
27
+ get description() {
28
+ return 'Sets a new owner for a Power Apps app';
29
+ }
30
+ constructor() {
31
+ super();
32
+ _PaAppOwnerSetCommand_instances.add(this);
33
+ __classPrivateFieldGet(this, _PaAppOwnerSetCommand_instances, "m", _PaAppOwnerSetCommand_initTelemetry).call(this);
34
+ __classPrivateFieldGet(this, _PaAppOwnerSetCommand_instances, "m", _PaAppOwnerSetCommand_initOptions).call(this);
35
+ __classPrivateFieldGet(this, _PaAppOwnerSetCommand_instances, "m", _PaAppOwnerSetCommand_initValidators).call(this);
36
+ __classPrivateFieldGet(this, _PaAppOwnerSetCommand_instances, "m", _PaAppOwnerSetCommand_initOptionSets).call(this);
37
+ }
38
+ commandAction(logger, args) {
39
+ return __awaiter(this, void 0, void 0, function* () {
40
+ if (this.verbose) {
41
+ logger.logToStderr(`Setting new owner ${args.options.userId || args.options.userName} for Power Apps app ${args.options.appName}...`);
42
+ }
43
+ try {
44
+ const userId = yield this.getUserId(args.options);
45
+ const requestOptions = {
46
+ url: `${this.resource}/providers/Microsoft.PowerApps/scopes/admin/environments/${args.options.environmentName}/apps/${args.options.appName}/modifyAppOwner?api-version=2022-11-01`,
47
+ headers: {
48
+ accept: 'application/json',
49
+ 'Content-Type': 'application/json'
50
+ },
51
+ responseType: 'json',
52
+ data: {
53
+ roleForOldAppOwner: args.options.roleForOldAppOwner,
54
+ newAppOwner: userId
55
+ }
56
+ };
57
+ yield request_1.default.post(requestOptions);
58
+ }
59
+ catch (err) {
60
+ this.handleRejectedODataJsonPromise(err);
61
+ }
62
+ });
63
+ }
64
+ getUserId(options) {
65
+ return __awaiter(this, void 0, void 0, function* () {
66
+ if (options.userId) {
67
+ return options.userId;
68
+ }
69
+ return aadUser_1.aadUser.getUserIdByUpn(options.userName);
70
+ });
71
+ }
72
+ }
73
+ _PaAppOwnerSetCommand_instances = new WeakSet(), _PaAppOwnerSetCommand_initTelemetry = function _PaAppOwnerSetCommand_initTelemetry() {
74
+ this.telemetry.push((args) => {
75
+ Object.assign(this.telemetryProperties, {
76
+ userId: typeof args.options.userId !== 'undefined',
77
+ userName: typeof args.options.userName !== 'undefined',
78
+ roleForOldAppOwner: typeof args.options.roleForOldAppOwner !== 'undefined'
79
+ });
80
+ });
81
+ }, _PaAppOwnerSetCommand_initOptions = function _PaAppOwnerSetCommand_initOptions() {
82
+ this.options.unshift({
83
+ option: '-e, --environmentName <environmentName>'
84
+ }, {
85
+ option: '--appName <appName>'
86
+ }, {
87
+ option: '--userId [userId]'
88
+ }, {
89
+ option: '--userName [userName]'
90
+ }, {
91
+ option: '--roleForOldAppOwner [roleForOldAppOwner]',
92
+ autocomplete: PaAppOwnerSetCommand.roleForOldAppOwner
93
+ });
94
+ }, _PaAppOwnerSetCommand_initValidators = function _PaAppOwnerSetCommand_initValidators() {
95
+ this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
96
+ if (!validation_1.validation.isValidGuid(args.options.appName)) {
97
+ return `${args.options.appName} is not a valid GUID for appName`;
98
+ }
99
+ if (args.options.userId && !validation_1.validation.isValidGuid(args.options.userId)) {
100
+ return `${args.options.userId} is not a valid GUID for userId`;
101
+ }
102
+ if (args.options.userName && !validation_1.validation.isValidUserPrincipalName(args.options.userName)) {
103
+ return `${args.options.userName} is not a valid UPN for userName`;
104
+ }
105
+ if (args.options.roleForOldAppOwner && PaAppOwnerSetCommand.roleForOldAppOwner.indexOf(args.options.roleForOldAppOwner) < 0) {
106
+ return `${args.options.roleForOldAppOwner} is not a valid roleForOldAppOwner. Allowed values are: ${PaAppOwnerSetCommand.roleForOldAppOwner.join(', ')}`;
107
+ }
108
+ return true;
109
+ }));
110
+ }, _PaAppOwnerSetCommand_initOptionSets = function _PaAppOwnerSetCommand_initOptionSets() {
111
+ this.optionSets.push({ options: ['userId', 'userName'] });
112
+ };
113
+ PaAppOwnerSetCommand.roleForOldAppOwner = ['CanView', 'CanEdit'];
114
+ module.exports = new PaAppOwnerSetCommand();
115
+ //# sourceMappingURL=app-owner-set.js.map
@@ -0,0 +1,104 @@
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 _PaAppPermissionListCommand_instances, _PaAppPermissionListCommand_initTelemetry, _PaAppPermissionListCommand_initOptions, _PaAppPermissionListCommand_initValidators;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const formatting_1 = require("../../../../utils/formatting");
19
+ const odata_1 = require("../../../../utils/odata");
20
+ const validation_1 = require("../../../../utils/validation");
21
+ const PowerAppsCommand_1 = require("../../../base/PowerAppsCommand");
22
+ const commands_1 = require("../../commands");
23
+ class PaAppPermissionListCommand extends PowerAppsCommand_1.default {
24
+ get name() {
25
+ return commands_1.default.APP_PERMISSION_LIST;
26
+ }
27
+ get description() {
28
+ return 'Lists all permissions of a Power Apps app';
29
+ }
30
+ defaultProperties() {
31
+ return ['roleName', 'principalId', 'principalType'];
32
+ }
33
+ constructor() {
34
+ super();
35
+ _PaAppPermissionListCommand_instances.add(this);
36
+ this.allowedRoleNames = ['Owner', 'CanEdit', 'CanView'];
37
+ __classPrivateFieldGet(this, _PaAppPermissionListCommand_instances, "m", _PaAppPermissionListCommand_initTelemetry).call(this);
38
+ __classPrivateFieldGet(this, _PaAppPermissionListCommand_instances, "m", _PaAppPermissionListCommand_initOptions).call(this);
39
+ __classPrivateFieldGet(this, _PaAppPermissionListCommand_instances, "m", _PaAppPermissionListCommand_initValidators).call(this);
40
+ }
41
+ commandAction(logger, args) {
42
+ return __awaiter(this, void 0, void 0, function* () {
43
+ if (this.verbose) {
44
+ logger.logToStderr(`Retrieving permissions for app ${args.options.appName}${args.options.roleName !== undefined ? ` with role name ${args.options.roleName}` : ''}`);
45
+ }
46
+ const url = `${this.resource}/providers/Microsoft.PowerApps${args.options.asAdmin ? '/scopes/admin' : ''}${args.options.environmentName ? '/environments/' + formatting_1.formatting.encodeQueryParameter(args.options.environmentName) : ''}/apps/${args.options.appName}/permissions?api-version=2022-11-01`;
47
+ try {
48
+ let permissions = yield odata_1.odata.getAllItems(url);
49
+ if (args.options.roleName) {
50
+ permissions = permissions.filter(permission => permission.properties.roleName === args.options.roleName);
51
+ }
52
+ if (args.options.output !== 'json') {
53
+ permissions.forEach(permission => {
54
+ permission.roleName = permission.properties.roleName;
55
+ permission.principalId = permission.properties.principal.id;
56
+ permission.principalType = permission.properties.principal.type;
57
+ });
58
+ }
59
+ logger.log(permissions);
60
+ }
61
+ catch (err) {
62
+ this.handleRejectedODataJsonPromise(err);
63
+ }
64
+ });
65
+ }
66
+ }
67
+ _PaAppPermissionListCommand_instances = new WeakSet(), _PaAppPermissionListCommand_initTelemetry = function _PaAppPermissionListCommand_initTelemetry() {
68
+ this.telemetry.push((args) => {
69
+ Object.assign(this.telemetryProperties, {
70
+ asAdmin: !!args.options.asAdmin,
71
+ environmentName: typeof args.options.environmentName !== 'undefined',
72
+ roleName: typeof args.options.roleName !== 'undefined'
73
+ });
74
+ });
75
+ }, _PaAppPermissionListCommand_initOptions = function _PaAppPermissionListCommand_initOptions() {
76
+ this.options.unshift({
77
+ option: '--appName <appName>'
78
+ }, {
79
+ option: '--asAdmin'
80
+ }, {
81
+ option: '-e, --environmentName [environmentName]'
82
+ }, {
83
+ option: '--roleName [roleName]',
84
+ autocomplete: this.allowedRoleNames
85
+ });
86
+ }, _PaAppPermissionListCommand_initValidators = function _PaAppPermissionListCommand_initValidators() {
87
+ this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
88
+ if (!validation_1.validation.isValidGuid(args.options.appName)) {
89
+ return `${args.options.appName} is not a valid GUID for appName.`;
90
+ }
91
+ if (args.options.roleName && !this.allowedRoleNames.includes(args.options.roleName)) {
92
+ return `${args.options.roleName} is not a valid roleName. Allowed values are ${this.allowedRoleNames.join(',')}`;
93
+ }
94
+ if (args.options.asAdmin && !args.options.environmentName) {
95
+ return 'Specifying the environmentName is required when using asAdmin';
96
+ }
97
+ if (!args.options.asAdmin && args.options.environmentName) {
98
+ return 'Specifying environmentName is only allowed when using asAdmin';
99
+ }
100
+ return true;
101
+ }));
102
+ };
103
+ module.exports = new PaAppPermissionListCommand();
104
+ //# sourceMappingURL=app-permission-list.js.map
@@ -7,6 +7,8 @@ exports.default = {
7
7
  APP_LIST: `${prefix} app list`,
8
8
  APP_REMOVE: `${prefix} app remove`,
9
9
  APP_CONSENT_SET: `${prefix} app consent set`,
10
+ APP_OWNER_SET: `${prefix} app owner set`,
11
+ APP_PERMISSION_LIST: `${prefix} app permission list`,
10
12
  CONNECTOR_EXPORT: `${prefix} connector export`,
11
13
  CONNECTOR_LIST: `${prefix} connector list`,
12
14
  ENVIRONMENT_GET: `${prefix} environment get`,
@@ -68,9 +68,13 @@ class PlannerBucketAddCommand extends GraphCommand_1.default {
68
68
  if (args.options.planId) {
69
69
  return args.options.planId;
70
70
  }
71
- const groupId = yield this.getGroupId(args);
72
- const plan = yield planner_1.planner.getPlanByTitle(args.options.planTitle, groupId);
73
- return plan.id;
71
+ if (args.options.planTitle) {
72
+ const groupId = yield this.getGroupId(args);
73
+ const plan = yield planner_1.planner.getPlanByTitle(args.options.planTitle, groupId);
74
+ return plan.id;
75
+ }
76
+ const plans = yield planner_1.planner.getPlansByRosterId(args.options.rosterId);
77
+ return plans[0].id;
74
78
  });
75
79
  }
76
80
  getGroupId(args) {
@@ -88,6 +92,7 @@ _PlannerBucketAddCommand_instances = new WeakSet(), _PlannerBucketAddCommand_ini
88
92
  Object.assign(this.telemetryProperties, {
89
93
  planId: typeof args.options.planId !== 'undefined',
90
94
  planTitle: typeof args.options.planTitle !== 'undefined',
95
+ rosterId: typeof args.options.rosterId !== 'undefined',
91
96
  ownerGroupId: typeof args.options.ownerGroupId !== 'undefined',
92
97
  ownerGroupName: typeof args.options.ownerGroupName !== 'undefined',
93
98
  orderHint: typeof args.options.orderHint !== 'undefined'
@@ -100,6 +105,8 @@ _PlannerBucketAddCommand_instances = new WeakSet(), _PlannerBucketAddCommand_ini
100
105
  option: "--planId [planId]"
101
106
  }, {
102
107
  option: "--planTitle [planTitle]"
108
+ }, {
109
+ option: '--rosterId [rosterId]'
103
110
  }, {
104
111
  option: "--ownerGroupId [ownerGroupId]"
105
112
  }, {
@@ -109,19 +116,16 @@ _PlannerBucketAddCommand_instances = new WeakSet(), _PlannerBucketAddCommand_ini
109
116
  });
110
117
  }, _PlannerBucketAddCommand_initValidators = function _PlannerBucketAddCommand_initValidators() {
111
118
  this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
112
- if (args.options.planTitle && !args.options.ownerGroupId && !args.options.ownerGroupName) {
113
- return 'Specify either ownerGroupId or ownerGroupName when using planTitle';
114
- }
115
- if (args.options.planTitle && args.options.ownerGroupId && args.options.ownerGroupName) {
116
- return 'Specify either ownerGroupId or ownerGroupName when using planTitle but not both';
117
- }
118
119
  if (args.options.ownerGroupId && !validation_1.validation.isValidGuid(args.options.ownerGroupId)) {
119
120
  return `${args.options.ownerGroupId} is not a valid GUID`;
120
121
  }
121
122
  return true;
122
123
  }));
123
124
  }, _PlannerBucketAddCommand_initOptionSets = function _PlannerBucketAddCommand_initOptionSets() {
124
- this.optionSets.push({ options: ['planId', 'planTitle'] });
125
+ this.optionSets.push({ options: ['planId', 'planTitle', 'rosterId'] }, {
126
+ options: ['ownerGroupId', 'ownerGroupName'],
127
+ runsWhen: (args) => args.options.planTitle !== undefined
128
+ });
125
129
  };
126
130
  module.exports = new PlannerBucketAddCommand();
127
131
  //# sourceMappingURL=bucket-add.js.map
@@ -75,13 +75,17 @@ class PlannerBucketGetCommand extends GraphCommand_1.default {
75
75
  }
76
76
  getPlanId(args) {
77
77
  return __awaiter(this, void 0, void 0, function* () {
78
- const { planId, planTitle } = args.options;
78
+ const { planId, planTitle, rosterId } = args.options;
79
79
  if (planId) {
80
80
  return planId;
81
81
  }
82
- const groupId = yield this.getGroupId(args);
83
- const plan = yield planner_1.planner.getPlanByTitle(planTitle, groupId);
84
- return plan.id;
82
+ if (planTitle) {
83
+ const groupId = yield this.getGroupId(args);
84
+ const plan = yield planner_1.planner.getPlanByTitle(planTitle, groupId);
85
+ return plan.id;
86
+ }
87
+ const plans = yield planner_1.planner.getPlansByRosterId(rosterId);
88
+ return plans[0].id;
85
89
  });
86
90
  }
87
91
  getBucketById(id) {
@@ -114,6 +118,7 @@ _PlannerBucketGetCommand_instances = new WeakSet(), _PlannerBucketGetCommand_ini
114
118
  name: typeof args.options.name !== 'undefined',
115
119
  planId: typeof args.options.planId !== 'undefined',
116
120
  planTitle: typeof args.options.planTitle !== 'undefined',
121
+ rosterId: typeof args.options.rosterId !== 'undefined',
117
122
  ownerGroupId: typeof args.options.ownerGroupId !== 'undefined',
118
123
  ownerGroupName: typeof args.options.ownerGroupName !== 'undefined'
119
124
  });
@@ -127,6 +132,8 @@ _PlannerBucketGetCommand_instances = new WeakSet(), _PlannerBucketGetCommand_ini
127
132
  option: '--planId [planId]'
128
133
  }, {
129
134
  option: "--planTitle [planTitle]"
135
+ }, {
136
+ option: '--rosterId [rosterId]'
130
137
  }, {
131
138
  option: '--ownerGroupId [ownerGroupId]'
132
139
  }, {
@@ -135,24 +142,12 @@ _PlannerBucketGetCommand_instances = new WeakSet(), _PlannerBucketGetCommand_ini
135
142
  }, _PlannerBucketGetCommand_initValidators = function _PlannerBucketGetCommand_initValidators() {
136
143
  this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
137
144
  if (args.options.id) {
138
- if (args.options.planId || args.options.planTitle || args.options.ownerGroupId || args.options.ownerGroupName) {
139
- return 'Don\'t specify planId, planTitle, ownerGroupId or ownerGroupName when using id';
145
+ if (args.options.planId || args.options.planTitle || args.options.rosterId || args.options.ownerGroupId || args.options.ownerGroupName) {
146
+ return 'Don\'t specify planId, planTitle, rosterId, ownerGroupId or ownerGroupName when using id';
140
147
  }
141
148
  }
142
149
  if (args.options.name) {
143
- if (!args.options.planId && !args.options.planTitle) {
144
- return 'Specify either planId or planTitle when using name';
145
- }
146
- if (args.options.planId && args.options.planTitle) {
147
- return 'Specify either planId or planTitle when using name but not both';
148
- }
149
150
  if (args.options.planTitle) {
150
- if (!args.options.ownerGroupId && !args.options.ownerGroupName) {
151
- return 'Specify either ownerGroupId or ownerGroupName when using planTitle';
152
- }
153
- if (args.options.ownerGroupId && args.options.ownerGroupName) {
154
- return 'Specify either ownerGroupId or ownerGroupName when using planTitle but not both';
155
- }
156
151
  if (args.options.ownerGroupId && !validation_1.validation.isValidGuid(args.options.ownerGroupId)) {
157
152
  return `${args.options.ownerGroupId} is not a valid GUID`;
158
153
  }
@@ -162,11 +157,22 @@ _PlannerBucketGetCommand_instances = new WeakSet(), _PlannerBucketGetCommand_ini
162
157
  return 'Don\'t specify ownerGroupId or ownerGroupName when using planId';
163
158
  }
164
159
  }
160
+ if (args.options.rosterId) {
161
+ if (args.options.ownerGroupId || args.options.ownerGroupName) {
162
+ return 'Don\'t specify ownerGroupId or ownerGroupName when using rosterId';
163
+ }
164
+ }
165
165
  }
166
166
  return true;
167
167
  }));
168
168
  }, _PlannerBucketGetCommand_initOptionSets = function _PlannerBucketGetCommand_initOptionSets() {
169
- this.optionSets.push({ options: ['id', 'name'] });
169
+ this.optionSets.push({ options: ['id', 'name'] }, {
170
+ options: ['planId', 'planTitle', 'rosterId'],
171
+ runsWhen: (args) => args.options.name !== undefined
172
+ }, {
173
+ options: ['ownerGroupId', 'ownerGroupName'],
174
+ runsWhen: (args) => args.options.planTitle !== undefined
175
+ });
170
176
  };
171
177
  module.exports = new PlannerBucketGetCommand();
172
178
  //# sourceMappingURL=bucket-get.js.map
@@ -56,9 +56,13 @@ class PlannerBucketListCommand extends GraphCommand_1.default {
56
56
  if (args.options.planId) {
57
57
  return args.options.planId;
58
58
  }
59
- const groupId = yield this.getGroupId(args);
60
- const plan = yield planner_1.planner.getPlanByTitle(args.options.planTitle, groupId);
61
- return plan.id;
59
+ if (args.options.planTitle) {
60
+ const groupId = yield this.getGroupId(args);
61
+ const plan = yield planner_1.planner.getPlanByTitle(args.options.planTitle, groupId);
62
+ return plan.id;
63
+ }
64
+ const plans = yield planner_1.planner.getPlansByRosterId(args.options.rosterId);
65
+ return plans[0].id;
62
66
  });
63
67
  }
64
68
  getGroupId(args) {
@@ -76,6 +80,7 @@ _PlannerBucketListCommand_instances = new WeakSet(), _PlannerBucketListCommand_i
76
80
  Object.assign(this.telemetryProperties, {
77
81
  planId: typeof args.options.planId !== 'undefined',
78
82
  planTitle: typeof args.options.planTitle !== 'undefined',
83
+ rosterId: typeof args.options.rosterId !== 'undefined',
79
84
  ownerGroupId: typeof args.options.ownerGroupId !== 'undefined',
80
85
  ownerGroupName: typeof args.options.ownerGroupName !== 'undefined'
81
86
  });
@@ -85,6 +90,8 @@ _PlannerBucketListCommand_instances = new WeakSet(), _PlannerBucketListCommand_i
85
90
  option: '--planId [planId]'
86
91
  }, {
87
92
  option: "--planTitle [planTitle]"
93
+ }, {
94
+ option: '--rosterId [rosterId]'
88
95
  }, {
89
96
  option: '--ownerGroupId [ownerGroupId]'
90
97
  }, {
@@ -92,19 +99,16 @@ _PlannerBucketListCommand_instances = new WeakSet(), _PlannerBucketListCommand_i
92
99
  });
93
100
  }, _PlannerBucketListCommand_initValidators = function _PlannerBucketListCommand_initValidators() {
94
101
  this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
95
- if (args.options.planTitle && !args.options.ownerGroupId && !args.options.ownerGroupName) {
96
- return 'Specify either ownerGroupId or ownerGroupName when using planTitle';
97
- }
98
- if (args.options.planTitle && args.options.ownerGroupId && args.options.ownerGroupName) {
99
- return 'Specify either ownerGroupId or ownerGroupName when using planTitle but not both';
100
- }
101
102
  if (args.options.ownerGroupId && !validation_1.validation.isValidGuid(args.options.ownerGroupId)) {
102
103
  return `${args.options.ownerGroupId} is not a valid GUID`;
103
104
  }
104
105
  return true;
105
106
  }));
106
107
  }, _PlannerBucketListCommand_initOptionSets = function _PlannerBucketListCommand_initOptionSets() {
107
- this.optionSets.push({ options: ['planId', 'planTitle'] });
108
+ this.optionSets.push({ options: ['planId', 'planTitle', 'rosterId'] }, {
109
+ options: ['ownerGroupId', 'ownerGroupName'],
110
+ runsWhen: (args) => args.options.planTitle !== undefined
111
+ });
108
112
  };
109
113
  module.exports = new PlannerBucketListCommand();
110
114
  //# sourceMappingURL=bucket-list.js.map
@@ -105,13 +105,17 @@ class PlannerBucketRemoveCommand extends GraphCommand_1.default {
105
105
  }
106
106
  getPlanId(args) {
107
107
  return __awaiter(this, void 0, void 0, function* () {
108
- const { planId, planTitle } = args.options;
108
+ const { planId, planTitle, rosterId } = args.options;
109
109
  if (planId) {
110
110
  return planId;
111
111
  }
112
- const groupId = yield this.getGroupId(args);
113
- const plan = yield planner_1.planner.getPlanByTitle(planTitle, groupId);
114
- return plan.id;
112
+ if (planTitle) {
113
+ const groupId = yield this.getGroupId(args);
114
+ const plan = yield planner_1.planner.getPlanByTitle(planTitle, groupId);
115
+ return plan.id;
116
+ }
117
+ const plans = yield planner_1.planner.getPlansByRosterId(rosterId);
118
+ return plans[0].id;
115
119
  });
116
120
  }
117
121
  getGroupId(args) {
@@ -132,6 +136,7 @@ _PlannerBucketRemoveCommand_instances = new WeakSet(), _PlannerBucketRemoveComma
132
136
  name: typeof args.options.name !== 'undefined',
133
137
  planId: typeof args.options.planId !== 'undefined',
134
138
  planTitle: typeof args.options.planTitle !== 'undefined',
139
+ rosterId: typeof args.options.rosterId !== 'undefined',
135
140
  ownerGroupId: typeof args.options.ownerGroupId !== 'undefined',
136
141
  ownerGroupName: typeof args.options.ownerGroupName !== 'undefined',
137
142
  force: args.options.force || false
@@ -146,6 +151,8 @@ _PlannerBucketRemoveCommand_instances = new WeakSet(), _PlannerBucketRemoveComma
146
151
  option: '--planId [planId]'
147
152
  }, {
148
153
  option: "--planTitle [planTitle]"
154
+ }, {
155
+ option: '--rosterId [rosterId]'
149
156
  }, {
150
157
  option: '--ownerGroupId [ownerGroupId]'
151
158
  }, {
@@ -156,38 +163,37 @@ _PlannerBucketRemoveCommand_instances = new WeakSet(), _PlannerBucketRemoveComma
156
163
  }, _PlannerBucketRemoveCommand_initValidators = function _PlannerBucketRemoveCommand_initValidators() {
157
164
  this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
158
165
  if (args.options.id) {
159
- if (args.options.planId || args.options.planTitle || args.options.ownerGroupId || args.options.ownerGroupName) {
160
- return 'Don\'t specify planId, planTitle, ownerGroupId or ownerGroupName when using id';
166
+ if (args.options.planId || args.options.planTitle || args.options.rosterId || args.options.ownerGroupId || args.options.ownerGroupName) {
167
+ return 'Don\'t specify planId, planTitle, rosterId, ownerGroupId or ownerGroupName when using id';
161
168
  }
162
169
  }
163
170
  else {
164
- if (!args.options.planId && !args.options.planTitle) {
165
- return 'Specify either planId or planTitle when using name';
166
- }
167
- if (args.options.planId && args.options.planTitle) {
168
- return 'Specify either planId or planTitle when using name but not both';
169
- }
170
171
  if (args.options.planTitle) {
171
- if (!args.options.ownerGroupId && !args.options.ownerGroupName) {
172
- return 'Specify either ownerGroupId or ownerGroupName when using planTitle';
173
- }
174
- if (args.options.ownerGroupId && args.options.ownerGroupName) {
175
- return 'Specify either ownerGroupId or ownerGroupName when using planTitle but not both';
176
- }
177
172
  if (args.options.ownerGroupId && !validation_1.validation.isValidGuid(args.options.ownerGroupId)) {
178
173
  return `${args.options.ownerGroupId} is not a valid GUID`;
179
174
  }
180
175
  }
181
- else {
176
+ else if (args.options.planId) {
182
177
  if (args.options.ownerGroupId || args.options.ownerGroupName) {
183
178
  return 'Don\'t specify ownerGroupId or ownerGroupName when using planId';
184
179
  }
185
180
  }
181
+ else {
182
+ if (args.options.ownerGroupId || args.options.ownerGroupName) {
183
+ return 'Don\'t specify ownerGroupId or ownerGroupName when using rosterId';
184
+ }
185
+ }
186
186
  }
187
187
  return true;
188
188
  }));
189
189
  }, _PlannerBucketRemoveCommand_initOptionSets = function _PlannerBucketRemoveCommand_initOptionSets() {
190
- this.optionSets.push({ options: ['id', 'name'] });
190
+ this.optionSets.push({ options: ['id', 'name'] }, {
191
+ options: ['planId', 'planTitle', 'rosterId'],
192
+ runsWhen: (args) => args.options.name !== undefined
193
+ }, {
194
+ options: ['ownerGroupId', 'ownerGroupName'],
195
+ runsWhen: (args) => args.options.planTitle !== undefined
196
+ });
191
197
  };
192
198
  module.exports = new PlannerBucketRemoveCommand();
193
199
  //# sourceMappingURL=bucket-remove.js.map
@@ -96,13 +96,17 @@ class PlannerBucketSetCommand extends GraphCommand_1.default {
96
96
  }
97
97
  getPlanId(args) {
98
98
  return __awaiter(this, void 0, void 0, function* () {
99
- const { planId, planTitle } = args.options;
99
+ const { planId, planTitle, rosterId } = args.options;
100
100
  if (planId) {
101
101
  return planId;
102
102
  }
103
- const groupId = yield this.getGroupId(args);
104
- const plan = yield planner_1.planner.getPlanByTitle(planTitle, groupId);
105
- return plan.id;
103
+ if (planTitle) {
104
+ const groupId = yield this.getGroupId(args);
105
+ const plan = yield planner_1.planner.getPlanByTitle(planTitle, groupId);
106
+ return plan.id;
107
+ }
108
+ const plans = yield planner_1.planner.getPlansByRosterId(rosterId);
109
+ return plans[0].id;
106
110
  });
107
111
  }
108
112
  getGroupId(args) {
@@ -123,6 +127,7 @@ _PlannerBucketSetCommand_instances = new WeakSet(), _PlannerBucketSetCommand_ini
123
127
  name: typeof args.options.name !== 'undefined',
124
128
  planId: typeof args.options.planId !== 'undefined',
125
129
  planTitle: typeof args.options.planTitle !== 'undefined',
130
+ rosterId: typeof args.options.rosterId !== 'undefined',
126
131
  ownerGroupId: typeof args.options.ownerGroupId !== 'undefined',
127
132
  ownerGroupName: typeof args.options.ownerGroupName !== 'undefined',
128
133
  newName: typeof args.options.newName !== 'undefined',
@@ -138,6 +143,8 @@ _PlannerBucketSetCommand_instances = new WeakSet(), _PlannerBucketSetCommand_ini
138
143
  option: '--planId [planId]'
139
144
  }, {
140
145
  option: "--planTitle [planTitle]"
146
+ }, {
147
+ option: '--rosterId [rosterId]'
141
148
  }, {
142
149
  option: '--ownerGroupId [ownerGroupId]'
143
150
  }, {
@@ -149,33 +156,18 @@ _PlannerBucketSetCommand_instances = new WeakSet(), _PlannerBucketSetCommand_ini
149
156
  });
150
157
  }, _PlannerBucketSetCommand_initValidators = function _PlannerBucketSetCommand_initValidators() {
151
158
  this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
152
- if (args.options.id) {
153
- if (args.options.planId || args.options.planTitle || args.options.ownerGroupId || args.options.ownerGroupName) {
154
- return 'Don\'t specify planId, planTitle, ownerGroupId or ownerGroupName when using id';
155
- }
159
+ if (args.options.id && (args.options.planId || args.options.planTitle || args.options.ownerGroupId || args.options.ownerGroupName || args.options.rosterId)) {
160
+ return 'Don\'t specify planId, planTitle, ownerGroupId, ownerGroupName or rosterId when using id';
156
161
  }
157
162
  if (args.options.name) {
158
- if (!args.options.planId && !args.options.planTitle) {
159
- return 'Specify either planId or planTitle when using name';
163
+ if (args.options.ownerGroupId && !validation_1.validation.isValidGuid(args.options.ownerGroupId)) {
164
+ return `${args.options.ownerGroupId} is not a valid GUID`;
160
165
  }
161
- if (args.options.planId && args.options.planTitle) {
162
- return 'Specify either planId or planTitle when using name but not both';
163
- }
164
- if (args.options.planTitle) {
165
- if (!args.options.ownerGroupId && !args.options.ownerGroupName) {
166
- return 'Specify either ownerGroupId or ownerGroupName when using planTitle';
167
- }
168
- if (args.options.ownerGroupId && args.options.ownerGroupName) {
169
- return 'Specify either ownerGroupId or ownerGroupName when using planTitle but not both';
170
- }
171
- if (args.options.ownerGroupId && !validation_1.validation.isValidGuid(args.options.ownerGroupId)) {
172
- return `${args.options.ownerGroupId} is not a valid GUID`;
173
- }
166
+ if (args.options.planId && (args.options.ownerGroupId || args.options.ownerGroupName)) {
167
+ return 'Don\'t specify ownerGroupId or ownerGroupName when using planId';
174
168
  }
175
- if (args.options.planId) {
176
- if (args.options.ownerGroupId || args.options.ownerGroupName) {
177
- return 'Don\'t specify ownerGroupId or ownerGroupName when using planId';
178
- }
169
+ if (args.options.rosterId && (args.options.ownerGroupId || args.options.ownerGroupName)) {
170
+ return 'Don\'t specify ownerGroupId or ownerGroupName when using rosterId';
179
171
  }
180
172
  }
181
173
  if (!args.options.newName && !args.options.orderHint) {
@@ -184,7 +176,13 @@ _PlannerBucketSetCommand_instances = new WeakSet(), _PlannerBucketSetCommand_ini
184
176
  return true;
185
177
  }));
186
178
  }, _PlannerBucketSetCommand_initOptionSets = function _PlannerBucketSetCommand_initOptionSets() {
187
- this.optionSets.push({ options: ['id', 'name'] });
179
+ this.optionSets.push({ options: ['id', 'name'] }, {
180
+ options: ['planId', 'planTitle', 'rosterId'],
181
+ runsWhen: (args) => args.options.name !== undefined
182
+ }, {
183
+ options: ['ownerGroupId', 'ownerGroupName'],
184
+ runsWhen: (args) => args.options.planTitle !== undefined
185
+ });
188
186
  };
189
187
  module.exports = new PlannerBucketSetCommand();
190
188
  //# sourceMappingURL=bucket-set.js.map