@pnp/cli-microsoft365 5.2.0 → 5.3.0-beta.4033f50
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-add.js +1 -1
- package/dist/m365/aad/commands/app/app-role-list.js +1 -1
- package/dist/m365/aad/commands/approleassignment/approleassignment-list.js +55 -22
- package/dist/m365/aad/commands/group/group-list.js +1 -1
- package/dist/m365/aad/commands/groupsetting/groupsetting-list.js +1 -1
- package/dist/m365/aad/commands/groupsettingtemplate/groupsettingtemplate-get.js +1 -1
- package/dist/m365/aad/commands/groupsettingtemplate/groupsettingtemplate-list.js +1 -1
- package/dist/m365/aad/commands/o365group/o365group-conversation-list.js +1 -1
- package/dist/m365/aad/commands/o365group/o365group-conversation-post-list.js +1 -1
- package/dist/m365/aad/commands/o365group/o365group-list.js +1 -1
- package/dist/m365/aad/commands/o365group/o365group-recyclebinitem-clear.js +3 -3
- package/dist/m365/aad/commands/o365group/o365group-recyclebinitem-list.js +1 -1
- package/dist/m365/aad/commands/o365group/o365group-user-list.js +2 -2
- package/dist/m365/aad/commands/o365group/o365group-user-set.js +2 -2
- package/dist/m365/aad/commands/user/user-list.js +1 -1
- package/dist/m365/aad/commands/user/user-signin-list.js +1 -1
- package/dist/m365/aad/commands.js +1 -1
- package/dist/m365/app/commands/app-open.js +64 -0
- package/dist/m365/app/commands.js +1 -0
- package/dist/m365/file/commands/file-list.js +1 -1
- package/dist/m365/outlook/commands/message/message-list.js +1 -1
- package/dist/m365/outlook/commands/room/room-list.js +1 -1
- package/dist/m365/outlook/commands/roomlist/roomlist-list.js +1 -1
- package/dist/m365/planner/commands/bucket/bucket-add.js +8 -16
- package/dist/m365/planner/commands/bucket/bucket-get.js +186 -0
- package/dist/m365/planner/commands/bucket/bucket-list.js +10 -19
- package/dist/m365/planner/commands/bucket/bucket-remove.js +202 -0
- package/dist/m365/planner/commands/bucket/bucket-set.js +9 -21
- package/dist/m365/planner/commands/plan/plan-add.js +6 -1
- package/dist/m365/planner/commands/plan/plan-details-get.js +12 -15
- package/dist/m365/planner/commands/plan/plan-get.js +13 -18
- package/dist/m365/planner/commands/plan/plan-list.js +10 -13
- package/dist/m365/planner/commands/task/task-add.js +8 -16
- package/dist/m365/planner/commands/task/task-details-get.js +6 -0
- package/dist/m365/planner/commands/task/task-get.js +138 -7
- package/dist/m365/planner/commands/task/task-list.js +15 -24
- package/dist/m365/planner/commands/task/task-set.js +9 -18
- package/dist/m365/planner/commands.js +2 -0
- package/dist/m365/pp/commands/managementapp/managementapp-list.js +1 -1
- package/dist/m365/spo/commands/field/field-list.js +84 -0
- package/dist/m365/spo/commands/list/list-roleinheritance-break.js +84 -0
- package/dist/m365/spo/commands/list/list-roleinheritance-reset.js +76 -0
- package/dist/m365/spo/commands/listitem/listitem-roleinheritance-break.js +83 -0
- package/dist/m365/spo/commands/listitem/listitem-roleinheritance-reset.js +79 -0
- package/dist/m365/spo/commands/roledefinition/roledefinition-list.js +49 -0
- package/dist/m365/spo/commands.js +6 -0
- package/dist/m365/teams/commands/app/app-list.js +1 -1
- package/dist/m365/teams/commands/channel/channel-list.js +1 -1
- package/dist/m365/teams/commands/channel/channel-member-list.js +1 -1
- package/dist/m365/teams/commands/chat/chat-get.js +8 -8
- package/dist/m365/teams/commands/chat/chat-list.js +1 -1
- package/dist/m365/teams/commands/chat/chat-member-list.js +1 -1
- package/dist/m365/teams/commands/chat/chat-message-list.js +1 -1
- package/dist/m365/teams/commands/chat/chat-message-send.js +6 -6
- package/dist/m365/teams/commands/chat/chatUtil.js +4 -4
- package/dist/m365/teams/commands/message/message-list.js +1 -1
- package/dist/m365/teams/commands/message/message-reply-list.js +1 -1
- package/dist/m365/teams/commands/tab/tab-list.js +1 -1
- package/dist/m365/teams/commands/team/team-list.js +1 -1
- package/dist/m365/teams/commands/user/user-app-list.js +1 -1
- package/dist/m365/teams/commands/user/user-list.js +2 -2
- package/dist/m365/tenant/commands/security/security-alerts-list.js +71 -0
- package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-healthissue-list.js +1 -1
- package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-message-list.js +1 -1
- package/dist/m365/tenant/commands.js +1 -0
- package/dist/m365/todo/commands/list/list-list.js +1 -1
- package/dist/m365/todo/commands/task/task-list.js +1 -1
- package/dist/utils/accessToken.js +18 -0
- package/dist/utils/odata.js +2 -2
- package/dist/utils/planner.js +65 -0
- package/docs/docs/cmd/app/app-open.md +45 -0
- package/docs/docs/cmd/planner/bucket/bucket-get.md +57 -0
- package/docs/docs/cmd/planner/bucket/bucket-remove.md +60 -0
- package/docs/docs/cmd/planner/task/task-get.md +30 -3
- package/docs/docs/cmd/spo/field/field-list.md +51 -0
- package/docs/docs/cmd/spo/list/list-roleinheritance-break.md +55 -0
- package/docs/docs/cmd/spo/list/list-roleinheritance-reset.md +36 -0
- package/docs/docs/cmd/spo/listitem/listitem-roleinheritance-break.md +58 -0
- package/docs/docs/cmd/spo/listitem/listitem-roleinheritance-reset.md +39 -0
- package/docs/docs/cmd/spo/roledefinition/roledefinition-list.md +24 -0
- package/docs/docs/cmd/teams/channel/channel-member-list.md +4 -4
- package/docs/docs/cmd/teams/channel/channel-member-remove.md +2 -2
- package/docs/docs/cmd/teams/channel/channel-member-set.md +2 -2
- package/docs/docs/cmd/tenant/security/security-alerts-list.md +30 -0
- package/npm-shrinkwrap.json +1517 -1284
- package/package.json +25 -25
|
@@ -0,0 +1,186 @@
|
|
|
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 request_1 = require("../../../../request");
|
|
13
|
+
const utils_1 = require("../../../../utils");
|
|
14
|
+
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
15
|
+
const commands_1 = require("../../commands");
|
|
16
|
+
const Auth_1 = require("../../../../Auth");
|
|
17
|
+
const planner_1 = require("../../../../utils/planner");
|
|
18
|
+
class PlannerBucketGetCommand extends GraphCommand_1.default {
|
|
19
|
+
get name() {
|
|
20
|
+
return commands_1.default.BUCKET_GET;
|
|
21
|
+
}
|
|
22
|
+
get description() {
|
|
23
|
+
return 'Gets the Microsoft Planner bucket in a plan';
|
|
24
|
+
}
|
|
25
|
+
getTelemetryProperties(args) {
|
|
26
|
+
const telemetryProps = super.getTelemetryProperties(args);
|
|
27
|
+
telemetryProps.id = typeof args.options.id !== 'undefined';
|
|
28
|
+
telemetryProps.name = typeof args.options.name !== 'undefined';
|
|
29
|
+
telemetryProps.planId = typeof args.options.planId !== 'undefined';
|
|
30
|
+
telemetryProps.planName = typeof args.options.planName !== 'undefined';
|
|
31
|
+
telemetryProps.ownerGroupId = typeof args.options.ownerGroupId !== 'undefined';
|
|
32
|
+
telemetryProps.ownerGroupName = typeof args.options.ownerGroupName !== 'undefined';
|
|
33
|
+
return telemetryProps;
|
|
34
|
+
}
|
|
35
|
+
commandAction(logger, args, cb) {
|
|
36
|
+
if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
|
|
37
|
+
this.handleError('This command does not support application permissions.', logger, cb);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
this
|
|
41
|
+
.getBucketId(args)
|
|
42
|
+
.then((bucketId) => this.getBucketById(bucketId))
|
|
43
|
+
.then((bucket) => {
|
|
44
|
+
logger.log(bucket);
|
|
45
|
+
cb();
|
|
46
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
47
|
+
}
|
|
48
|
+
getBucketId(args) {
|
|
49
|
+
const { id, name } = args.options;
|
|
50
|
+
if (id) {
|
|
51
|
+
return Promise.resolve(id);
|
|
52
|
+
}
|
|
53
|
+
return this
|
|
54
|
+
.getPlanId(args)
|
|
55
|
+
.then((planId) => {
|
|
56
|
+
const requestOptions = {
|
|
57
|
+
url: `${this.resource}/v1.0/planner/plans/${planId}/buckets`,
|
|
58
|
+
headers: {
|
|
59
|
+
accept: 'application/json;odata.metadata=none'
|
|
60
|
+
},
|
|
61
|
+
responseType: 'json'
|
|
62
|
+
};
|
|
63
|
+
return request_1.default.get(requestOptions);
|
|
64
|
+
})
|
|
65
|
+
.then(buckets => {
|
|
66
|
+
const filteredBuckets = buckets.value.filter(b => name.toLowerCase() === b.name.toLowerCase());
|
|
67
|
+
if (!filteredBuckets.length) {
|
|
68
|
+
return Promise.reject(`The specified bucket ${name} does not exist`);
|
|
69
|
+
}
|
|
70
|
+
if (filteredBuckets.length > 1) {
|
|
71
|
+
return Promise.reject(`Multiple buckets with name ${name} found: ${filteredBuckets.map(x => x.id)}`);
|
|
72
|
+
}
|
|
73
|
+
return Promise.resolve(filteredBuckets[0].id.toString());
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
getPlanId(args) {
|
|
77
|
+
const { planId, planName } = args.options;
|
|
78
|
+
if (planId) {
|
|
79
|
+
return Promise.resolve(planId);
|
|
80
|
+
}
|
|
81
|
+
return this
|
|
82
|
+
.getGroupId(args)
|
|
83
|
+
.then(groupId => planner_1.planner.getPlanByName(planName, groupId))
|
|
84
|
+
.then(plan => plan.id);
|
|
85
|
+
}
|
|
86
|
+
getBucketById(id) {
|
|
87
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
+
const requestOptions = {
|
|
89
|
+
url: `${this.resource}/v1.0/planner/buckets/${id}`,
|
|
90
|
+
headers: {
|
|
91
|
+
accept: 'application/json'
|
|
92
|
+
},
|
|
93
|
+
responseType: 'json'
|
|
94
|
+
};
|
|
95
|
+
return request_1.default.get(requestOptions);
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
getGroupId(args) {
|
|
99
|
+
const { ownerGroupId, ownerGroupName } = args.options;
|
|
100
|
+
if (ownerGroupId) {
|
|
101
|
+
return Promise.resolve(ownerGroupId);
|
|
102
|
+
}
|
|
103
|
+
const requestOptions = {
|
|
104
|
+
url: `${this.resource}/v1.0/groups?$filter=displayName eq '${encodeURIComponent(ownerGroupName)}'`,
|
|
105
|
+
headers: {
|
|
106
|
+
accept: 'application/json;odata.metadata=none'
|
|
107
|
+
},
|
|
108
|
+
responseType: 'json'
|
|
109
|
+
};
|
|
110
|
+
return request_1.default
|
|
111
|
+
.get(requestOptions)
|
|
112
|
+
.then(response => {
|
|
113
|
+
if (!response.value.length) {
|
|
114
|
+
return Promise.reject(`The specified owner group ${ownerGroupName} does not exist`);
|
|
115
|
+
}
|
|
116
|
+
if (response.value.length > 1) {
|
|
117
|
+
return Promise.reject(`Multiple owner groups with name ${ownerGroupName} found: ${response.value.map(x => x.id)}`);
|
|
118
|
+
}
|
|
119
|
+
return Promise.resolve(response.value[0].id);
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
options() {
|
|
123
|
+
const options = [
|
|
124
|
+
{
|
|
125
|
+
option: '-i, --id [id]'
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
option: '--name [name]'
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
option: '--planId [planId]'
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
option: '--planName [planName]'
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
option: '--ownerGroupId [ownerGroupId]'
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
option: '--ownerGroupName [ownerGroupName]'
|
|
141
|
+
}
|
|
142
|
+
];
|
|
143
|
+
const parentOptions = super.options();
|
|
144
|
+
return options.concat(parentOptions);
|
|
145
|
+
}
|
|
146
|
+
validate(args) {
|
|
147
|
+
if (args.options.id) {
|
|
148
|
+
if (args.options.planId || args.options.planName || args.options.ownerGroupId || args.options.ownerGroupName) {
|
|
149
|
+
return 'Don\'t specify planId, planName, ownerGroupId or ownerGroupName when using id';
|
|
150
|
+
}
|
|
151
|
+
if (args.options.name) {
|
|
152
|
+
return 'Specify either id or name';
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
if (args.options.name) {
|
|
156
|
+
if (!args.options.planId && !args.options.planName) {
|
|
157
|
+
return 'Specify either planId or planName when using name';
|
|
158
|
+
}
|
|
159
|
+
if (args.options.planId && args.options.planName) {
|
|
160
|
+
return 'Specify either planId or planName when using name but not both';
|
|
161
|
+
}
|
|
162
|
+
if (args.options.planName) {
|
|
163
|
+
if (!args.options.ownerGroupId && !args.options.ownerGroupName) {
|
|
164
|
+
return 'Specify either ownerGroupId or ownerGroupName when using planName';
|
|
165
|
+
}
|
|
166
|
+
if (args.options.ownerGroupId && args.options.ownerGroupName) {
|
|
167
|
+
return 'Specify either ownerGroupId or ownerGroupName when using planName but not both';
|
|
168
|
+
}
|
|
169
|
+
if (args.options.ownerGroupId && !utils_1.validation.isValidGuid(args.options.ownerGroupId)) {
|
|
170
|
+
return `${args.options.ownerGroupId} is not a valid GUID`;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
if (args.options.planId) {
|
|
174
|
+
if (args.options.ownerGroupId || args.options.ownerGroupName) {
|
|
175
|
+
return 'Don\'t specify ownerGroupId or ownerGroupName when using planId';
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
if (!args.options.id && !args.options.name) {
|
|
180
|
+
return 'Please specify id or name';
|
|
181
|
+
}
|
|
182
|
+
return true;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
module.exports = new PlannerBucketGetCommand();
|
|
186
|
+
//# sourceMappingURL=bucket-get.js.map
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const request_1 = require("../../../../request");
|
|
4
3
|
const utils_1 = require("../../../../utils");
|
|
4
|
+
const request_1 = require("../../../../request");
|
|
5
|
+
const planner_1 = require("../../../../utils/planner");
|
|
6
|
+
const Auth_1 = require("../../../../Auth");
|
|
5
7
|
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
6
8
|
const commands_1 = require("../../commands");
|
|
7
9
|
class PlannerBucketListCommand extends GraphCommand_1.default {
|
|
@@ -23,9 +25,13 @@ class PlannerBucketListCommand extends GraphCommand_1.default {
|
|
|
23
25
|
return ['id', 'name', 'planId', 'orderHint'];
|
|
24
26
|
}
|
|
25
27
|
commandAction(logger, args, cb) {
|
|
28
|
+
if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
|
|
29
|
+
this.handleError('This command does not support application permissions.', logger, cb);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
26
32
|
this
|
|
27
33
|
.getPlanId(args)
|
|
28
|
-
.then((planId) => utils_1.odata.getAllItems(`${this.resource}/v1.0/planner/plans/${planId}/buckets
|
|
34
|
+
.then((planId) => utils_1.odata.getAllItems(`${this.resource}/v1.0/planner/plans/${planId}/buckets`))
|
|
29
35
|
.then((buckets) => {
|
|
30
36
|
logger.log(buckets);
|
|
31
37
|
cb();
|
|
@@ -37,23 +43,8 @@ class PlannerBucketListCommand extends GraphCommand_1.default {
|
|
|
37
43
|
}
|
|
38
44
|
return this
|
|
39
45
|
.getGroupId(args)
|
|
40
|
-
.then(
|
|
41
|
-
|
|
42
|
-
url: `${this.resource}/v1.0/planner/plans?$filter=(owner eq '${groupId}')`,
|
|
43
|
-
headers: {
|
|
44
|
-
accept: 'application/json;odata.metadata=none'
|
|
45
|
-
},
|
|
46
|
-
responseType: 'json'
|
|
47
|
-
};
|
|
48
|
-
return request_1.default.get(requestOptions);
|
|
49
|
-
})
|
|
50
|
-
.then(response => {
|
|
51
|
-
const plan = response.value.find(val => val.title === args.options.planName);
|
|
52
|
-
if (!plan) {
|
|
53
|
-
return Promise.reject(`The specified plan does not exist`);
|
|
54
|
-
}
|
|
55
|
-
return Promise.resolve(plan.id);
|
|
56
|
-
});
|
|
46
|
+
.then(groupId => planner_1.planner.getPlanByName(args.options.planName, groupId))
|
|
47
|
+
.then(plan => plan.id);
|
|
57
48
|
}
|
|
58
49
|
getGroupId(args) {
|
|
59
50
|
if (args.options.ownerGroupId) {
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const cli_1 = require("../../../../cli");
|
|
4
|
+
const utils_1 = require("../../../../utils");
|
|
5
|
+
const request_1 = require("../../../../request");
|
|
6
|
+
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
7
|
+
const commands_1 = require("../../commands");
|
|
8
|
+
const planner_1 = require("../../../../utils/planner");
|
|
9
|
+
const Auth_1 = require("../../../../Auth");
|
|
10
|
+
class PlannerBucketRemoveCommand extends GraphCommand_1.default {
|
|
11
|
+
get name() {
|
|
12
|
+
return commands_1.default.BUCKET_REMOVE;
|
|
13
|
+
}
|
|
14
|
+
get description() {
|
|
15
|
+
return 'Removes the Microsoft Planner bucket from a plan';
|
|
16
|
+
}
|
|
17
|
+
getTelemetryProperties(args) {
|
|
18
|
+
const telemetryProps = super.getTelemetryProperties(args);
|
|
19
|
+
telemetryProps.id = typeof args.options.id !== 'undefined';
|
|
20
|
+
telemetryProps.name = typeof args.options.name !== 'undefined';
|
|
21
|
+
telemetryProps.planId = typeof args.options.planId !== 'undefined';
|
|
22
|
+
telemetryProps.planName = typeof args.options.planName !== 'undefined';
|
|
23
|
+
telemetryProps.ownerGroupId = typeof args.options.ownerGroupId !== 'undefined';
|
|
24
|
+
telemetryProps.ownerGroupName = typeof args.options.ownerGroupName !== 'undefined';
|
|
25
|
+
telemetryProps.confirm = args.options.confirm || false;
|
|
26
|
+
return telemetryProps;
|
|
27
|
+
}
|
|
28
|
+
commandAction(logger, args, cb) {
|
|
29
|
+
if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
|
|
30
|
+
this.handleError('This command does not support application permissions.', logger, cb);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const removeBucket = () => {
|
|
34
|
+
this
|
|
35
|
+
.getBucket(args)
|
|
36
|
+
.then(bucket => {
|
|
37
|
+
const requestOptions = {
|
|
38
|
+
url: `${this.resource}/v1.0/planner/buckets/${bucket.id}`,
|
|
39
|
+
headers: {
|
|
40
|
+
accept: 'application/json;odata.metadata=none',
|
|
41
|
+
'if-match': bucket['@odata.etag']
|
|
42
|
+
},
|
|
43
|
+
responseType: 'json'
|
|
44
|
+
};
|
|
45
|
+
return request_1.default.delete(requestOptions);
|
|
46
|
+
})
|
|
47
|
+
.then(_ => cb(), (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
48
|
+
};
|
|
49
|
+
if (args.options.confirm) {
|
|
50
|
+
removeBucket();
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
cli_1.Cli.prompt({
|
|
54
|
+
type: 'confirm',
|
|
55
|
+
name: 'continue',
|
|
56
|
+
default: false,
|
|
57
|
+
message: `Are you sure you want to remove the bucket ${args.options.id || args.options.name}?`
|
|
58
|
+
}, (result) => {
|
|
59
|
+
if (!result.continue) {
|
|
60
|
+
cb();
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
removeBucket();
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
getBucket(args) {
|
|
69
|
+
if (args.options.id) {
|
|
70
|
+
const requestOptions = {
|
|
71
|
+
url: `${this.resource}/v1.0/planner/buckets/${args.options.id}`,
|
|
72
|
+
headers: {
|
|
73
|
+
accept: 'application/json'
|
|
74
|
+
},
|
|
75
|
+
responseType: 'json'
|
|
76
|
+
};
|
|
77
|
+
return request_1.default.get(requestOptions);
|
|
78
|
+
}
|
|
79
|
+
return this
|
|
80
|
+
.getPlanId(args)
|
|
81
|
+
.then(planId => {
|
|
82
|
+
const requestOptions = {
|
|
83
|
+
url: `${this.resource}/v1.0/planner/plans/${planId}/buckets`,
|
|
84
|
+
headers: {
|
|
85
|
+
accept: 'application/json'
|
|
86
|
+
},
|
|
87
|
+
responseType: 'json'
|
|
88
|
+
};
|
|
89
|
+
return request_1.default.get(requestOptions);
|
|
90
|
+
})
|
|
91
|
+
.then(buckets => {
|
|
92
|
+
const filteredBuckets = buckets.value.filter(b => args.options.name.toLowerCase() === b.name.toLowerCase());
|
|
93
|
+
if (!filteredBuckets.length) {
|
|
94
|
+
return Promise.reject(`The specified bucket ${args.options.name} does not exist`);
|
|
95
|
+
}
|
|
96
|
+
if (filteredBuckets.length > 1) {
|
|
97
|
+
return Promise.reject(`Multiple buckets with name ${args.options.name} found: ${filteredBuckets.map(x => x.id)}`);
|
|
98
|
+
}
|
|
99
|
+
return Promise.resolve(filteredBuckets[0]);
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
getPlanId(args) {
|
|
103
|
+
const { planId, planName } = args.options;
|
|
104
|
+
if (planId) {
|
|
105
|
+
return Promise.resolve(planId);
|
|
106
|
+
}
|
|
107
|
+
return this
|
|
108
|
+
.getGroupId(args)
|
|
109
|
+
.then(groupId => planner_1.planner.getPlanByName(planName, groupId))
|
|
110
|
+
.then(plan => plan.id);
|
|
111
|
+
}
|
|
112
|
+
getGroupId(args) {
|
|
113
|
+
const { ownerGroupId, ownerGroupName } = args.options;
|
|
114
|
+
if (ownerGroupId) {
|
|
115
|
+
return Promise.resolve(ownerGroupId);
|
|
116
|
+
}
|
|
117
|
+
const requestOptions = {
|
|
118
|
+
url: `${this.resource}/v1.0/groups?$filter=displayName eq '${encodeURIComponent(ownerGroupName)}'`,
|
|
119
|
+
headers: {
|
|
120
|
+
accept: 'application/json;odata.metadata=none'
|
|
121
|
+
},
|
|
122
|
+
responseType: 'json'
|
|
123
|
+
};
|
|
124
|
+
return request_1.default
|
|
125
|
+
.get(requestOptions)
|
|
126
|
+
.then(response => {
|
|
127
|
+
if (!response.value.length) {
|
|
128
|
+
return Promise.reject(`The specified owner group ${ownerGroupName} does not exist`);
|
|
129
|
+
}
|
|
130
|
+
if (response.value.length > 1) {
|
|
131
|
+
return Promise.reject(`Multiple owner groups with name ${ownerGroupName} found: ${response.value.map(x => x.id)}`);
|
|
132
|
+
}
|
|
133
|
+
return Promise.resolve(response.value[0].id);
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
options() {
|
|
137
|
+
const options = [
|
|
138
|
+
{
|
|
139
|
+
option: '--id [id]'
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
option: '--name [name]'
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
option: '--planId [planId]'
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
option: '--planName [planName]'
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
option: '--ownerGroupId [ownerGroupId]'
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
option: '--ownerGroupName [ownerGroupName]'
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
option: '--confirm'
|
|
158
|
+
}
|
|
159
|
+
];
|
|
160
|
+
const parentOptions = super.options();
|
|
161
|
+
return options.concat(parentOptions);
|
|
162
|
+
}
|
|
163
|
+
optionSets() {
|
|
164
|
+
return [
|
|
165
|
+
['id', 'name']
|
|
166
|
+
];
|
|
167
|
+
}
|
|
168
|
+
validate(args) {
|
|
169
|
+
if (args.options.id) {
|
|
170
|
+
if (args.options.planId || args.options.planName || args.options.ownerGroupId || args.options.ownerGroupName) {
|
|
171
|
+
return 'Don\'t specify planId, planName, ownerGroupId or ownerGroupName when using id';
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
if (!args.options.planId && !args.options.planName) {
|
|
176
|
+
return 'Specify either planId or planName when using name';
|
|
177
|
+
}
|
|
178
|
+
if (args.options.planId && args.options.planName) {
|
|
179
|
+
return 'Specify either planId or planName when using name but not both';
|
|
180
|
+
}
|
|
181
|
+
if (args.options.planName) {
|
|
182
|
+
if (!args.options.ownerGroupId && !args.options.ownerGroupName) {
|
|
183
|
+
return 'Specify either ownerGroupId or ownerGroupName when using planName';
|
|
184
|
+
}
|
|
185
|
+
if (args.options.ownerGroupId && args.options.ownerGroupName) {
|
|
186
|
+
return 'Specify either ownerGroupId or ownerGroupName when using planName but not both';
|
|
187
|
+
}
|
|
188
|
+
if (args.options.ownerGroupId && !utils_1.validation.isValidGuid(args.options.ownerGroupId)) {
|
|
189
|
+
return `${args.options.ownerGroupId} is not a valid GUID`;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
if (args.options.ownerGroupId || args.options.ownerGroupName) {
|
|
194
|
+
return 'Don\'t specify ownerGroupId or ownerGroupName when using planId';
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return true;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
module.exports = new PlannerBucketRemoveCommand();
|
|
202
|
+
//# sourceMappingURL=bucket-remove.js.map
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const request_1 = require("../../../../request");
|
|
4
3
|
const utils_1 = require("../../../../utils");
|
|
5
4
|
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
5
|
+
const Auth_1 = require("../../../../Auth");
|
|
6
|
+
const request_1 = require("../../../../request");
|
|
7
|
+
const planner_1 = require("../../../../utils/planner");
|
|
6
8
|
const commands_1 = require("../../commands");
|
|
7
9
|
class PlannerBucketSetCommand extends GraphCommand_1.default {
|
|
8
10
|
get name() {
|
|
@@ -24,6 +26,10 @@ class PlannerBucketSetCommand extends GraphCommand_1.default {
|
|
|
24
26
|
return telemetryProps;
|
|
25
27
|
}
|
|
26
28
|
commandAction(logger, args, cb) {
|
|
29
|
+
if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
|
|
30
|
+
this.handleError('This command does not support application permissions.', logger, cb);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
27
33
|
this
|
|
28
34
|
.getBucket(args)
|
|
29
35
|
.then(bucket => {
|
|
@@ -88,26 +94,8 @@ class PlannerBucketSetCommand extends GraphCommand_1.default {
|
|
|
88
94
|
}
|
|
89
95
|
return this
|
|
90
96
|
.getGroupId(args)
|
|
91
|
-
.then(groupId =>
|
|
92
|
-
|
|
93
|
-
url: `${this.resource}/v1.0/planner/plans?$filter=owner eq '${groupId}'`,
|
|
94
|
-
headers: {
|
|
95
|
-
accept: 'application/json;odata.metadata=none'
|
|
96
|
-
},
|
|
97
|
-
responseType: 'json'
|
|
98
|
-
};
|
|
99
|
-
return request_1.default.get(requestOptions);
|
|
100
|
-
})
|
|
101
|
-
.then(plans => {
|
|
102
|
-
const filteredPlans = plans.value.filter(p => p.title.toLowerCase() === planName.toLowerCase());
|
|
103
|
-
if (filteredPlans.length === 0) {
|
|
104
|
-
return Promise.reject(`The specified plan ${planName} does not exist`);
|
|
105
|
-
}
|
|
106
|
-
if (filteredPlans.length > 1) {
|
|
107
|
-
return Promise.reject(`Multiple plans with name ${planName} found: ${filteredPlans.map(x => x.id)}`);
|
|
108
|
-
}
|
|
109
|
-
return Promise.resolve(filteredPlans[0].id);
|
|
110
|
-
});
|
|
97
|
+
.then(groupId => planner_1.planner.getPlanByName(planName, groupId))
|
|
98
|
+
.then(plan => plan.id);
|
|
111
99
|
}
|
|
112
100
|
getGroupId(args) {
|
|
113
101
|
const { ownerGroupId, ownerGroupName } = args.options;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const request_1 = require("../../../../request");
|
|
4
3
|
const utils_1 = require("../../../../utils");
|
|
4
|
+
const Auth_1 = require("../../../../Auth");
|
|
5
|
+
const request_1 = require("../../../../request");
|
|
5
6
|
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
6
7
|
const commands_1 = require("../../commands");
|
|
7
8
|
class PlannerPlanAddCommand extends GraphCommand_1.default {
|
|
@@ -21,6 +22,10 @@ class PlannerPlanAddCommand extends GraphCommand_1.default {
|
|
|
21
22
|
return ['id', 'title', 'createdDateTime', 'owner'];
|
|
22
23
|
}
|
|
23
24
|
commandAction(logger, args, cb) {
|
|
25
|
+
if (utils_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
|
+
}
|
|
24
29
|
this
|
|
25
30
|
.getGroupId(args)
|
|
26
31
|
.then((groupId) => {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const request_1 = require("../../../../request");
|
|
4
3
|
const utils_1 = require("../../../../utils");
|
|
4
|
+
const Auth_1 = require("../../../../Auth");
|
|
5
|
+
const request_1 = require("../../../../request");
|
|
6
|
+
const planner_1 = require("../../../../utils/planner");
|
|
5
7
|
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
6
8
|
const commands_1 = require("../../commands");
|
|
7
9
|
class PlannerPlanDetailsGetCommand extends GraphCommand_1.default {
|
|
@@ -24,11 +26,15 @@ class PlannerPlanDetailsGetCommand extends GraphCommand_1.default {
|
|
|
24
26
|
return telemetryProps;
|
|
25
27
|
}
|
|
26
28
|
commandAction(logger, args, cb) {
|
|
29
|
+
if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
|
|
30
|
+
this.handleError('This command does not support application permissions.', logger, cb);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
27
33
|
this
|
|
28
34
|
.getGroupId(args)
|
|
29
35
|
.then((groupId) => {
|
|
30
36
|
this.groupId = groupId;
|
|
31
|
-
return this.getPlanId(args
|
|
37
|
+
return this.getPlanId(args);
|
|
32
38
|
})
|
|
33
39
|
.then((planId) => {
|
|
34
40
|
args.options.planId = planId;
|
|
@@ -66,22 +72,13 @@ class PlannerPlanDetailsGetCommand extends GraphCommand_1.default {
|
|
|
66
72
|
return Promise.resolve(groupItem.id);
|
|
67
73
|
});
|
|
68
74
|
}
|
|
69
|
-
getPlanId(args
|
|
75
|
+
getPlanId(args) {
|
|
70
76
|
if (args.options.planId) {
|
|
71
77
|
return Promise.resolve(args.options.planId);
|
|
72
78
|
}
|
|
73
|
-
return
|
|
74
|
-
.
|
|
75
|
-
.then(
|
|
76
|
-
const plansMatchingName = plans.filter((plan) => plan.title === args.options.planTitle);
|
|
77
|
-
if (plansMatchingName && plansMatchingName.length > 0) {
|
|
78
|
-
if (plansMatchingName.length > 1) {
|
|
79
|
-
return Promise.reject(`Multiple plans with name ${args.options.planTitle} found: ${plansMatchingName.map(x => x.id)}`);
|
|
80
|
-
}
|
|
81
|
-
return Promise.resolve(plansMatchingName[0].id);
|
|
82
|
-
}
|
|
83
|
-
return Promise.reject(`The specified plan title does not exist`);
|
|
84
|
-
});
|
|
79
|
+
return planner_1.planner
|
|
80
|
+
.getPlanByName(args.options.planTitle, this.groupId)
|
|
81
|
+
.then(plan => plan.id);
|
|
85
82
|
}
|
|
86
83
|
getPlanDetails(args) {
|
|
87
84
|
const requestOptions = {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const request_1 = require("../../../../request");
|
|
4
3
|
const utils_1 = require("../../../../utils");
|
|
4
|
+
const request_1 = require("../../../../request");
|
|
5
|
+
const planner_1 = require("../../../../utils/planner");
|
|
5
6
|
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
6
7
|
const commands_1 = require("../../commands");
|
|
8
|
+
const Auth_1 = require("../../../../Auth");
|
|
7
9
|
class PlannerPlanGetCommand extends GraphCommand_1.default {
|
|
8
10
|
get name() {
|
|
9
11
|
return commands_1.default.PLAN_GET;
|
|
@@ -23,9 +25,13 @@ class PlannerPlanGetCommand extends GraphCommand_1.default {
|
|
|
23
25
|
return ['id', 'title', 'createdDateTime', 'owner', '@odata.etag'];
|
|
24
26
|
}
|
|
25
27
|
commandAction(logger, args, cb) {
|
|
28
|
+
if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
|
|
29
|
+
this.handleError('This command does not support application permissions.', logger, cb);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
26
32
|
if (args.options.id) {
|
|
27
|
-
|
|
28
|
-
.
|
|
33
|
+
planner_1.planner
|
|
34
|
+
.getPlanById(args.options.id)
|
|
29
35
|
.then((res) => {
|
|
30
36
|
logger.log(res);
|
|
31
37
|
cb();
|
|
@@ -34,11 +40,10 @@ class PlannerPlanGetCommand extends GraphCommand_1.default {
|
|
|
34
40
|
else {
|
|
35
41
|
this
|
|
36
42
|
.getGroupId(args)
|
|
37
|
-
.then(
|
|
38
|
-
.then((
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
logger.log(filteredPlan);
|
|
43
|
+
.then(groupId => planner_1.planner.getPlanByName(args.options.title, groupId))
|
|
44
|
+
.then((plan) => {
|
|
45
|
+
if (plan) {
|
|
46
|
+
logger.log(plan);
|
|
42
47
|
}
|
|
43
48
|
cb();
|
|
44
49
|
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
@@ -65,16 +70,6 @@ class PlannerPlanGetCommand extends GraphCommand_1.default {
|
|
|
65
70
|
return Promise.resolve(group.id);
|
|
66
71
|
});
|
|
67
72
|
}
|
|
68
|
-
getPlan(args) {
|
|
69
|
-
const requestOptions = {
|
|
70
|
-
url: `${this.resource}/v1.0/planner/plans/${args.options.id}`,
|
|
71
|
-
headers: {
|
|
72
|
-
'accept': 'application/json'
|
|
73
|
-
},
|
|
74
|
-
responseType: 'json'
|
|
75
|
-
};
|
|
76
|
-
return request_1.default.get(requestOptions);
|
|
77
|
-
}
|
|
78
73
|
options() {
|
|
79
74
|
const options = [
|
|
80
75
|
{
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const request_1 = require("../../../../request");
|
|
4
3
|
const utils_1 = require("../../../../utils");
|
|
4
|
+
const Auth_1 = require("../../../../Auth");
|
|
5
|
+
const request_1 = require("../../../../request");
|
|
6
|
+
const planner_1 = require("../../../../utils/planner");
|
|
5
7
|
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
6
8
|
const commands_1 = require("../../commands");
|
|
7
9
|
class PlannerPlanListCommand extends GraphCommand_1.default {
|
|
@@ -21,21 +23,16 @@ class PlannerPlanListCommand extends GraphCommand_1.default {
|
|
|
21
23
|
return ['id', 'title', 'createdDateTime', 'owner'];
|
|
22
24
|
}
|
|
23
25
|
commandAction(logger, args, cb) {
|
|
26
|
+
if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
|
|
27
|
+
this.handleError('This command does not support application permissions.', logger, cb);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
24
30
|
this
|
|
25
31
|
.getGroupId(args)
|
|
26
|
-
.then((groupId) =>
|
|
27
|
-
const requestOptions = {
|
|
28
|
-
url: `${this.resource}/v1.0/groups/${groupId}/planner/plans`,
|
|
29
|
-
headers: {
|
|
30
|
-
'accept': 'application/json;odata.metadata=none'
|
|
31
|
-
},
|
|
32
|
-
responseType: 'json'
|
|
33
|
-
};
|
|
34
|
-
return request_1.default.get(requestOptions);
|
|
35
|
-
})
|
|
32
|
+
.then((groupId) => planner_1.planner.getPlansByGroupId(groupId))
|
|
36
33
|
.then((res) => {
|
|
37
|
-
if (res
|
|
38
|
-
logger.log(res
|
|
34
|
+
if (res && res.length > 0) {
|
|
35
|
+
logger.log(res);
|
|
39
36
|
}
|
|
40
37
|
cb();
|
|
41
38
|
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|