@pnp/cli-microsoft365 6.0.0-beta.09b5216 → 6.0.0-beta.f73c4f8

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 (44) hide show
  1. package/dist/Command.js +22 -0
  2. package/dist/m365/planner/commands/bucket/bucket-add.js +17 -9
  3. package/dist/m365/planner/commands/bucket/bucket-get.js +19 -11
  4. package/dist/m365/planner/commands/bucket/bucket-list.js +17 -9
  5. package/dist/m365/planner/commands/bucket/bucket-remove.js +19 -11
  6. package/dist/m365/planner/commands/bucket/bucket-set.js +19 -11
  7. package/dist/m365/planner/commands/plan/plan-get.js +1 -1
  8. package/dist/m365/planner/commands/plan/plan-remove.js +1 -1
  9. package/dist/m365/planner/commands/task/task-add.js +16 -16
  10. package/dist/m365/planner/commands/task/task-get.js +14 -9
  11. package/dist/m365/planner/commands/task/task-list.js +19 -11
  12. package/dist/m365/planner/commands/task/task-reference-add.js +1 -7
  13. package/dist/m365/planner/commands/task/task-reference-remove.js +11 -14
  14. package/dist/m365/planner/commands/task/task-remove.js +4 -19
  15. package/dist/m365/planner/commands/task/task-set.js +17 -23
  16. package/dist/m365/search/commands/externalconnection/externalconnection-get.js +69 -0
  17. package/dist/m365/search/commands.js +1 -0
  18. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN015008_FILE_eslintrc_js.js +7 -0
  19. package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.15.0.js +6 -4
  20. package/dist/m365/spo/base-permissions.js +9 -0
  21. package/dist/m365/spo/commands/hubsite/hubsite-get.js +62 -12
  22. package/dist/m365/spo/commands/roledefinition/RoleDefinition.js +3 -0
  23. package/dist/m365/spo/commands/roledefinition/RoleType.js +16 -0
  24. package/dist/m365/spo/commands/roledefinition/roledefinition-get.js +59 -0
  25. package/dist/m365/spo/commands.js +1 -0
  26. package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-health-get.js +1 -9
  27. package/dist/utils/accessToken.js +18 -0
  28. package/dist/utils/planner.js +6 -6
  29. package/dist/utils/validation.js +5 -1
  30. package/docs/docs/cmd/aad/user/user-get.md +12 -0
  31. package/docs/docs/cmd/planner/bucket/bucket-add.md +9 -6
  32. package/docs/docs/cmd/planner/bucket/bucket-get.md +10 -7
  33. package/docs/docs/cmd/planner/bucket/bucket-list.md +8 -5
  34. package/docs/docs/cmd/planner/bucket/bucket-remove.md +8 -5
  35. package/docs/docs/cmd/planner/bucket/bucket-set.md +9 -6
  36. package/docs/docs/cmd/planner/plan/plan-remove.md +1 -1
  37. package/docs/docs/cmd/planner/task/task-add.md +11 -8
  38. package/docs/docs/cmd/planner/task/task-get.md +11 -8
  39. package/docs/docs/cmd/planner/task/task-list.md +9 -6
  40. package/docs/docs/cmd/planner/task/task-set.md +9 -6
  41. package/docs/docs/cmd/search/externalconnection/externalconnection-get.md +33 -0
  42. package/docs/docs/cmd/spo/hubsite/hubsite-get.md +19 -8
  43. package/docs/docs/cmd/spo/roledefinition/roledefinition-get.md +27 -0
  44. package/package.json +1 -1
package/dist/Command.js CHANGED
@@ -14,6 +14,7 @@ const appInsights_1 = require("./appInsights");
14
14
  const Auth_1 = require("./Auth");
15
15
  const cli_1 = require("./cli");
16
16
  const request_1 = require("./request");
17
+ const utils_1 = require("./utils");
17
18
  class CommandError {
18
19
  constructor(message, code) {
19
20
  this.message = message;
@@ -81,6 +82,7 @@ class Command {
81
82
  cb(new CommandError('Log in to Microsoft 365 first'));
82
83
  return;
83
84
  }
85
+ this.loadValuesFromAccessToken(args);
84
86
  this.commandAction(logger, args, cb);
85
87
  }, (error) => {
86
88
  cb(new CommandError(error));
@@ -292,6 +294,26 @@ class Command {
292
294
  payload[o] = unknownOptions[o];
293
295
  });
294
296
  }
297
+ loadValuesFromAccessToken(args) {
298
+ if (!Auth_1.default.service.accessTokens[Auth_1.default.defaultResource]) {
299
+ return;
300
+ }
301
+ const token = Auth_1.default.service.accessTokens[Auth_1.default.defaultResource].accessToken;
302
+ const optionNames = Object.getOwnPropertyNames(args.options);
303
+ optionNames.forEach(option => {
304
+ const value = args.options[option];
305
+ if (!value || typeof value !== 'string') {
306
+ return;
307
+ }
308
+ const lowerCaseValue = value.toLowerCase();
309
+ if (lowerCaseValue === '@meid') {
310
+ args.options[option] = utils_1.accessToken.getUserIdFromAccessToken(token);
311
+ }
312
+ if (lowerCaseValue === '@meusername') {
313
+ args.options[option] = utils_1.accessToken.getUserNameFromAccessToken(token);
314
+ }
315
+ });
316
+ }
295
317
  }
