@pnp/cli-microsoft365 5.5.0-beta.d1aff8a → 5.5.0-beta.f697eab
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/m365/aad/commands/o365group/o365group-recyclebinitem-restore.js +60 -9
- 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 +17 -9
- package/dist/m365/planner/commands/bucket/bucket-get.js +19 -11
- package/dist/m365/planner/commands/bucket/bucket-list.js +17 -9
- package/dist/m365/planner/commands/bucket/bucket-remove.js +19 -11
- package/dist/m365/planner/commands/bucket/bucket-set.js +19 -11
- package/dist/m365/planner/commands/plan/plan-add.js +98 -5
- package/dist/m365/planner/commands/plan/plan-get.js +1 -1
- package/dist/m365/planner/commands/plan/plan-remove.js +1 -1
- package/dist/m365/planner/commands/task/task-add.js +15 -9
- package/dist/m365/planner/commands/task/task-get.js +14 -9
- package/dist/m365/planner/commands/task/task-list.js +19 -11
- package/dist/m365/planner/commands/task/task-remove.js +4 -19
- package/dist/m365/planner/commands/task/task-set.js +15 -9
- package/dist/m365/search/commands/externalconnection/externalconnection-get.js +69 -0
- package/dist/m365/search/commands.js +1 -0
- package/dist/m365/spo/base-permissions.js +9 -0
- 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/listitem/listitem-get.js +9 -9
- package/dist/m365/spo/commands/listitem/listitem-list.js +5 -1
- 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-classic-list.js +1 -0
- package/dist/m365/spo/commands/site/site-list.js +59 -17
- package/dist/m365/spo/commands.js +3 -0
- package/dist/m365/teams/commands/team/team-archive.js +51 -15
- package/dist/m365/teams/commands/team/team-remove.js +47 -11
- package/dist/m365/teams/commands/team/team-unarchive.js +48 -12
- package/dist/utils/planner.js +6 -6
- package/docs/docs/cmd/aad/o365group/o365group-recyclebinitem-restore.md +21 -3
- package/docs/docs/cmd/planner/bucket/bucket-add.md +9 -6
- package/docs/docs/cmd/planner/bucket/bucket-get.md +10 -7
- package/docs/docs/cmd/planner/bucket/bucket-list.md +8 -5
- package/docs/docs/cmd/planner/bucket/bucket-remove.md +8 -5
- package/docs/docs/cmd/planner/bucket/bucket-set.md +9 -6
- package/docs/docs/cmd/planner/plan/plan-add.md +18 -2
- package/docs/docs/cmd/planner/task/task-add.md +11 -8
- package/docs/docs/cmd/planner/task/task-get.md +17 -8
- package/docs/docs/cmd/planner/task/task-list.md +9 -6
- package/docs/docs/cmd/planner/task/task-set.md +9 -6
- package/docs/docs/cmd/search/externalconnection/externalconnection-get.md +33 -0
- 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/listitem/listitem-get.md +11 -2
- package/docs/docs/cmd/spo/listitem/listitem-list.md +8 -0
- package/docs/docs/cmd/spo/roledefinition/roledefinition-get.md +27 -0
- package/docs/docs/cmd/spo/site/site-classic-list.md +3 -0
- package/docs/docs/cmd/spo/site/site-list.md +19 -7
- package/docs/docs/cmd/teams/team/team-archive.md +20 -5
- package/docs/docs/cmd/teams/team/team-remove.md +19 -5
- package/docs/docs/cmd/teams/team/team-unarchive.md +18 -4
- package/npm-shrinkwrap.json +173 -158
- package/package.json +13 -13
|
@@ -20,6 +20,7 @@ class PlannerBucketSetCommand extends GraphCommand_1.default {
|
|
|
20
20
|
telemetryProps.name = typeof args.options.name !== 'undefined';
|
|
21
21
|
telemetryProps.planId = typeof args.options.planId !== 'undefined';
|
|
22
22
|
telemetryProps.planName = typeof args.options.planName !== 'undefined';
|
|
23
|
+
telemetryProps.planTitle = typeof args.options.planTitle !== 'undefined';
|
|
23
24
|
telemetryProps.ownerGroupId = typeof args.options.ownerGroupId !== 'undefined';
|
|
24
25
|
telemetryProps.ownerGroupName = typeof args.options.ownerGroupName !== 'undefined';
|
|
25
26
|
telemetryProps.newName = typeof args.options.newName !== 'undefined';
|
|
@@ -27,6 +28,10 @@ class PlannerBucketSetCommand extends GraphCommand_1.default {
|
|
|
27
28
|
return telemetryProps;
|
|
28
29
|
}
|
|
29
30
|
commandAction(logger, args, cb) {
|
|
31
|
+
if (args.options.planName) {
|
|
32
|
+
args.options.planTitle = args.options.planName;
|
|
33
|
+
this.warn(logger, `Option 'planName' is deprecated. Please use 'planTitle' instead`);
|
|
34
|
+
}
|
|
30
35
|
if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
|
|
31
36
|
this.handleError('This command does not support application permissions.', logger, cb);
|
|
32
37
|
return;
|
|
@@ -89,13 +94,13 @@ class PlannerBucketSetCommand extends GraphCommand_1.default {
|
|
|
89
94
|
});
|
|
90
95
|
}
|
|
91
96
|
getPlanId(args) {
|
|
92
|
-
const { planId,
|
|
97
|
+
const { planId, planTitle } = args.options;
|
|
93
98
|
if (planId) {
|
|
94
99
|
return Promise.resolve(planId);
|
|
95
100
|
}
|
|
96
101
|
return this
|
|
97
102
|
.getGroupId(args)
|
|
98
|
-
.then(groupId => planner_1.planner.
|
|
103
|
+
.then(groupId => planner_1.planner.getPlanByTitle(planTitle, groupId))
|
|
99
104
|
.then(plan => plan.id);
|
|
100
105
|
}
|
|
101
106
|
getGroupId(args) {
|
|
@@ -121,6 +126,9 @@ class PlannerBucketSetCommand extends GraphCommand_1.default {
|
|
|
121
126
|
{
|
|
122
127
|
option: '--planName [planName]'
|
|
123
128
|
},
|
|
129
|
+
{
|
|
130
|
+
option: "--planTitle [planTitle]"
|
|
131
|
+
},
|
|
124
132
|
{
|
|
125
133
|
option: '--ownerGroupId [ownerGroupId]'
|
|
126
134
|
},
|
|
@@ -144,23 +152,23 @@ class PlannerBucketSetCommand extends GraphCommand_1.default {
|
|
|
144
152
|
}
|
|
145
153
|
validate(args) {
|
|
146
154
|
if (args.options.id) {
|
|
147
|
-
if (args.options.planId || args.options.planName || args.options.ownerGroupId || args.options.ownerGroupName) {
|
|
148
|
-
return 'Don\'t specify planId,
|
|
155
|
+
if (args.options.planId || args.options.planName || args.options.planTitle || args.options.ownerGroupId || args.options.ownerGroupName) {
|
|
156
|
+
return 'Don\'t specify planId, planTitle, ownerGroupId or ownerGroupName when using id';
|
|
149
157
|
}
|
|
150
158
|
}
|
|
151
159
|
if (args.options.name) {
|
|
152
|
-
if (!args.options.planId && !args.options.planName) {
|
|
153
|
-
return 'Specify either planId or
|
|
160
|
+
if (!args.options.planId && !args.options.planName && !args.options.planTitle) {
|
|
161
|
+
return 'Specify either planId or planTitle when using name';
|
|
154
162
|
}
|
|
155
|
-
if (args.options.planId && args.options.planName) {
|
|
156
|
-
return 'Specify either planId or
|
|
163
|
+
if (args.options.planId && (args.options.planName || args.options.planTitle)) {
|
|
164
|
+
return 'Specify either planId or planTitle when using name but not both';
|
|
157
165
|
}
|
|
158
|
-
if (args.options.planName) {
|
|
166
|
+
if (args.options.planName || args.options.planTitle) {
|
|
159
167
|
if (!args.options.ownerGroupId && !args.options.ownerGroupName) {
|
|
160
|
-
return 'Specify either ownerGroupId or ownerGroupName when using
|
|
168
|
+
return 'Specify either ownerGroupId or ownerGroupName when using planTitle';
|
|
161
169
|
}
|
|
162
170
|
if (args.options.ownerGroupId && args.options.ownerGroupName) {
|
|
163
|
-
return 'Specify either ownerGroupId or ownerGroupName when using
|
|
171
|
+
return 'Specify either ownerGroupId or ownerGroupName when using planTitle but not both';
|
|
164
172
|
}
|
|
165
173
|
if (args.options.ownerGroupId && !utils_1.validation.isValidGuid(args.options.ownerGroupId)) {
|
|
166
174
|
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
|
}
|
|
@@ -54,7 +54,7 @@ class PlannerPlanGetCommand extends GraphCommand_1.default {
|
|
|
54
54
|
else {
|
|
55
55
|
this
|
|
56
56
|
.getGroupId(args)
|
|
57
|
-
.then(groupId => planner_1.planner.
|
|
57
|
+
.then(groupId => planner_1.planner.getPlanByTitle(args.options.title, groupId))
|
|
58
58
|
.then(plan => this.getPlanDetails(plan))
|
|
59
59
|
.then((res) => {
|
|
60
60
|
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) {
|
|
@@ -24,6 +24,7 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
|
|
|
24
24
|
const telemetryProps = super.getTelemetryProperties(args);
|
|
25
25
|
telemetryProps.planId = typeof args.options.planId !== 'undefined';
|
|
26
26
|
telemetryProps.planName = typeof args.options.planName !== 'undefined';
|
|
27
|
+
telemetryProps.planTitle = typeof args.options.planTitle !== 'undefined';
|
|
27
28
|
telemetryProps.ownerGroupId = typeof args.options.ownerGroupId !== 'undefined';
|
|
28
29
|
telemetryProps.ownerGroupName = typeof args.options.ownerGroupName !== 'undefined';
|
|
29
30
|
telemetryProps.bucketId = typeof args.options.bucketId !== 'undefined';
|
|
@@ -42,6 +43,10 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
|
|
|
42
43
|
return telemetryProps;
|
|
43
44
|
}
|
|
44
45
|
commandAction(logger, args, cb) {
|
|
46
|
+
if (args.options.planName) {
|
|
47
|
+
args.options.planTitle = args.options.planName;
|
|
48
|
+
this.warn(logger, `Option 'planName' is deprecated. Please use 'planTitle' instead`);
|
|
49
|
+
}
|
|
45
50
|
if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
|
|
46
51
|
this.handleError('This command does not support application permissions.', logger, cb);
|
|
47
52
|
return;
|
|
@@ -175,7 +180,7 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
|
|
|
175
180
|
}
|
|
176
181
|
return this
|
|
177
182
|
.getGroupId(args)
|
|
178
|
-
.then((groupId) => planner_1.planner.
|
|
183
|
+
.then((groupId) => planner_1.planner.getPlanByTitle(args.options.planTitle, groupId))
|
|
179
184
|
.then(plan => plan.id);
|
|
180
185
|
}
|
|
181
186
|
getGroupId(args) {
|
|
@@ -223,6 +228,7 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
|
|
|
223
228
|
{ option: '-t, --title <title>' },
|
|
224
229
|
{ option: '--planId [planId]' },
|
|
225
230
|
{ option: '--planName [planName]' },
|
|
231
|
+
{ option: '--planTitle [planTitle]' },
|
|
226
232
|
{ option: '--ownerGroupId [ownerGroupId]' },
|
|
227
233
|
{ option: '--ownerGroupName [ownerGroupName]' },
|
|
228
234
|
{ option: '--bucketId [bucketId]' },
|
|
@@ -249,17 +255,17 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
|
|
|
249
255
|
return options.concat(parentOptions);
|
|
250
256
|
}
|
|
251
257
|
validate(args) {
|
|
252
|
-
if (!args.options.planId && !args.options.planName) {
|
|
253
|
-
return 'Specify either planId or
|
|
258
|
+
if (!args.options.planId && !args.options.planName && !args.options.planTitle) {
|
|
259
|
+
return 'Specify either planId or planTitle';
|
|
254
260
|
}
|
|
255
|
-
if (args.options.planId && args.options.planName) {
|
|
256
|
-
return 'Specify either planId or
|
|
261
|
+
if (args.options.planId && (args.options.planName || args.options.planTitle)) {
|
|
262
|
+
return 'Specify either planId or planTitle but not both';
|
|
257
263
|
}
|
|
258
|
-
if (args.options.planName && !args.options.ownerGroupId && !args.options.ownerGroupName) {
|
|
259
|
-
return 'Specify either ownerGroupId or ownerGroupName when using
|
|
264
|
+
if ((args.options.planName || args.options.planTitle) && !args.options.ownerGroupId && !args.options.ownerGroupName) {
|
|
265
|
+
return 'Specify either ownerGroupId or ownerGroupName when using planTitle';
|
|
260
266
|
}
|
|
261
|
-
if (args.options.planName && args.options.ownerGroupId && args.options.ownerGroupName) {
|
|
262
|
-
return 'Specify either ownerGroupId or ownerGroupName when using
|
|
267
|
+
if ((args.options.planName || args.options.planTitle) && args.options.ownerGroupId && args.options.ownerGroupName) {
|
|
268
|
+
return 'Specify either ownerGroupId or ownerGroupName when using planTitle but not both';
|
|
263
269
|
}
|
|
264
270
|
if (args.options.ownerGroupId && !utils_1.validation.isValidGuid(args.options.ownerGroupId)) {
|
|
265
271
|
return `${args.options.ownerGroupId} is not a valid GUID`;
|
|
@@ -31,6 +31,10 @@ class PlannerTaskGetCommand extends GraphCommand_1.default {
|
|
|
31
31
|
}
|
|
32
32
|
commandAction(logger, args, cb) {
|
|
33
33
|
this.showDeprecationWarning(logger, commands_1.default.TASK_DETAILS_GET, commands_1.default.TASK_GET);
|
|
34
|
+
if (args.options.planName) {
|
|
35
|
+
args.options.planTitle = args.options.planName;
|
|
36
|
+
this.warn(logger, `Option 'planName' is deprecated. Please use 'planTitle' instead`);
|
|
37
|
+
}
|
|
34
38
|
if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
|
|
35
39
|
this.handleError('This command does not support application permissions.', logger, cb);
|
|
36
40
|
return;
|
|
@@ -135,7 +139,7 @@ class PlannerTaskGetCommand extends GraphCommand_1.default {
|
|
|
135
139
|
}
|
|
136
140
|
return this
|
|
137
141
|
.getGroupId(options)
|
|
138
|
-
.then(groupId => planner_1.planner.
|
|
142
|
+
.then(groupId => planner_1.planner.getPlanByTitle(options.planTitle, groupId))
|
|
139
143
|
.then(plan => plan.id);
|
|
140
144
|
}
|
|
141
145
|
getGroupId(options) {
|
|
@@ -160,6 +164,7 @@ class PlannerTaskGetCommand extends GraphCommand_1.default {
|
|
|
160
164
|
{ option: '--bucketName [bucketName]' },
|
|
161
165
|
{ option: '--planId [planId]' },
|
|
162
166
|
{ option: '--planName [planName]' },
|
|
167
|
+
{ option: '--planTitle [planTitle]' },
|
|
163
168
|
{ option: '--ownerGroupId [ownerGroupId]' },
|
|
164
169
|
{ option: '--ownerGroupName [ownerGroupName]' }
|
|
165
170
|
];
|
|
@@ -173,17 +178,17 @@ class PlannerTaskGetCommand extends GraphCommand_1.default {
|
|
|
173
178
|
if (args.options.title && args.options.bucketId && args.options.bucketName) {
|
|
174
179
|
return 'Specify either bucketId or bucketName when using title but not both';
|
|
175
180
|
}
|
|
176
|
-
if (args.options.bucketName && !args.options.planId && !args.options.planName) {
|
|
177
|
-
return 'Specify either planId or
|
|
181
|
+
if (args.options.bucketName && !args.options.planId && !args.options.planName && !args.options.planTitle) {
|
|
182
|
+
return 'Specify either planId or planTitle when using bucketName';
|
|
178
183
|
}
|
|
179
|
-
if (args.options.bucketName && args.options.planId && args.options.planName) {
|
|
180
|
-
return 'Specify either planId or
|
|
184
|
+
if (args.options.bucketName && args.options.planId && (args.options.planName || args.options.planTitle)) {
|
|
185
|
+
return 'Specify either planId or planTitle when using bucketName but not both';
|
|
181
186
|
}
|
|
182
|
-
if (args.options.planName && !args.options.ownerGroupId && !args.options.ownerGroupName) {
|
|
183
|
-
return 'Specify either ownerGroupId or ownerGroupName when using
|
|
187
|
+
if ((args.options.planName || args.options.planTitle) && !args.options.ownerGroupId && !args.options.ownerGroupName) {
|
|
188
|
+
return 'Specify either ownerGroupId or ownerGroupName when using planTitle';
|
|
184
189
|
}
|
|
185
|
-
if (args.options.planName && args.options.ownerGroupId && args.options.ownerGroupName) {
|
|
186
|
-
return 'Specify either ownerGroupId or ownerGroupName when using
|
|
190
|
+
if ((args.options.planName || args.options.planTitle) && args.options.ownerGroupId && args.options.ownerGroupName) {
|
|
191
|
+
return 'Specify either ownerGroupId or ownerGroupName when using planTitle but not both';
|
|
187
192
|
}
|
|
188
193
|
if (args.options.ownerGroupId && !utils_1.validation.isValidGuid(args.options.ownerGroupId)) {
|
|
189
194
|
return `${args.options.ownerGroupId} is not a valid GUID`;
|
|
@@ -20,6 +20,7 @@ class PlannerTaskListCommand extends GraphCommand_1.default {
|
|
|
20
20
|
telemetryProps.bucketName = typeof args.options.bucketName !== 'undefined';
|
|
21
21
|
telemetryProps.planId = typeof args.options.planId !== 'undefined';
|
|
22
22
|
telemetryProps.planName = typeof args.options.planName !== 'undefined';
|
|
23
|
+
telemetryProps.planTitle = typeof args.options.planTitle !== 'undefined';
|
|
23
24
|
telemetryProps.ownerGroupId = typeof args.options.ownerGroupId !== 'undefined';
|
|
24
25
|
telemetryProps.ownerGroupName = typeof args.options.ownerGroupName !== 'undefined';
|
|
25
26
|
return telemetryProps;
|
|
@@ -28,13 +29,17 @@ class PlannerTaskListCommand extends GraphCommand_1.default {
|
|
|
28
29
|
return ['id', 'title', 'startDateTime', 'dueDateTime', 'completedDateTime'];
|
|
29
30
|
}
|
|
30
31
|
commandAction(logger, args, cb) {
|
|
32
|
+
if (args.options.planName) {
|
|
33
|
+
args.options.planTitle = args.options.planName;
|
|
34
|
+
this.warn(logger, `Option 'planName' is deprecated. Please use 'planTitle' instead`);
|
|
35
|
+
}
|
|
31
36
|
if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
|
|
32
37
|
this.handleError('This command does not support application permissions.', logger, cb);
|
|
33
38
|
return;
|
|
34
39
|
}
|
|
35
40
|
const bucketName = args.options.bucketName;
|
|
36
41
|
let bucketId = args.options.bucketId;
|
|
37
|
-
const
|
|
42
|
+
const planTitle = args.options.planTitle;
|
|
38
43
|
let planId = args.options.planId;
|
|
39
44
|
let taskItems = [];
|
|
40
45
|
if (bucketId || bucketName) {
|
|
@@ -53,7 +58,7 @@ class PlannerTaskListCommand extends GraphCommand_1.default {
|
|
|
53
58
|
cb();
|
|
54
59
|
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
55
60
|
}
|
|
56
|
-
else if (planId ||
|
|
61
|
+
else if (planId || planTitle) {
|
|
57
62
|
this
|
|
58
63
|
.getPlanId(args)
|
|
59
64
|
.then((retrievedPlanId) => {
|
|
@@ -112,7 +117,7 @@ class PlannerTaskListCommand extends GraphCommand_1.default {
|
|
|
112
117
|
}
|
|
113
118
|
return this
|
|
114
119
|
.getGroupId(args)
|
|
115
|
-
.then((groupId) => planner_1.planner.
|
|
120
|
+
.then((groupId) => planner_1.planner.getPlanByTitle(args.options.planTitle, groupId))
|
|
116
121
|
.then(plan => plan.id);
|
|
117
122
|
}
|
|
118
123
|
getGroupId(args) {
|
|
@@ -148,6 +153,9 @@ class PlannerTaskListCommand extends GraphCommand_1.default {
|
|
|
148
153
|
{
|
|
149
154
|
option: '--planName [planName]'
|
|
150
155
|
},
|
|
156
|
+
{
|
|
157
|
+
option: '--planTitle [planTitle]'
|
|
158
|
+
},
|
|
151
159
|
{
|
|
152
160
|
option: '--ownerGroupId [ownerGroupId]'
|
|
153
161
|
},
|
|
@@ -162,17 +170,17 @@ class PlannerTaskListCommand extends GraphCommand_1.default {
|
|
|
162
170
|
if (args.options.bucketId && args.options.bucketName) {
|
|
163
171
|
return 'To retrieve tasks from a bucket, specify bucketId or bucketName, but not both';
|
|
164
172
|
}
|
|
165
|
-
if (args.options.bucketName && !args.options.planId && !args.options.planName) {
|
|
166
|
-
return 'Specify either planId or
|
|
173
|
+
if (args.options.bucketName && !args.options.planId && !args.options.planName && !args.options.planTitle) {
|
|
174
|
+
return 'Specify either planId or planTitle when using bucketName';
|
|
167
175
|
}
|
|
168
|
-
if (args.options.planId && args.options.planName) {
|
|
169
|
-
return 'Specify either planId or
|
|
176
|
+
if (args.options.planId && (args.options.planName || args.options.planTitle)) {
|
|
177
|
+
return 'Specify either planId or planTitle but not both';
|
|
170
178
|
}
|
|
171
|
-
if (args.options.planName && !args.options.ownerGroupId && !args.options.ownerGroupName) {
|
|
172
|
-
return 'Specify either ownerGroupId or ownerGroupName when using
|
|
179
|
+
if ((args.options.planName || args.options.planTitle) && !args.options.ownerGroupId && !args.options.ownerGroupName) {
|
|
180
|
+
return 'Specify either ownerGroupId or ownerGroupName when using planTitle';
|
|
173
181
|
}
|
|
174
|
-
if (args.options.planName && args.options.ownerGroupId && args.options.ownerGroupName) {
|
|
175
|
-
return 'Specify either ownerGroupId or ownerGroupName when using
|
|
182
|
+
if ((args.options.planName || args.options.planTitle) && args.options.ownerGroupId && args.options.ownerGroupName) {
|
|
183
|
+
return 'Specify either ownerGroupId or ownerGroupName when using planTitle but not both';
|
|
176
184
|
}
|
|
177
185
|
if (args.options.ownerGroupId && !utils_1.validation.isValidGuid(args.options.ownerGroupId)) {
|
|
178
186
|
return `${args.options.ownerGroupId} is not a valid GUID`;
|
|
@@ -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 = [
|
|
@@ -24,6 +24,7 @@ class PlannerTaskSetCommand extends GraphCommand_1.default {
|
|
|
24
24
|
telemetryProps.title = typeof args.options.title !== 'undefined';
|
|
25
25
|
telemetryProps.planId = typeof args.options.planId !== 'undefined';
|
|
26
26
|
telemetryProps.planName = typeof args.options.planName !== 'undefined';
|
|
27
|
+
telemetryProps.planTitle = typeof args.options.planTitle !== 'undefined';
|
|
27
28
|
telemetryProps.ownerGroupId = typeof args.options.ownerGroupId !== 'undefined';
|
|
28
29
|
telemetryProps.ownerGroupName = typeof args.options.ownerGroupName !== 'undefined';
|
|
29
30
|
telemetryProps.bucketId = typeof args.options.bucketId !== 'undefined';
|
|
@@ -41,6 +42,10 @@ class PlannerTaskSetCommand extends GraphCommand_1.default {
|
|
|
41
42
|
return telemetryProps;
|
|
42
43
|
}
|
|
43
44
|
commandAction(logger, args, cb) {
|
|
45
|
+
if (args.options.planName) {
|
|
46
|
+
args.options.planTitle = args.options.planName;
|
|
47
|
+
this.warn(logger, `Option 'planName' is deprecated. Please use 'planTitle' instead`);
|
|
48
|
+
}
|
|
44
49
|
if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
|
|
45
50
|
this.handleError('This command does not support application permissions.', logger, cb);
|
|
46
51
|
return;
|
|
@@ -214,7 +219,7 @@ class PlannerTaskSetCommand extends GraphCommand_1.default {
|
|
|
214
219
|
}
|
|
215
220
|
return this
|
|
216
221
|
.getGroupId(options)
|
|
217
|
-
.then((groupId) => planner_1.planner.
|
|
222
|
+
.then((groupId) => planner_1.planner.getPlanByTitle(options.planTitle, groupId))
|
|
218
223
|
.then(plan => plan.id);
|
|
219
224
|
}
|
|
220
225
|
getGroupId(options) {
|
|
@@ -265,6 +270,7 @@ class PlannerTaskSetCommand extends GraphCommand_1.default {
|
|
|
265
270
|
{ option: '-t, --title [title]' },
|
|
266
271
|
{ option: '--planId [planId]' },
|
|
267
272
|
{ option: '--planName [planName]' },
|
|
273
|
+
{ option: '--planTitle [planTitle]' },
|
|
268
274
|
{ option: '--ownerGroupId [ownerGroupId]' },
|
|
269
275
|
{ option: '--ownerGroupName [ownerGroupName]' },
|
|
270
276
|
{ option: '--bucketId [bucketId]' },
|
|
@@ -287,17 +293,17 @@ class PlannerTaskSetCommand extends GraphCommand_1.default {
|
|
|
287
293
|
if (args.options.bucketId && args.options.bucketName) {
|
|
288
294
|
return 'Specify either bucketId or bucketName but not both';
|
|
289
295
|
}
|
|
290
|
-
if (args.options.bucketName && !args.options.planId && !args.options.planName) {
|
|
291
|
-
return 'Specify either planId or
|
|
296
|
+
if (args.options.bucketName && !args.options.planId && !args.options.planName && !args.options.planTitle) {
|
|
297
|
+
return 'Specify either planId or planTitle when using bucketName';
|
|
292
298
|
}
|
|
293
|
-
if (args.options.bucketName && args.options.planId && args.options.planName) {
|
|
294
|
-
return 'Specify either planId or
|
|
299
|
+
if (args.options.bucketName && args.options.planId && (args.options.planName || args.options.planTitle)) {
|
|
300
|
+
return 'Specify either planId or planTitle when using bucketName but not both';
|
|
295
301
|
}
|
|
296
|
-
if (args.options.planName && !args.options.ownerGroupId && !args.options.ownerGroupName) {
|
|
297
|
-
return 'Specify either ownerGroupId or ownerGroupName when using
|
|
302
|
+
if ((args.options.planName || args.options.planTitle) && !args.options.ownerGroupId && !args.options.ownerGroupName) {
|
|
303
|
+
return 'Specify either ownerGroupId or ownerGroupName when using planTitle';
|
|
298
304
|
}
|
|
299
|
-
if (args.options.planName && args.options.ownerGroupId && args.options.ownerGroupName) {
|
|
300
|
-
return 'Specify either ownerGroupId or ownerGroupName when using
|
|
305
|
+
if ((args.options.planName || args.options.planTitle) && args.options.ownerGroupId && args.options.ownerGroupName) {
|
|
306
|
+
return 'Specify either ownerGroupId or ownerGroupName when using planTitle but not both';
|
|
301
307
|
}
|
|
302
308
|
if (args.options.ownerGroupId && !utils_1.validation.isValidGuid(args.options.ownerGroupId)) {
|
|
303
309
|
return `${args.options.ownerGroupId} is not a valid GUID`;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const request_1 = require("../../../../request");
|
|
4
|
+
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
5
|
+
const commands_1 = require("../../commands");
|
|
6
|
+
class SearchExternalConnectionGetCommand extends GraphCommand_1.default {
|
|
7
|
+
get name() {
|
|
8
|
+
return commands_1.default.EXTERNALCONNECTION_GET;
|
|
9
|
+
}
|
|
10
|
+
get description() {
|
|
11
|
+
return 'Get a specific external connection for use in Microsoft Search';
|
|
12
|
+
}
|
|
13
|
+
getTelemetryProperties(args) {
|
|
14
|
+
const telemetryProps = super.getTelemetryProperties(args);
|
|
15
|
+
telemetryProps.id = typeof args.options.id !== 'undefined';
|
|
16
|
+
telemetryProps.name = typeof args.options.name !== 'undefined';
|
|
17
|
+
return telemetryProps;
|
|
18
|
+
}
|
|
19
|
+
commandAction(logger, args, cb) {
|
|
20
|
+
let url = `${this.resource}/v1.0/external/connections`;
|
|
21
|
+
if (args.options.id) {
|
|
22
|
+
url += `/${encodeURIComponent(args.options.id)}`;
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
url += `?$filter=name eq '${encodeURIComponent(args.options.name)}'`;
|
|
26
|
+
}
|
|
27
|
+
const requestOptions = {
|
|
28
|
+
url: url,
|
|
29
|
+
headers: {
|
|
30
|
+
accept: 'application/json;odata.metadata=none'
|
|
31
|
+
},
|
|
32
|
+
responseType: 'json'
|
|
33
|
+
};
|
|
34
|
+
request_1.default
|
|
35
|
+
.get(requestOptions)
|
|
36
|
+
.then((res) => {
|
|
37
|
+
if (args.options.name) {
|
|
38
|
+
if (res.value.length === 0) {
|
|
39
|
+
return Promise.reject(`External connection with name '${args.options.name}' not found`);
|
|
40
|
+
}
|
|
41
|
+
res = res.value[0];
|
|
42
|
+
}
|
|
43
|
+
return Promise.resolve(res);
|
|
44
|
+
})
|
|
45
|
+
.then(res => {
|
|
46
|
+
logger.log(res);
|
|
47
|
+
cb();
|
|
48
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
49
|
+
}
|
|
50
|
+
optionSets() {
|
|
51
|
+
return [
|
|
52
|
+
['id', 'name']
|
|
53
|
+
];
|
|
54
|
+
}
|
|
55
|
+
options() {
|
|
56
|
+
const options = [
|
|
57
|
+
{
|
|
58
|
+
option: '-i, --id [id]'
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
option: '-n, --name [name]'
|
|
62
|
+
}
|
|
63
|
+
];
|
|
64
|
+
const parentOptions = super.options();
|
|
65
|
+
return options.concat(parentOptions);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
module.exports = new SearchExternalConnectionGetCommand();
|
|
69
|
+
//# sourceMappingURL=externalconnection-get.js.map
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const prefix = 'search';
|
|
4
4
|
exports.default = {
|
|
5
5
|
EXTERNALCONNECTION_ADD: `${prefix} externalconnection add`,
|
|
6
|
+
EXTERNALCONNECTION_GET: `${prefix} externalconnection get`,
|
|
6
7
|
EXTERNALCONNECTION_LIST: `${prefix} externalconnection list`
|
|
7
8
|
};
|
|
8
9
|
//# sourceMappingURL=commands.js.map
|
|
@@ -22,6 +22,15 @@ class BasePermissions {
|
|
|
22
22
|
set low(value) {
|
|
23
23
|
this._low = value;
|
|
24
24
|
}
|
|
25
|
+
parse() {
|
|
26
|
+
const result = [];
|
|
27
|
+
for (const permissionKind in PermissionKind) {
|
|
28
|
+
if (this.has(PermissionKind[permissionKind])) {
|
|
29
|
+
result.push(permissionKind);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
25
34
|
has(perm) {
|
|
26
35
|
let hasPermission = false;
|
|
27
36
|
if (perm === PermissionKind.FullMask) {
|