@pnp/cli-microsoft365 11.9.0 → 11.10.0-beta.6474466
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/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/m365/planner/commands/roster/roster-add.js +5 -0
- package/dist/m365/planner/commands/roster/roster-get.js +8 -18
- package/dist/m365/planner/commands/roster/roster-member-add.js +29 -45
- package/dist/m365/planner/commands/roster/roster-member-get.js +28 -44
- package/dist/m365/planner/commands/roster/roster-member-list.js +8 -18
- package/dist/m365/planner/commands/roster/roster-member-remove.js +30 -48
- package/dist/m365/planner/commands/roster/roster-plan-list.js +28 -46
- package/dist/m365/planner/commands/roster/roster-remove.js +9 -27
- package/dist/m365/planner/commands/task/task-add.js +97 -111
- package/dist/m365/planner/commands/task/task-checklistitem-add.js +10 -23
- package/dist/m365/planner/commands/task/task-checklistitem-list.js +16 -26
- package/dist/m365/planner/commands/task/task-checklistitem-remove.js +10 -23
- package/dist/m365/planner/commands/task/task-get.js +46 -69
- package/dist/m365/planner/commands/task/task-list.js +33 -69
- package/dist/m365/planner/commands/task/task-reference-add.js +15 -35
- package/dist/m365/planner/commands/task/task-reference-list.js +8 -18
- package/dist/m365/planner/commands/task/task-reference-remove.js +26 -36
- package/dist/m365/planner/commands/task/task-remove.js +47 -71
- package/dist/m365/planner/commands/task/task-set.js +92 -113
- package/dist/m365/purview/commands/auditlog/auditlog-list.js +36 -60
- package/dist/m365/purview/commands/retentionevent/retentionevent-add.js +34 -53
- package/dist/m365/purview/commands/retentionevent/retentionevent-get.js +10 -23
- package/dist/m365/purview/commands/retentionevent/retentionevent-remove.js +11 -32
- package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-add.js +9 -24
- package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-get.js +10 -23
- package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-remove.js +11 -32
- package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-set.js +21 -35
- package/dist/m365/purview/commands/retentionlabel/retentionlabel-add.js +40 -82
- package/dist/m365/purview/commands/retentionlabel/retentionlabel-get.js +10 -23
- package/dist/m365/purview/commands/retentionlabel/retentionlabel-remove.js +11 -32
- package/dist/m365/purview/commands/retentionlabel/retentionlabel-set.js +35 -78
- package/dist/m365/purview/commands/sensitivitylabel/sensitivitylabel-get.js +19 -44
- package/dist/m365/purview/commands/sensitivitylabel/sensitivitylabel-list.js +16 -39
- package/dist/m365/purview/commands/sensitivitylabel/sensitivitylabel-policysettings-list.js +16 -39
- package/dist/m365/purview/commands/threatassessment/threatassessment-add.js +44 -67
- package/dist/m365/purview/commands/threatassessment/threatassessment-get.js +11 -33
- package/dist/m365/purview/commands/threatassessment/threatassessment-list.js +10 -33
- package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-add.mdx +21 -0
- package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-get.mdx +19 -0
- package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-list.mdx +19 -0
- package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-remove.mdx +21 -0
- package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-set.mdx +21 -0
- package/docs/docs/cmd/spo/cdn/cdn-get.mdx +19 -0
- package/docs/docs/cmd/spo/cdn/cdn-origin-add.mdx +21 -0
- package/docs/docs/cmd/spo/cdn/cdn-origin-list.mdx +19 -0
- package/docs/docs/cmd/spo/cdn/cdn-origin-remove.mdx +21 -0
- package/docs/docs/cmd/spo/cdn/cdn-policy-list.mdx +19 -0
- package/docs/docs/cmd/spo/cdn/cdn-policy-set.mdx +21 -0
- package/docs/docs/cmd/spo/cdn/cdn-set.mdx +21 -0
- package/docs/docs/cmd/spo/contenttype/contenttype-add.mdx +19 -0
- package/docs/docs/cmd/spo/contenttype/contenttype-get.mdx +19 -0
- package/docs/docs/cmd/spo/contenttype/contenttype-list.mdx +19 -0
- package/docs/docs/cmd/spo/contenttype/contenttype-remove.mdx +21 -0
- package/docs/docs/cmd/spo/contenttype/contenttype-set.mdx +21 -0
- package/docs/docs/cmd/spo/contenttype/contenttype-sync.mdx +19 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +2 -2
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
-
};
|
|
6
|
-
var _PlannerTaskSetCommand_instances, _PlannerTaskSetCommand_initTelemetry, _PlannerTaskSetCommand_initOptions, _PlannerTaskSetCommand_initValidators, _PlannerTaskSetCommand_initOptionSets, _PlannerTaskSetCommand_initTypes;
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
7
3
|
import request from '../../../../request.js';
|
|
8
4
|
import { entraGroup } from '../../../../utils/entraGroup.js';
|
|
9
5
|
import { formatting } from '../../../../utils/formatting.js';
|
|
@@ -12,6 +8,73 @@ import { validation } from '../../../../utils/validation.js';
|
|
|
12
8
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
13
9
|
import commands from '../../commands.js';
|
|
14
10
|
import { taskPriority } from '../../taskPriority.js';
|
|
11
|
+
const allowedAppliedCategories = ['category1', 'category2', 'category3', 'category4', 'category5', 'category6'];
|
|
12
|
+
export const options = z.strictObject({
|
|
13
|
+
...globalOptionsZod.shape,
|
|
14
|
+
id: z.string().alias('i'),
|
|
15
|
+
title: z.string().optional().alias('t'),
|
|
16
|
+
planId: z.string().optional(),
|
|
17
|
+
planTitle: z.string().optional(),
|
|
18
|
+
rosterId: z.string().optional(),
|
|
19
|
+
ownerGroupId: z.string()
|
|
20
|
+
.refine(val => validation.isValidGuid(val), {
|
|
21
|
+
message: 'The value is not a valid GUID.'
|
|
22
|
+
})
|
|
23
|
+
.optional(),
|
|
24
|
+
ownerGroupName: z.string().optional(),
|
|
25
|
+
bucketId: z.string().optional(),
|
|
26
|
+
bucketName: z.string().optional(),
|
|
27
|
+
startDateTime: z.string()
|
|
28
|
+
.refine(val => validation.isValidISODateTime(val), {
|
|
29
|
+
message: 'The startDateTime is not a valid ISO date string.'
|
|
30
|
+
})
|
|
31
|
+
.optional(),
|
|
32
|
+
dueDateTime: z.string()
|
|
33
|
+
.refine(val => validation.isValidISODateTime(val), {
|
|
34
|
+
message: 'The dueDateTime is not a valid ISO date string.'
|
|
35
|
+
})
|
|
36
|
+
.optional(),
|
|
37
|
+
percentComplete: z.string()
|
|
38
|
+
.refine(val => !isNaN(Number(val)) && Number(val) >= 0 && Number(val) <= 100, {
|
|
39
|
+
message: 'percentComplete should be between 0 and 100.'
|
|
40
|
+
})
|
|
41
|
+
.optional(),
|
|
42
|
+
assignedToUserIds: z.string()
|
|
43
|
+
.superRefine((val, ctx) => {
|
|
44
|
+
const result = validation.isValidGuidArray(val);
|
|
45
|
+
if (result !== true) {
|
|
46
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, message: `The following GUIDs are invalid for the option 'assignedToUserIds': ${result}.` });
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
.optional(),
|
|
50
|
+
assignedToUserNames: z.string()
|
|
51
|
+
.superRefine((val, ctx) => {
|
|
52
|
+
const result = validation.isValidUserPrincipalNameArray(val);
|
|
53
|
+
if (result !== true) {
|
|
54
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, message: `The following user principal names are invalid for the option 'assignedToUserNames': ${result}.` });
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
.optional(),
|
|
58
|
+
assigneePriority: z.string().optional(),
|
|
59
|
+
description: z.string().optional(),
|
|
60
|
+
appliedCategories: z.string()
|
|
61
|
+
.refine(val => val.split(',').every(cat => allowedAppliedCategories.includes(cat.toLocaleLowerCase().trim())), {
|
|
62
|
+
message: `The appliedCategories contains invalid value. Specify either ${allowedAppliedCategories.join(', ')} as properties.`
|
|
63
|
+
})
|
|
64
|
+
.optional(),
|
|
65
|
+
orderHint: z.string().optional(),
|
|
66
|
+
priority: z.string()
|
|
67
|
+
.refine(val => {
|
|
68
|
+
const num = Number(val);
|
|
69
|
+
if (!isNaN(num)) {
|
|
70
|
+
return num >= 0 && num <= 10 && Number.isInteger(num);
|
|
71
|
+
}
|
|
72
|
+
return taskPriority.priorityValues.map(l => l.toLowerCase()).includes(val.toLowerCase());
|
|
73
|
+
}, {
|
|
74
|
+
message: `The value is not a valid priority. Allowed values are 0-10 or ${taskPriority.priorityValues.join('|')}.`
|
|
75
|
+
})
|
|
76
|
+
.optional()
|
|
77
|
+
});
|
|
15
78
|
class PlannerTaskSetCommand extends GraphCommand {
|
|
16
79
|
get name() {
|
|
17
80
|
return commands.TASK_SET;
|
|
@@ -19,15 +82,27 @@ class PlannerTaskSetCommand extends GraphCommand {
|
|
|
19
82
|
get description() {
|
|
20
83
|
return 'Updates a Microsoft Planner Task';
|
|
21
84
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
85
|
+
get schema() {
|
|
86
|
+
return options;
|
|
87
|
+
}
|
|
88
|
+
getRefinedSchema(schema) {
|
|
89
|
+
return schema
|
|
90
|
+
.refine(opts => !(opts.bucketId && opts.bucketName), {
|
|
91
|
+
message: `Specify either 'bucketId' or 'bucketName', but not both.`,
|
|
92
|
+
params: { customCode: 'optionSet', options: ['bucketId', 'bucketName'] }
|
|
93
|
+
})
|
|
94
|
+
.refine(opts => !opts.bucketName || [opts.planId, opts.planTitle, opts.rosterId].filter(x => x !== undefined).length === 1, {
|
|
95
|
+
message: `Specify exactly one of the following options: 'planId', 'planTitle' or 'rosterId'.`,
|
|
96
|
+
params: { customCode: 'optionSet', options: ['planId', 'planTitle', 'rosterId'] }
|
|
97
|
+
})
|
|
98
|
+
.refine(opts => !opts.planTitle || [opts.ownerGroupId, opts.ownerGroupName].filter(x => x !== undefined).length === 1, {
|
|
99
|
+
message: `Specify exactly one of the following options: 'ownerGroupId' or 'ownerGroupName'.`,
|
|
100
|
+
params: { customCode: 'optionSet', options: ['ownerGroupId', 'ownerGroupName'] }
|
|
101
|
+
})
|
|
102
|
+
.refine(opts => !(opts.assignedToUserIds && opts.assignedToUserNames), {
|
|
103
|
+
message: 'Specify either assignedToUserIds or assignedToUserNames but not both.',
|
|
104
|
+
params: { customCode: 'optionSet', options: ['assignedToUserIds', 'assignedToUserNames'] }
|
|
105
|
+
});
|
|
31
106
|
}
|
|
32
107
|
async commandAction(logger, args) {
|
|
33
108
|
try {
|
|
@@ -102,7 +177,7 @@ class PlannerTaskSetCommand extends GraphCommand {
|
|
|
102
177
|
return {};
|
|
103
178
|
}
|
|
104
179
|
const categories = {};
|
|
105
|
-
options.appliedCategories.toLocaleLowerCase().split(',').forEach(x => categories[x] = true);
|
|
180
|
+
options.appliedCategories.toLocaleLowerCase().split(',').forEach(x => categories[x.trim()] = true);
|
|
106
181
|
return categories;
|
|
107
182
|
}
|
|
108
183
|
async generateUserAssignments(options) {
|
|
@@ -121,7 +196,6 @@ class PlannerTaskSetCommand extends GraphCommand {
|
|
|
121
196
|
if (options.assignedToUserIds) {
|
|
122
197
|
return options.assignedToUserIds.split(',').map(o => o.trim());
|
|
123
198
|
}
|
|
124
|
-
// Hitting this section means assignedToUserNames won't be undefined
|
|
125
199
|
const userNames = options.assignedToUserNames;
|
|
126
200
|
const userArr = userNames.split(',').map(o => o.trim());
|
|
127
201
|
const promises = userArr.map(user => {
|
|
@@ -138,7 +212,6 @@ class PlannerTaskSetCommand extends GraphCommand {
|
|
|
138
212
|
let userUpns = [];
|
|
139
213
|
userUpns = usersRes.map(res => res.value[0]?.userPrincipalName);
|
|
140
214
|
const userIds = usersRes.map(res => res.value[0]?.id);
|
|
141
|
-
// Find the members where no graph response was found
|
|
142
215
|
const invalidUsers = userArr.filter(user => !userUpns.some((upn) => upn?.toLowerCase() === user.toLowerCase()));
|
|
143
216
|
if (invalidUsers && invalidUsers.length > 0) {
|
|
144
217
|
throw `Cannot proceed with planner task update. The following users provided are invalid : ${invalidUsers.join(',')}`;
|
|
@@ -188,7 +261,7 @@ class PlannerTaskSetCommand extends GraphCommand {
|
|
|
188
261
|
requestBody.dueDateTime = options.dueDateTime;
|
|
189
262
|
}
|
|
190
263
|
if (options.percentComplete) {
|
|
191
|
-
requestBody.percentComplete = options.percentComplete;
|
|
264
|
+
requestBody.percentComplete = Number(options.percentComplete);
|
|
192
265
|
}
|
|
193
266
|
if (this.assignments && Object.keys(this.assignments).length > 0) {
|
|
194
267
|
requestBody.assignments = this.assignments;
|
|
@@ -208,99 +281,5 @@ class PlannerTaskSetCommand extends GraphCommand {
|
|
|
208
281
|
return requestBody;
|
|
209
282
|
}
|
|
210
283
|
}
|
|
211
|
-
_PlannerTaskSetCommand_instances = new WeakSet(), _PlannerTaskSetCommand_initTelemetry = function _PlannerTaskSetCommand_initTelemetry() {
|
|
212
|
-
this.telemetry.push((args) => {
|
|
213
|
-
Object.assign(this.telemetryProperties, {
|
|
214
|
-
title: typeof args.options.title !== 'undefined',
|
|
215
|
-
planId: typeof args.options.planId !== 'undefined',
|
|
216
|
-
planTitle: typeof args.options.planTitle !== 'undefined',
|
|
217
|
-
rosterId: typeof args.options.rosterId !== 'undefined',
|
|
218
|
-
ownerGroupId: typeof args.options.ownerGroupId !== 'undefined',
|
|
219
|
-
ownerGroupName: typeof args.options.ownerGroupName !== 'undefined',
|
|
220
|
-
bucketId: typeof args.options.bucketId !== 'undefined',
|
|
221
|
-
bucketName: typeof args.options.bucketName !== 'undefined',
|
|
222
|
-
startDateTime: typeof args.options.startDateTime !== 'undefined',
|
|
223
|
-
dueDateTime: typeof args.options.dueDateTime !== 'undefined',
|
|
224
|
-
percentComplete: typeof args.options.percentComplete !== 'undefined',
|
|
225
|
-
assignedToUserIds: typeof args.options.assignedToUserIds !== 'undefined',
|
|
226
|
-
assignedToUserNames: typeof args.options.assignedToUserNames !== 'undefined',
|
|
227
|
-
assigneePriority: typeof args.options.assigneePriority !== 'undefined',
|
|
228
|
-
description: typeof args.options.description !== 'undefined',
|
|
229
|
-
appliedCategories: typeof args.options.appliedCategories !== 'undefined',
|
|
230
|
-
orderHint: typeof args.options.orderHint !== 'undefined',
|
|
231
|
-
priority: typeof args.options.priority !== 'undefined'
|
|
232
|
-
});
|
|
233
|
-
});
|
|
234
|
-
}, _PlannerTaskSetCommand_initOptions = function _PlannerTaskSetCommand_initOptions() {
|
|
235
|
-
this.options.unshift({ option: '-i, --id <id>' }, { option: '-t, --title [title]' }, { option: '--planId [planId]' }, { option: '--planTitle [planTitle]' }, { option: '--rosterId [rosterId]' }, { option: '--ownerGroupId [ownerGroupId]' }, { option: '--ownerGroupName [ownerGroupName]' }, { option: '--bucketId [bucketId]' }, { option: '--bucketName [bucketName]' }, { option: '--startDateTime [startDateTime]' }, { option: '--dueDateTime [dueDateTime]' }, { option: '--percentComplete [percentComplete]' }, { option: '--assignedToUserIds [assignedToUserIds]' }, { option: '--assignedToUserNames [assignedToUserNames]' }, { option: '--assigneePriority [assigneePriority]' }, { option: '--description [description]' }, { option: '--appliedCategories [appliedCategories]' }, { option: '--orderHint [orderHint]' }, { option: '--priority [priority]', autocomplete: taskPriority.priorityValues });
|
|
236
|
-
}, _PlannerTaskSetCommand_initValidators = function _PlannerTaskSetCommand_initValidators() {
|
|
237
|
-
this.validators.push(async (args) => {
|
|
238
|
-
if (args.options.ownerGroupId && !validation.isValidGuid(args.options.ownerGroupId)) {
|
|
239
|
-
return `${args.options.ownerGroupId} is not a valid GUID`;
|
|
240
|
-
}
|
|
241
|
-
if (args.options.startDateTime && !validation.isValidISODateTime(args.options.startDateTime)) {
|
|
242
|
-
return 'The startDateTime is not a valid ISO date string';
|
|
243
|
-
}
|
|
244
|
-
if (args.options.dueDateTime && !validation.isValidISODateTime(args.options.dueDateTime)) {
|
|
245
|
-
return 'The dueDateTime is not a valid ISO date string';
|
|
246
|
-
}
|
|
247
|
-
if (args.options.percentComplete && isNaN(args.options.percentComplete)) {
|
|
248
|
-
return `percentComplete is not a number`;
|
|
249
|
-
}
|
|
250
|
-
if (args.options.percentComplete && (args.options.percentComplete < 0 || args.options.percentComplete > 100)) {
|
|
251
|
-
return `percentComplete should be between 0 and 100`;
|
|
252
|
-
}
|
|
253
|
-
if (args.options.assignedToUserIds) {
|
|
254
|
-
const isValidGUIDArrayResult = validation.isValidGuidArray(args.options.assignedToUserIds);
|
|
255
|
-
if (isValidGUIDArrayResult !== true) {
|
|
256
|
-
return `The following GUIDs are invalid for the option 'assignedToUserIds': ${isValidGUIDArrayResult}.`;
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
if (args.options.assignedToUserNames) {
|
|
260
|
-
const isValidUPNArrayResult = validation.isValidUserPrincipalNameArray(args.options.assignedToUserNames);
|
|
261
|
-
if (isValidUPNArrayResult !== true) {
|
|
262
|
-
return `The following user principal names are invalid for the option 'assignedToUserNames': ${isValidUPNArrayResult}.`;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
if (args.options.appliedCategories && args.options.appliedCategories.split(',').filter(category => this.allowedAppliedCategories.indexOf(category.toLocaleLowerCase()) < 0).length !== 0) {
|
|
266
|
-
return 'The appliedCategories contains invalid value. Specify either category1, category2, category3, category4, category5 and/or category6 as properties';
|
|
267
|
-
}
|
|
268
|
-
if (args.options.priority !== undefined) {
|
|
269
|
-
if (typeof args.options.priority === "number") {
|
|
270
|
-
if (isNaN(args.options.priority) || args.options.priority < 0 || args.options.priority > 10 || !Number.isInteger(args.options.priority)) {
|
|
271
|
-
return 'priority should be an integer between 0 and 10.';
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
else if (taskPriority.priorityValues.map(l => l.toLowerCase()).indexOf(args.options.priority.toString().toLowerCase()) === -1) {
|
|
275
|
-
return `${args.options.priority} is not a valid priority value. Allowed values are ${taskPriority.priorityValues.join('|')}.`;
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
return true;
|
|
279
|
-
});
|
|
280
|
-
}, _PlannerTaskSetCommand_initOptionSets = function _PlannerTaskSetCommand_initOptionSets() {
|
|
281
|
-
this.optionSets.push({
|
|
282
|
-
options: ['bucketId', 'bucketName'],
|
|
283
|
-
runsWhen: (args) => {
|
|
284
|
-
return args.options.bucketId || args.options.bucketName;
|
|
285
|
-
}
|
|
286
|
-
}, {
|
|
287
|
-
options: ['planId', 'planTitle', 'rosterId'],
|
|
288
|
-
runsWhen: (args) => {
|
|
289
|
-
return args.options.bucketName !== undefined;
|
|
290
|
-
}
|
|
291
|
-
}, {
|
|
292
|
-
options: ['ownerGroupId', 'ownerGroupName'],
|
|
293
|
-
runsWhen: (args) => {
|
|
294
|
-
return args.options.planTitle !== undefined;
|
|
295
|
-
}
|
|
296
|
-
}, {
|
|
297
|
-
options: ['assignedToUserIds', 'assignedToUserNames'],
|
|
298
|
-
runsWhen: (args) => {
|
|
299
|
-
return args.options.assignedToUserIds || args.options.assignedToUserNames;
|
|
300
|
-
}
|
|
301
|
-
});
|
|
302
|
-
}, _PlannerTaskSetCommand_initTypes = function _PlannerTaskSetCommand_initTypes() {
|
|
303
|
-
this.types.string.push('id', 'title', 'planId', 'planTitle', 'ownerGroupId', 'ownerGroupName', 'bucketId', 'bucketName', 'description', 'assigneePriority', 'orderHint', 'rosterId', 'startDateTime', 'dueDateTime', 'assignedToUserIds', 'assignedToUserNames', 'assignments', 'appliedCategories');
|
|
304
|
-
};
|
|
305
284
|
export default new PlannerTaskSetCommand();
|
|
306
285
|
//# sourceMappingURL=task-set.js.map
|
|
@@ -1,15 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
-
};
|
|
6
|
-
var _PurviewAuditLogListCommand_instances, _PurviewAuditLogListCommand_initTelemetry, _PurviewAuditLogListCommand_initOptions, _PurviewAuditLogListCommand_initValidators;
|
|
1
|
+
import { z } from 'zod';
|
|
7
2
|
import Auth from '../../../../Auth.js';
|
|
3
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
8
4
|
import request from '../../../../request.js';
|
|
9
5
|
import { accessToken } from '../../../../utils/accessToken.js';
|
|
10
6
|
import { validation } from '../../../../utils/validation.js';
|
|
11
7
|
import O365MgmtCommand from '../../../base/O365MgmtCommand.js';
|
|
12
8
|
import commands from '../../commands.js';
|
|
9
|
+
const contentTypeOptions = ['AzureActiveDirectory', 'Exchange', 'SharePoint', 'General', 'DLP'];
|
|
10
|
+
export const options = z.strictObject({
|
|
11
|
+
...globalOptionsZod.shape,
|
|
12
|
+
contentType: z.enum(contentTypeOptions),
|
|
13
|
+
startTime: z.string().refine(val => validation.isValidISODateTime(val), {
|
|
14
|
+
error: 'The value is not a valid ISO date time string.'
|
|
15
|
+
}).refine(val => {
|
|
16
|
+
const lowerDateLimit = new Date();
|
|
17
|
+
lowerDateLimit.setDate(lowerDateLimit.getDate() - 7);
|
|
18
|
+
lowerDateLimit.setHours(lowerDateLimit.getHours() - 1);
|
|
19
|
+
return new Date(val) >= lowerDateLimit;
|
|
20
|
+
}, {
|
|
21
|
+
error: 'startTime value cannot be more than 7 days in the past.'
|
|
22
|
+
}).optional(),
|
|
23
|
+
endTime: z.string().refine(val => validation.isValidISODateTime(val), {
|
|
24
|
+
error: 'The value is not a valid ISO date time string.'
|
|
25
|
+
}).refine(val => new Date(val) <= new Date(), {
|
|
26
|
+
error: 'endTime value cannot be in the future.'
|
|
27
|
+
}).optional()
|
|
28
|
+
});
|
|
13
29
|
class PurviewAuditLogListCommand extends O365MgmtCommand {
|
|
14
30
|
get name() {
|
|
15
31
|
return commands.AUDITLOG_LIST;
|
|
@@ -17,17 +33,23 @@ class PurviewAuditLogListCommand extends O365MgmtCommand {
|
|
|
17
33
|
get description() {
|
|
18
34
|
return 'Lists audit logs within your tenant';
|
|
19
35
|
}
|
|
36
|
+
get schema() {
|
|
37
|
+
return options;
|
|
38
|
+
}
|
|
39
|
+
getRefinedSchema(schema) {
|
|
40
|
+
return schema
|
|
41
|
+
.refine(opts => {
|
|
42
|
+
if (opts.startTime && opts.endTime) {
|
|
43
|
+
return new Date(opts.startTime) < new Date(opts.endTime);
|
|
44
|
+
}
|
|
45
|
+
return true;
|
|
46
|
+
}, {
|
|
47
|
+
error: 'startTime value must be before endTime.'
|
|
48
|
+
});
|
|
49
|
+
}
|
|
20
50
|
defaultProperties() {
|
|
21
51
|
return ['CreationTime', 'UserId', 'Operation', 'ObjectId'];
|
|
22
52
|
}
|
|
23
|
-
constructor() {
|
|
24
|
-
super();
|
|
25
|
-
_PurviewAuditLogListCommand_instances.add(this);
|
|
26
|
-
this.contentTypeOptions = ['AzureActiveDirectory', 'Exchange', 'SharePoint', 'General', 'DLP'];
|
|
27
|
-
__classPrivateFieldGet(this, _PurviewAuditLogListCommand_instances, "m", _PurviewAuditLogListCommand_initTelemetry).call(this);
|
|
28
|
-
__classPrivateFieldGet(this, _PurviewAuditLogListCommand_instances, "m", _PurviewAuditLogListCommand_initOptions).call(this);
|
|
29
|
-
__classPrivateFieldGet(this, _PurviewAuditLogListCommand_instances, "m", _PurviewAuditLogListCommand_initValidators).call(this);
|
|
30
|
-
}
|
|
31
53
|
async commandAction(logger, args) {
|
|
32
54
|
// If we don't create a now object, start and end date can be an few extra ms apart due to execution time between code lines
|
|
33
55
|
const now = new Date();
|
|
@@ -136,51 +158,5 @@ class PurviewAuditLogListCommand extends O365MgmtCommand {
|
|
|
136
158
|
return 0;
|
|
137
159
|
}
|
|
138
160
|
}
|
|
139
|
-
_PurviewAuditLogListCommand_instances = new WeakSet(), _PurviewAuditLogListCommand_initTelemetry = function _PurviewAuditLogListCommand_initTelemetry() {
|
|
140
|
-
this.telemetry.push((args) => {
|
|
141
|
-
Object.assign(this.telemetryProperties, {
|
|
142
|
-
startTime: typeof args.options.startTime !== 'undefined',
|
|
143
|
-
endTime: typeof args.options.endTime !== 'undefined'
|
|
144
|
-
});
|
|
145
|
-
});
|
|
146
|
-
}, _PurviewAuditLogListCommand_initOptions = function _PurviewAuditLogListCommand_initOptions() {
|
|
147
|
-
this.options.unshift({
|
|
148
|
-
option: '--contentType <contentType>',
|
|
149
|
-
autocomplete: this.contentTypeOptions
|
|
150
|
-
}, {
|
|
151
|
-
option: '--startTime [startTime]'
|
|
152
|
-
}, {
|
|
153
|
-
option: '--endTime [endTime]'
|
|
154
|
-
});
|
|
155
|
-
}, _PurviewAuditLogListCommand_initValidators = function _PurviewAuditLogListCommand_initValidators() {
|
|
156
|
-
this.validators.push(async (args) => {
|
|
157
|
-
if (this.contentTypeOptions.indexOf(args.options.contentType) === -1) {
|
|
158
|
-
return `'${args.options.contentType}' is not a valid contentType value. Allowed values: ${this.contentTypeOptions}.`;
|
|
159
|
-
}
|
|
160
|
-
if (args.options.startTime) {
|
|
161
|
-
if (!validation.isValidISODateTime(args.options.startTime)) {
|
|
162
|
-
return `'${args.options.startTime}' is not a valid ISO date time string.`;
|
|
163
|
-
}
|
|
164
|
-
const lowerDateLimit = new Date();
|
|
165
|
-
lowerDateLimit.setDate(lowerDateLimit.getDate() - 7);
|
|
166
|
-
lowerDateLimit.setHours(lowerDateLimit.getHours() - 1); // Min date is 7 days ago, however there seems to be an 1h margin
|
|
167
|
-
if (new Date(args.options.startTime) < lowerDateLimit) {
|
|
168
|
-
return 'startTime value cannot be more than 7 days in the past.';
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
if (args.options.endTime) {
|
|
172
|
-
if (!validation.isValidISODateTime(args.options.endTime)) {
|
|
173
|
-
return `'${args.options.endTime}' is not a valid ISO date time string.`;
|
|
174
|
-
}
|
|
175
|
-
if (new Date(args.options.endTime) > new Date()) {
|
|
176
|
-
return 'endTime value cannot be in the future.';
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
if (args.options.startTime && args.options.endTime && new Date(args.options.startTime) >= new Date(args.options.endTime)) {
|
|
180
|
-
return 'startTime value must be before endTime.';
|
|
181
|
-
}
|
|
182
|
-
return true;
|
|
183
|
-
});
|
|
184
|
-
};
|
|
185
161
|
export default new PurviewAuditLogListCommand();
|
|
186
162
|
//# sourceMappingURL=auditlog-list.js.map
|
|
@@ -1,14 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
-
};
|
|
6
|
-
var _PurviewRetentionEventAddCommand_instances, _PurviewRetentionEventAddCommand_initOptions, _PurviewRetentionEventAddCommand_initValidators, _PurviewRetentionEventAddCommand_initTelemetry, _PurviewRetentionEventAddCommand_initOptionSets;
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
7
3
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
8
4
|
import commands from '../../commands.js';
|
|
9
5
|
import request from '../../../../request.js';
|
|
10
6
|
import { validation } from '../../../../utils/validation.js';
|
|
11
7
|
import { odata } from '../../../../utils/odata.js';
|
|
8
|
+
export const options = z.strictObject({
|
|
9
|
+
...globalOptionsZod.shape,
|
|
10
|
+
displayName: z.string().alias('n'),
|
|
11
|
+
eventTypeId: z.string().optional().alias('i'),
|
|
12
|
+
eventTypeName: z.string().optional().alias('e'),
|
|
13
|
+
description: z.string().optional().alias('d'),
|
|
14
|
+
triggerDateTime: z.string().optional()
|
|
15
|
+
.refine(val => val === undefined || validation.isValidISODateTime(val), {
|
|
16
|
+
message: 'The triggerDateTime is not a valid ISO date string'
|
|
17
|
+
}),
|
|
18
|
+
assetIds: z.string().optional().alias('a'),
|
|
19
|
+
keywords: z.string().optional().alias('k')
|
|
20
|
+
});
|
|
12
21
|
class PurviewRetentionEventAddCommand extends GraphCommand {
|
|
13
22
|
get name() {
|
|
14
23
|
return commands.RETENTIONEVENT_ADD;
|
|
@@ -16,13 +25,25 @@ class PurviewRetentionEventAddCommand extends GraphCommand {
|
|
|
16
25
|
get description() {
|
|
17
26
|
return 'Creates a retention event';
|
|
18
27
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
28
|
+
get schema() {
|
|
29
|
+
return options;
|
|
30
|
+
}
|
|
31
|
+
getRefinedSchema(schema) {
|
|
32
|
+
return schema
|
|
33
|
+
.refine(opts => [opts.eventTypeId, opts.eventTypeName].filter(x => x !== undefined).length === 1, {
|
|
34
|
+
error: `Specify either 'eventTypeId' or 'eventTypeName', but not both.`,
|
|
35
|
+
params: {
|
|
36
|
+
customCode: 'optionSet',
|
|
37
|
+
options: ['eventTypeId', 'eventTypeName']
|
|
38
|
+
}
|
|
39
|
+
})
|
|
40
|
+
.refine(opts => opts.assetIds !== undefined || opts.keywords !== undefined, {
|
|
41
|
+
error: 'Specify assetIds and/or keywords, but at least one.',
|
|
42
|
+
params: {
|
|
43
|
+
customCode: 'optionSet',
|
|
44
|
+
options: ['assetIds', 'keywords']
|
|
45
|
+
}
|
|
46
|
+
});
|
|
26
47
|
}
|
|
27
48
|
async commandAction(logger, args) {
|
|
28
49
|
if (this.verbose) {
|
|
@@ -74,45 +95,5 @@ class PurviewRetentionEventAddCommand extends GraphCommand {
|
|
|
74
95
|
return eventTypes[0].id;
|
|
75
96
|
}
|
|
76
97
|
}
|
|
77
|
-
_PurviewRetentionEventAddCommand_instances = new WeakSet(), _PurviewRetentionEventAddCommand_initOptions = function _PurviewRetentionEventAddCommand_initOptions() {
|
|
78
|
-
this.options.unshift({
|
|
79
|
-
option: '-n, --displayName <displayName>'
|
|
80
|
-
}, {
|
|
81
|
-
option: '-i, --eventTypeId [eventTypeId]'
|
|
82
|
-
}, {
|
|
83
|
-
option: '-e, --eventTypeName [eventTypeName]'
|
|
84
|
-
}, {
|
|
85
|
-
option: '-d, --description [description]'
|
|
86
|
-
}, {
|
|
87
|
-
option: '--triggerDateTime [triggerDateTime]'
|
|
88
|
-
}, {
|
|
89
|
-
option: '-a, --assetIds [assetIds]'
|
|
90
|
-
}, {
|
|
91
|
-
option: '-k, --keywords [keywords]'
|
|
92
|
-
});
|
|
93
|
-
}, _PurviewRetentionEventAddCommand_initValidators = function _PurviewRetentionEventAddCommand_initValidators() {
|
|
94
|
-
this.validators.push(async (args) => {
|
|
95
|
-
if (args.options.triggerDateTime && !validation.isValidISODateTime(args.options.triggerDateTime)) {
|
|
96
|
-
return 'The triggerDateTime is not a valid ISO date string';
|
|
97
|
-
}
|
|
98
|
-
if (!args.options.assetIds && !args.options.keywords) {
|
|
99
|
-
return 'Specify assetIds and/or keywords, but at least one.';
|
|
100
|
-
}
|
|
101
|
-
return true;
|
|
102
|
-
});
|
|
103
|
-
}, _PurviewRetentionEventAddCommand_initTelemetry = function _PurviewRetentionEventAddCommand_initTelemetry() {
|
|
104
|
-
this.telemetry.push((args) => {
|
|
105
|
-
Object.assign(this.telemetryProperties, {
|
|
106
|
-
description: typeof args.options.description !== 'undefined',
|
|
107
|
-
triggerDateTime: typeof args.options.triggerDateTime !== 'undefined',
|
|
108
|
-
eventTypeId: typeof args.options.eventTypeId !== 'undefined',
|
|
109
|
-
eventTypeName: typeof args.options.eventTypeName !== 'undefined',
|
|
110
|
-
assetIds: typeof args.options.assetIds !== 'undefined',
|
|
111
|
-
keywords: typeof args.options.keywords !== 'undefined'
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
}, _PurviewRetentionEventAddCommand_initOptionSets = function _PurviewRetentionEventAddCommand_initOptionSets() {
|
|
115
|
-
this.optionSets.push({ options: ['eventTypeId', 'eventTypeName'] });
|
|
116
|
-
};
|
|
117
98
|
export default new PurviewRetentionEventAddCommand();
|
|
118
99
|
//# sourceMappingURL=retentionevent-add.js.map
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
-
};
|
|
6
|
-
var _PurviewRetentionEventGetCommand_instances, _PurviewRetentionEventGetCommand_initOptions, _PurviewRetentionEventGetCommand_initValidators;
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
7
3
|
import request from '../../../../request.js';
|
|
8
4
|
import { validation } from '../../../../utils/validation.js';
|
|
9
5
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
10
6
|
import commands from '../../commands.js';
|
|
7
|
+
export const options = z.strictObject({
|
|
8
|
+
...globalOptionsZod.shape,
|
|
9
|
+
id: z.string().refine(val => validation.isValidGuid(val), {
|
|
10
|
+
message: 'The value must be a valid GUID.'
|
|
11
|
+
}).alias('i')
|
|
12
|
+
});
|
|
11
13
|
class PurviewRetentionEventGetCommand extends GraphCommand {
|
|
12
14
|
get name() {
|
|
13
15
|
return commands.RETENTIONEVENT_GET;
|
|
@@ -15,11 +17,8 @@ class PurviewRetentionEventGetCommand extends GraphCommand {
|
|
|
15
17
|
get description() {
|
|
16
18
|
return 'Gets a retention event';
|
|
17
19
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
_PurviewRetentionEventGetCommand_instances.add(this);
|
|
21
|
-
__classPrivateFieldGet(this, _PurviewRetentionEventGetCommand_instances, "m", _PurviewRetentionEventGetCommand_initOptions).call(this);
|
|
22
|
-
__classPrivateFieldGet(this, _PurviewRetentionEventGetCommand_instances, "m", _PurviewRetentionEventGetCommand_initValidators).call(this);
|
|
20
|
+
get schema() {
|
|
21
|
+
return options;
|
|
23
22
|
}
|
|
24
23
|
async commandAction(logger, args) {
|
|
25
24
|
if (this.verbose) {
|
|
@@ -41,17 +40,5 @@ class PurviewRetentionEventGetCommand extends GraphCommand {
|
|
|
41
40
|
}
|
|
42
41
|
}
|
|
43
42
|
}
|
|
44
|
-
_PurviewRetentionEventGetCommand_instances = new WeakSet(), _PurviewRetentionEventGetCommand_initOptions = function _PurviewRetentionEventGetCommand_initOptions() {
|
|
45
|
-
this.options.unshift({
|
|
46
|
-
option: '-i, --id <id>'
|
|
47
|
-
});
|
|
48
|
-
}, _PurviewRetentionEventGetCommand_initValidators = function _PurviewRetentionEventGetCommand_initValidators() {
|
|
49
|
-
this.validators.push(async (args) => {
|
|
50
|
-
if (!validation.isValidGuid(args.options.id)) {
|
|
51
|
-
return `'${args.options.id}' is not a valid GUID.`;
|
|
52
|
-
}
|
|
53
|
-
return true;
|
|
54
|
-
});
|
|
55
|
-
};
|
|
56
43
|
export default new PurviewRetentionEventGetCommand();
|
|
57
44
|
//# sourceMappingURL=retentionevent-get.js.map
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
-
};
|
|
6
|
-
var _PurviewRetentionEventRemoveCommand_instances, _PurviewRetentionEventRemoveCommand_initTelemetry, _PurviewRetentionEventRemoveCommand_initOptions, _PurviewRetentionEventRemoveCommand_initValidators;
|
|
1
|
+
import { z } from 'zod';
|
|
7
2
|
import { cli } from '../../../../cli/cli.js';
|
|
3
|
+
import { globalOptionsZod } from '../../../../Command.js';
|
|
8
4
|
import request from '../../../../request.js';
|
|
9
5
|
import { validation } from '../../../../utils/validation.js';
|
|
10
6
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
11
7
|
import commands from '../../commands.js';
|
|
8
|
+
export const options = z.strictObject({
|
|
9
|
+
...globalOptionsZod.shape,
|
|
10
|
+
id: z.string().refine(val => validation.isValidGuid(val), {
|
|
11
|
+
message: 'The value must be a valid GUID.'
|
|
12
|
+
}).alias('i'),
|
|
13
|
+
force: z.boolean().optional().alias('f')
|
|
14
|
+
});
|
|
12
15
|
class PurviewRetentionEventRemoveCommand extends GraphCommand {
|
|
13
16
|
get name() {
|
|
14
17
|
return commands.RETENTIONEVENT_REMOVE;
|
|
@@ -16,12 +19,8 @@ class PurviewRetentionEventRemoveCommand extends GraphCommand {
|
|
|
16
19
|
get description() {
|
|
17
20
|
return 'Deletes a retention event';
|
|
18
21
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
_PurviewRetentionEventRemoveCommand_instances.add(this);
|
|
22
|
-
__classPrivateFieldGet(this, _PurviewRetentionEventRemoveCommand_instances, "m", _PurviewRetentionEventRemoveCommand_initTelemetry).call(this);
|
|
23
|
-
__classPrivateFieldGet(this, _PurviewRetentionEventRemoveCommand_instances, "m", _PurviewRetentionEventRemoveCommand_initOptions).call(this);
|
|
24
|
-
__classPrivateFieldGet(this, _PurviewRetentionEventRemoveCommand_instances, "m", _PurviewRetentionEventRemoveCommand_initValidators).call(this);
|
|
22
|
+
get schema() {
|
|
23
|
+
return options;
|
|
25
24
|
}
|
|
26
25
|
async commandAction(logger, args) {
|
|
27
26
|
if (args.options.force) {
|
|
@@ -50,25 +49,5 @@ class PurviewRetentionEventRemoveCommand extends GraphCommand {
|
|
|
50
49
|
}
|
|
51
50
|
}
|
|
52
51
|
}
|
|
53
|
-
_PurviewRetentionEventRemoveCommand_instances = new WeakSet(), _PurviewRetentionEventRemoveCommand_initTelemetry = function _PurviewRetentionEventRemoveCommand_initTelemetry() {
|
|
54
|
-
this.telemetry.push((args) => {
|
|
55
|
-
Object.assign(this.telemetryProperties, {
|
|
56
|
-
force: !!args.options.force
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
}, _PurviewRetentionEventRemoveCommand_initOptions = function _PurviewRetentionEventRemoveCommand_initOptions() {
|
|
60
|
-
this.options.unshift({
|
|
61
|
-
option: '-i, --id <id>'
|
|
62
|
-
}, {
|
|
63
|
-
option: '-f, --force'
|
|
64
|
-
});
|
|
65
|
-
}, _PurviewRetentionEventRemoveCommand_initValidators = function _PurviewRetentionEventRemoveCommand_initValidators() {
|
|
66
|
-
this.validators.push(async (args) => {
|
|
67
|
-
if (!validation.isValidGuid(args.options.id)) {
|
|
68
|
-
return `'${args.options.id}' is not a valid GUID.`;
|
|
69
|
-
}
|
|
70
|
-
return true;
|
|
71
|
-
});
|
|
72
|
-
};
|
|
73
52
|
export default new PurviewRetentionEventRemoveCommand();
|
|
74
53
|
//# sourceMappingURL=retentionevent-remove.js.map
|