@pnp/cli-microsoft365 6.0.0-beta.8352f49 → 6.0.0-beta.9d619b2
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 +2 -2
- package/dist/Command.js +22 -0
- package/dist/m365/aad/commands/app/app-remove.js +0 -4
- package/dist/m365/aad/commands/app/app-role-remove.js +0 -4
- package/dist/m365/aad/commands/o365group/o365group-recyclebinitem-restore.js +60 -9
- package/dist/m365/aad/commands.js +0 -2
- package/dist/m365/base/PowerAppsCommand.js +10 -0
- package/dist/m365/pa/commands/app/app-get.js +3 -5
- package/dist/m365/pa/commands/app/app-list.js +10 -9
- package/dist/m365/pa/commands/app/app-remove.js +3 -3
- package/dist/m365/pa/commands/connector/connector-export.js +3 -3
- package/dist/m365/pa/commands/connector/connector-list.js +10 -9
- package/dist/m365/pa/commands/environment/environment-get.js +3 -3
- package/dist/m365/pa/commands/environment/environment-list.js +4 -4
- package/dist/m365/planner/commands/bucket/bucket-add.js +11 -11
- package/dist/m365/planner/commands/bucket/bucket-get.js +13 -13
- package/dist/m365/planner/commands/bucket/bucket-list.js +11 -11
- package/dist/m365/planner/commands/bucket/bucket-remove.js +13 -13
- package/dist/m365/planner/commands/bucket/bucket-set.js +13 -13
- package/dist/m365/planner/commands/plan/plan-add.js +98 -5
- package/dist/m365/planner/commands/plan/plan-get.js +1 -5
- package/dist/m365/planner/commands/plan/plan-remove.js +1 -1
- package/dist/m365/planner/commands/task/task-add.js +12 -18
- package/dist/m365/planner/commands/task/task-get.js +10 -20
- package/dist/m365/planner/commands/task/task-list.js +13 -13
- package/dist/m365/planner/commands/task/task-reference-add.js +1 -7
- package/dist/m365/planner/commands/task/task-reference-remove.js +11 -14
- package/dist/m365/planner/commands/task/task-remove.js +4 -19
- package/dist/m365/planner/commands/task/task-set.js +13 -25
- package/dist/m365/planner/commands.js +0 -2
- package/dist/m365/search/commands/externalconnection/externalconnection-get.js +69 -0
- package/dist/m365/search/commands.js +1 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN015008_FILE_eslintrc_js.js +7 -0
- package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.15.0.js +6 -4
- package/dist/m365/spo/base-permissions.js +9 -0
- package/dist/m365/spo/commands/customaction/customaction-get.js +32 -4
- package/dist/m365/spo/commands/customaction/customaction-remove.js +43 -8
- package/dist/m365/spo/commands/field/field-set.js +16 -9
- package/dist/m365/spo/commands/group/group-add.js +96 -0
- package/dist/m365/spo/commands/group/group-set.js +167 -0
- package/dist/m365/spo/commands/hubsite/hubsite-get.js +99 -13
- package/dist/m365/spo/commands/list/list-list.js +1 -10
- package/dist/m365/spo/commands/listitem/listitem-get.js +9 -9
- package/dist/m365/spo/commands/listitem/listitem-list.js +9 -26
- package/dist/m365/spo/commands/roledefinition/RoleDefinition.js +3 -0
- package/dist/m365/spo/commands/roledefinition/RoleType.js +16 -0
- package/dist/m365/spo/commands/roledefinition/roledefinition-get.js +59 -0
- package/dist/m365/spo/commands/site/site-list.js +47 -16
- package/dist/m365/spo/commands/site/site-set.js +322 -162
- package/dist/m365/spo/commands/tenant/tenant-appcatalog-add.js +9 -6
- package/dist/m365/spo/commands.js +3 -3
- package/dist/m365/teams/commands/team/team-archive.js +51 -15
- package/dist/m365/teams/commands/team/team-clone.js +33 -7
- package/dist/m365/teams/commands/team/team-remove.js +47 -11
- package/dist/m365/teams/commands/team/team-set.js +25 -5
- package/dist/m365/teams/commands/team/team-unarchive.js +48 -12
- package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-health-get.js +1 -9
- package/dist/utils/accessToken.js +18 -0
- package/dist/utils/planner.js +6 -6
- package/dist/utils/validation.js +5 -1
- package/docs/docs/cmd/aad/app/app-remove.md +0 -6
- package/docs/docs/cmd/aad/app/app-role-remove.md +0 -6
- package/docs/docs/cmd/aad/o365group/o365group-recyclebinitem-restore.md +21 -3
- package/docs/docs/cmd/aad/user/user-get.md +12 -0
- package/docs/docs/cmd/planner/bucket/bucket-add.md +7 -7
- package/docs/docs/cmd/planner/bucket/bucket-get.md +8 -8
- package/docs/docs/cmd/planner/bucket/bucket-list.md +6 -6
- package/docs/docs/cmd/planner/bucket/bucket-remove.md +6 -6
- package/docs/docs/cmd/planner/bucket/bucket-set.md +7 -7
- package/docs/docs/cmd/planner/plan/plan-add.md +18 -2
- package/docs/docs/cmd/planner/plan/plan-get.md +0 -6
- package/docs/docs/cmd/planner/plan/plan-remove.md +1 -1
- package/docs/docs/cmd/planner/task/task-add.md +9 -9
- package/docs/docs/cmd/planner/task/task-get.md +15 -9
- package/docs/docs/cmd/planner/task/task-list.md +7 -7
- package/docs/docs/cmd/planner/task/task-set.md +7 -7
- package/docs/docs/cmd/search/externalconnection/externalconnection-get.md +33 -0
- package/docs/docs/cmd/spo/customaction/customaction-get.md +15 -2
- package/docs/docs/cmd/spo/customaction/customaction-remove.md +33 -2
- package/docs/docs/cmd/spo/field/field-set.md +7 -4
- package/docs/docs/cmd/spo/group/group-add.md +51 -0
- package/docs/docs/cmd/spo/group/group-set.md +69 -0
- package/docs/docs/cmd/spo/hubsite/hubsite-get.md +39 -7
- package/docs/docs/cmd/spo/list/list-list.md +0 -3
- package/docs/docs/cmd/spo/listitem/listitem-get.md +11 -2
- package/docs/docs/cmd/spo/listitem/listitem-list.md +8 -6
- package/docs/docs/cmd/spo/roledefinition/roledefinition-get.md +27 -0
- package/docs/docs/cmd/spo/site/site-list.md +19 -7
- package/docs/docs/cmd/spo/site/site-set.md +50 -6
- package/docs/docs/cmd/teams/team/team-archive.md +20 -5
- package/docs/docs/cmd/teams/team/team-clone.md +11 -5
- package/docs/docs/cmd/teams/team/team-remove.md +19 -5
- package/docs/docs/cmd/teams/team/team-set.md +10 -4
- package/docs/docs/cmd/teams/team/team-unarchive.md +18 -4
- package/npm-shrinkwrap.json +173 -158
- package/package.json +13 -13
- package/dist/m365/spo/commands/site/site-classic-add.js +0 -333
- package/dist/m365/spo/commands/site/site-classic-list.js +0 -98
- package/dist/m365/spo/commands/site/site-classic-set.js +0 -358
- package/docs/docs/cmd/spo/site/site-classic-add.md +0 -93
- package/docs/docs/cmd/spo/site/site-classic-list.md +0 -65
- package/docs/docs/cmd/spo/site/site-classic-set.md +0 -99
|
@@ -20,7 +20,7 @@ class PlannerBucketRemoveCommand extends GraphCommand_1.default {
|
|
|
20
20
|
telemetryProps.id = typeof args.options.id !== 'undefined';
|
|
21
21
|
telemetryProps.name = typeof args.options.name !== 'undefined';
|
|
22
22
|
telemetryProps.planId = typeof args.options.planId !== 'undefined';
|
|
23
|
-
telemetryProps.
|
|
23
|
+
telemetryProps.planTitle = typeof args.options.planTitle !== 'undefined';
|
|
24
24
|
telemetryProps.ownerGroupId = typeof args.options.ownerGroupId !== 'undefined';
|
|
25
25
|
telemetryProps.ownerGroupName = typeof args.options.ownerGroupName !== 'undefined';
|
|
26
26
|
telemetryProps.confirm = args.options.confirm || false;
|
|
@@ -101,13 +101,13 @@ class PlannerBucketRemoveCommand extends GraphCommand_1.default {
|
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
103
|
getPlanId(args) {
|
|
104
|
-
const { planId,
|
|
104
|
+
const { planId, planTitle } = args.options;
|
|
105
105
|
if (planId) {
|
|
106
106
|
return Promise.resolve(planId);
|
|
107
107
|
}
|
|
108
108
|
return this
|
|
109
109
|
.getGroupId(args)
|
|
110
|
-
.then(groupId => planner_1.planner.
|
|
110
|
+
.then(groupId => planner_1.planner.getPlanByTitle(planTitle, groupId))
|
|
111
111
|
.then(plan => plan.id);
|
|
112
112
|
}
|
|
113
113
|
getGroupId(args) {
|
|
@@ -131,7 +131,7 @@ class PlannerBucketRemoveCommand extends GraphCommand_1.default {
|
|
|
131
131
|
option: '--planId [planId]'
|
|
132
132
|
},
|
|
133
133
|
{
|
|
134
|
-
option:
|
|
134
|
+
option: "--planTitle [planTitle]"
|
|
135
135
|
},
|
|
136
136
|
{
|
|
137
137
|
option: '--ownerGroupId [ownerGroupId]'
|
|
@@ -153,23 +153,23 @@ class PlannerBucketRemoveCommand extends GraphCommand_1.default {
|
|
|
153
153
|
}
|
|
154
154
|
validate(args) {
|
|
155
155
|
if (args.options.id) {
|
|
156
|
-
if (args.options.planId || args.options.
|
|
157
|
-
return 'Don\'t specify planId,
|
|
156
|
+
if (args.options.planId || args.options.planTitle || args.options.ownerGroupId || args.options.ownerGroupName) {
|
|
157
|
+
return 'Don\'t specify planId, planTitle, ownerGroupId or ownerGroupName when using id';
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
else {
|
|
161
|
-
if (!args.options.planId && !args.options.
|
|
162
|
-
return 'Specify either planId or
|
|
161
|
+
if (!args.options.planId && !args.options.planTitle) {
|
|
162
|
+
return 'Specify either planId or planTitle when using name';
|
|
163
163
|
}
|
|
164
|
-
if (args.options.planId && args.options.
|
|
165
|
-
return 'Specify either planId or
|
|
164
|
+
if (args.options.planId && args.options.planTitle) {
|
|
165
|
+
return 'Specify either planId or planTitle when using name but not both';
|
|
166
166
|
}
|
|
167
|
-
if (args.options.
|
|
167
|
+
if (args.options.planTitle) {
|
|
168
168
|
if (!args.options.ownerGroupId && !args.options.ownerGroupName) {
|
|
169
|
-
return 'Specify either ownerGroupId or ownerGroupName when using
|
|
169
|
+
return 'Specify either ownerGroupId or ownerGroupName when using planTitle';
|
|
170
170
|
}
|
|
171
171
|
if (args.options.ownerGroupId && args.options.ownerGroupName) {
|
|
172
|
-
return 'Specify either ownerGroupId or ownerGroupName when using
|
|
172
|
+
return 'Specify either ownerGroupId or ownerGroupName when using planTitle but not both';
|
|
173
173
|
}
|
|
174
174
|
if (args.options.ownerGroupId && !utils_1.validation.isValidGuid(args.options.ownerGroupId)) {
|
|
175
175
|
return `${args.options.ownerGroupId} is not a valid GUID`;
|
|
@@ -19,7 +19,7 @@ class PlannerBucketSetCommand extends GraphCommand_1.default {
|
|
|
19
19
|
telemetryProps.id = typeof args.options.id !== 'undefined';
|
|
20
20
|
telemetryProps.name = typeof args.options.name !== 'undefined';
|
|
21
21
|
telemetryProps.planId = typeof args.options.planId !== 'undefined';
|
|
22
|
-
telemetryProps.
|
|
22
|
+
telemetryProps.planTitle = typeof args.options.planTitle !== 'undefined';
|
|
23
23
|
telemetryProps.ownerGroupId = typeof args.options.ownerGroupId !== 'undefined';
|
|
24
24
|
telemetryProps.ownerGroupName = typeof args.options.ownerGroupName !== 'undefined';
|
|
25
25
|
telemetryProps.newName = typeof args.options.newName !== 'undefined';
|
|
@@ -89,13 +89,13 @@ class PlannerBucketSetCommand extends GraphCommand_1.default {
|
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
91
|
getPlanId(args) {
|
|
92
|
-
const { planId,
|
|
92
|
+
const { planId, planTitle } = args.options;
|
|
93
93
|
if (planId) {
|
|
94
94
|
return Promise.resolve(planId);
|
|
95
95
|
}
|
|
96
96
|
return this
|
|
97
97
|
.getGroupId(args)
|
|
98
|
-
.then(groupId => planner_1.planner.
|
|
98
|
+
.then(groupId => planner_1.planner.getPlanByTitle(planTitle, groupId))
|
|
99
99
|
.then(plan => plan.id);
|
|
100
100
|
}
|
|
101
101
|
getGroupId(args) {
|
|
@@ -119,7 +119,7 @@ class PlannerBucketSetCommand extends GraphCommand_1.default {
|
|
|
119
119
|
option: '--planId [planId]'
|
|
120
120
|
},
|
|
121
121
|
{
|
|
122
|
-
option:
|
|
122
|
+
option: "--planTitle [planTitle]"
|
|
123
123
|
},
|
|
124
124
|
{
|
|
125
125
|
option: '--ownerGroupId [ownerGroupId]'
|
|
@@ -144,23 +144,23 @@ class PlannerBucketSetCommand extends GraphCommand_1.default {
|
|
|
144
144
|
}
|
|
145
145
|
validate(args) {
|
|
146
146
|
if (args.options.id) {
|
|
147
|
-
if (args.options.planId || args.options.
|
|
148
|
-
return 'Don\'t specify planId,
|
|
147
|
+
if (args.options.planId || args.options.planTitle || args.options.ownerGroupId || args.options.ownerGroupName) {
|
|
148
|
+
return 'Don\'t specify planId, planTitle, ownerGroupId or ownerGroupName when using id';
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
if (args.options.name) {
|
|
152
|
-
if (!args.options.planId && !args.options.
|
|
153
|
-
return 'Specify either planId or
|
|
152
|
+
if (!args.options.planId && !args.options.planTitle) {
|
|
153
|
+
return 'Specify either planId or planTitle when using name';
|
|
154
154
|
}
|
|
155
|
-
if (args.options.planId && args.options.
|
|
156
|
-
return 'Specify either planId or
|
|
155
|
+
if (args.options.planId && args.options.planTitle) {
|
|
156
|
+
return 'Specify either planId or planTitle when using name but not both';
|
|
157
157
|
}
|
|
158
|
-
if (args.options.
|
|
158
|
+
if (args.options.planTitle) {
|
|
159
159
|
if (!args.options.ownerGroupId && !args.options.ownerGroupName) {
|
|
160
|
-
return 'Specify either ownerGroupId or ownerGroupName when using
|
|
160
|
+
return 'Specify either ownerGroupId or ownerGroupName when using planTitle';
|
|
161
161
|
}
|
|
162
162
|
if (args.options.ownerGroupId && args.options.ownerGroupName) {
|
|
163
|
-
return 'Specify either ownerGroupId or ownerGroupName when using
|
|
163
|
+
return 'Specify either ownerGroupId or ownerGroupName when using planTitle but not both';
|
|
164
164
|
}
|
|
165
165
|
if (args.options.ownerGroupId && !utils_1.validation.isValidGuid(args.options.ownerGroupId)) {
|
|
166
166
|
return `${args.options.ownerGroupId} is not a valid GUID`;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const utils_1 = require("../../../../utils");
|
|
4
3
|
const Auth_1 = require("../../../../Auth");
|
|
5
4
|
const request_1 = require("../../../../request");
|
|
5
|
+
const utils_1 = require("../../../../utils");
|
|
6
6
|
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
7
7
|
const commands_1 = require("../../commands");
|
|
8
|
-
const aadGroup_1 = require("../../../../utils/aadGroup");
|
|
9
8
|
class PlannerPlanAddCommand extends GraphCommand_1.default {
|
|
10
9
|
get name() {
|
|
11
10
|
return commands_1.default.PLAN_ADD;
|
|
@@ -17,6 +16,8 @@ class PlannerPlanAddCommand extends GraphCommand_1.default {
|
|
|
17
16
|
const telemetryProps = super.getTelemetryProperties(args);
|
|
18
17
|
telemetryProps.ownerGroupId = typeof args.options.ownerGroupId !== 'undefined';
|
|
19
18
|
telemetryProps.ownerGroupName = typeof args.options.ownerGroupName !== 'undefined';
|
|
19
|
+
telemetryProps.shareWithUserIds = typeof args.options.shareWithUserIds !== 'undefined';
|
|
20
|
+
telemetryProps.shareWithUserNames = typeof args.options.shareWithUserNames !== 'undefined';
|
|
20
21
|
return telemetryProps;
|
|
21
22
|
}
|
|
22
23
|
defaultProperties() {
|
|
@@ -43,16 +44,96 @@ class PlannerPlanAddCommand extends GraphCommand_1.default {
|
|
|
43
44
|
};
|
|
44
45
|
return request_1.default.post(requestOptions);
|
|
45
46
|
})
|
|
47
|
+
.then(newPlan => this.updatePlanDetails(args.options, newPlan))
|
|
46
48
|
.then((res) => {
|
|
47
49
|
logger.log(res);
|
|
48
50
|
cb();
|
|
49
51
|
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
50
52
|
}
|
|
53
|
+
updatePlanDetails(options, newPlan) {
|
|
54
|
+
const planId = newPlan.id;
|
|
55
|
+
if (!options.shareWithUserIds && !options.shareWithUserNames) {
|
|
56
|
+
return Promise.resolve(newPlan);
|
|
57
|
+
}
|
|
58
|
+
return Promise
|
|
59
|
+
.all([this.generateSharedWith(options), this.getPlanDetailsEtag(planId)])
|
|
60
|
+
.then(resArray => {
|
|
61
|
+
const sharedWith = resArray[0];
|
|
62
|
+
const etag = resArray[1];
|
|
63
|
+
const requestOptionsPlanDetails = {
|
|
64
|
+
url: `${this.resource}/v1.0/planner/plans/${planId}/details`,
|
|
65
|
+
headers: {
|
|
66
|
+
'accept': 'application/json;odata.metadata=none',
|
|
67
|
+
'If-Match': etag,
|
|
68
|
+
'Prefer': 'return=representation'
|
|
69
|
+
},
|
|
70
|
+
responseType: 'json',
|
|
71
|
+
data: {
|
|
72
|
+
sharedWith: sharedWith
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
return request_1.default.patch(requestOptionsPlanDetails);
|
|
76
|
+
})
|
|
77
|
+
.then(planDetails => {
|
|
78
|
+
return Object.assign(Object.assign({}, newPlan), planDetails);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
getPlanDetailsEtag(planId) {
|
|
82
|
+
const requestOptions = {
|
|
83
|
+
url: `${this.resource}/v1.0/planner/plans/${planId}/details`,
|
|
84
|
+
headers: {
|
|
85
|
+
accept: 'application/json'
|
|
86
|
+
},
|
|
87
|
+
responseType: 'json'
|
|
88
|
+
};
|
|
89
|
+
return request_1.default
|
|
90
|
+
.get(requestOptions)
|
|
91
|
+
.then((response) => response['@odata.etag']);
|
|
92
|
+
}
|
|
93
|
+
generateSharedWith(options) {
|
|
94
|
+
const sharedWith = {};
|
|
95
|
+
return this
|
|
96
|
+
.getUserIds(options)
|
|
97
|
+
.then((userIds) => {
|
|
98
|
+
userIds.map(x => sharedWith[x] = true);
|
|
99
|
+
return Promise.resolve(sharedWith);
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
getUserIds(options) {
|
|
103
|
+
if (options.shareWithUserIds) {
|
|
104
|
+
return Promise.resolve(options.shareWithUserIds.split(','));
|
|
105
|
+
}
|
|
106
|
+
// Hitting this section means assignedToUserNames won't be undefined
|
|
107
|
+
const userNames = options.shareWithUserNames;
|
|
108
|
+
const userArr = userNames.split(',').map(o => o.trim());
|
|
109
|
+
const promises = userArr.map(user => {
|
|
110
|
+
const requestOptions = {
|
|
111
|
+
url: `${this.resource}/v1.0/users?$filter=userPrincipalName eq '${utils_1.formatting.encodeQueryParameter(user)}'&$select=id,userPrincipalName`,
|
|
112
|
+
headers: {
|
|
113
|
+
'content-type': 'application/json'
|
|
114
|
+
},
|
|
115
|
+
responseType: 'json'
|
|
116
|
+
};
|
|
117
|
+
return request_1.default.get(requestOptions);
|
|
118
|
+
});
|
|
119
|
+
return Promise
|
|
120
|
+
.all(promises)
|
|
121
|
+
.then((usersRes) => {
|
|
122
|
+
const userUpns = usersRes.map(res => { var _a; return (_a = res.value[0]) === null || _a === void 0 ? void 0 : _a.userPrincipalName; });
|
|
123
|
+
const userIds = usersRes.map(res => { var _a; return (_a = res.value[0]) === null || _a === void 0 ? void 0 : _a.id; });
|
|
124
|
+
// Find the members where no graph response was found
|
|
125
|
+
const invalidUsers = userArr.filter(user => !userUpns.some((upn) => (upn === null || upn === void 0 ? void 0 : upn.toLowerCase()) === user.toLowerCase()));
|
|
126
|
+
if (invalidUsers && invalidUsers.length > 0) {
|
|
127
|
+
return Promise.reject(`Cannot proceed with planner plan creation. The following users provided are invalid : ${invalidUsers.join(',')}`);
|
|
128
|
+
}
|
|
129
|
+
return Promise.resolve(userIds);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
51
132
|
getGroupId(args) {
|
|
52
133
|
if (args.options.ownerGroupId) {
|
|
53
134
|
return Promise.resolve(args.options.ownerGroupId);
|
|
54
135
|
}
|
|
55
|
-
return
|
|
136
|
+
return utils_1.aadGroup
|
|
56
137
|
.getGroupByDisplayName(args.options.ownerGroupName)
|
|
57
138
|
.then(group => group.id);
|
|
58
139
|
}
|
|
@@ -62,10 +143,16 @@ class PlannerPlanAddCommand extends GraphCommand_1.default {
|
|
|
62
143
|
option: '-t, --title <title>'
|
|
63
144
|
},
|
|
64
145
|
{
|
|
65
|
-
option:
|
|
146
|
+
option: '--ownerGroupId [ownerGroupId]'
|
|
66
147
|
},
|
|
67
148
|
{
|
|
68
|
-
option:
|
|
149
|
+
option: '--ownerGroupName [ownerGroupName]'
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
option: '--shareWithUserIds [shareWithUserIds]'
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
option: '--shareWithUserNames [shareWithUserNames]'
|
|
69
156
|
}
|
|
70
157
|
];
|
|
71
158
|
const parentOptions = super.options();
|
|
@@ -81,6 +168,12 @@ class PlannerPlanAddCommand extends GraphCommand_1.default {
|
|
|
81
168
|
if (args.options.ownerGroupId && !utils_1.validation.isValidGuid(args.options.ownerGroupId)) {
|
|
82
169
|
return `${args.options.ownerGroupId} is not a valid GUID`;
|
|
83
170
|
}
|
|
171
|
+
if (args.options.shareWithUserIds && args.options.shareWithUserNames) {
|
|
172
|
+
return 'Specify either shareWithUserIds or shareWithUserNames but not both';
|
|
173
|
+
}
|
|
174
|
+
if (args.options.shareWithUserIds && !utils_1.validation.isValidGuidArray(args.options.shareWithUserIds.split(','))) {
|
|
175
|
+
return 'shareWithUserIds contains invalid GUID';
|
|
176
|
+
}
|
|
84
177
|
return true;
|
|
85
178
|
}
|
|
86
179
|
}
|
|
@@ -11,9 +11,6 @@ class PlannerPlanGetCommand extends GraphCommand_1.default {
|
|
|
11
11
|
get name() {
|
|
12
12
|
return commands_1.default.PLAN_GET;
|
|
13
13
|
}
|
|
14
|
-
alias() {
|
|
15
|
-
return [commands_1.default.PLAN_DETAILS_GET];
|
|
16
|
-
}
|
|
17
14
|
get description() {
|
|
18
15
|
return 'Get a Microsoft Planner plan';
|
|
19
16
|
}
|
|
@@ -31,7 +28,6 @@ class PlannerPlanGetCommand extends GraphCommand_1.default {
|
|
|
31
28
|
return ['id', 'title', 'createdDateTime', 'owner', '@odata.etag'];
|
|
32
29
|
}
|
|
33
30
|
commandAction(logger, args, cb) {
|
|
34
|
-
this.showDeprecationWarning(logger, commands_1.default.PLAN_DETAILS_GET, commands_1.default.PLAN_GET);
|
|
35
31
|
if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
|
|
36
32
|
this.handleError('This command does not support application permissions.', logger, cb);
|
|
37
33
|
return;
|
|
@@ -54,7 +50,7 @@ class PlannerPlanGetCommand extends GraphCommand_1.default {
|
|
|
54
50
|
else {
|
|
55
51
|
this
|
|
56
52
|
.getGroupId(args)
|
|
57
|
-
.then(groupId => planner_1.planner.
|
|
53
|
+
.then(groupId => planner_1.planner.getPlanByTitle(args.options.title, groupId))
|
|
58
54
|
.then(plan => this.getPlanDetails(plan))
|
|
59
55
|
.then((res) => {
|
|
60
56
|
if (res) {
|
|
@@ -82,7 +82,7 @@ class PlannerPlanRemoveCommand extends GraphCommand_1.default {
|
|
|
82
82
|
return planner_1.planner.getPlanById(id, 'minimal');
|
|
83
83
|
}
|
|
84
84
|
const groupId = yield this.getGroupId(args);
|
|
85
|
-
return yield planner_1.planner.
|
|
85
|
+
return yield planner_1.planner.getPlanByTitle(title, groupId);
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
88
|
getGroupId(args) {
|
|
@@ -23,7 +23,7 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
|
|
|
23
23
|
getTelemetryProperties(args) {
|
|
24
24
|
const telemetryProps = super.getTelemetryProperties(args);
|
|
25
25
|
telemetryProps.planId = typeof args.options.planId !== 'undefined';
|
|
26
|
-
telemetryProps.
|
|
26
|
+
telemetryProps.planTitle = typeof args.options.planTitle !== 'undefined';
|
|
27
27
|
telemetryProps.ownerGroupId = typeof args.options.ownerGroupId !== 'undefined';
|
|
28
28
|
telemetryProps.ownerGroupName = typeof args.options.ownerGroupName !== 'undefined';
|
|
29
29
|
telemetryProps.bucketId = typeof args.options.bucketId !== 'undefined';
|
|
@@ -96,13 +96,7 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
|
|
|
96
96
|
};
|
|
97
97
|
return request_1.default
|
|
98
98
|
.get(requestOptions)
|
|
99
|
-
.then((response) =>
|
|
100
|
-
const etag = response ? response['@odata.etag'] : undefined;
|
|
101
|
-
if (!etag) {
|
|
102
|
-
return Promise.reject(`Error fetching task details`);
|
|
103
|
-
}
|
|
104
|
-
return Promise.resolve(etag);
|
|
105
|
-
});
|
|
99
|
+
.then((response) => response['@odata.etag']);
|
|
106
100
|
}
|
|
107
101
|
generateAppliedCategories(options) {
|
|
108
102
|
if (!options.appliedCategories) {
|
|
@@ -181,7 +175,7 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
|
|
|
181
175
|
}
|
|
182
176
|
return this
|
|
183
177
|
.getGroupId(args)
|
|
184
|
-
.then((groupId) => planner_1.planner.
|
|
178
|
+
.then((groupId) => planner_1.planner.getPlanByTitle(args.options.planTitle, groupId))
|
|
185
179
|
.then(plan => plan.id);
|
|
186
180
|
}
|
|
187
181
|
getGroupId(args) {
|
|
@@ -228,7 +222,7 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
|
|
|
228
222
|
const options = [
|
|
229
223
|
{ option: '-t, --title <title>' },
|
|
230
224
|
{ option: '--planId [planId]' },
|
|
231
|
-
{ option: '--
|
|
225
|
+
{ option: '--planTitle [planTitle]' },
|
|
232
226
|
{ option: '--ownerGroupId [ownerGroupId]' },
|
|
233
227
|
{ option: '--ownerGroupName [ownerGroupName]' },
|
|
234
228
|
{ option: '--bucketId [bucketId]' },
|
|
@@ -255,17 +249,17 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
|
|
|
255
249
|
return options.concat(parentOptions);
|
|
256
250
|
}
|
|
257
251
|
validate(args) {
|
|
258
|
-
if (!args.options.planId && !args.options.
|
|
259
|
-
return 'Specify either planId or
|
|
252
|
+
if (!args.options.planId && !args.options.planTitle) {
|
|
253
|
+
return 'Specify either planId or planTitle';
|
|
260
254
|
}
|
|
261
|
-
if (args.options.planId && args.options.
|
|
262
|
-
return 'Specify either planId or
|
|
255
|
+
if (args.options.planId && args.options.planTitle) {
|
|
256
|
+
return 'Specify either planId or planTitle but not both';
|
|
263
257
|
}
|
|
264
|
-
if (args.options.
|
|
265
|
-
return 'Specify either ownerGroupId or ownerGroupName when using
|
|
258
|
+
if (args.options.planTitle && !args.options.ownerGroupId && !args.options.ownerGroupName) {
|
|
259
|
+
return 'Specify either ownerGroupId or ownerGroupName when using planTitle';
|
|
266
260
|
}
|
|
267
|
-
if (args.options.
|
|
268
|
-
return 'Specify either ownerGroupId or ownerGroupName when using
|
|
261
|
+
if (args.options.planTitle && args.options.ownerGroupId && args.options.ownerGroupName) {
|
|
262
|
+
return 'Specify either ownerGroupId or ownerGroupName when using planTitle but not both';
|
|
269
263
|
}
|
|
270
264
|
if (args.options.ownerGroupId && !utils_1.validation.isValidGuid(args.options.ownerGroupId)) {
|
|
271
265
|
return `${args.options.ownerGroupId} is not a valid GUID`;
|
|
@@ -11,9 +11,6 @@ class PlannerTaskGetCommand extends GraphCommand_1.default {
|
|
|
11
11
|
get name() {
|
|
12
12
|
return commands_1.default.TASK_GET;
|
|
13
13
|
}
|
|
14
|
-
alias() {
|
|
15
|
-
return [commands_1.default.TASK_DETAILS_GET];
|
|
16
|
-
}
|
|
17
14
|
get description() {
|
|
18
15
|
return 'Retrieve the specified planner task';
|
|
19
16
|
}
|
|
@@ -24,21 +21,15 @@ class PlannerTaskGetCommand extends GraphCommand_1.default {
|
|
|
24
21
|
telemetryProps.bucketId = typeof args.options.bucketId !== 'undefined';
|
|
25
22
|
telemetryProps.bucketName = typeof args.options.bucketName !== 'undefined';
|
|
26
23
|
telemetryProps.planId = typeof args.options.planId !== 'undefined';
|
|
27
|
-
telemetryProps.planName = typeof args.options.planName !== 'undefined';
|
|
28
24
|
telemetryProps.ownerGroupId = typeof args.options.ownerGroupId !== 'undefined';
|
|
29
25
|
telemetryProps.ownerGroupName = typeof args.options.ownerGroupName !== 'undefined';
|
|
30
26
|
return telemetryProps;
|
|
31
27
|
}
|
|
32
28
|
commandAction(logger, args, cb) {
|
|
33
|
-
this.showDeprecationWarning(logger, commands_1.default.TASK_DETAILS_GET, commands_1.default.TASK_GET);
|
|
34
29
|
if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
|
|
35
30
|
this.handleError('This command does not support application permissions.', logger, cb);
|
|
36
31
|
return;
|
|
37
32
|
}
|
|
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
|
-
}
|
|
42
33
|
this
|
|
43
34
|
.getTaskId(args.options)
|
|
44
35
|
.then(taskId => this.getTask(taskId))
|
|
@@ -135,7 +126,7 @@ class PlannerTaskGetCommand extends GraphCommand_1.default {
|
|
|
135
126
|
}
|
|
136
127
|
return this
|
|
137
128
|
.getGroupId(options)
|
|
138
|
-
.then(groupId => planner_1.planner.
|
|
129
|
+
.then(groupId => planner_1.planner.getPlanByTitle(options.planTitle, groupId))
|
|
139
130
|
.then(plan => plan.id);
|
|
140
131
|
}
|
|
141
132
|
getGroupId(options) {
|
|
@@ -153,13 +144,12 @@ class PlannerTaskGetCommand extends GraphCommand_1.default {
|
|
|
153
144
|
}
|
|
154
145
|
options() {
|
|
155
146
|
const options = [
|
|
156
|
-
{ option: '--taskId [taskId]' },
|
|
157
147
|
{ option: '-i, --id [id]' },
|
|
158
148
|
{ option: '-t, --title [title]' },
|
|
159
149
|
{ option: '--bucketId [bucketId]' },
|
|
160
150
|
{ option: '--bucketName [bucketName]' },
|
|
161
151
|
{ option: '--planId [planId]' },
|
|
162
|
-
{ option: '--
|
|
152
|
+
{ option: '--planTitle [planTitle]' },
|
|
163
153
|
{ option: '--ownerGroupId [ownerGroupId]' },
|
|
164
154
|
{ option: '--ownerGroupName [ownerGroupName]' }
|
|
165
155
|
];
|
|
@@ -173,17 +163,17 @@ class PlannerTaskGetCommand extends GraphCommand_1.default {
|
|
|
173
163
|
if (args.options.title && args.options.bucketId && args.options.bucketName) {
|
|
174
164
|
return 'Specify either bucketId or bucketName when using title but not both';
|
|
175
165
|
}
|
|
176
|
-
if (args.options.bucketName && !args.options.planId && !args.options.
|
|
177
|
-
return 'Specify either planId or
|
|
166
|
+
if (args.options.bucketName && !args.options.planId && !args.options.planTitle) {
|
|
167
|
+
return 'Specify either planId or planTitle when using bucketName';
|
|
178
168
|
}
|
|
179
|
-
if (args.options.bucketName && args.options.planId && args.options.
|
|
180
|
-
return 'Specify either planId or
|
|
169
|
+
if (args.options.bucketName && args.options.planId && args.options.planTitle) {
|
|
170
|
+
return 'Specify either planId or planTitle when using bucketName but not both';
|
|
181
171
|
}
|
|
182
|
-
if (args.options.
|
|
183
|
-
return 'Specify either ownerGroupId or ownerGroupName when using
|
|
172
|
+
if (args.options.planTitle && !args.options.ownerGroupId && !args.options.ownerGroupName) {
|
|
173
|
+
return 'Specify either ownerGroupId or ownerGroupName when using planTitle';
|
|
184
174
|
}
|
|
185
|
-
if (args.options.
|
|
186
|
-
return 'Specify either ownerGroupId or ownerGroupName when using
|
|
175
|
+
if (args.options.planTitle && args.options.ownerGroupId && args.options.ownerGroupName) {
|
|
176
|
+
return 'Specify either ownerGroupId or ownerGroupName when using planTitle but not both';
|
|
187
177
|
}
|
|
188
178
|
if (args.options.ownerGroupId && !utils_1.validation.isValidGuid(args.options.ownerGroupId)) {
|
|
189
179
|
return `${args.options.ownerGroupId} is not a valid GUID`;
|
|
@@ -19,7 +19,7 @@ class PlannerTaskListCommand extends GraphCommand_1.default {
|
|
|
19
19
|
telemetryProps.bucketId = typeof args.options.bucketId !== 'undefined';
|
|
20
20
|
telemetryProps.bucketName = typeof args.options.bucketName !== 'undefined';
|
|
21
21
|
telemetryProps.planId = typeof args.options.planId !== 'undefined';
|
|
22
|
-
telemetryProps.
|
|
22
|
+
telemetryProps.planTitle = typeof args.options.planTitle !== 'undefined';
|
|
23
23
|
telemetryProps.ownerGroupId = typeof args.options.ownerGroupId !== 'undefined';
|
|
24
24
|
telemetryProps.ownerGroupName = typeof args.options.ownerGroupName !== 'undefined';
|
|
25
25
|
return telemetryProps;
|
|
@@ -34,7 +34,7 @@ class PlannerTaskListCommand extends GraphCommand_1.default {
|
|
|
34
34
|
}
|
|
35
35
|
const bucketName = args.options.bucketName;
|
|
36
36
|
let bucketId = args.options.bucketId;
|
|
37
|
-
const
|
|
37
|
+
const planTitle = args.options.planTitle;
|
|
38
38
|
let planId = args.options.planId;
|
|
39
39
|
let taskItems = [];
|
|
40
40
|
if (bucketId || bucketName) {
|
|
@@ -53,7 +53,7 @@ class PlannerTaskListCommand extends GraphCommand_1.default {
|
|
|
53
53
|
cb();
|
|
54
54
|
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
55
55
|
}
|
|
56
|
-
else if (planId ||
|
|
56
|
+
else if (planId || planTitle) {
|
|
57
57
|
this
|
|
58
58
|
.getPlanId(args)
|
|
59
59
|
.then((retrievedPlanId) => {
|
|
@@ -112,7 +112,7 @@ class PlannerTaskListCommand extends GraphCommand_1.default {
|
|
|
112
112
|
}
|
|
113
113
|
return this
|
|
114
114
|
.getGroupId(args)
|
|
115
|
-
.then((groupId) => planner_1.planner.
|
|
115
|
+
.then((groupId) => planner_1.planner.getPlanByTitle(args.options.planTitle, groupId))
|
|
116
116
|
.then(plan => plan.id);
|
|
117
117
|
}
|
|
118
118
|
getGroupId(args) {
|
|
@@ -146,7 +146,7 @@ class PlannerTaskListCommand extends GraphCommand_1.default {
|
|
|
146
146
|
option: '--planId [planId]'
|
|
147
147
|
},
|
|
148
148
|
{
|
|
149
|
-
option: '--
|
|
149
|
+
option: '--planTitle [planTitle]'
|
|
150
150
|
},
|
|
151
151
|
{
|
|
152
152
|
option: '--ownerGroupId [ownerGroupId]'
|
|
@@ -162,17 +162,17 @@ class PlannerTaskListCommand extends GraphCommand_1.default {
|
|
|
162
162
|
if (args.options.bucketId && args.options.bucketName) {
|
|
163
163
|
return 'To retrieve tasks from a bucket, specify bucketId or bucketName, but not both';
|
|
164
164
|
}
|
|
165
|
-
if (args.options.bucketName && !args.options.planId && !args.options.
|
|
166
|
-
return 'Specify either planId or
|
|
165
|
+
if (args.options.bucketName && !args.options.planId && !args.options.planTitle) {
|
|
166
|
+
return 'Specify either planId or planTitle when using bucketName';
|
|
167
167
|
}
|
|
168
|
-
if (args.options.planId && args.options.
|
|
169
|
-
return 'Specify either planId or
|
|
168
|
+
if (args.options.planId && args.options.planTitle) {
|
|
169
|
+
return 'Specify either planId or planTitle but not both';
|
|
170
170
|
}
|
|
171
|
-
if (args.options.
|
|
172
|
-
return 'Specify either ownerGroupId or ownerGroupName when using
|
|
171
|
+
if (args.options.planTitle && !args.options.ownerGroupId && !args.options.ownerGroupName) {
|
|
172
|
+
return 'Specify either ownerGroupId or ownerGroupName when using planTitle';
|
|
173
173
|
}
|
|
174
|
-
if (args.options.
|
|
175
|
-
return 'Specify either ownerGroupId or ownerGroupName when using
|
|
174
|
+
if (args.options.planTitle && args.options.ownerGroupId && args.options.ownerGroupName) {
|
|
175
|
+
return 'Specify either ownerGroupId or ownerGroupName when using planTitle but not both';
|
|
176
176
|
}
|
|
177
177
|
if (args.options.ownerGroupId && !utils_1.validation.isValidGuid(args.options.ownerGroupId)) {
|
|
178
178
|
return `${args.options.ownerGroupId} is not a valid GUID`;
|
|
@@ -46,13 +46,7 @@ class PlannerTaskReferenceAddCommand extends GraphCommand_1.default {
|
|
|
46
46
|
};
|
|
47
47
|
return request_1.default
|
|
48
48
|
.get(requestOptions)
|
|
49
|
-
.then((response) =>
|
|
50
|
-
const etag = response ? response['@odata.etag'] : undefined;
|
|
51
|
-
if (!etag) {
|
|
52
|
-
return Promise.reject(`Error fetching task details`);
|
|
53
|
-
}
|
|
54
|
-
return Promise.resolve(etag);
|
|
55
|
-
});
|
|
49
|
+
.then((response) => response['@odata.etag']);
|
|
56
50
|
}
|
|
57
51
|
options() {
|
|
58
52
|
const options = [
|
|
@@ -74,21 +74,18 @@ class PlannerTaskReferenceRemoveCommand extends GraphCommand_1.default {
|
|
|
74
74
|
let url = options.url;
|
|
75
75
|
return request_1.default
|
|
76
76
|
.get(requestOptions)
|
|
77
|
-
.then((
|
|
78
|
-
const etag = response ? response['@odata.etag'] : undefined;
|
|
79
|
-
if (!etag) {
|
|
80
|
-
return Promise.reject(`Error fetching task details`);
|
|
81
|
-
}
|
|
77
|
+
.then((taskDetails) => {
|
|
82
78
|
if (options.alias) {
|
|
83
|
-
const alias = options.alias;
|
|
84
79
|
const urls = [];
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
80
|
+
if (taskDetails.references) {
|
|
81
|
+
Object.entries(taskDetails.references).forEach((ref) => {
|
|
82
|
+
var _a;
|
|
83
|
+
if (((_a = ref[1].alias) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) === options.alias.toLocaleLowerCase()) {
|
|
84
|
+
urls.push(decodeURIComponent(ref[0]));
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
if (urls.length === 0) {
|
|
92
89
|
return Promise.reject(`The specified reference with alias ${options.alias} does not exist`);
|
|
93
90
|
}
|
|
94
91
|
if (urls.length > 1) {
|
|
@@ -96,7 +93,7 @@ class PlannerTaskReferenceRemoveCommand extends GraphCommand_1.default {
|
|
|
96
93
|
}
|
|
97
94
|
url = urls[0];
|
|
98
95
|
}
|
|
99
|
-
return Promise.resolve({ etag, url });
|
|
96
|
+
return Promise.resolve({ etag: taskDetails['@odata.etag'], url });
|
|
100
97
|
});
|
|
101
98
|
}
|
|
102
99
|
options() {
|
|
@@ -114,7 +114,7 @@ class PlannerTaskRemoveCommand extends GraphCommand_1.default {
|
|
|
114
114
|
}
|
|
115
115
|
return this
|
|
116
116
|
.getGroupId(options)
|
|
117
|
-
.then(groupId => planner_1.planner.
|
|
117
|
+
.then(groupId => planner_1.planner.getPlanByTitle(planTitle, groupId))
|
|
118
118
|
.then(plan => plan.id);
|
|
119
119
|
}
|
|
120
120
|
getGroupId(options) {
|
|
@@ -122,24 +122,9 @@ class PlannerTaskRemoveCommand extends GraphCommand_1.default {
|
|
|
122
122
|
if (ownerGroupId) {
|
|
123
123
|
return Promise.resolve(ownerGroupId);
|
|
124
124
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
accept: 'application/json;odata.metadata=none'
|
|
129
|
-
},
|
|
130
|
-
responseType: 'json'
|
|
131
|
-
};
|
|
132
|
-
return request_1.default
|
|
133
|
-
.get(requestOptions)
|
|
134
|
-
.then(response => {
|
|
135
|
-
if (response.value.length === 0) {
|
|
136
|
-
return Promise.reject(`The specified owner group ${ownerGroupName} does not exist`);
|
|
137
|
-
}
|
|
138
|
-
if (response.value.length > 1) {
|
|
139
|
-
return Promise.reject(`Multiple owner groups with name ${ownerGroupName} found: ${response.value.map(x => x.id)}`);
|
|
140
|
-
}
|
|
141
|
-
return Promise.resolve(response.value[0].id);
|
|
142
|
-
});
|
|
125
|
+
return utils_1.aadGroup
|
|
126
|
+
.getGroupByDisplayName(ownerGroupName)
|
|
127
|
+
.then(group => group.id);
|
|
143
128
|
}
|
|
144
129
|
options() {
|
|
145
130
|
const options = [
|