@pnp/cli-microsoft365 5.4.0-beta.d01ee78 → 5.4.0-beta.fb9344d
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.
- package/.devcontainer/Dockerfile +1 -1
- package/.eslintrc.js +1 -0
- package/dist/m365/aad/commands/app/app-set.js +4 -1
- package/dist/m365/aad/commands/o365group/o365group-conversation-post-list.js +4 -19
- package/dist/m365/aad/commands/o365group/o365group-get.js +3 -9
- package/dist/m365/aad/commands/o365group/o365group-recyclebinitem-remove.js +129 -0
- package/dist/m365/aad/commands.js +1 -0
- package/dist/m365/base/PlannerCommand.js +10 -0
- package/dist/m365/flow/commands/flow-export.js +3 -3
- package/dist/m365/planner/commands/bucket/bucket-add.js +4 -16
- package/dist/m365/planner/commands/bucket/bucket-get.js +4 -18
- package/dist/m365/planner/commands/bucket/bucket-list.js +4 -17
- package/dist/m365/planner/commands/bucket/bucket-remove.js +4 -18
- package/dist/m365/planner/commands/bucket/bucket-set.js +4 -18
- package/dist/m365/planner/commands/plan/plan-add.js +4 -16
- package/dist/m365/planner/commands/plan/plan-details-get.js +4 -19
- package/dist/m365/planner/commands/plan/plan-get.js +4 -17
- package/dist/m365/planner/commands/plan/plan-list.js +4 -17
- package/dist/m365/planner/commands/task/task-add.js +60 -23
- package/dist/m365/planner/commands/task/task-checklistitem-add.js +89 -0
- package/dist/m365/planner/commands/task/{task-details-get.js → task-checklistitem-list.js} +21 -13
- package/dist/m365/planner/commands/task/task-checklistitem-remove.js +85 -0
- package/dist/m365/planner/commands/task/task-get.js +40 -29
- package/dist/m365/planner/commands/task/task-list.js +4 -16
- package/dist/m365/planner/commands/task/task-reference-remove.js +125 -0
- package/dist/m365/planner/commands/task/task-remove.js +201 -0
- package/dist/m365/planner/commands/task/task-set.js +21 -17
- package/dist/m365/planner/commands/tenant/tenant-settings-list.js +33 -0
- package/dist/m365/planner/commands.js +8 -2
- package/dist/m365/planner/taskPriority.js +27 -0
- package/dist/m365/spo/commands/contenttype/contenttype-add.js +1 -1
- package/dist/m365/spo/commands/contenttype/contenttype-field-remove.js +1 -1
- package/dist/m365/spo/commands/contenttype/contenttype-get.js +1 -1
- package/dist/m365/spo/commands/eventreceiver/eventreceiver-get.js +3 -3
- package/dist/m365/spo/commands/eventreceiver/eventreceiver-list.js +102 -0
- package/dist/m365/spo/commands/field/field-add.js +1 -1
- package/dist/m365/spo/commands/field/field-get.js +5 -5
- package/dist/m365/spo/commands/field/field-list.js +3 -3
- package/dist/m365/spo/commands/field/field-remove.js +5 -5
- package/dist/m365/spo/commands/file/file-sharinginfo-get.js +1 -1
- package/dist/m365/spo/commands/hubsite/hubsite-list.js +1 -1
- package/dist/m365/spo/commands/list/ListPrincipalType.js +13 -0
- package/dist/m365/spo/commands/list/list-contenttype-add.js +3 -3
- package/dist/m365/spo/commands/list/list-contenttype-default-set.js +2 -2
- package/dist/m365/spo/commands/list/list-contenttype-list.js +3 -3
- package/dist/m365/spo/commands/list/list-contenttype-remove.js +3 -3
- package/dist/m365/spo/commands/list/list-get.js +8 -2
- package/dist/m365/spo/commands/list/list-label-get.js +3 -3
- package/dist/m365/spo/commands/list/list-label-set.js +2 -2
- package/dist/m365/spo/commands/list/list-list.js +10 -1
- package/dist/m365/spo/commands/list/list-remove.js +2 -2
- package/dist/m365/spo/commands/list/list-roleinheritance-break.js +2 -2
- package/dist/m365/spo/commands/list/list-roleinheritance-reset.js +2 -2
- package/dist/m365/spo/commands/list/list-sitescript-get.js +3 -3
- package/dist/m365/spo/commands/list/list-view-add.js +3 -3
- package/dist/m365/spo/commands/list/list-view-field-add.js +2 -2
- package/dist/m365/spo/commands/list/list-view-field-remove.js +2 -2
- package/dist/m365/spo/commands/list/list-view-field-set.js +2 -2
- package/dist/m365/spo/commands/list/list-view-get.js +4 -4
- package/dist/m365/spo/commands/list/list-view-list.js +3 -3
- package/dist/m365/spo/commands/list/list-view-remove.js +3 -3
- package/dist/m365/spo/commands/list/list-view-set.js +3 -3
- package/dist/m365/spo/commands/list/list-webhook-add.js +3 -3
- package/dist/m365/spo/commands/list/list-webhook-get.js +3 -3
- package/dist/m365/spo/commands/list/list-webhook-list.js +5 -5
- package/dist/m365/spo/commands/list/list-webhook-remove.js +4 -4
- package/dist/m365/spo/commands/list/list-webhook-set.js +3 -3
- package/dist/m365/spo/commands/listitem/listitem-add.js +2 -2
- package/dist/m365/spo/commands/listitem/listitem-attachment-list.js +2 -2
- package/dist/m365/spo/commands/listitem/listitem-get.js +2 -2
- package/dist/m365/spo/commands/listitem/listitem-isrecord.js +2 -2
- package/dist/m365/spo/commands/listitem/listitem-list.js +31 -11
- package/dist/m365/spo/commands/listitem/listitem-record-declare.js +2 -2
- package/dist/m365/spo/commands/listitem/listitem-record-undeclare.js +2 -2
- package/dist/m365/spo/commands/listitem/listitem-remove.js +2 -2
- package/dist/m365/spo/commands/listitem/listitem-roleinheritance-break.js +2 -2
- package/dist/m365/spo/commands/listitem/listitem-roleinheritance-reset.js +2 -2
- package/dist/m365/spo/commands/listitem/listitem-set.js +2 -2
- package/dist/m365/spo/commands/roledefinition/roledefinition-remove.js +82 -0
- package/dist/m365/spo/commands/site/site-remove.js +23 -37
- package/dist/m365/spo/commands.js +2 -0
- package/dist/m365/teams/commands/app/app-list.js +6 -20
- package/dist/m365/teams/commands/channel/channel-get.js +6 -19
- package/dist/m365/teams/commands/channel/channel-list.js +6 -18
- package/dist/m365/teams/commands/channel/channel-member-add.js +7 -18
- package/dist/m365/teams/commands/channel/channel-member-list.js +6 -19
- package/dist/m365/teams/commands/channel/channel-member-remove.js +6 -19
- package/dist/m365/teams/commands/channel/channel-member-set.js +6 -19
- package/dist/m365/teams/commands/tab/tab-get.js +6 -19
- package/dist/m365/teams/commands/team/team-add.js +2 -7
- package/dist/m365/teams/commands/team/team-get.js +6 -19
- package/dist/utils/aadGroup.js +57 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/validation.js +12 -2
- package/docs/docs/cmd/aad/app/app-set.md +1 -1
- package/docs/docs/cmd/aad/o365group/o365group-recyclebinitem-remove.md +45 -0
- package/docs/docs/cmd/file/file-list.md +4 -4
- package/docs/docs/cmd/planner/bucket/bucket-set.md +4 -4
- package/docs/docs/cmd/planner/plan/plan-details-get.md +2 -2
- package/docs/docs/cmd/planner/plan/plan-get.md +4 -4
- package/docs/docs/cmd/planner/task/task-add.md +40 -4
- package/docs/docs/cmd/planner/task/task-checklistitem-add.md +36 -0
- package/docs/docs/cmd/planner/task/task-checklistitem-list.md +24 -0
- package/docs/docs/cmd/planner/task/task-checklistitem-remove.md +36 -0
- package/docs/docs/cmd/planner/task/task-get.md +3 -0
- package/docs/docs/cmd/planner/task/task-reference-remove.md +39 -0
- package/docs/docs/cmd/planner/task/task-remove.md +78 -0
- package/docs/docs/cmd/planner/task/task-set.md +13 -3
- package/docs/docs/cmd/planner/tenant/tenant-settings-list.md +28 -0
- package/docs/docs/cmd/spo/eventreceiver/eventreceiver-list.md +64 -0
- package/docs/docs/cmd/spo/file/file-checkout.md +1 -1
- package/docs/docs/cmd/spo/hubsite/hubsite-list.md +1 -4
- package/docs/docs/cmd/spo/list/list-list.md +3 -0
- package/docs/docs/cmd/spo/listitem/listitem-list.md +16 -10
- package/docs/docs/cmd/spo/roledefinition/roledefinition-remove.md +36 -0
- package/package.json +12 -7
- package/docs/docs/cmd/planner/task/task-details-get.md +0 -24
|
@@ -2,11 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const Auth_1 = require("../../../../Auth");
|
|
4
4
|
const request_1 = require("../../../../request");
|
|
5
|
-
const planner_1 = require("../../../../utils/planner");
|
|
6
5
|
const utils_1 = require("../../../../utils");
|
|
6
|
+
const aadGroup_1 = require("../../../../utils/aadGroup");
|
|
7
|
+
const planner_1 = require("../../../../utils/planner");
|
|
7
8
|
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
8
9
|
const commands_1 = require("../../commands");
|
|
10
|
+
const taskPriority_1 = require("../../taskPriority");
|
|
9
11
|
class PlannerTaskAddCommand extends GraphCommand_1.default {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.allowedAppliedCategories = ['category1', 'category2', 'category3', 'category4', 'category5', 'category6'];
|
|
15
|
+
this.allowedPreviewTypes = ['automatic', 'nopreview', 'checklist', 'description', 'reference'];
|
|
16
|
+
}
|
|
10
17
|
get name() {
|
|
11
18
|
return commands_1.default.TASK_ADD;
|
|
12
19
|
}
|
|
@@ -26,8 +33,12 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
|
|
|
26
33
|
telemetryProps.percentComplete = typeof args.options.percentComplete !== 'undefined';
|
|
27
34
|
telemetryProps.assignedToUserIds = typeof args.options.assignedToUserIds !== 'undefined';
|
|
28
35
|
telemetryProps.assignedToUserNames = typeof args.options.assignedToUserNames !== 'undefined';
|
|
36
|
+
telemetryProps.assigneePriority = typeof args.options.assigneePriority !== 'undefined';
|
|
29
37
|
telemetryProps.description = typeof args.options.description !== 'undefined';
|
|
38
|
+
telemetryProps.appliedCategories = typeof args.options.appliedCategories !== 'undefined';
|
|
39
|
+
telemetryProps.previewType = typeof args.options.previewType !== 'undefined';
|
|
30
40
|
telemetryProps.orderHint = typeof args.options.orderHint !== 'undefined';
|
|
41
|
+
telemetryProps.priority = typeof args.options.priority !== 'undefined';
|
|
31
42
|
return telemetryProps;
|
|
32
43
|
}
|
|
33
44
|
commandAction(logger, args, cb) {
|
|
@@ -46,10 +57,11 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
|
|
|
46
57
|
return this.generateUserAssignments(args);
|
|
47
58
|
})
|
|
48
59
|
.then(assignments => {
|
|
60
|
+
const appliedCategories = this.generateAppliedCategories(args.options);
|
|
49
61
|
const requestOptions = {
|
|
50
62
|
url: `${this.resource}/v1.0/planner/tasks`,
|
|
51
63
|
headers: {
|
|
52
|
-
|
|
64
|
+
accept: 'application/json;odata.metadata=none'
|
|
53
65
|
},
|
|
54
66
|
responseType: 'json',
|
|
55
67
|
data: {
|
|
@@ -60,7 +72,10 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
|
|
|
60
72
|
dueDateTime: args.options.dueDateTime,
|
|
61
73
|
percentComplete: args.options.percentComplete,
|
|
62
74
|
assignments: assignments,
|
|
63
|
-
orderHint: args.options.orderHint
|
|
75
|
+
orderHint: args.options.orderHint,
|
|
76
|
+
assigneePriority: args.options.assigneePriority,
|
|
77
|
+
appliedCategories: appliedCategories,
|
|
78
|
+
priority: taskPriority_1.taskPriority.getPriorityValue(args.options.priority)
|
|
64
79
|
}
|
|
65
80
|
};
|
|
66
81
|
return request_1.default.post(requestOptions);
|
|
@@ -89,9 +104,17 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
|
|
|
89
104
|
return Promise.resolve(etag);
|
|
90
105
|
});
|
|
91
106
|
}
|
|
107
|
+
generateAppliedCategories(options) {
|
|
108
|
+
if (!options.appliedCategories) {
|
|
109
|
+
return {};
|
|
110
|
+
}
|
|
111
|
+
const categories = {};
|
|
112
|
+
options.appliedCategories.toLocaleLowerCase().split(',').forEach(x => categories[x] = true);
|
|
113
|
+
return categories;
|
|
114
|
+
}
|
|
92
115
|
updateTaskDetails(options, newTask) {
|
|
93
116
|
const taskId = newTask.id;
|
|
94
|
-
if (!options.description) {
|
|
117
|
+
if (!options.description && !options.previewType) {
|
|
95
118
|
return Promise.resolve(newTask);
|
|
96
119
|
}
|
|
97
120
|
return this
|
|
@@ -106,7 +129,8 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
|
|
|
106
129
|
},
|
|
107
130
|
responseType: 'json',
|
|
108
131
|
data: {
|
|
109
|
-
description: options.description
|
|
132
|
+
description: options.description,
|
|
133
|
+
previewType: options.previewType
|
|
110
134
|
}
|
|
111
135
|
};
|
|
112
136
|
return request_1.default.patch(requestOptionsTaskDetails);
|
|
@@ -164,22 +188,9 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
|
|
|
164
188
|
if (args.options.ownerGroupId) {
|
|
165
189
|
return Promise.resolve(args.options.ownerGroupId);
|
|
166
190
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
accept: 'application/json;odata.metadata=none'
|
|
171
|
-
},
|
|
172
|
-
responseType: 'json'
|
|
173
|
-
};
|
|
174
|
-
return request_1.default
|
|
175
|
-
.get(requestOptions)
|
|
176
|
-
.then(response => {
|
|
177
|
-
const group = response.value[0];
|
|
178
|
-
if (!group) {
|
|
179
|
-
return Promise.reject(`The specified owner group does not exist`);
|
|
180
|
-
}
|
|
181
|
-
return Promise.resolve(group.id);
|
|
182
|
-
});
|
|
191
|
+
return aadGroup_1.aadGroup
|
|
192
|
+
.getGroupByDisplayName(args.options.ownerGroupName)
|
|
193
|
+
.then(group => group.id);
|
|
183
194
|
}
|
|
184
195
|
getUserIds(options) {
|
|
185
196
|
if (options.assignedToUserIds) {
|
|
@@ -227,8 +238,18 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
|
|
|
227
238
|
{ option: '--percentComplete [percentComplete]' },
|
|
228
239
|
{ option: '--assignedToUserIds [assignedToUserIds]' },
|
|
229
240
|
{ option: '--assignedToUserNames [assignedToUserNames]' },
|
|
241
|
+
{ option: '--assigneePriority [assigneePriority]' },
|
|
230
242
|
{ option: '--description [description]' },
|
|
231
|
-
{
|
|
243
|
+
{
|
|
244
|
+
option: '--appliedCategories [appliedCategories]',
|
|
245
|
+
autocomplete: this.allowedAppliedCategories
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
option: '--previewType [previewType]',
|
|
249
|
+
autocomplete: this.allowedPreviewTypes
|
|
250
|
+
},
|
|
251
|
+
{ option: '--orderHint [orderHint]' },
|
|
252
|
+
{ option: '--priority [priority]', autocomplete: taskPriority_1.taskPriority.priorityValues }
|
|
232
253
|
];
|
|
233
254
|
const parentOptions = super.options();
|
|
234
255
|
return options.concat(parentOptions);
|
|
@@ -265,7 +286,7 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
|
|
|
265
286
|
return `percentComplete is not a number`;
|
|
266
287
|
}
|
|
267
288
|
if (args.options.percentComplete && (args.options.percentComplete < 0 || args.options.percentComplete > 100)) {
|
|
268
|
-
return `percentComplete should be between 0 and 100
|
|
289
|
+
return `percentComplete should be between 0 and 100`;
|
|
269
290
|
}
|
|
270
291
|
if (args.options.assignedToUserIds && !utils_1.validation.isValidGuidArray(args.options.assignedToUserIds.split(','))) {
|
|
271
292
|
return 'assignedToUserIds contains invalid GUID';
|
|
@@ -273,6 +294,22 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
|
|
|
273
294
|
if (args.options.assignedToUserIds && args.options.assignedToUserNames) {
|
|
274
295
|
return 'Specify either assignedToUserIds or assignedToUserNames but not both';
|
|
275
296
|
}
|
|
297
|
+
if (args.options.appliedCategories && args.options.appliedCategories.split(',').filter(category => this.allowedAppliedCategories.indexOf(category.toLocaleLowerCase()) < 0).length !== 0) {
|
|
298
|
+
return `The appliedCategories contains invalid value. Specify either ${this.allowedAppliedCategories.join(', ')} as properties`;
|
|
299
|
+
}
|
|
300
|
+
if (args.options.previewType && this.allowedPreviewTypes.indexOf(args.options.previewType.toLocaleLowerCase()) === -1) {
|
|
301
|
+
return `${args.options.previewType} is not a valid preview type value. Allowed values are ${this.allowedPreviewTypes.join(', ')}`;
|
|
302
|
+
}
|
|
303
|
+
if (args.options.priority !== undefined) {
|
|
304
|
+
if (typeof args.options.priority === "number") {
|
|
305
|
+
if (isNaN(args.options.priority) || args.options.priority < 0 || args.options.priority > 10 || !Number.isInteger(args.options.priority)) {
|
|
306
|
+
return 'priority should be an integer between 0 and 10.';
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
else if (taskPriority_1.taskPriority.priorityValues.map(l => l.toLowerCase()).indexOf(args.options.priority.toString().toLowerCase()) === -1) {
|
|
310
|
+
return `${args.options.priority} is not a valid priority value. Allowed values are ${taskPriority_1.taskPriority.priorityValues.join('|')}.`;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
276
313
|
return true;
|
|
277
314
|
}
|
|
278
315
|
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const accessToken_1 = require("../../../../utils/accessToken");
|
|
4
|
+
const uuid_1 = require("uuid");
|
|
5
|
+
const Auth_1 = require("../../../../Auth");
|
|
6
|
+
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
7
|
+
const commands_1 = require("../../commands");
|
|
8
|
+
const request_1 = require("../../../../request");
|
|
9
|
+
class PlannerTaskChecklistItemAddCommand extends GraphCommand_1.default {
|
|
10
|
+
get name() {
|
|
11
|
+
return commands_1.default.TASK_CHECKLISTITEM_ADD;
|
|
12
|
+
}
|
|
13
|
+
get description() {
|
|
14
|
+
return 'Adds a new checklist item to a Planner task.';
|
|
15
|
+
}
|
|
16
|
+
getTelemetryProperties(args) {
|
|
17
|
+
const telemetryProps = super.getTelemetryProperties(args);
|
|
18
|
+
telemetryProps.isChecked = args.options.isChecked || false;
|
|
19
|
+
return telemetryProps;
|
|
20
|
+
}
|
|
21
|
+
defaultProperties() {
|
|
22
|
+
return ['id', 'title', 'isChecked'];
|
|
23
|
+
}
|
|
24
|
+
commandAction(logger, args, cb) {
|
|
25
|
+
if (accessToken_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
|
|
26
|
+
this.handleError('This command does not support application permissions.', logger, cb);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
this
|
|
30
|
+
.getTaskDetailsEtag(args.options.taskId)
|
|
31
|
+
.then(etag => {
|
|
32
|
+
const body = {
|
|
33
|
+
checklist: {
|
|
34
|
+
// Generate new GUID for new task checklist item
|
|
35
|
+
[(0, uuid_1.v4)()]: {
|
|
36
|
+
'@odata.type': 'microsoft.graph.plannerChecklistItem',
|
|
37
|
+
title: args.options.title,
|
|
38
|
+
isChecked: args.options.isChecked || false
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const requestOptions = {
|
|
43
|
+
url: `${this.resource}/v1.0/planner/tasks/${encodeURIComponent(args.options.taskId)}/details`,
|
|
44
|
+
headers: {
|
|
45
|
+
accept: 'application/json;odata.metadata=none',
|
|
46
|
+
prefer: 'return=representation',
|
|
47
|
+
'if-match': etag
|
|
48
|
+
},
|
|
49
|
+
responseType: 'json',
|
|
50
|
+
data: body
|
|
51
|
+
};
|
|
52
|
+
return request_1.default.patch(requestOptions);
|
|
53
|
+
})
|
|
54
|
+
.then((result) => {
|
|
55
|
+
if (args.options.output === 'json') {
|
|
56
|
+
logger.log(result.checklist);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
// Transform checklist item object to text friendly format
|
|
60
|
+
const output = Object.getOwnPropertyNames(result.checklist).map(prop => (Object.assign({ id: prop }, result.checklist[prop])));
|
|
61
|
+
logger.log(output);
|
|
62
|
+
}
|
|
63
|
+
cb();
|
|
64
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
65
|
+
}
|
|
66
|
+
getTaskDetailsEtag(taskId) {
|
|
67
|
+
const requestOptions = {
|
|
68
|
+
url: `${this.resource}/v1.0/planner/tasks/${encodeURIComponent(taskId)}/details`,
|
|
69
|
+
headers: {
|
|
70
|
+
accept: 'application/json;odata.metadata=minimal'
|
|
71
|
+
},
|
|
72
|
+
responseType: 'json'
|
|
73
|
+
};
|
|
74
|
+
return request_1.default
|
|
75
|
+
.get(requestOptions)
|
|
76
|
+
.then((task) => task['@odata.etag'], () => Promise.reject('Planner task was not found.'));
|
|
77
|
+
}
|
|
78
|
+
options() {
|
|
79
|
+
const options = [
|
|
80
|
+
{ option: '-i, --taskId <taskId>' },
|
|
81
|
+
{ option: '-t, --title <title>' },
|
|
82
|
+
{ option: '--isChecked' }
|
|
83
|
+
];
|
|
84
|
+
const parentOptions = super.options();
|
|
85
|
+
return options.concat(parentOptions);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
module.exports = new PlannerTaskChecklistItemAddCommand();
|
|
89
|
+
//# sourceMappingURL=task-checklistitem-add.js.map
|
|
@@ -5,12 +5,15 @@ const Auth_1 = require("../../../../Auth");
|
|
|
5
5
|
const request_1 = require("../../../../request");
|
|
6
6
|
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
7
7
|
const commands_1 = require("../../commands");
|
|
8
|
-
class
|
|
8
|
+
class PlannerTaskChecklistItemListCommand extends GraphCommand_1.default {
|
|
9
9
|
get name() {
|
|
10
|
-
return commands_1.default.
|
|
10
|
+
return commands_1.default.TASK_CHECKLISTITEM_LIST;
|
|
11
11
|
}
|
|
12
12
|
get description() {
|
|
13
|
-
return
|
|
13
|
+
return "Lists the checklist items of a Planner task.";
|
|
14
|
+
}
|
|
15
|
+
defaultProperties() {
|
|
16
|
+
return ['id', 'title', 'isChecked'];
|
|
14
17
|
}
|
|
15
18
|
commandAction(logger, args, cb) {
|
|
16
19
|
if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
|
|
@@ -18,28 +21,33 @@ class PlannerTaskDetailsGetCommand extends GraphCommand_1.default {
|
|
|
18
21
|
return;
|
|
19
22
|
}
|
|
20
23
|
const requestOptions = {
|
|
21
|
-
url: `${this.resource}/v1.0/planner/tasks/${encodeURIComponent(args.options.taskId)}/details`,
|
|
24
|
+
url: `${this.resource}/v1.0/planner/tasks/${encodeURIComponent(args.options.taskId)}/details?$select=checklist`,
|
|
22
25
|
headers: {
|
|
23
|
-
accept:
|
|
26
|
+
accept: "application/json;odata.metadata=none"
|
|
24
27
|
},
|
|
25
|
-
responseType:
|
|
28
|
+
responseType: "json"
|
|
26
29
|
};
|
|
27
|
-
request_1.default
|
|
28
|
-
.
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
request_1.default.get(requestOptions).then((res) => {
|
|
31
|
+
if (!args.options.output || args.options.output === 'json') {
|
|
32
|
+
logger.log(res.checklist);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
//converted to text friendly output
|
|
36
|
+
const output = Object.getOwnPropertyNames(res.checklist).map(prop => (Object.assign({ id: prop }, res.checklist[prop])));
|
|
37
|
+
logger.log(output);
|
|
38
|
+
}
|
|
31
39
|
cb();
|
|
32
40
|
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
33
41
|
}
|
|
34
42
|
options() {
|
|
35
43
|
const options = [
|
|
36
44
|
{
|
|
37
|
-
option:
|
|
45
|
+
option: "-i, --taskId <taskId>"
|
|
38
46
|
}
|
|
39
47
|
];
|
|
40
48
|
const parentOptions = super.options();
|
|
41
49
|
return options.concat(parentOptions);
|
|
42
50
|
}
|
|
43
51
|
}
|
|
44
|
-
module.exports = new
|
|
45
|
-
//# sourceMappingURL=task-
|
|
52
|
+
module.exports = new PlannerTaskChecklistItemListCommand();
|
|
53
|
+
//# sourceMappingURL=task-checklistitem-list.js.map
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const cli_1 = require("../../../../cli");
|
|
4
|
+
const request_1 = require("../../../../request");
|
|
5
|
+
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
6
|
+
const commands_1 = require("../../commands");
|
|
7
|
+
class PlannerTaskChecklistItemRemoveCommand extends GraphCommand_1.default {
|
|
8
|
+
get name() {
|
|
9
|
+
return commands_1.default.TASK_CHECKLISTITEM_REMOVE;
|
|
10
|
+
}
|
|
11
|
+
get description() {
|
|
12
|
+
return 'Removes the checklist item from the planner task';
|
|
13
|
+
}
|
|
14
|
+
getTelemetryProperties(args) {
|
|
15
|
+
const telemetryProps = super.getTelemetryProperties(args);
|
|
16
|
+
telemetryProps.confirm = (!(!args.options.confirm)).toString();
|
|
17
|
+
return telemetryProps;
|
|
18
|
+
}
|
|
19
|
+
commandAction(logger, args, cb) {
|
|
20
|
+
if (args.options.confirm) {
|
|
21
|
+
this.removeChecklistitem(logger, args, cb);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
cli_1.Cli.prompt({
|
|
25
|
+
type: 'confirm',
|
|
26
|
+
name: 'continue',
|
|
27
|
+
default: false,
|
|
28
|
+
message: `Are you sure you want to remove the checklist item with id ${args.options.id} from the planner task?`
|
|
29
|
+
}, (result) => {
|
|
30
|
+
if (!result.continue) {
|
|
31
|
+
cb();
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
this.removeChecklistitem(logger, args, cb);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
removeChecklistitem(logger, args, cb) {
|
|
40
|
+
this
|
|
41
|
+
.getTaskDetails(args.options.taskId)
|
|
42
|
+
.then(task => {
|
|
43
|
+
if (!task.checklist || !task.checklist[args.options.id]) {
|
|
44
|
+
return Promise.reject(`The specified checklist item with id ${args.options.id} does not exist`);
|
|
45
|
+
}
|
|
46
|
+
const requestOptionsTaskDetails = {
|
|
47
|
+
url: `${this.resource}/v1.0/planner/tasks/${args.options.taskId}/details`,
|
|
48
|
+
headers: {
|
|
49
|
+
'accept': 'application/json;odata.metadata=none',
|
|
50
|
+
'If-Match': task['@odata.etag'],
|
|
51
|
+
'Prefer': 'return=representation'
|
|
52
|
+
},
|
|
53
|
+
responseType: 'json',
|
|
54
|
+
data: {
|
|
55
|
+
checklist: {
|
|
56
|
+
[args.options.id]: null
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
return request_1.default.patch(requestOptionsTaskDetails);
|
|
61
|
+
})
|
|
62
|
+
.then(_ => cb(), (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
63
|
+
}
|
|
64
|
+
getTaskDetails(taskId) {
|
|
65
|
+
const requestOptions = {
|
|
66
|
+
url: `${this.resource}/v1.0/planner/tasks/${encodeURIComponent(taskId)}/details?$select=checklist`,
|
|
67
|
+
headers: {
|
|
68
|
+
accept: 'application/json;odata.metadata=minimal'
|
|
69
|
+
},
|
|
70
|
+
responseType: 'json'
|
|
71
|
+
};
|
|
72
|
+
return request_1.default.get(requestOptions);
|
|
73
|
+
}
|
|
74
|
+
options() {
|
|
75
|
+
const options = [
|
|
76
|
+
{ option: '-i, --id <id>' },
|
|
77
|
+
{ option: '--taskId <taskId>' },
|
|
78
|
+
{ option: '--confirm' }
|
|
79
|
+
];
|
|
80
|
+
const parentOptions = super.options();
|
|
81
|
+
return options.concat(parentOptions);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
module.exports = new PlannerTaskChecklistItemRemoveCommand();
|
|
85
|
+
//# sourceMappingURL=task-checklistitem-remove.js.map
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const Auth_1 = require("../../../../Auth");
|
|
4
4
|
const request_1 = require("../../../../request");
|
|
5
5
|
const utils_1 = require("../../../../utils");
|
|
6
|
+
const aadGroup_1 = require("../../../../utils/aadGroup");
|
|
6
7
|
const planner_1 = require("../../../../utils/planner");
|
|
7
8
|
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
8
9
|
const commands_1 = require("../../commands");
|
|
@@ -10,6 +11,9 @@ class PlannerTaskGetCommand extends GraphCommand_1.default {
|
|
|
10
11
|
get name() {
|
|
11
12
|
return commands_1.default.TASK_GET;
|
|
12
13
|
}
|
|
14
|
+
alias() {
|
|
15
|
+
return [commands_1.default.TASK_DETAILS_GET];
|
|
16
|
+
}
|
|
13
17
|
get description() {
|
|
14
18
|
return 'Retrieve the specified planner task';
|
|
15
19
|
}
|
|
@@ -26,27 +30,49 @@ class PlannerTaskGetCommand extends GraphCommand_1.default {
|
|
|
26
30
|
return telemetryProps;
|
|
27
31
|
}
|
|
28
32
|
commandAction(logger, args, cb) {
|
|
33
|
+
this.showDeprecationWarning(logger, commands_1.default.TASK_DETAILS_GET, commands_1.default.TASK_GET);
|
|
29
34
|
if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
|
|
30
35
|
this.handleError('This command does not support application permissions.', logger, cb);
|
|
31
36
|
return;
|
|
32
37
|
}
|
|
38
|
+
// This check has been added to support task details get alias. Needs to be removed when deprecation is removed.
|
|
39
|
+
if (args.options.taskId) {
|
|
40
|
+
args.options.id = args.options.taskId;
|
|
41
|
+
}
|
|
33
42
|
this
|
|
34
43
|
.getTaskId(args.options)
|
|
35
|
-
.then(taskId =>
|
|
36
|
-
|
|
37
|
-
url: `${this.resource}/v1.0/planner/tasks/${encodeURIComponent(taskId)}`,
|
|
38
|
-
headers: {
|
|
39
|
-
accept: 'application/json;odata.metadata=none'
|
|
40
|
-
},
|
|
41
|
-
responseType: 'json'
|
|
42
|
-
};
|
|
43
|
-
return request_1.default.get(requestOptions);
|
|
44
|
-
})
|
|
44
|
+
.then(taskId => this.getTask(taskId))
|
|
45
|
+
.then(task => this.getTaskDetails(task))
|
|
45
46
|
.then((res) => {
|
|
46
47
|
logger.log(res);
|
|
47
48
|
cb();
|
|
48
49
|
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
49
50
|
}
|
|
51
|
+
getTask(taskId) {
|
|
52
|
+
const requestOptions = {
|
|
53
|
+
url: `${this.resource}/v1.0/planner/tasks/${encodeURIComponent(taskId)}`,
|
|
54
|
+
headers: {
|
|
55
|
+
accept: 'application/json;odata.metadata=none'
|
|
56
|
+
},
|
|
57
|
+
responseType: 'json'
|
|
58
|
+
};
|
|
59
|
+
return request_1.default.get(requestOptions);
|
|
60
|
+
}
|
|
61
|
+
getTaskDetails(task) {
|
|
62
|
+
const requestOptionsTaskDetails = {
|
|
63
|
+
url: `${this.resource}/v1.0/planner/tasks/${task.id}/details`,
|
|
64
|
+
headers: {
|
|
65
|
+
'accept': 'application/json;odata.metadata=none',
|
|
66
|
+
'Prefer': 'return=representation'
|
|
67
|
+
},
|
|
68
|
+
responseType: 'json'
|
|
69
|
+
};
|
|
70
|
+
return request_1.default
|
|
71
|
+
.get(requestOptionsTaskDetails)
|
|
72
|
+
.then(taskDetails => {
|
|
73
|
+
return Object.assign(Object.assign({}, task), taskDetails);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
50
76
|
getTaskId(options) {
|
|
51
77
|
if (options.id) {
|
|
52
78
|
return Promise.resolve(options.id);
|
|
@@ -116,25 +142,9 @@ class PlannerTaskGetCommand extends GraphCommand_1.default {
|
|
|
116
142
|
if (options.ownerGroupId) {
|
|
117
143
|
return Promise.resolve(options.ownerGroupId);
|
|
118
144
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
accept: 'application/json;odata.metadata=none'
|
|
123
|
-
},
|
|
124
|
-
responseType: 'json'
|
|
125
|
-
};
|
|
126
|
-
return request_1.default
|
|
127
|
-
.get(requestOptions)
|
|
128
|
-
.then(response => {
|
|
129
|
-
const groups = response.value;
|
|
130
|
-
if (!groups.length) {
|
|
131
|
-
return Promise.reject(`The specified ownerGroup ${options.ownerGroupName} does not exist`);
|
|
132
|
-
}
|
|
133
|
-
if (groups.length > 1) {
|
|
134
|
-
return Promise.reject(`Multiple ownerGroups with name ${options.ownerGroupName} found: ${groups.map(x => x.id)}`);
|
|
135
|
-
}
|
|
136
|
-
return Promise.resolve(groups[0].id);
|
|
137
|
-
});
|
|
145
|
+
return aadGroup_1.aadGroup
|
|
146
|
+
.getGroupByDisplayName(options.ownerGroupName)
|
|
147
|
+
.then(group => group.id);
|
|
138
148
|
}
|
|
139
149
|
optionSets() {
|
|
140
150
|
return [
|
|
@@ -143,6 +153,7 @@ class PlannerTaskGetCommand extends GraphCommand_1.default {
|
|
|
143
153
|
}
|
|
144
154
|
options() {
|
|
145
155
|
const options = [
|
|
156
|
+
{ option: '--taskId [taskId]' },
|
|
146
157
|
{ option: '-i, --id [id]' },
|
|
147
158
|
{ option: '-t, --title [title]' },
|
|
148
159
|
{ option: '--bucketId [bucketId]' },
|
|
@@ -6,6 +6,7 @@ const request_1 = require("../../../../request");
|
|
|
6
6
|
const planner_1 = require("../../../../utils/planner");
|
|
7
7
|
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
8
8
|
const commands_1 = require("../../commands");
|
|
9
|
+
const aadGroup_1 = require("../../../../utils/aadGroup");
|
|
9
10
|
class PlannerTaskListCommand extends GraphCommand_1.default {
|
|
10
11
|
get name() {
|
|
11
12
|
return commands_1.default.TASK_LIST;
|
|
@@ -118,22 +119,9 @@ class PlannerTaskListCommand extends GraphCommand_1.default {
|
|
|
118
119
|
if (args.options.ownerGroupId) {
|
|
119
120
|
return Promise.resolve(encodeURIComponent(args.options.ownerGroupId));
|
|
120
121
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
accept: 'application/json;odata.metadata=none'
|
|
125
|
-
},
|
|
126
|
-
responseType: 'json'
|
|
127
|
-
};
|
|
128
|
-
return request_1.default
|
|
129
|
-
.get(requestOptions)
|
|
130
|
-
.then(response => {
|
|
131
|
-
const group = response.value[0];
|
|
132
|
-
if (!group) {
|
|
133
|
-
return Promise.reject(`The specified owner group does not exist`);
|
|
134
|
-
}
|
|
135
|
-
return Promise.resolve(group.id);
|
|
136
|
-
});
|
|
122
|
+
return aadGroup_1.aadGroup
|
|
123
|
+
.getGroupByDisplayName(args.options.ownerGroupName)
|
|
124
|
+
.then(group => group.id);
|
|
137
125
|
}
|
|
138
126
|
mergeTaskPriority(taskItems, betaTaskItems) {
|
|
139
127
|
const findBetaTask = (id) => betaTaskItems.find(task => task.id === id);
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const cli_1 = require("../../../../cli");
|
|
4
|
+
const request_1 = require("../../../../request");
|
|
5
|
+
const utils_1 = require("../../../../utils");
|
|
6
|
+
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
7
|
+
const commands_1 = require("../../commands");
|
|
8
|
+
class PlannerTaskReferenceRemoveCommand extends GraphCommand_1.default {
|
|
9
|
+
get name() {
|
|
10
|
+
return commands_1.default.TASK_REFERENCE_REMOVE;
|
|
11
|
+
}
|
|
12
|
+
get description() {
|
|
13
|
+
return 'Removes the reference from the Planner task';
|
|
14
|
+
}
|
|
15
|
+
getTelemetryProperties(args) {
|
|
16
|
+
const telemetryProps = super.getTelemetryProperties(args);
|
|
17
|
+
telemetryProps.url = typeof args.options.url !== 'undefined';
|
|
18
|
+
telemetryProps.alias = typeof args.options.alias !== 'undefined';
|
|
19
|
+
telemetryProps.confirm = (!(!args.options.confirm)).toString();
|
|
20
|
+
return telemetryProps;
|
|
21
|
+
}
|
|
22
|
+
commandAction(logger, args, cb) {
|
|
23
|
+
if (args.options.confirm) {
|
|
24
|
+
this.removeReference(logger, args, cb);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
cli_1.Cli.prompt({
|
|
28
|
+
type: 'confirm',
|
|
29
|
+
name: 'continue',
|
|
30
|
+
default: false,
|
|
31
|
+
message: `Are you sure you want to remove the reference from the Planner task?`
|
|
32
|
+
}, (result) => {
|
|
33
|
+
if (!result.continue) {
|
|
34
|
+
cb();
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
this.removeReference(logger, args, cb);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
removeReference(logger, args, cb) {
|
|
43
|
+
this
|
|
44
|
+
.getTaskDetailsEtagAndUrl(args.options)
|
|
45
|
+
.then(({ etag, url }) => {
|
|
46
|
+
const requestOptionsTaskDetails = {
|
|
47
|
+
url: `${this.resource}/v1.0/planner/tasks/${args.options.taskId}/details`,
|
|
48
|
+
headers: {
|
|
49
|
+
'accept': 'application/json;odata.metadata=none',
|
|
50
|
+
'If-Match': etag,
|
|
51
|
+
'Prefer': 'return=representation'
|
|
52
|
+
},
|
|
53
|
+
responseType: 'json',
|
|
54
|
+
data: {
|
|
55
|
+
references: {
|
|
56
|
+
[utils_1.formatting.openTypesEncoder(url)]: null
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
return request_1.default.patch(requestOptionsTaskDetails);
|
|
61
|
+
})
|
|
62
|
+
.then(() => {
|
|
63
|
+
cb();
|
|
64
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
65
|
+
}
|
|
66
|
+
getTaskDetailsEtagAndUrl(options) {
|
|
67
|
+
const requestOptions = {
|
|
68
|
+
url: `${this.resource}/v1.0/planner/tasks/${encodeURIComponent(options.taskId)}/details`,
|
|
69
|
+
headers: {
|
|
70
|
+
accept: 'application/json'
|
|
71
|
+
},
|
|
72
|
+
responseType: 'json'
|
|
73
|
+
};
|
|
74
|
+
let url = options.url;
|
|
75
|
+
return request_1.default
|
|
76
|
+
.get(requestOptions)
|
|
77
|
+
.then((response) => {
|
|
78
|
+
const etag = response ? response['@odata.etag'] : undefined;
|
|
79
|
+
if (!etag) {
|
|
80
|
+
return Promise.reject(`Error fetching task details`);
|
|
81
|
+
}
|
|
82
|
+
if (options.alias) {
|
|
83
|
+
const alias = options.alias;
|
|
84
|
+
const urls = [];
|
|
85
|
+
Object.entries(response.references).forEach((ref) => {
|
|
86
|
+
var _a;
|
|
87
|
+
if (((_a = ref[1].alias) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) === alias.toLocaleLowerCase()) {
|
|
88
|
+
urls.push(decodeURIComponent(ref[0]));
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
if (!urls.length) {
|
|
92
|
+
return Promise.reject(`The specified reference with alias ${options.alias} does not exist`);
|
|
93
|
+
}
|
|
94
|
+
if (urls.length > 1) {
|
|
95
|
+
return Promise.reject(`Multiple references with alias ${options.alias} found. Pass one of the following urls within the "--url" option : ${urls}`);
|
|
96
|
+
}
|
|
97
|
+
url = urls[0];
|
|
98
|
+
}
|
|
99
|
+
return Promise.resolve({ etag, url });
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
options() {
|
|
103
|
+
const options = [
|
|
104
|
+
{ option: '-u, --url [url]' },
|
|
105
|
+
{ option: '--alias [alias]' },
|
|
106
|
+
{ option: '-i, --taskId <taskId>' },
|
|
107
|
+
{ option: '--confirm' }
|
|
108
|
+
];
|
|
109
|
+
const parentOptions = super.options();
|
|
110
|
+
return options.concat(parentOptions);
|
|
111
|
+
}
|
|
112
|
+
optionSets() {
|
|
113
|
+
return [
|
|
114
|
+
['url', 'alias']
|
|
115
|
+
];
|
|
116
|
+
}
|
|
117
|
+
validate(args) {
|
|
118
|
+
if (args.options.url && args.options.url.indexOf('https://') !== 0 && args.options.url.indexOf('http://') !== 0) {
|
|
119
|
+
return 'The url option should contain a valid URL. A valid URL starts with http(s)://';
|
|
120
|
+
}
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
module.exports = new PlannerTaskReferenceRemoveCommand();
|
|
125
|
+
//# sourceMappingURL=task-reference-remove.js.map
|