@pnp/cli-microsoft365 5.0.0-beta.60ed6bc → 5.0.0-beta.6d4dbfb

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.
Files changed (121) hide show
  1. package/.devcontainer/devcontainer.json +9 -1
  2. package/.eslintrc.js +2 -0
  3. package/README.md +1 -1
  4. package/dist/Utils.js +7 -0
  5. package/dist/appInsights.js +5 -2
  6. package/dist/cli/Cli.js +24 -4
  7. package/dist/m365/aad/commands/app/app-add.js +58 -5
  8. package/dist/m365/aad/commands/app/app-get.js +97 -0
  9. package/dist/m365/aad/commands/group/group-list.js +41 -0
  10. package/dist/m365/aad/commands/o365group/{GroupUser.js → GroupExtended.js} +1 -1
  11. package/dist/m365/aad/commands/o365group/o365group-add.js +56 -50
  12. package/dist/m365/aad/commands/o365group/o365group-user-set.js +3 -3
  13. package/dist/m365/aad/commands/oauth2grant/oauth2grant-list.js +4 -4
  14. package/dist/m365/aad/commands/oauth2grant/oauth2grant-remove.js +36 -12
  15. package/dist/m365/aad/commands/user/user-get.js +33 -6
  16. package/dist/m365/aad/commands/user/user-hibp.js +67 -0
  17. package/dist/m365/aad/commands/user/user-list.js +7 -4
  18. package/dist/m365/aad/commands/user/user-password-validate.js +42 -0
  19. package/dist/m365/aad/commands.js +4 -0
  20. package/dist/m365/app/commands/permission/permission-list.js +266 -0
  21. package/dist/m365/app/commands.js +7 -0
  22. package/dist/m365/base/AppCommand.js +76 -0
  23. package/dist/m365/{aad/commands/o365group/Group.js → base/M365RcJson.js} +1 -1
  24. package/dist/m365/cli/commands/cli-doctor.js +2 -0
  25. package/dist/m365/cli/commands/config/config-set.js +4 -1
  26. package/dist/m365/file/commands/file-list.js +181 -0
  27. package/dist/m365/file/commands.js +2 -1
  28. package/dist/m365/flow/commands/flow-get.js +2 -2
  29. package/dist/m365/pa/cds-project-mutator.js +1 -1
  30. package/dist/m365/pa/commands/app/app-list.js +28 -1
  31. package/dist/m365/planner/AppliedCategories.js +3 -0
  32. package/dist/m365/planner/commands/task/task-add.js +288 -0
  33. package/dist/m365/planner/commands/task/task-details-get.js +39 -0
  34. package/dist/m365/planner/commands/task/task-get.js +37 -0
  35. package/dist/m365/planner/commands/task/task-set.js +357 -0
  36. package/dist/m365/planner/commands.js +5 -1
  37. package/dist/m365/search/commands/externalconnection/externalconnection-add.js +99 -0
  38. package/dist/m365/search/commands.js +7 -0
  39. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN006005_CFG_PS_metadata.js +63 -0
  40. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN006006_CFG_PS_features.js +60 -0
  41. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN014008_CODE_launch_hostedWorkbench_type.js +62 -0
  42. package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.13.1.js +53 -0
  43. package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.14.0-beta.5.js +59 -0
  44. package/dist/m365/spfx/commands/project/project-upgrade.js +17 -13
  45. package/dist/m365/spfx/commands/spfx-doctor.js +176 -62
  46. package/dist/m365/spo/commands/contenttype/contenttype-list.js +52 -0
  47. package/dist/m365/spo/commands/group/group-user-add.js +64 -13
  48. package/dist/m365/spo/commands/group/group-user-remove.js +100 -0
  49. package/dist/m365/spo/commands/list/list-get.js +6 -2
  50. package/dist/m365/spo/commands/page/Page.js +3 -1
  51. package/dist/m365/spo/commands/page/page-add.js +7 -10
  52. package/dist/m365/spo/commands/page/page-set.js +7 -10
  53. package/dist/m365/spo/commands/site/site-ensure.js +1 -1
  54. package/dist/m365/spo/commands/site/site-recyclebinitem-list.js +76 -0
  55. package/dist/m365/spo/commands/site/site-remove.js +98 -30
  56. package/dist/m365/spo/commands/web/web-installedlanguage-list.js +48 -0
  57. package/dist/m365/spo/commands.js +5 -1
  58. package/dist/m365/teams/commands/app/app-list.js +9 -6
  59. package/dist/m365/teams/commands/chat/chat-list.js +43 -0
  60. package/dist/m365/teams/commands/chat/chat-member-list.js +42 -0
  61. package/dist/m365/teams/commands/chat/chat-message-list.js +60 -0
  62. package/dist/m365/teams/commands/message/message-get.js +1 -1
  63. package/dist/m365/teams/commands/report/report-directroutingcalls.js +1 -1
  64. package/dist/m365/teams/commands/tab/tab-get.js +9 -6
  65. package/dist/m365/teams/commands.js +3 -0
  66. package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-health-get.js +57 -0
  67. package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-health-list.js +56 -0
  68. package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-healthissue-get.js +39 -0
  69. package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-healthissue-list.js +38 -0
  70. package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-message-get.js +51 -0
  71. package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-message-list.js +38 -0
  72. package/dist/m365/tenant/commands.js +6 -0
  73. package/dist/request.js +9 -4
  74. package/dist/settingsNames.js +6 -1
  75. package/docs/docs/cmd/_global.md +2 -2
  76. package/docs/docs/cmd/aad/app/app-add.md +11 -0
  77. package/docs/docs/cmd/aad/app/app-get.md +48 -0
  78. package/docs/docs/cmd/aad/group/group-list.md +21 -0
  79. package/docs/docs/cmd/aad/o365group/o365group-add.md +1 -0
  80. package/docs/docs/cmd/aad/oauth2grant/oauth2grant-list.md +2 -2
  81. package/docs/docs/cmd/aad/oauth2grant/oauth2grant-remove.md +9 -0
  82. package/docs/docs/cmd/aad/user/user-get.md +13 -4
  83. package/docs/docs/cmd/aad/user/user-hibp.md +46 -0
  84. package/docs/docs/cmd/aad/user/user-list.md +9 -0
  85. package/docs/docs/cmd/aad/user/user-password-validate.md +29 -0
  86. package/docs/docs/cmd/app/permission/permission-list.md +36 -0
  87. package/docs/docs/cmd/file/file-list.md +46 -0
  88. package/docs/docs/cmd/pa/app/app-list.md +17 -1
  89. package/docs/docs/cmd/planner/task/task-add.md +78 -0
  90. package/docs/docs/cmd/planner/task/task-details-get.md +24 -0
  91. package/docs/docs/cmd/planner/task/task-get.md +24 -0
  92. package/docs/docs/cmd/planner/task/task-set.md +99 -0
  93. package/docs/docs/cmd/search/externalconnection/externalconnection-add.md +43 -0
  94. package/docs/docs/cmd/spfx/project/project-externalize.md +1 -1
  95. package/docs/docs/cmd/spfx/project/project-rename.md +1 -1
  96. package/docs/docs/cmd/spfx/project/project-upgrade.md +1 -1
  97. package/docs/docs/cmd/spfx/spfx-doctor.md +1 -1
  98. package/docs/docs/cmd/spo/contenttype/contenttype-list.md +33 -0
  99. package/docs/docs/cmd/spo/group/group-user-add.md +24 -6
  100. package/docs/docs/cmd/spo/group/group-user-remove.md +39 -0
  101. package/docs/docs/cmd/spo/list/list-get.md +9 -0
  102. package/docs/docs/cmd/spo/page/page-add.md +2 -2
  103. package/docs/docs/cmd/spo/page/page-set.md +3 -3
  104. package/docs/docs/cmd/spo/site/site-recyclebinitem-list.md +40 -0
  105. package/docs/docs/cmd/spo/site/site-remove.md +3 -1
  106. package/docs/docs/cmd/spo/web/web-installedlanguage-list.md +24 -0
  107. package/docs/docs/cmd/teams/channel/channel-get.md +1 -1
  108. package/docs/docs/cmd/teams/chat/chat-list.md +30 -0
  109. package/docs/docs/cmd/teams/chat/chat-member-list.md +24 -0
  110. package/docs/docs/cmd/teams/chat/chat-message-list.md +24 -0
  111. package/docs/docs/cmd/teams/message/message-get.md +0 -3
  112. package/docs/docs/cmd/teams/report/report-directroutingcalls.md +0 -3
  113. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-health-get.md +33 -0
  114. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-health-list.md +30 -0
  115. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-healthissue-get.md +24 -0
  116. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-healthissue-list.md +34 -0
  117. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-message-get.md +28 -0
  118. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-message-list.md +34 -0
  119. package/npm-shrinkwrap.json +1308 -1478
  120. package/package.json +34 -27
  121. package/dist/m365/base/AadCommand.js +0 -10
