@pnp/cli-microsoft365 5.4.0-beta.3879fc9 → 5.4.0-beta.5d38887
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/.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 +4 -16
- 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-set.js +4 -16
- package/dist/m365/planner/commands/tenant/tenant-settings-list.js +33 -0
- package/dist/m365/planner/commands.js +6 -1
- package/dist/m365/spo/commands/eventreceiver/eventreceiver-list.js +102 -0
- 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/dist/m365/spo/commands/listitem/listitem-list.js +30 -10
- 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/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/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/tenant/tenant-settings-list.md +28 -0
- package/docs/docs/cmd/spo/eventreceiver/eventreceiver-list.md +64 -0
- 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 +1 -1
- package/docs/docs/cmd/planner/task/task-details-get.md +0 -24
|
@@ -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
|
|
@@ -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 PlannerTaskSetCommand extends GraphCommand_1.default {
|
|
10
11
|
constructor() {
|
|
11
12
|
super(...arguments);
|
|
@@ -230,22 +231,9 @@ class PlannerTaskSetCommand extends GraphCommand_1.default {
|
|
|
230
231
|
if (options.ownerGroupId) {
|
|
231
232
|
return Promise.resolve(options.ownerGroupId);
|
|
232
233
|
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
accept: 'application/json;odata.metadata=none'
|
|
237
|
-
},
|
|
238
|
-
responseType: 'json'
|
|
239
|
-
};
|
|
240
|
-
return request_1.default
|
|
241
|
-
.get(requestOptions)
|
|
242
|
-
.then(response => {
|
|
243
|
-
const group = response.value[0];
|
|
244
|
-
if (!group) {
|
|
245
|
-
return Promise.reject(`The specified owner group does not exist`);
|
|
246
|
-
}
|
|
247
|
-
return Promise.resolve(group.id);
|
|
248
|
-
});
|
|
234
|
+
return aadGroup_1.aadGroup
|
|
235
|
+
.getGroupByDisplayName(options.ownerGroupName)
|
|
236
|
+
.then(group => group.id);
|
|
249
237
|
}
|
|
250
238
|
mapRequestBody(options, appliedCategories) {
|
|
251
239
|
const requestBody = {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const request_1 = require("../../../../request");
|
|
4
|
+
const PlannerCommand_1 = require("../../../base/PlannerCommand");
|
|
5
|
+
const commands_1 = require("../../commands");
|
|
6
|
+
class PlannerTenantSettingsListCommand extends PlannerCommand_1.default {
|
|
7
|
+
get name() {
|
|
8
|
+
return commands_1.default.TENANT_SETTINGS_LIST;
|
|
9
|
+
}
|
|
10
|
+
get description() {
|
|
11
|
+
return 'Lists the Microsoft Planner configuration of the tenant';
|
|
12
|
+
}
|
|
13
|
+
defaultProperties() {
|
|
14
|
+
return ['isPlannerAllowed', 'allowCalendarSharing', 'allowTenantMoveWithDataLoss', 'allowTenantMoveWithDataMigration', 'allowRosterCreation', 'allowPlannerMobilePushNotifications'];
|
|
15
|
+
}
|
|
16
|
+
commandAction(logger, args, cb) {
|
|
17
|
+
const requestOptions = {
|
|
18
|
+
url: `${this.resource}/taskAPI/tenantAdminSettings/Settings`,
|
|
19
|
+
headers: {
|
|
20
|
+
accept: 'application/json;odata.metadata=none'
|
|
21
|
+
},
|
|
22
|
+
responseType: 'json'
|
|
23
|
+
};
|
|
24
|
+
request_1.default
|
|
25
|
+
.get(requestOptions)
|
|
26
|
+
.then((result) => {
|
|
27
|
+
logger.log(result);
|
|
28
|
+
cb();
|
|
29
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
module.exports = new PlannerTenantSettingsListCommand();
|
|
33
|
+
//# sourceMappingURL=tenant-settings-list.js.map
|
|
@@ -12,12 +12,17 @@ exports.default = {
|
|
|
12
12
|
PLAN_GET: `${prefix} plan get`,
|
|
13
13
|
PLAN_LIST: `${prefix} plan list`,
|
|
14
14
|
TASK_ADD: `${prefix} task add`,
|
|
15
|
+
TASK_CHECKLISTITEM_ADD: `${prefix} task checklistitem add`,
|
|
16
|
+
TASK_CHECKLISTITEM_LIST: `${prefix} task checklistitem list`,
|
|
17
|
+
TASK_CHECKLISTITEM_REMOVE: `${prefix} task checklistitem remove`,
|
|
15
18
|
TASK_DETAILS_GET: `${prefix} task details get`,
|
|
16
19
|
TASK_GET: `${prefix} task get`,
|
|
17
20
|
TASK_LIST: `${prefix} task list`,
|
|
18
21
|
TASK_REFERENCE_ADD: `${prefix} task reference add`,
|
|
19
22
|
TASK_REFERENCE_LIST: `${prefix} task reference list`,
|
|
23
|
+
TASK_REFERENCE_REMOVE: `${prefix} task reference remove`,
|
|
20
24
|
TASK_REMOVE: `${prefix} task remove`,
|
|
21
|
-
TASK_SET: `${prefix} task set
|
|
25
|
+
TASK_SET: `${prefix} task set`,
|
|
26
|
+
TENANT_SETTINGS_LIST: `${prefix} tenant settings list`
|
|
22
27
|
};
|
|
23
28
|
//# sourceMappingURL=commands.js.map
|