@pnp/cli-microsoft365 5.2.0-beta.dc50ce6 → 5.3.0-beta.99da27d
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/planner/commands/bucket/bucket-remove.js +214 -0
- package/dist/m365/planner/commands/bucket/bucket-set.js +208 -0
- package/dist/m365/planner/commands/task/task-get.js +150 -7
- package/dist/m365/planner/commands.js +2 -0
- package/dist/m365/spfx/commands/project/project-upgrade/{upgrade-1.15.0-beta.1.js → upgrade-1.15.0-beta.6.js} +27 -27
- package/dist/m365/spfx/commands/project/project-upgrade.js +1 -1
- package/dist/m365/spfx/commands/spfx-doctor.js +1 -105
- 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.js +3 -0
- package/dist/m365/teams/commands/channel/channel-member-remove.js +214 -0
- package/dist/m365/teams/commands.js +2 -0
- package/dist/m365/tenant/commands/security/security-alerts-list.js +71 -0
- package/dist/m365/tenant/commands.js +1 -0
- package/docs/docs/cmd/planner/bucket/bucket-remove.md +60 -0
- package/docs/docs/cmd/planner/bucket/bucket-set.md +57 -0
- package/docs/docs/cmd/planner/task/task-get.md +30 -3
- package/docs/docs/cmd/planner/task/task-set.md +2 -2
- package/docs/docs/cmd/spfx/project/project-upgrade.md +1 -1
- package/docs/docs/cmd/spfx/spfx-doctor.md +1 -1
- 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-list.md +2 -2
- package/docs/docs/cmd/teams/channel/channel-member-remove.md +57 -0
- package/docs/docs/cmd/tenant/security/security-alerts-list.md +30 -0
- package/npm-shrinkwrap.json +1517 -1284
- package/package.json +26 -24
package/.eslintrc.js
CHANGED
|
@@ -0,0 +1,214 @@
|
|
|
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
|
+
class PlannerBucketRemoveCommand extends GraphCommand_1.default {
|
|
9
|
+
get name() {
|
|
10
|
+
return commands_1.default.BUCKET_REMOVE;
|
|
11
|
+
}
|
|
12
|
+
get description() {
|
|
13
|
+
return 'Removes the Microsoft Planner bucket from a plan';
|
|
14
|
+
}
|
|
15
|
+
getTelemetryProperties(args) {
|
|
16
|
+
const telemetryProps = super.getTelemetryProperties(args);
|
|
17
|
+
telemetryProps.id = typeof args.options.id !== 'undefined';
|
|
18
|
+
telemetryProps.name = typeof args.options.name !== 'undefined';
|
|
19
|
+
telemetryProps.planId = typeof args.options.planId !== 'undefined';
|
|
20
|
+
telemetryProps.planName = typeof args.options.planName !== 'undefined';
|
|
21
|
+
telemetryProps.ownerGroupId = typeof args.options.ownerGroupId !== 'undefined';
|
|
22
|
+
telemetryProps.ownerGroupName = typeof args.options.ownerGroupName !== 'undefined';
|
|
23
|
+
telemetryProps.confirm = args.options.confirm || false;
|
|
24
|
+
return telemetryProps;
|
|
25
|
+
}
|
|
26
|
+
commandAction(logger, args, cb) {
|
|
27
|
+
const removeBucket = () => {
|
|
28
|
+
this
|
|
29
|
+
.getBucket(args)
|
|
30
|
+
.then(bucket => {
|
|
31
|
+
const requestOptions = {
|
|
32
|
+
url: `${this.resource}/v1.0/planner/buckets/${bucket.id}`,
|
|
33
|
+
headers: {
|
|
34
|
+
accept: 'application/json;odata.metadata=none',
|
|
35
|
+
'if-match': bucket['@odata.etag']
|
|
36
|
+
},
|
|
37
|
+
responseType: 'json'
|
|
38
|
+
};
|
|
39
|
+
return request_1.default.delete(requestOptions);
|
|
40
|
+
})
|
|
41
|
+
.then(_ => cb(), (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
42
|
+
};
|
|
43
|
+
if (args.options.confirm) {
|
|
44
|
+
removeBucket();
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
cli_1.Cli.prompt({
|
|
48
|
+
type: 'confirm',
|
|
49
|
+
name: 'continue',
|
|
50
|
+
default: false,
|
|
51
|
+
message: `Are you sure you want to remove the bucket ${args.options.id || args.options.name}?`
|
|
52
|
+
}, (result) => {
|
|
53
|
+
if (!result.continue) {
|
|
54
|
+
cb();
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
removeBucket();
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
getBucket(args) {
|
|
63
|
+
if (args.options.id) {
|
|
64
|
+
const requestOptions = {
|
|
65
|
+
url: `${this.resource}/v1.0/planner/buckets/${args.options.id}`,
|
|
66
|
+
headers: {
|
|
67
|
+
accept: 'application/json'
|
|
68
|
+
},
|
|
69
|
+
responseType: 'json'
|
|
70
|
+
};
|
|
71
|
+
return request_1.default.get(requestOptions);
|
|
72
|
+
}
|
|
73
|
+
return this
|
|
74
|
+
.getPlanId(args)
|
|
75
|
+
.then(planId => {
|
|
76
|
+
const requestOptions = {
|
|
77
|
+
url: `${this.resource}/v1.0/planner/plans/${planId}/buckets`,
|
|
78
|
+
headers: {
|
|
79
|
+
accept: 'application/json'
|
|
80
|
+
},
|
|
81
|
+
responseType: 'json'
|
|
82
|
+
};
|
|
83
|
+
return request_1.default.get(requestOptions);
|
|
84
|
+
})
|
|
85
|
+
.then(buckets => {
|
|
86
|
+
const filteredBuckets = buckets.value.filter(b => args.options.name.toLowerCase() === b.name.toLowerCase());
|
|
87
|
+
if (!filteredBuckets.length) {
|
|
88
|
+
return Promise.reject(`The specified bucket ${args.options.name} does not exist`);
|
|
89
|
+
}
|
|
90
|
+
if (filteredBuckets.length > 1) {
|
|
91
|
+
return Promise.reject(`Multiple buckets with name ${args.options.name} found: ${filteredBuckets.map(x => x.id)}`);
|
|
92
|
+
}
|
|
93
|
+
return Promise.resolve(filteredBuckets[0]);
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
getPlanId(args) {
|
|
97
|
+
const { planId, planName } = args.options;
|
|
98
|
+
if (planId) {
|
|
99
|
+
return Promise.resolve(planId);
|
|
100
|
+
}
|
|
101
|
+
return this
|
|
102
|
+
.getGroupId(args)
|
|
103
|
+
.then(groupId => {
|
|
104
|
+
const requestOptions = {
|
|
105
|
+
url: `${this.resource}/v1.0/planner/plans?$filter=owner eq '${groupId}'`,
|
|
106
|
+
headers: {
|
|
107
|
+
accept: 'application/json;odata.metadata=none'
|
|
108
|
+
},
|
|
109
|
+
responseType: 'json'
|
|
110
|
+
};
|
|
111
|
+
return request_1.default.get(requestOptions);
|
|
112
|
+
})
|
|
113
|
+
.then(plans => {
|
|
114
|
+
const filteredPlans = plans.value.filter(p => p.title.toLowerCase() === planName.toLowerCase());
|
|
115
|
+
if (!filteredPlans.length) {
|
|
116
|
+
return Promise.reject(`The specified plan ${planName} does not exist`);
|
|
117
|
+
}
|
|
118
|
+
if (filteredPlans.length > 1) {
|
|
119
|
+
return Promise.reject(`Multiple plans with name ${planName} found: ${filteredPlans.map(x => x.id)}`);
|
|
120
|
+
}
|
|
121
|
+
return Promise.resolve(filteredPlans[0].id);
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
getGroupId(args) {
|
|
125
|
+
const { ownerGroupId, ownerGroupName } = args.options;
|
|
126
|
+
if (ownerGroupId) {
|
|
127
|
+
return Promise.resolve(ownerGroupId);
|
|
128
|
+
}
|
|
129
|
+
const requestOptions = {
|
|
130
|
+
url: `${this.resource}/v1.0/groups?$filter=displayName eq '${encodeURIComponent(ownerGroupName)}'`,
|
|
131
|
+
headers: {
|
|
132
|
+
accept: 'application/json;odata.metadata=none'
|
|
133
|
+
},
|
|
134
|
+
responseType: 'json'
|
|
135
|
+
};
|
|
136
|
+
return request_1.default
|
|
137
|
+
.get(requestOptions)
|
|
138
|
+
.then(response => {
|
|
139
|
+
if (!response.value.length) {
|
|
140
|
+
return Promise.reject(`The specified owner group ${ownerGroupName} does not exist`);
|
|
141
|
+
}
|
|
142
|
+
if (response.value.length > 1) {
|
|
143
|
+
return Promise.reject(`Multiple owner groups with name ${ownerGroupName} found: ${response.value.map(x => x.id)}`);
|
|
144
|
+
}
|
|
145
|
+
return Promise.resolve(response.value[0].id);
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
options() {
|
|
149
|
+
const options = [
|
|
150
|
+
{
|
|
151
|
+
option: '--id [id]'
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
option: '--name [name]'
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
option: '--planId [planId]'
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
option: '--planName [planName]'
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
option: '--ownerGroupId [ownerGroupId]'
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
option: '--ownerGroupName [ownerGroupName]'
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
option: '--confirm'
|
|
170
|
+
}
|
|
171
|
+
];
|
|
172
|
+
const parentOptions = super.options();
|
|
173
|
+
return options.concat(parentOptions);
|
|
174
|
+
}
|
|
175
|
+
optionSets() {
|
|
176
|
+
return [
|
|
177
|
+
['id', 'name']
|
|
178
|
+
];
|
|
179
|
+
}
|
|
180
|
+
validate(args) {
|
|
181
|
+
if (args.options.id) {
|
|
182
|
+
if (args.options.planId || args.options.planName || args.options.ownerGroupId || args.options.ownerGroupName) {
|
|
183
|
+
return 'Don\'t specify planId, planName, ownerGroupId or ownerGroupName when using id';
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
if (!args.options.planId && !args.options.planName) {
|
|
188
|
+
return 'Specify either planId or planName when using name';
|
|
189
|
+
}
|
|
190
|
+
if (args.options.planId && args.options.planName) {
|
|
191
|
+
return 'Specify either planId or planName when using name but not both';
|
|
192
|
+
}
|
|
193
|
+
if (args.options.planName) {
|
|
194
|
+
if (!args.options.ownerGroupId && !args.options.ownerGroupName) {
|
|
195
|
+
return 'Specify either ownerGroupId or ownerGroupName when using planName';
|
|
196
|
+
}
|
|
197
|
+
if (args.options.ownerGroupId && args.options.ownerGroupName) {
|
|
198
|
+
return 'Specify either ownerGroupId or ownerGroupName when using planName but not both';
|
|
199
|
+
}
|
|
200
|
+
if (args.options.ownerGroupId && !utils_1.validation.isValidGuid(args.options.ownerGroupId)) {
|
|
201
|
+
return `${args.options.ownerGroupId} is not a valid GUID`;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
if (args.options.ownerGroupId || args.options.ownerGroupName) {
|
|
206
|
+
return 'Don\'t specify ownerGroupId or ownerGroupName when using planId';
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return true;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
module.exports = new PlannerBucketRemoveCommand();
|
|
214
|
+
//# sourceMappingURL=bucket-remove.js.map
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const request_1 = require("../../../../request");
|
|
4
|
+
const utils_1 = require("../../../../utils");
|
|
5
|
+
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
6
|
+
const commands_1 = require("../../commands");
|
|
7
|
+
class PlannerBucketSetCommand extends GraphCommand_1.default {
|
|
8
|
+
get name() {
|
|
9
|
+
return commands_1.default.BUCKET_SET;
|
|
10
|
+
}
|
|
11
|
+
get description() {
|
|
12
|
+
return 'Updates a Microsoft Planner bucket';
|
|
13
|
+
}
|
|
14
|
+
getTelemetryProperties(args) {
|
|
15
|
+
const telemetryProps = super.getTelemetryProperties(args);
|
|
16
|
+
telemetryProps.id = typeof args.options.id !== 'undefined';
|
|
17
|
+
telemetryProps.name = typeof args.options.name !== 'undefined';
|
|
18
|
+
telemetryProps.planId = typeof args.options.planId !== 'undefined';
|
|
19
|
+
telemetryProps.planName = typeof args.options.planName !== 'undefined';
|
|
20
|
+
telemetryProps.ownerGroupId = typeof args.options.ownerGroupId !== 'undefined';
|
|
21
|
+
telemetryProps.ownerGroupName = typeof args.options.ownerGroupName !== 'undefined';
|
|
22
|
+
telemetryProps.newName = typeof args.options.newName !== 'undefined';
|
|
23
|
+
telemetryProps.orderHint = typeof args.options.orderHint !== 'undefined';
|
|
24
|
+
return telemetryProps;
|
|
25
|
+
}
|
|
26
|
+
commandAction(logger, args, cb) {
|
|
27
|
+
this
|
|
28
|
+
.getBucket(args)
|
|
29
|
+
.then(bucket => {
|
|
30
|
+
const requestOptions = {
|
|
31
|
+
url: `${this.resource}/v1.0/planner/buckets/${bucket.id}`,
|
|
32
|
+
headers: {
|
|
33
|
+
accept: 'application/json;odata.metadata=none',
|
|
34
|
+
'if-match': bucket['@odata.etag']
|
|
35
|
+
},
|
|
36
|
+
responseType: 'json',
|
|
37
|
+
data: {}
|
|
38
|
+
};
|
|
39
|
+
const { newName, orderHint } = args.options;
|
|
40
|
+
if (newName) {
|
|
41
|
+
requestOptions.data.name = newName;
|
|
42
|
+
}
|
|
43
|
+
if (orderHint) {
|
|
44
|
+
requestOptions.data.orderHint = orderHint;
|
|
45
|
+
}
|
|
46
|
+
return request_1.default.patch(requestOptions);
|
|
47
|
+
})
|
|
48
|
+
.then(_ => cb(), (rawRes) => this.handleRejectedODataJsonPromise(rawRes, logger, cb));
|
|
49
|
+
}
|
|
50
|
+
getBucket(args) {
|
|
51
|
+
if (args.options.id) {
|
|
52
|
+
const requestOptions = {
|
|
53
|
+
url: `${this.resource}/v1.0/planner/buckets/${args.options.id}`,
|
|
54
|
+
headers: {
|
|
55
|
+
accept: 'application/json'
|
|
56
|
+
},
|
|
57
|
+
responseType: 'json'
|
|
58
|
+
};
|
|
59
|
+
return request_1.default.get(requestOptions);
|
|
60
|
+
}
|
|
61
|
+
return this
|
|
62
|
+
.getPlanId(args)
|
|
63
|
+
.then(planId => {
|
|
64
|
+
const requestOptions = {
|
|
65
|
+
url: `${this.resource}/v1.0/planner/plans/${planId}/buckets`,
|
|
66
|
+
headers: {
|
|
67
|
+
accept: 'application/json'
|
|
68
|
+
},
|
|
69
|
+
responseType: 'json'
|
|
70
|
+
};
|
|
71
|
+
return request_1.default.get(requestOptions);
|
|
72
|
+
})
|
|
73
|
+
.then(buckets => {
|
|
74
|
+
const filteredBuckets = buckets.value.filter(b => args.options.name.toLowerCase() === b.name.toLowerCase());
|
|
75
|
+
if (!filteredBuckets.length) {
|
|
76
|
+
return Promise.reject(`The specified bucket ${args.options.name} does not exist`);
|
|
77
|
+
}
|
|
78
|
+
if (filteredBuckets.length > 1) {
|
|
79
|
+
return Promise.reject(`Multiple buckets with name ${args.options.name} found: ${filteredBuckets.map(x => x.id)}`);
|
|
80
|
+
}
|
|
81
|
+
return Promise.resolve(filteredBuckets[0]);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
getPlanId(args) {
|
|
85
|
+
const { planId, planName } = args.options;
|
|
86
|
+
if (planId) {
|
|
87
|
+
return Promise.resolve(planId);
|
|
88
|
+
}
|
|
89
|
+
return this
|
|
90
|
+
.getGroupId(args)
|
|
91
|
+
.then(groupId => {
|
|
92
|
+
const requestOptions = {
|
|
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
|
+
});
|
|
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 === 0) {
|
|
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: '-i, --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: '--newName [newName]'
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
option: '--orderHint [orderHint]'
|
|
161
|
+
}
|
|
162
|
+
];
|
|
163
|
+
const parentOptions = super.options();
|
|
164
|
+
return options.concat(parentOptions);
|
|
165
|
+
}
|
|
166
|
+
optionSets() {
|
|
167
|
+
return [
|
|
168
|
+
['id', 'name']
|
|
169
|
+
];
|
|
170
|
+
}
|
|
171
|
+
validate(args) {
|
|
172
|
+
if (args.options.id) {
|
|
173
|
+
if (args.options.planId || args.options.planName || args.options.ownerGroupId || args.options.ownerGroupName) {
|
|
174
|
+
return 'Don\'t specify planId, planName, ownerGroupId or ownerGroupName when using id';
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
if (args.options.name) {
|
|
178
|
+
if (!args.options.planId && !args.options.planName) {
|
|
179
|
+
return 'Specify either planId or planName when using name';
|
|
180
|
+
}
|
|
181
|
+
if (args.options.planId && args.options.planName) {
|
|
182
|
+
return 'Specify either planId or planName when using name but not both';
|
|
183
|
+
}
|
|
184
|
+
if (args.options.planName) {
|
|
185
|
+
if (!args.options.ownerGroupId && !args.options.ownerGroupName) {
|
|
186
|
+
return 'Specify either ownerGroupId or ownerGroupName when using planName';
|
|
187
|
+
}
|
|
188
|
+
if (args.options.ownerGroupId && args.options.ownerGroupName) {
|
|
189
|
+
return 'Specify either ownerGroupId or ownerGroupName when using planName but not both';
|
|
190
|
+
}
|
|
191
|
+
if (args.options.ownerGroupId && !utils_1.validation.isValidGuid(args.options.ownerGroupId)) {
|
|
192
|
+
return `${args.options.ownerGroupId} is not a valid GUID`;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
if (args.options.planId) {
|
|
196
|
+
if (args.options.ownerGroupId || args.options.ownerGroupName) {
|
|
197
|
+
return 'Don\'t specify ownerGroupId or ownerGroupName when using planId';
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
if (!args.options.newName && !args.options.orderHint) {
|
|
202
|
+
return 'Specify either newName or orderHint';
|
|
203
|
+
}
|
|
204
|
+
return true;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
module.exports = new PlannerBucketSetCommand();
|
|
208
|
+
//# sourceMappingURL=bucket-set.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const request_1 = require("../../../../request");
|
|
4
|
+
const utils_1 = require("../../../../utils");
|
|
4
5
|
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
5
6
|
const commands_1 = require("../../commands");
|
|
6
7
|
class PlannerTaskGetCommand extends GraphCommand_1.default {
|
|
@@ -11,27 +12,169 @@ class PlannerTaskGetCommand extends GraphCommand_1.default {
|
|
|
11
12
|
return 'Retrieve the the specified planner task';
|
|
12
13
|
}
|
|
13
14
|
commandAction(logger, args, cb) {
|
|
15
|
+
this
|
|
16
|
+
.getTaskId(args.options)
|
|
17
|
+
.then(taskId => {
|
|
18
|
+
const requestOptions = {
|
|
19
|
+
url: `${this.resource}/beta/planner/tasks/${encodeURIComponent(taskId)}`,
|
|
20
|
+
headers: {
|
|
21
|
+
accept: 'application/json;odata.metadata=none'
|
|
22
|
+
},
|
|
23
|
+
responseType: 'json'
|
|
24
|
+
};
|
|
25
|
+
return request_1.default.get(requestOptions);
|
|
26
|
+
})
|
|
27
|
+
.then((res) => {
|
|
28
|
+
logger.log(res);
|
|
29
|
+
cb();
|
|
30
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
31
|
+
}
|
|
32
|
+
getTaskId(options) {
|
|
33
|
+
if (options.id) {
|
|
34
|
+
return Promise.resolve(options.id);
|
|
35
|
+
}
|
|
36
|
+
return this
|
|
37
|
+
.getBucketId(options)
|
|
38
|
+
.then(bucketId => {
|
|
39
|
+
const requestOptions = {
|
|
40
|
+
url: `${this.resource}/v1.0/planner/buckets/${bucketId}/tasks?$select=id,title`,
|
|
41
|
+
headers: {
|
|
42
|
+
accept: 'application/json;odata.metadata=none'
|
|
43
|
+
},
|
|
44
|
+
responseType: 'json'
|
|
45
|
+
};
|
|
46
|
+
return request_1.default.get(requestOptions);
|
|
47
|
+
})
|
|
48
|
+
.then((response) => {
|
|
49
|
+
const title = options.title;
|
|
50
|
+
const tasks = response.value.filter(val => { var _a; return ((_a = val.title) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) === title.toLocaleLowerCase(); });
|
|
51
|
+
if (!tasks.length) {
|
|
52
|
+
return Promise.reject(`The specified task ${options.title} does not exist`);
|
|
53
|
+
}
|
|
54
|
+
if (tasks.length > 1) {
|
|
55
|
+
return Promise.reject(`Multiple tasks with title ${options.title} found: ${tasks.map(x => x.id)}`);
|
|
56
|
+
}
|
|
57
|
+
return Promise.resolve(tasks[0].id);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
getBucketId(options) {
|
|
61
|
+
if (options.bucketId) {
|
|
62
|
+
return Promise.resolve(options.bucketId);
|
|
63
|
+
}
|
|
64
|
+
return this
|
|
65
|
+
.getPlanId(options)
|
|
66
|
+
.then(planId => {
|
|
67
|
+
const requestOptions = {
|
|
68
|
+
url: `${this.resource}/v1.0/planner/plans/${planId}/buckets?$select=id,name`,
|
|
69
|
+
headers: {
|
|
70
|
+
accept: 'application/json;odata.metadata=none'
|
|
71
|
+
},
|
|
72
|
+
responseType: 'json'
|
|
73
|
+
};
|
|
74
|
+
return request_1.default.get(requestOptions);
|
|
75
|
+
})
|
|
76
|
+
.then((response) => {
|
|
77
|
+
const bucketName = options.bucketName;
|
|
78
|
+
const buckets = response.value.filter(val => { var _a; return ((_a = val.name) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) === bucketName.toLocaleLowerCase(); });
|
|
79
|
+
if (!buckets.length) {
|
|
80
|
+
return Promise.reject(`The specified bucket ${options.bucketName} does not exist`);
|
|
81
|
+
}
|
|
82
|
+
if (buckets.length > 1) {
|
|
83
|
+
return Promise.reject(`Multiple buckets with name ${options.bucketName} found: ${buckets.map(x => x.id)}`);
|
|
84
|
+
}
|
|
85
|
+
return Promise.resolve(buckets[0].id);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
getPlanId(options) {
|
|
89
|
+
if (options.planId) {
|
|
90
|
+
return Promise.resolve(options.planId);
|
|
91
|
+
}
|
|
92
|
+
return this
|
|
93
|
+
.getGroupId(options)
|
|
94
|
+
.then((groupId) => {
|
|
95
|
+
const requestOptions = {
|
|
96
|
+
url: `${this.resource}/v1.0/planner/plans?$filter=owner eq '${groupId}'&$select=id,title`,
|
|
97
|
+
headers: {
|
|
98
|
+
accept: 'application/json;odata.metadata=none'
|
|
99
|
+
},
|
|
100
|
+
responseType: 'json'
|
|
101
|
+
};
|
|
102
|
+
return request_1.default.get(requestOptions);
|
|
103
|
+
})
|
|
104
|
+
.then((response) => {
|
|
105
|
+
const planName = options.planName;
|
|
106
|
+
const plans = response.value.filter(val => { var _a; return ((_a = val.title) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) === planName.toLocaleLowerCase(); });
|
|
107
|
+
if (!plans.length) {
|
|
108
|
+
return Promise.reject(`The specified plan ${options.planName} does not exist`);
|
|
109
|
+
}
|
|
110
|
+
if (plans.length > 1) {
|
|
111
|
+
return Promise.reject(`Multiple plans with name ${options.planName} found: ${plans.map(x => x.id)}`);
|
|
112
|
+
}
|
|
113
|
+
return Promise.resolve(plans[0].id);
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
getGroupId(options) {
|
|
117
|
+
if (options.ownerGroupId) {
|
|
118
|
+
return Promise.resolve(options.ownerGroupId);
|
|
119
|
+
}
|
|
14
120
|
const requestOptions = {
|
|
15
|
-
url: `${this.resource}/
|
|
121
|
+
url: `${this.resource}/v1.0/groups?$filter=displayName eq '${encodeURIComponent(options.ownerGroupName)}'&$select=id`,
|
|
16
122
|
headers: {
|
|
17
123
|
accept: 'application/json;odata.metadata=none'
|
|
18
124
|
},
|
|
19
125
|
responseType: 'json'
|
|
20
126
|
};
|
|
21
|
-
request_1.default
|
|
127
|
+
return request_1.default
|
|
22
128
|
.get(requestOptions)
|
|
23
|
-
.then(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
129
|
+
.then(response => {
|
|
130
|
+
const groups = response.value;
|
|
131
|
+
if (!groups.length) {
|
|
132
|
+
return Promise.reject(`The specified ownerGroup ${options.ownerGroupName} does not exist`);
|
|
133
|
+
}
|
|
134
|
+
if (groups.length > 1) {
|
|
135
|
+
return Promise.reject(`Multiple ownerGroups with name ${options.ownerGroupName} found: ${groups.map(x => x.id)}`);
|
|
136
|
+
}
|
|
137
|
+
return Promise.resolve(groups[0].id);
|
|
138
|
+
});
|
|
27
139
|
}
|
|
28
140
|
options() {
|
|
29
141
|
const options = [
|
|
30
|
-
{ option: '-i, --id
|
|
142
|
+
{ option: '-i, --id [id]' },
|
|
143
|
+
{ option: '-t, --title [title]' },
|
|
144
|
+
{ option: '--bucketId [bucketId]' },
|
|
145
|
+
{ option: '--bucketName [bucketName]' },
|
|
146
|
+
{ option: '--planId [planId]' },
|
|
147
|
+
{ option: '--planName [planName]' },
|
|
148
|
+
{ option: '--ownerGroupId [ownerGroupId]' },
|
|
149
|
+
{ option: '--ownerGroupName [ownerGroupName]' }
|
|
31
150
|
];
|
|
32
151
|
const parentOptions = super.options();
|
|
33
152
|
return options.concat(parentOptions);
|
|
34
153
|
}
|
|
154
|
+
validate(args) {
|
|
155
|
+
if (args.options.title && !args.options.bucketId && !args.options.bucketName) {
|
|
156
|
+
return 'Specify either bucketId or bucketName when using title';
|
|
157
|
+
}
|
|
158
|
+
if (args.options.title && args.options.bucketId && args.options.bucketName) {
|
|
159
|
+
return 'Specify either bucketId or bucketName when using title but not both';
|
|
160
|
+
}
|
|
161
|
+
if (args.options.bucketName && !args.options.planId && !args.options.planName) {
|
|
162
|
+
return 'Specify either planId or planName when using bucketName';
|
|
163
|
+
}
|
|
164
|
+
if (args.options.bucketName && args.options.planId && args.options.planName) {
|
|
165
|
+
return 'Specify either planId or planName when using bucketName but not both';
|
|
166
|
+
}
|
|
167
|
+
if (args.options.planName && !args.options.ownerGroupId && !args.options.ownerGroupName) {
|
|
168
|
+
return 'Specify either ownerGroupId or ownerGroupName when using planName';
|
|
169
|
+
}
|
|
170
|
+
if (args.options.planName && args.options.ownerGroupId && args.options.ownerGroupName) {
|
|
171
|
+
return 'Specify either ownerGroupId or ownerGroupName when using planName but not both';
|
|
172
|
+
}
|
|
173
|
+
if (args.options.ownerGroupId && !utils_1.validation.isValidGuid(args.options.ownerGroupId)) {
|
|
174
|
+
return `${args.options.ownerGroupId} is not a valid GUID`;
|
|
175
|
+
}
|
|
176
|
+
return true;
|
|
177
|
+
}
|
|
35
178
|
}
|
|
36
179
|
module.exports = new PlannerTaskGetCommand();
|
|
37
180
|
//# sourceMappingURL=task-get.js.map
|
|
@@ -4,6 +4,8 @@ const prefix = 'planner';
|
|
|
4
4
|
exports.default = {
|
|
5
5
|
BUCKET_ADD: `${prefix} bucket add`,
|
|
6
6
|
BUCKET_LIST: `${prefix} bucket list`,
|
|
7
|
+
BUCKET_SET: `${prefix} bucket set`,
|
|
8
|
+
BUCKET_REMOVE: `${prefix} bucket remove`,
|
|
7
9
|
PLAN_ADD: `${prefix} plan add`,
|
|
8
10
|
PLAN_GET: `${prefix} plan get`,
|
|
9
11
|
PLAN_DETAILS_GET: `${prefix} plan details get`,
|