296
318
  exports.default = Command;
297
319
  //# sourceMappingURL=Command.js.map
@@ -18,6 +18,7 @@ class PlannerBucketAddCommand extends GraphCommand_1.default {
18
18
  const telemetryProps = super.getTelemetryProperties(args);
19
19
  telemetryProps.planId = typeof args.options.planId !== 'undefined';
20
20
  telemetryProps.planName = typeof args.options.planName !== 'undefined';
21
+ telemetryProps.planTitle = typeof args.options.planTitle !== 'undefined';
21
22
  telemetryProps.ownerGroupId = typeof args.options.ownerGroupId !== 'undefined';
22
23
  telemetryProps.ownerGroupName = typeof args.options.ownerGroupName !== 'undefined';
23
24
  telemetryProps.orderHint = typeof args.options.orderHint !== 'undefined';
@@ -27,6 +28,10 @@ class PlannerBucketAddCommand extends GraphCommand_1.default {
27
28
  return ['id', 'name', 'planId', 'orderHint'];
28
29
  }
29
30
  commandAction(logger, args, cb) {
31
+ if (args.options.planName) {
32
+ args.options.planTitle = args.options.planName;
33
+ this.warn(logger, `Option 'planName' is deprecated. Please use 'planTitle' instead`);
34
+ }
30
35
  if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
31
36
  this.handleError('This command does not support application permissions.', logger, cb);
32
37
  return;
@@ -59,7 +64,7 @@ class PlannerBucketAddCommand extends GraphCommand_1.default {
59
64
  }
60
65
  return this
61
66
  .getGroupId(args)
62
- .then(groupId => planner_1.planner.getPlanByName(args.options.planName, groupId))
67
+ .then(groupId => planner_1.planner.getPlanByTitle(args.options.planTitle, groupId))
63
68
  .then(plan => plan.id);
64
69
  }
65
70
  getGroupId(args) {
@@ -81,6 +86,9 @@ class PlannerBucketAddCommand extends GraphCommand_1.default {
81
86
  {
82
87
  option: "--planName [planName]"
83
88
  },
89
+ {
90
+ option: "--planTitle [planTitle]"
91
+ },
84
92
  {
85
93
  option: "--ownerGroupId [ownerGroupId]"
86
94
  },
@@ -95,17 +103,17 @@ class PlannerBucketAddCommand extends GraphCommand_1.default {
95
103
  return options.concat(parentOptions);
96
104
  }
97
105
  validate(args) {
98
- if (!args.options.planId && !args.options.planName) {
99
- return 'Specify either planId or planName';
106
+ if (!args.options.planId && !args.options.planName && !args.options.planTitle) {
107
+ return 'Specify either planId or planTitle';
100
108
  }
101
- if (args.options.planId && args.options.planName) {
102
- return 'Specify either planId or planName but not both';
109
+ if (args.options.planId && (args.options.planName || args.options.planTitle)) {
110
+ return 'Specify either planId or planTitle but not both';
103
111
  }
104
- if (args.options.planName && !args.options.ownerGroupId && !args.options.ownerGroupName) {
105
- return 'Specify either ownerGroupId or ownerGroupName when using planName';
112
+ if ((args.options.planName || args.options.planTitle) && !args.options.ownerGroupId && !args.options.ownerGroupName) {
113
+ return 'Specify either ownerGroupId or ownerGroupName when using planTitle';
106
114
  }
107
- if (args.options.planName && args.options.ownerGroupId && args.options.ownerGroupName) {
108
- return 'Specify either ownerGroupId or ownerGroupName when using planName but not both';
115
+ if ((args.options.planName || args.options.planTitle) && args.options.ownerGroupId && args.options.ownerGroupName) {
116
+ return 'Specify either ownerGroupId or ownerGroupName when using planTitle but not both';
109
117
  }
110
118
  if (args.options.ownerGroupId && !utils_1.validation.isValidGuid(args.options.ownerGroupId)) {
111
119
  return `${args.options.ownerGroupId} is not a valid GUID`;
@@ -29,11 +29,16 @@ class PlannerBucketGetCommand extends GraphCommand_1.default {
29
29
  telemetryProps.name = typeof args.options.name !== 'undefined';
30
30
  telemetryProps.planId = typeof args.options.planId !== 'undefined';
31
31
  telemetryProps.planName = typeof args.options.planName !== 'undefined';
32
+ telemetryProps.planTitle = typeof args.options.planTitle !== 'undefined';
32
33
  telemetryProps.ownerGroupId = typeof args.options.ownerGroupId !== 'undefined';
33
34
  telemetryProps.ownerGroupName = typeof args.options.ownerGroupName !== 'undefined';
34
35
  return telemetryProps;
35
36
  }
36
37
  commandAction(logger, args, cb) {
38
+ if (args.options.planName) {
39
+ args.options.planTitle = args.options.planName;
40
+ this.warn(logger, `Option 'planName' is deprecated. Please use 'planTitle' instead`);
41
+ }
37
42
  if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
38
43
  this.handleError('This command does not support application permissions.', logger, cb);
39
44
  return;
@@ -75,13 +80,13 @@ class PlannerBucketGetCommand extends GraphCommand_1.default {
75
80
  });
76
81
  }
77
82
  getPlanId(args) {
78
- const { planId, planName } = args.options;
83
+ const { planId, planTitle } = args.options;
79
84
  if (planId) {
80
85
  return Promise.resolve(planId);
81
86
  }
82
87
  return this
83
88
  .getGroupId(args)
84
- .then(groupId => planner_1.planner.getPlanByName(planName, groupId))
89
+ .then(groupId => planner_1.planner.getPlanByTitle(planTitle, groupId))
85
90
  .then(plan => plan.id);
86
91
  }
87
92
  getBucketById(id) {
@@ -119,6 +124,9 @@ class PlannerBucketGetCommand extends GraphCommand_1.default {
119
124
  {
120
125
  option: '--planName [planName]'
121
126
  },
127
+ {
128
+ option: "--planTitle [planTitle]"
129
+ },
122
130
  {
123
131
  option: '--ownerGroupId [ownerGroupId]'
124
132
  },
@@ -131,26 +139,26 @@ class PlannerBucketGetCommand extends GraphCommand_1.default {
131
139
  }
132
140
  validate(args) {
133
141
  if (args.options.id) {
134
- if (args.options.planId || args.options.planName || args.options.ownerGroupId || args.options.ownerGroupName) {
135
- return 'Don\'t specify planId, planName, ownerGroupId or ownerGroupName when using id';
142
+ if (args.options.planId || args.options.planName || args.options.planTitle || args.options.ownerGroupId || args.options.ownerGroupName) {
143
+ return 'Don\'t specify planId, planTitle, ownerGroupId or ownerGroupName when using id';
136
144
  }
137
145
  if (args.options.name) {
138
146
  return 'Specify either id or name';
139
147
  }
140
148
  }
141
149
  if (args.options.name) {
142
- if (!args.options.planId && !args.options.planName) {
143
- return 'Specify either planId or planName when using name';
150
+ if (!args.options.planId && !args.options.planName && !args.options.planTitle) {
151
+ return 'Specify either planId or planTitle when using name';
144
152
  }
145
- if (args.options.planId && args.options.planName) {
146
- return 'Specify either planId or planName when using name but not both';
153
+ if (args.options.planId && (args.options.planName || args.options.planTitle)) {
154
+ return 'Specify either planId or planTitle when using name but not both';
147
155
  }
148
- if (args.options.planName) {
156
+ if (args.options.planName || args.options.planTitle) {
149
157
  if (!args.options.ownerGroupId && !args.options.ownerGroupName) {
150
- return 'Specify either ownerGroupId or ownerGroupName when using planName';
158
+ return 'Specify either ownerGroupId or ownerGroupName when using planTitle';
151
159
  }
152
160
  if (args.options.ownerGroupId && args.options.ownerGroupName) {
153
- return 'Specify either ownerGroupId or ownerGroupName when using planName but not both';
161
+ return 'Specify either ownerGroupId or ownerGroupName when using planTitle but not both';
154
162
  }
155
163
  if (args.options.ownerGroupId && !utils_1.validation.isValidGuid(args.options.ownerGroupId)) {
156
164
  return `${args.options.ownerGroupId} is not a valid GUID`;
@@ -17,6 +17,7 @@ class PlannerBucketListCommand extends GraphCommand_1.default {
17
17
  const telemetryProps = super.getTelemetryProperties(args);
18
18
  telemetryProps.planId = typeof args.options.planId !== 'undefined';
19
19
  telemetryProps.planName = typeof args.options.planName !== 'undefined';
20
+ telemetryProps.planTitle = typeof args.options.planTitle !== 'undefined';
20
21
  telemetryProps.ownerGroupId = typeof args.options.ownerGroupId !== 'undefined';
21
22
  telemetryProps.ownerGroupName = typeof args.options.ownerGroupName !== 'undefined';
22
23
  return telemetryProps;
@@ -25,6 +26,10 @@ class PlannerBucketListCommand extends GraphCommand_1.default {
25
26
  return ['id', 'name', 'planId', 'orderHint'];
26
27
  }
27
28
  commandAction(logger, args, cb) {
29
+ if (args.options.planName) {
30
+ args.options.planTitle = args.options.planName;
31
+ this.warn(logger, `Option 'planName' is deprecated. Please use 'planTitle' instead`);
32
+ }
28
33
  if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
29
34
  this.handleError('This command does not support application permissions.', logger, cb);
30
35
  return;
@@ -43,7 +48,7 @@ class PlannerBucketListCommand extends GraphCommand_1.default {
43
48
  }
44
49
  return this
45
50
  .getGroupId(args)
46
- .then(groupId => planner_1.planner.getPlanByName(args.options.planName, groupId))
51
+ .then(groupId => planner_1.planner.getPlanByTitle(args.options.planTitle, groupId))
47
52
  .then(plan => plan.id);
48
53
  }
49
54
  getGroupId(args) {
@@ -62,6 +67,9 @@ class PlannerBucketListCommand extends GraphCommand_1.default {
62
67
  {
63
68
  option: '--planName [planName]'
64
69
  },
70
+ {
71
+ option: "--planTitle [planTitle]"
72
+ },
65
73
  {
66
74
  option: '--ownerGroupId [ownerGroupId]'
67
75
  },
@@ -73,17 +81,17 @@ class PlannerBucketListCommand extends GraphCommand_1.default {
73
81
  return options.concat(parentOptions);
74
82
  }
75
83
  validate(args) {
76
- if (!args.options.planId && !args.options.planName) {
77
- return 'Specify either planId or planName';
84
+ if (!args.options.planId && !args.options.planName && !args.options.planTitle) {
85
+ return 'Specify either planId or planTitle';
78
86
  }
79
- if (args.options.planId && args.options.planName) {
80
- return 'Specify either planId or planName but not both';
87
+ if (args.options.planId && (args.options.planName || args.options.planTitle)) {
88
+ return 'Specify either planId or planTitle but not both';
81
89
  }
82
- if (args.options.planName && !args.options.ownerGroupId && !args.options.ownerGroupName) {
83
- return 'Specify either ownerGroupId or ownerGroupName when using planName';
90
+ if ((args.options.planName || args.options.planTitle) && !args.options.ownerGroupId && !args.options.ownerGroupName) {
91
+ return 'Specify either ownerGroupId or ownerGroupName when using planTitle';
84
92
  }
85
- if (args.options.planName && args.options.ownerGroupId && args.options.ownerGroupName) {
86
- return 'Specify either ownerGroupId or ownerGroupName when using planName but not both';
93
+ if ((args.options.planName || args.options.planTitle) && args.options.ownerGroupId && args.options.ownerGroupName) {
94
+ return 'Specify either ownerGroupId or ownerGroupName when using planTitle but not both';
87
95
  }
88
96
  if (args.options.ownerGroupId && !utils_1.validation.isValidGuid(args.options.ownerGroupId)) {
89
97
  return `${args.options.ownerGroupId} is not a valid GUID`;
@@ -21,12 +21,17 @@ class PlannerBucketRemoveCommand extends GraphCommand_1.default {
21
21
  telemetryProps.name = typeof args.options.name !== 'undefined';
22
22
  telemetryProps.planId = typeof args.options.planId !== 'undefined';
23
23
  telemetryProps.planName = typeof args.options.planName !== 'undefined';
24
+ telemetryProps.planTitle = typeof args.options.planTitle !== 'undefined';
24
25
  telemetryProps.ownerGroupId = typeof args.options.ownerGroupId !== 'undefined';
25
26
  telemetryProps.ownerGroupName = typeof args.options.ownerGroupName !== 'undefined';
26
27
  telemetryProps.confirm = args.options.confirm || false;
27
28
  return telemetryProps;
28
29
  }
29
30
  commandAction(logger, args, cb) {
31
+ if (args.options.planName) {
32
+ args.options.planTitle = args.options.planName;
33
+ this.warn(logger, `Option 'planName' is deprecated. Please use 'planTitle' instead`);
34
+ }
30
35
  if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
31
36
  this.handleError('This command does not support application permissions.', logger, cb);
32
37
  return;
@@ -101,13 +106,13 @@ class PlannerBucketRemoveCommand extends GraphCommand_1.default {
101
106
  });
102
107
  }
103
108
  getPlanId(args) {
104
- const { planId, planName } = args.options;
109
+ const { planId, planTitle } = args.options;
105
110
  if (planId) {
106
111
  return Promise.resolve(planId);
107
112
  }
108
113
  return this
109
114
  .getGroupId(args)
110
- .then(groupId => planner_1.planner.getPlanByName(planName, groupId))
115
+ .then(groupId => planner_1.planner.getPlanByTitle(planTitle, groupId))
111
116
  .then(plan => plan.id);
112
117
  }
113
118
  getGroupId(args) {
@@ -133,6 +138,9 @@ class PlannerBucketRemoveCommand extends GraphCommand_1.default {
133
138
  {
134
139
  option: '--planName [planName]'
135
140
  },
141
+ {
142
+ option: "--planTitle [planTitle]"
143
+ },
136
144
  {
137
145
  option: '--ownerGroupId [ownerGroupId]'
138
146
  },
@@ -153,23 +161,23 @@ class PlannerBucketRemoveCommand extends GraphCommand_1.default {
153
161
  }
154
162
  validate(args) {
155
163
  if (args.options.id) {
156
- if (args.options.planId || args.options.planName || args.options.ownerGroupId || args.options.ownerGroupName) {
157
- return 'Don\'t specify planId, planName, ownerGroupId or ownerGroupName when using id';
164
+ if (args.options.planId || args.options.planName || args.options.planTitle || args.options.ownerGroupId || args.options.ownerGroupName) {
165
+ return 'Don\'t specify planId, planTitle, ownerGroupId or ownerGroupName when using id';
158
166
  }
159
167
  }
160
168
  else {
161
- if (!args.options.planId && !args.options.planName) {
162
- return 'Specify either planId or planName when using name';
169
+ if (!args.options.planId && !args.options.planName && !args.options.planTitle) {
170
+ return 'Specify either planId or planTitle when using name';
163
171
  }
164
- if (args.options.planId && args.options.planName) {
165
- return 'Specify either planId or planName when using name but not both';
172
+ if (args.options.planId && (args.options.planName || args.options.planTitle)) {
173
+ return 'Specify either planId or planTitle when using name but not both';
166
174
  }
167
- if (args.options.planName) {
175
+ if (args.options.planName || args.options.planTitle) {
168
176
  if (!args.options.ownerGroupId && !args.options.ownerGroupName) {
169
- return 'Specify either ownerGroupId or ownerGroupName when using planName';
177
+ return 'Specify either ownerGroupId or ownerGroupName when using planTitle';
170
178
  }
171
179
  if (args.options.ownerGroupId && args.options.ownerGroupName) {
172
- return 'Specify either ownerGroupId or ownerGroupName when using planName but not both';
180
+ return 'Specify either ownerGroupId or ownerGroupName when using planTitle but not both';
173
181
  }
174
182
  if (args.options.ownerGroupId && !utils_1.validation.isValidGuid(args.options.ownerGroupId)) {
175
183
  return `${args.options.ownerGroupId} is not a valid GUID`;
@@ -20,6 +20,7 @@ class PlannerBucketSetCommand extends GraphCommand_1.default {
20
20
  telemetryProps.name = typeof args.options.name !== 'undefined';
21
21
  telemetryProps.planId = typeof args.options.planId !== 'undefined';
22
22
  telemetryProps.planName = typeof args.options.planName !== 'undefined';
23
+ telemetryProps.planTitle = typeof args.options.planTitle !== 'undefined';
23
24
  telemetryProps.ownerGroupId = typeof args.options.ownerGroupId !== 'undefined';
24
25
  telemetryProps.ownerGroupName = typeof args.options.ownerGroupName !== 'undefined';
25
26
  telemetryProps.newName = typeof args.options.newName !== 'undefined';
@@ -27,6 +28,10 @@ class PlannerBucketSetCommand extends GraphCommand_1.default {
27
28
  return telemetryProps;
28
29
  }
29
30
  commandAction(logger, args, cb) {
31
+ if (args.options.planName) {
32
+ args.options.planTitle = args.options.planName;
33
+ this.warn(logger, `Option 'planName' is deprecated. Please use 'planTitle' instead`);
34
+ }
30
35
  if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
31
36
  this.handleError('This command does not support application permissions.', logger, cb);
32
37
  return;
@@ -89,13 +94,13 @@ class PlannerBucketSetCommand extends GraphCommand_1.default {
89
94
  });
90
95
  }
91
96
  getPlanId(args) {
92
- const { planId, planName } = args.options;
97
+ const { planId, planTitle } = args.options;
93
98
  if (planId) {
94
99
  return Promise.resolve(planId);
95
100
  }
96
101
  return this
97
102
  .getGroupId(args)
98
- .then(groupId => planner_1.planner.getPlanByName(planName, groupId))
103
+ .then(groupId => planner_1.planner.getPlanByTitle(planTitle, groupId))
99
104
  .then(plan => plan.id);
100
105
  }
101
106
  getGroupId(args) {
@@ -121,6 +126,9 @@ class PlannerBucketSetCommand extends GraphCommand_1.default {
121
126
  {
122
127
  option: '--planName [planName]'
123
128
  },
129
+ {
130
+ option: "--planTitle [planTitle]"
131
+ },
124
132
  {
125
133
  option: '--ownerGroupId [ownerGroupId]'
126
134
  },
@@ -144,23 +152,23 @@ class PlannerBucketSetCommand extends GraphCommand_1.default {
144
152
  }
145
153
  validate(args) {
146
154
  if (args.options.id) {
147
- if (args.options.planId || args.options.planName || args.options.ownerGroupId || args.options.ownerGroupName) {
148
- return 'Don\'t specify planId, planName, ownerGroupId or ownerGroupName when using id';
155
+ if (args.options.planId || args.options.planName || args.options.planTitle || args.options.ownerGroupId || args.options.ownerGroupName) {
156
+ return 'Don\'t specify planId, planTitle, ownerGroupId or ownerGroupName when using id';
149
157
  }
150
158
  }
151
159
  if (args.options.name) {
152
- if (!args.options.planId && !args.options.planName) {
153
- return 'Specify either planId or planName when using name';
160
+ if (!args.options.planId && !args.options.planName && !args.options.planTitle) {
161
+ return 'Specify either planId or planTitle when using name';
154
162
  }
155
- if (args.options.planId && args.options.planName) {
156
- return 'Specify either planId or planName when using name but not both';
163
+ if (args.options.planId && (args.options.planName || args.options.planTitle)) {
164
+ return 'Specify either planId or planTitle when using name but not both';
157
165
  }
158
- if (args.options.planName) {
166
+ if (args.options.planName || args.options.planTitle) {
159
167
  if (!args.options.ownerGroupId && !args.options.ownerGroupName) {
160
- return 'Specify either ownerGroupId or ownerGroupName when using planName';
168
+ return 'Specify either ownerGroupId or ownerGroupName when using planTitle';
161
169
  }
162
170
  if (args.options.ownerGroupId && args.options.ownerGroupName) {
163
- return 'Specify either ownerGroupId or ownerGroupName when using planName but not both';
171
+ return 'Specify either ownerGroupId or ownerGroupName when using planTitle but not both';
164
172
  }
165
173
  if (args.options.ownerGroupId && !utils_1.validation.isValidGuid(args.options.ownerGroupId)) {
166
174
  return `${args.options.ownerGroupId} is not a valid GUID`;
@@ -54,7 +54,7 @@ class PlannerPlanGetCommand extends GraphCommand_1.default {
54
54
  else {
55
55
  this
56
56
  .getGroupId(args)
57
- .then(groupId => planner_1.planner.getPlanByName(args.options.title, groupId))
57
+ .then(groupId => planner_1.planner.getPlanByTitle(args.options.title, groupId))
58
58
  .then(plan => this.getPlanDetails(plan))
59
59
  .then((res) => {
60
60
  if (res) {
@@ -82,7 +82,7 @@ class PlannerPlanRemoveCommand extends GraphCommand_1.default {
82
82
  return planner_1.planner.getPlanById(id, 'minimal');
83
83
  }
84
84
  const groupId = yield this.getGroupId(args);
85
- return yield planner_1.planner.getPlanByName(title, groupId);
85
+ return yield planner_1.planner.getPlanByTitle(title, groupId);
86
86
  });
87
87
  }
88
88
  getGroupId(args) {
@@ -24,6 +24,7 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
24
24
  const telemetryProps = super.getTelemetryProperties(args);
25
25
  telemetryProps.planId = typeof args.options.planId !== 'undefined';
26
26
  telemetryProps.planName = typeof args.options.planName !== 'undefined';
27
+ telemetryProps.planTitle = typeof args.options.planTitle !== 'undefined';
27
28
  telemetryProps.ownerGroupId = typeof args.options.ownerGroupId !== 'undefined';
28
29
  telemetryProps.ownerGroupName = typeof args.options.ownerGroupName !== 'undefined';
29
30
  telemetryProps.bucketId = typeof args.options.bucketId !== 'undefined';
@@ -42,6 +43,10 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
42
43
  return telemetryProps;
43
44
  }
44
45
  commandAction(logger, args, cb) {
46
+ if (args.options.planName) {
47
+ args.options.planTitle = args.options.planName;
48
+ this.warn(logger, `Option 'planName' is deprecated. Please use 'planTitle' instead`);
49
+ }
45
50
  if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
46
51
  this.handleError('This command does not support application permissions.', logger, cb);
47
52
  return;
@@ -96,13 +101,7 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
96
101
  };
97
102
  return request_1.default
98
103
  .get(requestOptions)
99
- .then((response) => {
100
- const etag = response ? response['@odata.etag'] : undefined;
101
- if (!etag) {
102
- return Promise.reject(`Error fetching task details`);
103
- }
104
- return Promise.resolve(etag);
105
- });
104
+ .then((response) => response['@odata.etag']);
106
105
  }
107
106
  generateAppliedCategories(options) {
108
107
  if (!options.appliedCategories) {
@@ -181,7 +180,7 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
181
180
  }
182
181
  return this
183
182
  .getGroupId(args)
184
- .then((groupId) => planner_1.planner.getPlanByName(args.options.planName, groupId))
183
+ .then((groupId) => planner_1.planner.getPlanByTitle(args.options.planTitle, groupId))
185
184
  .then(plan => plan.id);
186
185
  }
187
186
  getGroupId(args) {
@@ -229,6 +228,7 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
229
228
  { option: '-t, --title <title>' },
230
229
  { option: '--planId [planId]' },
231
230
  { option: '--planName [planName]' },
231
+ { option: '--planTitle [planTitle]' },
232
232
  { option: '--ownerGroupId [ownerGroupId]' },
233
233
  { option: '--ownerGroupName [ownerGroupName]' },
234
234
  { option: '--bucketId [bucketId]' },
@@ -255,17 +255,17 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
255
255
  return options.concat(parentOptions);
256
256
  }
257
257
  validate(args) {
258
- if (!args.options.planId && !args.options.planName) {
259
- return 'Specify either planId or planName';
258
+ if (!args.options.planId && !args.options.planName && !args.options.planTitle) {
259
+ return 'Specify either planId or planTitle';
260
260
  }
261
- if (args.options.planId && args.options.planName) {
262
- return 'Specify either planId or planName but not both';
261
+ if (args.options.planId && (args.options.planName || args.options.planTitle)) {
262
+ return 'Specify either planId or planTitle but not both';
263
263
  }
264
- if (args.options.planName && !args.options.ownerGroupId && !args.options.ownerGroupName) {
265
- return 'Specify either ownerGroupId or ownerGroupName when using planName';
264
+ if ((args.options.planName || args.options.planTitle) && !args.options.ownerGroupId && !args.options.ownerGroupName) {
265
+ return 'Specify either ownerGroupId or ownerGroupName when using planTitle';
266
266
  }
267
- if (args.options.planName && args.options.ownerGroupId && args.options.ownerGroupName) {
268
- return 'Specify either ownerGroupId or ownerGroupName when using planName but not both';
267
+ if ((args.options.planName || args.options.planTitle) && args.options.ownerGroupId && args.options.ownerGroupName) {
268
+ return 'Specify either ownerGroupId or ownerGroupName when using planTitle but not both';
269
269
  }
270
270
  if (args.options.ownerGroupId && !utils_1.validation.isValidGuid(args.options.ownerGroupId)) {
271
271
  return `${args.options.ownerGroupId} is not a valid GUID`;
@@ -31,6 +31,10 @@ class PlannerTaskGetCommand extends GraphCommand_1.default {
31
31
  }
32
32
  commandAction(logger, args, cb) {
33
33
  this.showDeprecationWarning(logger, commands_1.default.TASK_DETAILS_GET, commands_1.default.TASK_GET);
34
+ if (args.options.planName) {
35
+ args.options.planTitle = args.options.planName;
36
+ this.warn(logger, `Option 'planName' is deprecated. Please use 'planTitle' instead`);
37
+ }
34
38
  if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
35
39
  this.handleError('This command does not support application permissions.', logger, cb);
36
40
  return;
@@ -135,7 +139,7 @@ class PlannerTaskGetCommand extends GraphCommand_1.default {
135
139
  }
136
140
  return this
137
141
  .getGroupId(options)
138
- .then(groupId => planner_1.planner.getPlanByName(options.planName, groupId))
142
+ .then(groupId => planner_1.planner.getPlanByTitle(options.planTitle, groupId))
139
143
  .then(plan => plan.id);
140
144
  }
141
145
  getGroupId(options) {
@@ -160,6 +164,7 @@ class PlannerTaskGetCommand extends GraphCommand_1.default {
160
164
  { option: '--bucketName [bucketName]' },
161
165
  { option: '--planId [planId]' },
162
166
  { option: '--planName [planName]' },
167
+ { option: '--planTitle [planTitle]' },
163
168
  { option: '--ownerGroupId [ownerGroupId]' },
164
169
  { option: '--ownerGroupName [ownerGroupName]' }
165
170
  ];
@@ -173,17 +178,17 @@ class PlannerTaskGetCommand extends GraphCommand_1.default {
173
178
  if (args.options.title && args.options.bucketId && args.options.bucketName) {
174
179
  return 'Specify either bucketId or bucketName when using title but not both';
175
180
  }
176
- if (args.options.bucketName && !args.options.planId && !args.options.planName) {
177
- return 'Specify either planId or planName when using bucketName';
181
+ if (args.options.bucketName && !args.options.planId && !args.options.planName && !args.options.planTitle) {
182
+ return 'Specify either planId or planTitle when using bucketName';
178
183
  }
179
- if (args.options.bucketName && args.options.planId && args.options.planName) {
180
- return 'Specify either planId or planName when using bucketName but not both';
184
+ if (args.options.bucketName && args.options.planId && (args.options.planName || args.options.planTitle)) {
185
+ return 'Specify either planId or planTitle when using bucketName but not both';
181
186
  }
182
- if (args.options.planName && !args.options.ownerGroupId && !args.options.ownerGroupName) {
183
- return 'Specify either ownerGroupId or ownerGroupName when using planName';
187
+ if ((args.options.planName || args.options.planTitle) && !args.options.ownerGroupId && !args.options.ownerGroupName) {
188
+ return 'Specify either ownerGroupId or ownerGroupName when using planTitle';
184
189
  }
185
- if (args.options.planName && args.options.ownerGroupId && args.options.ownerGroupName) {
186
- return 'Specify either ownerGroupId or ownerGroupName when using planName but not both';
190
+ if ((args.options.planName || args.options.planTitle) && args.options.ownerGroupId && args.options.ownerGroupName) {
191
+ return 'Specify either ownerGroupId or ownerGroupName when using planTitle but not both';
187
192
  }
188
193
  if (args.options.ownerGroupId && !utils_1.validation.isValidGuid(args.options.ownerGroupId)) {
189
194
  return `${args.options.ownerGroupId} is not a valid GUID`;
@@ -20,6 +20,7 @@ class PlannerTaskListCommand extends GraphCommand_1.default {
20
20
  telemetryProps.bucketName = typeof args.options.bucketName !== 'undefined';
21
21
  telemetryProps.planId = typeof args.options.planId !== 'undefined';
22
22
  telemetryProps.planName = typeof args.options.planName !== 'undefined';
23
+ telemetryProps.planTitle = typeof args.options.planTitle !== 'undefined';
23
24
  telemetryProps.ownerGroupId = typeof args.options.ownerGroupId !== 'undefined';
24
25
  telemetryProps.ownerGroupName = typeof args.options.ownerGroupName !== 'undefined';
25
26
  return telemetryProps;
@@ -28,13 +29,17 @@ class PlannerTaskListCommand extends GraphCommand_1.default {
28
29
  return ['id', 'title', 'startDateTime', 'dueDateTime', 'completedDateTime'];
29
30
  }
30
31
  commandAction(logger, args, cb) {
32
+ if (args.options.planName) {
33
+ args.options.planTitle = args.options.planName;
34
+ this.warn(logger, `Option 'planName' is deprecated. Please use 'planTitle' instead`);
35
+ }
31
36
  if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
32
37
  this.handleError('This command does not support application permissions.', logger, cb);
33
38
  return;
34
39
  }
35
40
  const bucketName = args.options.bucketName;
36
41
  let bucketId = args.options.bucketId;
37
- const planName = args.options.planName;
42
+ const planTitle = args.options.planTitle;
38
43
  let planId = args.options.planId;
39
44
  let taskItems = [];
40
45
  if (bucketId || bucketName) {
@@ -53,7 +58,7 @@ class PlannerTaskListCommand extends GraphCommand_1.default {
53
58
  cb();
54
59
  }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
55
60
  }
56
- else if (planId || planName) {
61
+ else if (planId || planTitle) {
57
62
  this
58
63
  .getPlanId(args)
59
64
  .then((retrievedPlanId) => {
@@ -112,7 +117,7 @@ class PlannerTaskListCommand extends GraphCommand_1.default {
112
117
  }
113
118
  return this
114
119
  .getGroupId(args)
115
- .then((groupId) => planner_1.planner.getPlanByName(args.options.planName, groupId))
120
+ .then((groupId) => planner_1.planner.getPlanByTitle(args.options.planTitle, groupId))
116
121
  .then(plan => plan.id);
117
122
  }
118
123
  getGroupId(args) {
@@ -148,6 +153,9 @@ class PlannerTaskListCommand extends GraphCommand_1.default {
148
153
  {
149
154
  option: '--planName [planName]'
150
155
  },
156
+ {
157
+ option: '--planTitle [planTitle]'
158
+ },
151
159
  {
152
160
  option: '--ownerGroupId [ownerGroupId]'
153
161
  },
@@ -162,17 +170,17 @@ class PlannerTaskListCommand extends GraphCommand_1.default {
162
170
  if (args.options.bucketId && args.options.bucketName) {
163
171
  return 'To retrieve tasks from a bucket, specify bucketId or bucketName, but not both';
164
172
  }
165
- if (args.options.bucketName && !args.options.planId && !args.options.planName) {
166
- return 'Specify either planId or planName when using bucketName';
173
+ if (args.options.bucketName && !args.options.planId && !args.options.planName && !args.options.planTitle) {
174
+ return 'Specify either planId or planTitle when using bucketName';
167
175
  }
168
- if (args.options.planId && args.options.planName) {
169
- return 'Specify either planId or planName but not both';
176
+ if (args.options.planId && (args.options.planName || args.options.planTitle)) {
177
+ return 'Specify either planId or planTitle but not both';
170
178
  }
171
- if (args.options.planName && !args.options.ownerGroupId && !args.options.ownerGroupName) {
172
- return 'Specify either ownerGroupId or ownerGroupName when using planName';
179
+ if ((args.options.planName || args.options.planTitle) && !args.options.ownerGroupId && !args.options.ownerGroupName) {
180
+ return 'Specify either ownerGroupId or ownerGroupName when using planTitle';
173
181
  }
174
- if (args.options.planName && args.options.ownerGroupId && args.options.ownerGroupName) {
175
- return 'Specify either ownerGroupId or ownerGroupName when using planName but not both';
182
+ if ((args.options.planName || args.options.planTitle) && args.options.ownerGroupId && args.options.ownerGroupName) {
183
+ return 'Specify either ownerGroupId or ownerGroupName when using planTitle but not both';
176
184
  }
177
185
  if (args.options.ownerGroupId && !utils_1.validation.isValidGuid(args.options.ownerGroupId)) {
178
186
  return `${args.options.ownerGroupId} is not a valid GUID`;