@@ -0,0 +1,357 @@
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 PlannerTaskSetCommand extends GraphCommand_1.default {
8
+ constructor() {
9
+ super(...arguments);
10
+ this.allowedAppliedCategories = ['category1', 'category2', 'category3', 'category4', 'category5', 'category6'];
11
+ }
12
+ get name() {
13
+ return commands_1.default.TASK_SET;
14
+ }
15
+ get description() {
16
+ return 'Updates a Microsoft Planner Task';
17
+ }
18
+ getTelemetryProperties(args) {
19
+ const telemetryProps = super.getTelemetryProperties(args);
20
+ telemetryProps.title = typeof args.options.title !== 'undefined';
21
+ telemetryProps.planId = typeof args.options.planId !== 'undefined';
22
+ telemetryProps.planName = typeof args.options.planName !== 'undefined';
23
+ telemetryProps.ownerGroupId = typeof args.options.ownerGroupId !== 'undefined';
24
+ telemetryProps.ownerGroupName = typeof args.options.ownerGroupName !== 'undefined';
25
+ telemetryProps.bucketId = typeof args.options.bucketId !== 'undefined';
26
+ telemetryProps.bucketName = typeof args.options.bucketName !== 'undefined';
27
+ telemetryProps.startDateTime = typeof args.options.startDateTime !== 'undefined';
28
+ telemetryProps.dueDateTime = typeof args.options.dueDateTime !== 'undefined';
29
+ telemetryProps.percentComplete = typeof args.options.percentComplete !== 'undefined';
30
+ telemetryProps.assignedToUserIds = typeof args.options.assignedToUserIds !== 'undefined';
31
+ telemetryProps.assignedToUserNames = typeof args.options.assignedToUserNames !== 'undefined';
32
+ telemetryProps.assigneePriority = typeof args.options.assigneePriority !== 'undefined';
33
+ telemetryProps.description = typeof args.options.description !== 'undefined';
34
+ telemetryProps.appliedCategories = typeof args.options.appliedCategories !== 'undefined';
35
+ telemetryProps.orderHint = typeof args.options.orderHint !== 'undefined';
36
+ return telemetryProps;
37
+ }
38
+ commandAction(logger, args, cb) {
39
+ this
40
+ .getBucketId(args.options)
41
+ .then(bucketId => {
42
+ this.bucketId = bucketId;
43
+ return this.generateUserAssignments(args.options);
44
+ })
45
+ .then(resultAssignments => {
46
+ this.assignments = resultAssignments;
47
+ return this.getTaskEtag(args.options.id);
48
+ })
49
+ .then(etag => {
50
+ const appliedCategories = this.generateAppliedCategories(args.options);
51
+ const data = this.mapRequestBody(args.options, appliedCategories);
52
+ const requestOptions = {
53
+ url: `${this.resource}/v1.0/planner/tasks/${args.options.id}`,
54
+ headers: {
55
+ 'accept': 'application/json;odata.metadata=none',
56
+ 'If-Match': etag,
57
+ 'Prefer': 'return=representation'
58
+ },
59
+ responseType: 'json',
60
+ data: data
61
+ };
62
+ return request_1.default.patch(requestOptions);
63
+ })
64
+ .then(newTask => this.updateTaskDetails(args.options, newTask))
65
+ .then((res) => {
66
+ logger.log(res);
67
+ cb();
68
+ }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
69
+ }
70
+ updateTaskDetails(options, newTask) {
71
+ if (!options.description) {
72
+ return Promise.resolve(newTask);
73
+ }
74
+ const taskId = newTask.id;
75
+ return this
76
+ .getTaskDetailsEtag(taskId)
77
+ .then(etag => {
78
+ const requestOptionsTaskDetails = {
79
+ url: `${this.resource}/v1.0/planner/tasks/${taskId}/details`,
80
+ headers: {
81
+ 'accept': 'application/json;odata.metadata=none',
82
+ 'If-Match': etag,
83
+ 'Prefer': 'return=representation'
84
+ },
85
+ responseType: 'json',
86
+ data: {
87
+ description: options.description
88
+ }
89
+ };
90
+ return request_1.default.patch(requestOptionsTaskDetails);
91
+ })
92
+ .then(taskDetails => {
93
+ return Object.assign(Object.assign({}, newTask), taskDetails);
94
+ });
95
+ }
96
+ getTaskDetailsEtag(taskId) {
97
+ const requestOptions = {
98
+ url: `${this.resource}/v1.0/planner/tasks/${encodeURIComponent(taskId)}/details`,
99
+ headers: {
100
+ accept: 'application/json'
101
+ },
102
+ responseType: 'json'
103
+ };
104
+ return request_1.default
105
+ .get(requestOptions)
106
+ .then((response) => {
107
+ const etag = response ? response['@odata.etag'] : undefined;
108
+ if (!etag) {
109
+ return Promise.reject(`Error fetching task details`);
110
+ }
111
+ return Promise.resolve(etag);
112
+ });
113
+ }
114
+ getTaskEtag(taskId) {
115
+ const requestOptions = {
116
+ url: `${this.resource}/v1.0/planner/tasks/${encodeURIComponent(taskId)}`,
117
+ headers: {
118
+ accept: 'application/json'
119
+ },
120
+ responseType: 'json'
121
+ };
122
+ return request_1.default
123
+ .get(requestOptions)
124
+ .then((response) => {
125
+ const etag = response ? response['@odata.etag'] : undefined;
126
+ if (!etag) {
127
+ return Promise.reject(`Error fetching task`);
128
+ }
129
+ return Promise.resolve(etag);
130
+ });
131
+ }
132
+ generateAppliedCategories(options) {
133
+ if (!options.appliedCategories) {
134
+ return {};
135
+ }
136
+ const categories = {};
137
+ options.appliedCategories.toLocaleLowerCase().split(',').forEach(x => categories[x] = true);
138
+ return categories;
139
+ }
140
+ generateUserAssignments(options) {
141
+ const assignments = {};
142
+ if (!options.assignedToUserIds && !options.assignedToUserNames) {
143
+ return Promise.resolve(assignments);
144
+ }
145
+ return this
146
+ .getUserIds(options)
147
+ .then((userIds) => {
148
+ userIds.forEach(x => assignments[x] = {
149
+ '@odata.type': '#microsoft.graph.plannerAssignment',
150
+ orderHint: ' !'
151
+ });
152
+ return Promise.resolve(assignments);
153
+ });
154
+ }
155
+ getUserIds(options) {
156
+ if (options.assignedToUserIds) {
157
+ return Promise.resolve(options.assignedToUserIds.split(',').map(o => o.trim()));
158
+ }
159
+ // Hitting this section means assignedToUserNames won't be undefined
160
+ const userNames = options.assignedToUserNames;
161
+ const userArr = userNames.split(',').map(o => o.trim());
162
+ let userIds = [];
163
+ const promises = userArr.map(user => {
164
+ const requestOptions = {
165
+ url: `${this.resource}/v1.0/users?$filter=userPrincipalName eq '${Utils_1.default.encodeQueryParameter(user)}'&$select=id,userPrincipalName`,
166
+ headers: {
167
+ 'accept ': 'application/json;odata.metadata=none'
168
+ },
169
+ responseType: 'json'
170
+ };
171
+ return request_1.default.get(requestOptions);
172
+ });
173
+ return Promise
174
+ .all(promises)
175
+ .then((usersRes) => {
176
+ let userUpns = [];
177
+ userUpns = usersRes.map(res => { var _a; return (_a = res.value[0]) === null || _a === void 0 ? void 0 : _a.userPrincipalName; });
178
+ userIds = usersRes.map(res => { var _a; return (_a = res.value[0]) === null || _a === void 0 ? void 0 : _a.id; });
179
+ // Find the members where no graph response was found
180
+ const invalidUsers = userArr.filter(user => !userUpns.some((upn) => (upn === null || upn === void 0 ? void 0 : upn.toLowerCase()) === user.toLowerCase()));
181
+ if (invalidUsers && invalidUsers.length > 0) {
182
+ return Promise.reject(`Cannot proceed with planner task update. The following users provided are invalid : ${invalidUsers.join(',')}`);
183
+ }
184
+ return Promise.resolve(userIds);
185
+ });
186
+ }
187
+ getBucketId(options) {
188
+ if (options.bucketId) {
189
+ return Promise.resolve(options.bucketId);
190
+ }
191
+ if (!options.bucketName) {
192
+ return Promise.resolve(undefined);
193
+ }
194
+ return this
195
+ .getPlanId(options)
196
+ .then(planId => {
197
+ const requestOptions = {
198
+ url: `${this.resource}/v1.0/planner/plans/${planId}/buckets?$select=id,name`,
199
+ headers: {
200
+ accept: 'application/json;odata.metadata=none'
201
+ },
202
+ responseType: 'json'
203
+ };
204
+ return request_1.default.get(requestOptions);
205
+ })
206
+ .then((response) => {
207
+ const bucket = response.value.find(val => val.name === options.bucketName);
208
+ if (!bucket) {
209
+ return Promise.reject(`The specified bucket does not exist`);
210
+ }
211
+ return Promise.resolve(bucket.id);
212
+ });
213
+ }
214
+ getPlanId(options) {
215
+ if (options.planId) {
216
+ return Promise.resolve(options.planId);
217
+ }
218
+ return this
219
+ .getGroupId(options)
220
+ .then((groupId) => {
221
+ const requestOptions = {
222
+ url: `${this.resource}/v1.0/planner/plans?$filter=(owner eq '${groupId}')&$select=id,title`,
223
+ headers: {
224
+ accept: 'application/json;odata.metadata=none'
225
+ },
226
+ responseType: 'json'
227
+ };
228
+ return request_1.default.get(requestOptions);
229
+ })
230
+ .then((response) => {
231
+ const plan = response.value.find(val => val.title === options.planName);
232
+ if (!plan) {
233
+ return Promise.reject(`The specified plan does not exist`);
234
+ }
235
+ return Promise.resolve(plan.id);
236
+ });
237
+ }
238
+ getGroupId(options) {
239
+ if (options.ownerGroupId) {
240
+ return Promise.resolve(options.ownerGroupId);
241
+ }
242
+ const requestOptions = {
243
+ url: `${this.resource}/v1.0/groups?$filter=displayName eq '${encodeURIComponent(options.ownerGroupName)}'&$select=id`,
244
+ headers: {
245
+ accept: 'application/json;odata.metadata=none'
246
+ },
247
+ responseType: 'json'
248
+ };
249
+ return request_1.default
250
+ .get(requestOptions)
251
+ .then(response => {
252
+ const group = response.value[0];
253
+ if (!group) {
254
+ return Promise.reject(`The specified owner group does not exist`);
255
+ }
256
+ return Promise.resolve(group.id);
257
+ });
258
+ }
259
+ mapRequestBody(options, appliedCategories) {
260
+ const requestBody = {};
261
+ if (options.title) {
262
+ requestBody.title = options.title;
263
+ }
264
+ if (this.bucketId) {
265
+ requestBody.bucketId = this.bucketId;
266
+ }
267
+ if (options.startDateTime) {
268
+ requestBody.startDateTime = options.startDateTime;
269
+ }
270
+ if (options.dueDateTime) {
271
+ requestBody.dueDateTime = options.dueDateTime;
272
+ }
273
+ if (options.percentComplete) {
274
+ requestBody.percentComplete = options.percentComplete;
275
+ }
276
+ if (this.assignments && Object.keys(this.assignments).length > 0) {
277
+ requestBody.assignments = this.assignments;
278
+ }
279
+ if (options.assigneePriority) {
280
+ requestBody.assigneePriority = options.assigneePriority;
281
+ }
282
+ if (appliedCategories && Object.keys(appliedCategories).length > 0) {
283
+ requestBody.appliedCategories = appliedCategories;
284
+ }
285
+ if (options.orderHint) {
286
+ requestBody.orderHint = options.orderHint;
287
+ }
288
+ return requestBody;
289
+ }
290
+ options() {
291
+ const options = [
292
+ { option: '-i, --id <id>' },
293
+ { option: '-t, --title [title]' },
294
+ { option: '--planId [planId]' },
295
+ { option: '--planName [planName]' },
296
+ { option: '--ownerGroupId [ownerGroupId]' },
297
+ { option: '--ownerGroupName [ownerGroupName]' },
298
+ { option: '--bucketId [bucketId]' },
299
+ { option: '--bucketName [bucketName]' },
300
+ { option: '--startDateTime [startDateTime]' },
301
+ { option: '--dueDateTime [dueDateTime]' },
302
+ { option: '--percentComplete [percentComplete]' },
303
+ { option: '--assignedToUserIds [assignedToUserIds]' },
304
+ { option: '--assignedToUserNames [assignedToUserNames]' },
305
+ { option: '--assigneePriority [assigneePriority]' },
306
+ { option: '--description [description]' },
307
+ { option: '--appliedCategories [appliedCategories]' },
308
+ { option: '--orderHint [orderHint]' }
309
+ ];
310
+ const parentOptions = super.options();
311
+ return options.concat(parentOptions);
312
+ }
313
+ validate(args) {
314
+ if (args.options.bucketId && args.options.bucketName) {
315
+ return 'Specify either bucketId or bucketName but not both';
316
+ }
317
+ if (args.options.bucketName && !args.options.planId && !args.options.planName) {
318
+ return 'Specify either planId or planName when using bucketName';
319
+ }
320
+ if (args.options.bucketName && args.options.planId && args.options.planName) {
321
+ return 'Specify either planId or planName when using bucketName but not both';
322
+ }
323
+ if (args.options.planName && !args.options.ownerGroupId && !args.options.ownerGroupName) {
324
+ return 'Specify either ownerGroupId or ownerGroupName when using planName';
325
+ }
326
+ if (args.options.planName && args.options.ownerGroupId && args.options.ownerGroupName) {
327
+ return 'Specify either ownerGroupId or ownerGroupName when using planName but not both';
328
+ }
329
+ if (args.options.ownerGroupId && !Utils_1.default.isValidGuid(args.options.ownerGroupId)) {
330
+ return `${args.options.ownerGroupId} is not a valid GUID`;
331
+ }
332
+ if (args.options.startDateTime && !Utils_1.default.isValidISODateTime(args.options.startDateTime)) {
333
+ return 'The startDateTime is not a valid ISO date string';
334
+ }
335
+ if (args.options.dueDateTime && !Utils_1.default.isValidISODateTime(args.options.dueDateTime)) {
336
+ return 'The dueDateTime is not a valid ISO date string';
337
+ }
338
+ if (args.options.percentComplete && isNaN(args.options.percentComplete)) {
339
+ return `percentComplete is not a number`;
340
+ }
341
+ if (args.options.percentComplete && (args.options.percentComplete < 0 || args.options.percentComplete > 100)) {
342
+ return `percentComplete should be between 0 and 100`;
343
+ }
344
+ if (args.options.assignedToUserIds && !Utils_1.default.isValidGuidArray(args.options.assignedToUserIds.split(','))) {
345
+ return 'assignedToUserIds contains invalid GUID';
346
+ }
347
+ if (args.options.assignedToUserIds && args.options.assignedToUserNames) {
348
+ return 'Specify either assignedToUserIds or assignedToUserNames but not both';
349
+ }
350
+ if (args.options.appliedCategories && args.options.appliedCategories.split(',').filter(category => this.allowedAppliedCategories.indexOf(category.toLocaleLowerCase()) < 0).length !== 0) {
351
+ return 'The appliedCategories contains invalid value. Specify either category1, category2, category3, category4, category5 and/or category6 as properties';
352
+ }
353
+ return true;
354
+ }
355
+ }
356
+ module.exports = new PlannerTaskSetCommand();
357
+ //# sourceMappingURL=task-set.js.map
@@ -7,6 +7,10 @@ exports.default = {
7
7
  PLAN_ADD: `${prefix} plan add`,
8
8
  PLAN_GET: `${prefix} plan get`,
9
9
  PLAN_LIST: `${prefix} plan list`,
10
- TASK_LIST: `${prefix} task list`
10
+ TASK_ADD: `${prefix} task add`,
11
+ TASK_DETAILS_GET: `${prefix} task details get`,
12
+ TASK_GET: `${prefix} task get`,
13
+ TASK_LIST: `${prefix} task list`,
14
+ TASK_SET: `${prefix} task set`
11
15
  };
12
16
  //# sourceMappingURL=commands.js.map
@@ -0,0 +1,99 @@
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 SearchExternalConnectionAddCommand extends GraphCommand_1.default {
7
+ get name() {
8
+ return commands_1.default.EXTERNALCONNECTION_ADD;
9
+ }
10
+ get description() {
11
+ return 'Adds a new External Connection for Microsoft Search';
12
+ }
13
+ getTelemetryProperties(args) {
14
+ const telemetryProps = super.getTelemetryProperties(args);
15
+ telemetryProps.authorizedAppIds = typeof args.options.authorizedAppIds !== undefined;
16
+ return telemetryProps;
17
+ }
18
+ commandAction(logger, args, cb) {
19
+ let appIds = [];
20
+ if (args.options.authorizedAppIds !== undefined &&
21
+ args.options.authorizedAppIds !== '') {
22
+ appIds = args.options.authorizedAppIds.split(',');
23
+ }
24
+ const commandData = {
25
+ id: args.options.id,
26
+ name: args.options.name,
27
+ description: args.options.description,
28
+ configuration: {
29
+ authorizedAppIds: appIds
30
+ }
31
+ };
32
+ const requestOptions = {
33
+ url: `${this.resource}/v1.0/external/connections`,
34
+ headers: {
35
+ accept: 'application/json;odata.metadata=none'
36
+ },
37
+ responseType: 'json',
38
+ data: commandData
39
+ };
40
+ request_1.default
41
+ .post(requestOptions)
42
+ .then(_ => cb(), err => this.handleRejectedODataJsonPromise(err, logger, cb));
43
+ }
44
+ options() {
45
+ const options = [
46
+ {
47
+ option: '-i, --id <id>'
48
+ },
49
+ {
50
+ option: '-n, --name <name>'
51
+ },
52
+ {
53
+ option: '-d, --description <description>'
54
+ },
55
+ {
56
+ option: '--authorizedAppIds [authorizedAppIds]'
57
+ }
58
+ ];
59
+ const parentOptions = super.options();
60
+ return options.concat(parentOptions);
61
+ }
62
+ validate(args) {
63
+ const id = args.options.id;
64
+ if (id.length < 3 || id.length > 32) {
65
+ return 'ID must be between 3 and 32 characters in length.';
66
+ }
67
+ const alphaNumericRegEx = /[^\w]|_/g;
68
+ if (alphaNumericRegEx.test(id)) {
69
+ return 'ID must only contain alphanumeric characters.';
70
+ }
71
+ if (id.length > 9 &&
72
+ id.startsWith('Microsoft')) {
73
+ return 'ID cannot begin with Microsoft';
74
+ }
75
+ const invalidIds = ['None',
76
+ 'Directory',
77
+ 'Exchange',
78
+ 'ExchangeArchive',
79
+ 'LinkedIn',
80
+ 'Mailbox',
81
+ 'OneDriveBusiness',
82
+ 'SharePoint',
83
+ 'Teams',
84
+ 'Yammer',
85
+ 'Connectors',
86
+ 'TaskFabric',
87
+ 'PowerBI',
88
+ 'Assistant',
89
+ 'TopicEngine',
90
+ 'MSFT_All_Connectors'
91
+ ];
92
+ if (invalidIds.indexOf(id) > -1) {
93
+ return `ID cannot be one of the following values: ${invalidIds.join(', ')}.`;
94
+ }
95
+ return true;
96
+ }
97
+ }
98
+ module.exports = new SearchExternalConnectionAddCommand();
99
+ //# sourceMappingURL=externalconnection-add.js.map
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const prefix = 'search';
4
+ exports.default = {
5
+ EXTERNALCONNECTION_ADD: `${prefix} externalconnection add`
6
+ };
7
+ //# sourceMappingURL=commands.js.map
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FN006005_CFG_PS_metadata = void 0;
4
+ const JsonRule_1 = require("./JsonRule");
5
+ class FN006005_CFG_PS_metadata extends JsonRule_1.JsonRule {
6
+ constructor() {
7
+ super();
8
+ }
9
+ get id() {
10
+ return 'FN006005';
11
+ }
12
+ get title() {
13
+ return 'package-solution.json metadata';
14
+ }
15
+ get description() {
16
+ return `In package-solution.json add metadata section`;
17
+ }
18
+ get resolution() {
19
+ return '';
20
+ }
21
+ get resolutionType() {
22
+ return 'json';
23
+ }
24
+ get severity() {
25
+ return 'Required';
26
+ }
27
+ get file() {
28
+ return './config/package-solution.json';
29
+ }
30
+ visit(project, findings) {
31
+ var _a;
32
+ if (!project.packageSolutionJson ||
33
+ !project.packageSolutionJson.solution) {
34
+ return;
35
+ }
36
+ if (!project.packageSolutionJson.solution.metadata) {
37
+ const solutionDescription = `${(_a = project.packageJson) === null || _a === void 0 ? void 0 : _a.name} description`;
38
+ const resolution = {
39
+ solution: {
40
+ metadata: {
41
+ shortDescription: {
42
+ default: solutionDescription
43
+ },
44
+ longDescription: {
45
+ default: solutionDescription
46
+ },
47
+ screenshotPaths: [],
48
+ videoUrl: '',
49
+ categories: []
50
+ }
51
+ }
52
+ };
53
+ const node = this.getAstNodeFromFile(project.packageSolutionJson, 'solution');
54
+ this.addFindingWithOccurrences([{
55
+ file: this.file,
56
+ resolution: JSON.stringify(resolution, null, 2),
57
+ position: this.getPositionFromNode(node)
58
+ }], findings);
59
+ }
60
+ }
61
+ }
62
+ exports.FN006005_CFG_PS_metadata = FN006005_CFG_PS_metadata;
63
+ //# sourceMappingURL=FN006005_CFG_PS_metadata.js.map
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FN006006_CFG_PS_features = void 0;
4
+ const JsonRule_1 = require("./JsonRule");
5
+ const uuid_1 = require("uuid");
6
+ class FN006006_CFG_PS_features extends JsonRule_1.JsonRule {
7
+ constructor() {
8
+ super();
9
+ }
10
+ get id() {
11
+ return 'FN006006';
12
+ }
13
+ get title() {
14
+ return 'package-solution.json features';
15
+ }
16
+ get description() {
17
+ return `In package-solution.json add features section`;
18
+ }
19
+ get resolution() {
20
+ return '';
21
+ }
22
+ get resolutionType() {
23
+ return 'json';
24
+ }
25
+ get severity() {
26
+ return 'Required';
27
+ }
28
+ get file() {
29
+ return './config/package-solution.json';
30
+ }
31
+ visit(project, findings) {
32
+ var _a, _b;
33
+ if (!project.packageSolutionJson ||
34
+ !project.packageSolutionJson.solution) {
35
+ return;
36
+ }
37
+ if (!project.packageSolutionJson.solution.features) {
38
+ const resolution = {
39
+ solution: {
40
+ features: [
41
+ {
42
+ title: `${(_a = project.packageJson) === null || _a === void 0 ? void 0 : _a.name} Feature`,
43
+ description: `The feature that activates elements of the ${(_b = project.packageJson) === null || _b === void 0 ? void 0 : _b.name} solution.`,
44
+ id: (0, uuid_1.v4)(),
45
+ version: project.packageSolutionJson.solution.version
46
+ }
47
+ ]
48
+ }
49
+ };
50
+ const node = this.getAstNodeFromFile(project.packageSolutionJson, 'solution');
51
+ this.addFindingWithOccurrences([{
52
+ file: this.file,
53
+ resolution: JSON.stringify(resolution, null, 2),
54
+ position: this.getPositionFromNode(node)
55
+ }], findings);
56
+ }
57
+ }
58
+ }
59
+ exports.FN006006_CFG_PS_features = FN006006_CFG_PS_features;
60
+ //# sourceMappingURL=FN006006_CFG_PS_features.js.map
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FN014008_CODE_launch_hostedWorkbench_type = void 0;
4
+ const path = require("path");
5
+ const JsonRule_1 = require("./JsonRule");
6
+ class FN014008_CODE_launch_hostedWorkbench_type extends JsonRule_1.JsonRule {
7
+ constructor(type) {
8
+ super();
9
+ this.type = type;
10
+ }
11
+ get id() {
12
+ return 'FN014008';
13
+ }
14
+ get title() {
15
+ return 'Hosted workbench type in .vscode/launch.json';
16
+ }
17
+ get description() {
18
+ return `In the .vscode/launch.json file, update the type property for the hosted workbench launch configuration`;
19
+ }
20
+ get resolution() {
21
+ return `{
22
+ "configurations": [
23
+ {
24
+ "type": "${this.type}"
25
+ }
26
+ ]
27
+ }`;
28
+ }
29
+ get resolutionType() {
30
+ return 'json';
31
+ }
32
+ get severity() {
33
+ return 'Recommended';
34
+ }
35
+ get file() {
36
+ return '.vscode/launch.json';
37
+ }
38
+ visit(project, findings) {
39
+ if (!project.vsCode ||
40
+ !project.vsCode.launchJson ||
41
+ !project.vsCode.launchJson.configurations) {
42
+ return;
43
+ }
44
+ const occurrences = [];
45
+ project.vsCode.launchJson.configurations.forEach((configuration, i) => {
46
+ if (configuration.name === 'Hosted workbench' &&
47
+ configuration.type !== this.type) {
48
+ const node = this.getAstNodeFromFile(project.vsCode.launchJson, `configurations[${i}].url`);
49
+ occurrences.push({
50
+ file: path.relative(project.path, this.file),
51
+ resolution: this.resolution,
52
+ position: this.getPositionFromNode(node)
53
+ });
54
+ }
55
+ });
56
+ if (occurrences.length > 0) {
57
+ this.addFindingWithOccurrences(occurrences, findings);
58
+ }
59
+ }
60
+ }
61
+ exports.FN014008_CODE_launch_hostedWorkbench_type = FN014008_CODE_launch_hostedWorkbench_type;
62
+ //# sourceMappingURL=FN014008_CODE_launch_hostedWorkbench_type.js.map