@pnp/cli-microsoft365 5.4.0-beta.fdd7cb1 → 5.5.0-beta.5a6c547
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/dist/Auth.js +1 -1
- package/dist/m365/aad/commands/app/app-set.js +4 -1
- package/dist/m365/aad/commands/o365group/o365group-recyclebinitem-remove.js +129 -0
- package/dist/m365/aad/commands.js +1 -0
- package/dist/m365/planner/commands/plan/plan-get.js +57 -16
- package/dist/m365/planner/commands/task/task-add.js +57 -8
- package/dist/m365/planner/commands/task/task-checklistitem-list.js +53 -0
- package/dist/m365/planner/commands/task/task-checklistitem-remove.js +85 -0
- package/dist/m365/planner/commands/task/task-reference-remove.js +125 -0
- package/dist/m365/planner/commands/task/task-set.js +17 -1
- package/dist/m365/planner/commands/tenant/tenant-settings-set.js +95 -0
- package/dist/m365/planner/commands.js +5 -1
- package/dist/m365/planner/taskPriority.js +27 -0
- package/dist/m365/spfx/commands/project/project-upgrade/{upgrade-1.15.0-rc.0.js → upgrade-1.15.0.js} +28 -28
- package/dist/m365/spfx/commands/project/project-upgrade.js +13 -15
- 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-get.js +6 -0
- package/dist/m365/spo/commands/list/list-list.js +10 -1
- 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/planner/plan/plan-get.md +14 -2
- package/docs/docs/cmd/planner/task/task-add.md +40 -4
- 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-reference-remove.md +39 -0
- package/docs/docs/cmd/planner/task/task-set.md +11 -1
- package/docs/docs/cmd/planner/tenant/tenant-settings-set.md +56 -0
- package/docs/docs/cmd/spfx/project/project-upgrade.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/tenant/serviceannouncement/serviceannouncement-health-get.md +1 -1
- package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-healthissue-list.md +1 -1
- package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-message-list.md +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/dist/m365/planner/commands/plan/plan-details-get.js +0 -116
- package/docs/docs/cmd/planner/plan/plan-details-get.md +0 -45
package/dist/Auth.js
CHANGED
|
@@ -330,7 +330,7 @@ class Auth {
|
|
|
330
330
|
}
|
|
331
331
|
return this.clientApplication.acquireTokenByUsernamePassword({
|
|
332
332
|
username: this.service.userName,
|
|
333
|
-
password:
|
|
333
|
+
password: this.service.password,
|
|
334
334
|
scopes: [`${resource}/.default`]
|
|
335
335
|
});
|
|
336
336
|
});
|
|
@@ -71,8 +71,11 @@ class AadAppSetCommand extends GraphCommand_1.default {
|
|
|
71
71
|
if (this.verbose) {
|
|
72
72
|
logger.logToStderr(`Configuring Azure AD application ID URI...`);
|
|
73
73
|
}
|
|
74
|
+
const identifierUris = args.options.uri
|
|
75
|
+
.split(',')
|
|
76
|
+
.map(u => u.trim());
|
|
74
77
|
const applicationInfo = {
|
|
75
|
-
identifierUris:
|
|
78
|
+
identifierUris: identifierUris
|
|
76
79
|
};
|
|
77
80
|
const requestOptions = {
|
|
78
81
|
url: `${this.resource}/v1.0/myorganization/applications/${objectId}`,
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const cli_1 = require("../../../../cli");
|
|
13
|
+
const request_1 = require("../../../../request");
|
|
14
|
+
const utils_1 = require("../../../../utils");
|
|
15
|
+
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
16
|
+
const commands_1 = require("../../commands");
|
|
17
|
+
class AadO365GroupRecycleBinItemRemoveCommand extends GraphCommand_1.default {
|
|
18
|
+
get name() {
|
|
19
|
+
return commands_1.default.O365GROUP_RECYCLEBINITEM_REMOVE;
|
|
20
|
+
}
|
|
21
|
+
get description() {
|
|
22
|
+
return 'Permanently deletes a Microsoft 365 Group from the recycle bin in the current tenant';
|
|
23
|
+
}
|
|
24
|
+
getTelemetryProperties(args) {
|
|
25
|
+
const telemetryProps = super.getTelemetryProperties(args);
|
|
26
|
+
telemetryProps.id = typeof args.options.id !== 'undefined';
|
|
27
|
+
telemetryProps.displayName = typeof args.options.displayName !== 'undefined';
|
|
28
|
+
telemetryProps.mailNickname = typeof args.options.mailNickname !== 'undefined';
|
|
29
|
+
telemetryProps.confirm = !!args.options.confirm;
|
|
30
|
+
return telemetryProps;
|
|
31
|
+
}
|
|
32
|
+
commandAction(logger, args, cb) {
|
|
33
|
+
const removeGroup = () => __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
try {
|
|
35
|
+
const groupId = yield this.getGroupId(args.options);
|
|
36
|
+
const requestOptions = {
|
|
37
|
+
url: `${this.resource}/v1.0/directory/deletedItems/${groupId}`,
|
|
38
|
+
headers: {
|
|
39
|
+
accept: 'application/json;odata.metadata=none'
|
|
40
|
+
},
|
|
41
|
+
responseType: 'json'
|
|
42
|
+
};
|
|
43
|
+
yield request_1.default.delete(requestOptions);
|
|
44
|
+
cb();
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
this.handleRejectedODataJsonPromise(err, logger, cb);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
if (args.options.confirm) {
|
|
51
|
+
removeGroup();
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
cli_1.Cli.prompt({
|
|
55
|
+
type: 'confirm',
|
|
56
|
+
name: 'continue',
|
|
57
|
+
default: false,
|
|
58
|
+
message: `Are you sure you want to remove the group '${args.options.id || args.options.displayName || args.options.mailNickname}'?`
|
|
59
|
+
}, (result) => {
|
|
60
|
+
if (!result.continue) {
|
|
61
|
+
cb();
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
removeGroup();
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
getGroupId(options) {
|
|
70
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
const { id, displayName, mailNickname } = options;
|
|
72
|
+
if (id) {
|
|
73
|
+
return id;
|
|
74
|
+
}
|
|
75
|
+
let filterValue = '';
|
|
76
|
+
if (displayName) {
|
|
77
|
+
filterValue = `displayName eq '${utils_1.formatting.encodeQueryParameter(displayName)}'`;
|
|
78
|
+
}
|
|
79
|
+
if (mailNickname) {
|
|
80
|
+
filterValue = `mailNickname eq '${utils_1.formatting.encodeQueryParameter(mailNickname)}'`;
|
|
81
|
+
}
|
|
82
|
+
const requestOptions = {
|
|
83
|
+
url: `${this.resource}/v1.0/directory/deletedItems/Microsoft.Graph.Group?$filter=${filterValue}`,
|
|
84
|
+
headers: {
|
|
85
|
+
accept: 'application/json;odata.metadata=none'
|
|
86
|
+
},
|
|
87
|
+
responseType: 'json'
|
|
88
|
+
};
|
|
89
|
+
const response = yield request_1.default.get(requestOptions);
|
|
90
|
+
const groups = response.value;
|
|
91
|
+
if (groups.length === 0) {
|
|
92
|
+
throw Error(`The specified group '${displayName || mailNickname}' does not exist.`);
|
|
93
|
+
}
|
|
94
|
+
if (groups.length > 1) {
|
|
95
|
+
throw Error(`Multiple groups with name '${displayName || mailNickname}' found: ${groups.map(x => x.id).join(',')}.`);
|
|
96
|
+
}
|
|
97
|
+
return groups[0].id;
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
optionSets() {
|
|
101
|
+
return [['id', 'displayName', 'mailNickname']];
|
|
102
|
+
}
|
|
103
|
+
options() {
|
|
104
|
+
const options = [
|
|
105
|
+
{
|
|
106
|
+
option: '-i, --id [id]'
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
option: '-d, --displayName [displayName]'
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
option: '-m, --mailNickname [mailNickname]'
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
option: '--confirm'
|
|
116
|
+
}
|
|
117
|
+
];
|
|
118
|
+
const parentOptions = super.options();
|
|
119
|
+
return options.concat(parentOptions);
|
|
120
|
+
}
|
|
121
|
+
validate(args) {
|
|
122
|
+
if (args.options.id && !utils_1.validation.isValidGuid(args.options.id)) {
|
|
123
|
+
return `${args.options.id} is not a valid GUID`;
|
|
124
|
+
}
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
module.exports = new AadO365GroupRecycleBinItemRemoveCommand();
|
|
129
|
+
//# sourceMappingURL=o365group-recyclebinitem-remove.js.map
|
|
@@ -29,6 +29,7 @@ exports.default = {
|
|
|
29
29
|
O365GROUP_CONVERSATION_POST_LIST: `${prefix} o365group conversation post list`,
|
|
30
30
|
O365GROUP_RECYCLEBINITEM_CLEAR: `${prefix} o365group recyclebinitem clear`,
|
|
31
31
|
O365GROUP_RECYCLEBINITEM_LIST: `${prefix} o365group recyclebinitem list`,
|
|
32
|
+
O365GROUP_RECYCLEBINITEM_REMOVE: `${prefix} o365group recyclebinitem remove`,
|
|
32
33
|
O365GROUP_RECYCLEBINITEM_RESTORE: `${prefix} o365group recyclebinitem restore`,
|
|
33
34
|
O365GROUP_SET: `${prefix} o365group set`,
|
|
34
35
|
O365GROUP_TEAMIFY: `${prefix} o365group teamify`,
|
|
@@ -6,15 +6,21 @@ const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
|
6
6
|
const commands_1 = require("../../commands");
|
|
7
7
|
const Auth_1 = require("../../../../Auth");
|
|
8
8
|
const aadGroup_1 = require("../../../../utils/aadGroup");
|
|
9
|
+
const request_1 = require("../../../../request");
|
|
9
10
|
class PlannerPlanGetCommand extends GraphCommand_1.default {
|
|
10
11
|
get name() {
|
|
11
12
|
return commands_1.default.PLAN_GET;
|
|
12
13
|
}
|
|
14
|
+
alias() {
|
|
15
|
+
return [commands_1.default.PLAN_DETAILS_GET];
|
|
16
|
+
}
|
|
13
17
|
get description() {
|
|
14
18
|
return 'Get a Microsoft Planner plan';
|
|
15
19
|
}
|
|
16
20
|
getTelemetryProperties(args) {
|
|
17
21
|
const telemetryProps = super.getTelemetryProperties(args);
|
|
22
|
+
telemetryProps.planId = typeof args.options.planId !== 'undefined';
|
|
23
|
+
telemetryProps.planTitle = typeof args.options.planTitle !== 'undefined';
|
|
18
24
|
telemetryProps.id = typeof args.options.id !== 'undefined';
|
|
19
25
|
telemetryProps.title = typeof args.options.title !== 'undefined';
|
|
20
26
|
telemetryProps.ownerGroupId = typeof args.options.ownerGroupId !== 'undefined';
|
|
@@ -25,13 +31,21 @@ class PlannerPlanGetCommand extends GraphCommand_1.default {
|
|
|
25
31
|
return ['id', 'title', 'createdDateTime', 'owner', '@odata.etag'];
|
|
26
32
|
}
|
|
27
33
|
commandAction(logger, args, cb) {
|
|
34
|
+
this.showDeprecationWarning(logger, commands_1.default.PLAN_DETAILS_GET, commands_1.default.PLAN_GET);
|
|
28
35
|
if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
|
|
29
36
|
this.handleError('This command does not support application permissions.', logger, cb);
|
|
30
37
|
return;
|
|
31
38
|
}
|
|
39
|
+
if (args.options.planId) {
|
|
40
|
+
args.options.id = args.options.planId;
|
|
41
|
+
}
|
|
42
|
+
if (args.options.planTitle) {
|
|
43
|
+
args.options.title = args.options.planTitle;
|
|
44
|
+
}
|
|
32
45
|
if (args.options.id) {
|
|
33
46
|
planner_1.planner
|
|
34
47
|
.getPlanById(args.options.id)
|
|
48
|
+
.then(plan => this.getPlanDetails(plan))
|
|
35
49
|
.then((res) => {
|
|
36
50
|
logger.log(res);
|
|
37
51
|
cb();
|
|
@@ -41,14 +55,30 @@ class PlannerPlanGetCommand extends GraphCommand_1.default {
|
|
|
41
55
|
this
|
|
42
56
|
.getGroupId(args)
|
|
43
57
|
.then(groupId => planner_1.planner.getPlanByName(args.options.title, groupId))
|
|
44
|
-
.then(
|
|
45
|
-
|
|
46
|
-
|
|
58
|
+
.then(plan => this.getPlanDetails(plan))
|
|
59
|
+
.then((res) => {
|
|
60
|
+
if (res) {
|
|
61
|
+
logger.log(res);
|
|
47
62
|
}
|
|
48
63
|
cb();
|
|
49
64
|
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
50
65
|
}
|
|
51
66
|
}
|
|
67
|
+
getPlanDetails(plan) {
|
|
68
|
+
const requestOptionsTaskDetails = {
|
|
69
|
+
url: `${this.resource}/v1.0/planner/plans/${plan.id}/details`,
|
|
70
|
+
headers: {
|
|
71
|
+
'accept': 'application/json;odata.metadata=none',
|
|
72
|
+
'Prefer': 'return=representation'
|
|
73
|
+
},
|
|
74
|
+
responseType: 'json'
|
|
75
|
+
};
|
|
76
|
+
return request_1.default
|
|
77
|
+
.get(requestOptionsTaskDetails)
|
|
78
|
+
.then(planDetails => {
|
|
79
|
+
return Object.assign(Object.assign({}, plan), planDetails);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
52
82
|
getGroupId(args) {
|
|
53
83
|
if (args.options.ownerGroupId) {
|
|
54
84
|
return Promise.resolve(args.options.ownerGroupId);
|
|
@@ -59,6 +89,12 @@ class PlannerPlanGetCommand extends GraphCommand_1.default {
|
|
|
59
89
|
}
|
|
60
90
|
options() {
|
|
61
91
|
const options = [
|
|
92
|
+
{
|
|
93
|
+
option: '--planId [planId]'
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
option: '--planTitle [planTitle]'
|
|
97
|
+
},
|
|
62
98
|
{
|
|
63
99
|
option: '-i, --id [id]'
|
|
64
100
|
},
|
|
@@ -76,20 +112,25 @@ class PlannerPlanGetCommand extends GraphCommand_1.default {
|
|
|
76
112
|
return options.concat(parentOptions);
|
|
77
113
|
}
|
|
78
114
|
validate(args) {
|
|
79
|
-
if (
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
return 'Specify either id or title';
|
|
84
|
-
}
|
|
85
|
-
if (args.options.title && !args.options.ownerGroupId && !args.options.ownerGroupName) {
|
|
86
|
-
return 'Specify either ownerGroupId or ownerGroupName';
|
|
87
|
-
}
|
|
88
|
-
if (args.options.title && args.options.ownerGroupId && args.options.ownerGroupName) {
|
|
89
|
-
return 'Specify either ownerGroupId or ownerGroupName but not both';
|
|
115
|
+
if (args.options.planId && args.options.planTitle ||
|
|
116
|
+
args.options.id && args.options.title ||
|
|
117
|
+
args.options.planId && args.options.title ||
|
|
118
|
+
args.options.id && args.options.planTitle) {
|
|
119
|
+
return 'Specify either id or title but not both';
|
|
90
120
|
}
|
|
91
|
-
if (args.options.
|
|
92
|
-
|
|
121
|
+
if (!args.options.planId && !args.options.id) {
|
|
122
|
+
if (!args.options.planTitle && !args.options.title) {
|
|
123
|
+
return 'Specify either id or title';
|
|
124
|
+
}
|
|
125
|
+
if ((args.options.title || args.options.planTitle) && !args.options.ownerGroupId && !args.options.ownerGroupName) {
|
|
126
|
+
return 'Specify either ownerGroupId or ownerGroupName';
|
|
127
|
+
}
|
|
128
|
+
if ((args.options.title || args.options.planTitle) && args.options.ownerGroupId && args.options.ownerGroupName) {
|
|
129
|
+
return 'Specify either ownerGroupId or ownerGroupName but not both';
|
|
130
|
+
}
|
|
131
|
+
if (args.options.ownerGroupId && !utils_1.validation.isValidGuid(args.options.ownerGroupId)) {
|
|
132
|
+
return `${args.options.ownerGroupId} is not a valid GUID`;
|
|
133
|
+
}
|
|
93
134
|
}
|
|
94
135
|
return true;
|
|
95
136
|
}
|
|
@@ -2,12 +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");
|
|
9
|
-
const
|
|
10
|
+
const taskPriority_1 = require("../../taskPriority");
|
|
10
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
|
+
}
|
|
11
17
|
get name() {
|
|
12
18
|
return commands_1.default.TASK_ADD;
|
|
13
19
|
}
|
|
@@ -27,8 +33,12 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
|
|
|
27
33
|
telemetryProps.percentComplete = typeof args.options.percentComplete !== 'undefined';
|
|
28
34
|
telemetryProps.assignedToUserIds = typeof args.options.assignedToUserIds !== 'undefined';
|
|
29
35
|
telemetryProps.assignedToUserNames = typeof args.options.assignedToUserNames !== 'undefined';
|
|
36
|
+
telemetryProps.assigneePriority = typeof args.options.assigneePriority !== 'undefined';
|
|
30
37
|
telemetryProps.description = typeof args.options.description !== 'undefined';
|
|
38
|
+
telemetryProps.appliedCategories = typeof args.options.appliedCategories !== 'undefined';
|
|
39
|
+
telemetryProps.previewType = typeof args.options.previewType !== 'undefined';
|
|
31
40
|
telemetryProps.orderHint = typeof args.options.orderHint !== 'undefined';
|
|
41
|
+
telemetryProps.priority = typeof args.options.priority !== 'undefined';
|
|
32
42
|
return telemetryProps;
|
|
33
43
|
}
|
|
34
44
|
commandAction(logger, args, cb) {
|
|
@@ -47,10 +57,11 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
|
|
|
47
57
|
return this.generateUserAssignments(args);
|
|
48
58
|
})
|
|
49
59
|
.then(assignments => {
|
|
60
|
+
const appliedCategories = this.generateAppliedCategories(args.options);
|
|
50
61
|
const requestOptions = {
|
|
51
62
|
url: `${this.resource}/v1.0/planner/tasks`,
|
|
52
63
|
headers: {
|
|
53
|
-
|
|
64
|
+
accept: 'application/json;odata.metadata=none'
|
|
54
65
|
},
|
|
55
66
|
responseType: 'json',
|
|
56
67
|
data: {
|
|
@@ -61,7 +72,10 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
|
|
|
61
72
|
dueDateTime: args.options.dueDateTime,
|
|
62
73
|
percentComplete: args.options.percentComplete,
|
|
63
74
|
assignments: assignments,
|
|
64
|
-
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)
|
|
65
79
|
}
|
|
66
80
|
};
|
|
67
81
|
return request_1.default.post(requestOptions);
|
|
@@ -90,9 +104,17 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
|
|
|
90
104
|
return Promise.resolve(etag);
|
|
91
105
|
});
|
|
92
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
|
+
}
|
|
93
115
|
updateTaskDetails(options, newTask) {
|
|
94
116
|
const taskId = newTask.id;
|
|
95
|
-
if (!options.description) {
|
|
117
|
+
if (!options.description && !options.previewType) {
|
|
96
118
|
return Promise.resolve(newTask);
|
|
97
119
|
}
|
|
98
120
|
return this
|
|
@@ -107,7 +129,8 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
|
|
|
107
129
|
},
|
|
108
130
|
responseType: 'json',
|
|
109
131
|
data: {
|
|
110
|
-
description: options.description
|
|
132
|
+
description: options.description,
|
|
133
|
+
previewType: options.previewType
|
|
111
134
|
}
|
|
112
135
|
};
|
|
113
136
|
return request_1.default.patch(requestOptionsTaskDetails);
|
|
@@ -215,8 +238,18 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
|
|
|
215
238
|
{ option: '--percentComplete [percentComplete]' },
|
|
216
239
|
{ option: '--assignedToUserIds [assignedToUserIds]' },
|
|
217
240
|
{ option: '--assignedToUserNames [assignedToUserNames]' },
|
|
241
|
+
{ option: '--assigneePriority [assigneePriority]' },
|
|
218
242
|
{ option: '--description [description]' },
|
|
219
|
-
{
|
|
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 }
|
|
220
253
|
];
|
|
221
254
|
const parentOptions = super.options();
|
|
222
255
|
return options.concat(parentOptions);
|
|
@@ -253,7 +286,7 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
|
|
|
253
286
|
return `percentComplete is not a number`;
|
|
254
287
|
}
|
|
255
288
|
if (args.options.percentComplete && (args.options.percentComplete < 0 || args.options.percentComplete > 100)) {
|
|
256
|
-
return `percentComplete should be between 0 and 100
|
|
289
|
+
return `percentComplete should be between 0 and 100`;
|
|
257
290
|
}
|
|
258
291
|
if (args.options.assignedToUserIds && !utils_1.validation.isValidGuidArray(args.options.assignedToUserIds.split(','))) {
|
|
259
292
|
return 'assignedToUserIds contains invalid GUID';
|
|
@@ -261,6 +294,22 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
|
|
|
261
294
|
if (args.options.assignedToUserIds && args.options.assignedToUserNames) {
|
|
262
295
|
return 'Specify either assignedToUserIds or assignedToUserNames but not both';
|
|
263
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
|
+
}
|
|
264
313
|
return true;
|
|
265
314
|
}
|
|
266
315
|
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_1 = require("../../../../utils");
|
|
4
|
+
const Auth_1 = require("../../../../Auth");
|
|
5
|
+
const request_1 = require("../../../../request");
|
|
6
|
+
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
7
|
+
const commands_1 = require("../../commands");
|
|
8
|
+
class PlannerTaskChecklistItemListCommand extends GraphCommand_1.default {
|
|
9
|
+
get name() {
|
|
10
|
+
return commands_1.default.TASK_CHECKLISTITEM_LIST;
|
|
11
|
+
}
|
|
12
|
+
get description() {
|
|
13
|
+
return "Lists the checklist items of a Planner task.";
|
|
14
|
+
}
|
|
15
|
+
defaultProperties() {
|
|
16
|
+
return ['id', 'title', 'isChecked'];
|
|
17
|
+
}
|
|
18
|
+
commandAction(logger, args, cb) {
|
|
19
|
+
if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
|
|
20
|
+
this.handleError('This command does not support application permissions.', logger, cb);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const requestOptions = {
|
|
24
|
+
url: `${this.resource}/v1.0/planner/tasks/${encodeURIComponent(args.options.taskId)}/details?$select=checklist`,
|
|
25
|
+
headers: {
|
|
26
|
+
accept: "application/json;odata.metadata=none"
|
|
27
|
+
},
|
|
28
|
+
responseType: "json"
|
|
29
|
+
};
|
|
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
|
+
}
|
|
39
|
+
cb();
|
|
40
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
41
|
+
}
|
|
42
|
+
options() {
|
|
43
|
+
const options = [
|
|
44
|
+
{
|
|
45
|
+
option: "-i, --taskId <taskId>"
|
|
46
|
+
}
|
|
47
|
+
];
|
|
48
|
+
const parentOptions = super.options();
|
|
49
|
+
return options.concat(parentOptions);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
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
|