@pnp/cli-microsoft365 11.9.0 → 11.10.0-beta.3e566b1

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 (107) hide show
  1. package/.devcontainer/Dockerfile +1 -1
  2. package/.devproxy/api-specs/sharepoint-admin.yaml +50 -0
  3. package/Dockerfile +1 -1
  4. package/allCommands.json +1 -1
  5. package/allCommandsFull.json +1 -1
  6. package/dist/Auth.js +4 -2
  7. package/dist/m365/outlook/commands/event/event-get.js +77 -0
  8. package/dist/m365/outlook/commands.js +1 -0
  9. package/dist/m365/planner/commands/roster/roster-add.js +5 -0
  10. package/dist/m365/planner/commands/roster/roster-get.js +8 -18
  11. package/dist/m365/planner/commands/roster/roster-member-add.js +29 -45
  12. package/dist/m365/planner/commands/roster/roster-member-get.js +28 -44
  13. package/dist/m365/planner/commands/roster/roster-member-list.js +8 -18
  14. package/dist/m365/planner/commands/roster/roster-member-remove.js +30 -48
  15. package/dist/m365/planner/commands/roster/roster-plan-list.js +28 -46
  16. package/dist/m365/planner/commands/roster/roster-remove.js +9 -27
  17. package/dist/m365/planner/commands/task/task-add.js +97 -111
  18. package/dist/m365/planner/commands/task/task-checklistitem-add.js +10 -23
  19. package/dist/m365/planner/commands/task/task-checklistitem-list.js +16 -26
  20. package/dist/m365/planner/commands/task/task-checklistitem-remove.js +10 -23
  21. package/dist/m365/planner/commands/task/task-get.js +46 -69
  22. package/dist/m365/planner/commands/task/task-list.js +33 -69
  23. package/dist/m365/planner/commands/task/task-reference-add.js +15 -35
  24. package/dist/m365/planner/commands/task/task-reference-list.js +8 -18
  25. package/dist/m365/planner/commands/task/task-reference-remove.js +26 -36
  26. package/dist/m365/planner/commands/task/task-remove.js +47 -71
  27. package/dist/m365/planner/commands/task/task-set.js +92 -113
  28. package/dist/m365/pp/commands/website/Webrole.js +2 -0
  29. package/dist/m365/pp/commands/website/website-remove.js +80 -0
  30. package/dist/m365/pp/commands/website/website-webrole-list.js +61 -0
  31. package/dist/m365/pp/commands.js +3 -1
  32. package/dist/m365/purview/commands/auditlog/auditlog-list.js +36 -60
  33. package/dist/m365/purview/commands/retentionevent/retentionevent-add.js +34 -53
  34. package/dist/m365/purview/commands/retentionevent/retentionevent-get.js +10 -23
  35. package/dist/m365/purview/commands/retentionevent/retentionevent-remove.js +11 -32
  36. package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-add.js +9 -24
  37. package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-get.js +10 -23
  38. package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-remove.js +11 -32
  39. package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-set.js +21 -35
  40. package/dist/m365/purview/commands/retentionlabel/retentionlabel-add.js +40 -82
  41. package/dist/m365/purview/commands/retentionlabel/retentionlabel-get.js +10 -23
  42. package/dist/m365/purview/commands/retentionlabel/retentionlabel-remove.js +11 -32
  43. package/dist/m365/purview/commands/retentionlabel/retentionlabel-set.js +35 -78
  44. package/dist/m365/purview/commands/sensitivitylabel/sensitivitylabel-get.js +19 -44
  45. package/dist/m365/purview/commands/sensitivitylabel/sensitivitylabel-list.js +16 -39
  46. package/dist/m365/purview/commands/sensitivitylabel/sensitivitylabel-policysettings-list.js +16 -39
  47. package/dist/m365/purview/commands/threatassessment/threatassessment-add.js +44 -67
  48. package/dist/m365/purview/commands/threatassessment/threatassessment-get.js +11 -33
  49. package/dist/m365/purview/commands/threatassessment/threatassessment-list.js +10 -33
  50. package/dist/m365/spo/commands/homesite/homesite-remove.js +1 -1
  51. package/dist/m365/spo/commands/web/{web-alert-list.js → web-rule-list.js} +7 -4
  52. package/dist/m365/spo/commands/web/{web-alert-remove.js → web-rule-remove.js} +7 -4
  53. package/dist/m365/spo/commands.js +2 -0
  54. package/dist/utils/powerPlatform.js +20 -0
  55. package/docs/docs/cmd/outlook/event/event-get.mdx +280 -0
  56. package/docs/docs/cmd/pp/website/website-remove.mdx +89 -0
  57. package/docs/docs/cmd/pp/website/website-webrole-list.mdx +139 -0
  58. package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-add.mdx +21 -0
  59. package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-get.mdx +19 -0
  60. package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-list.mdx +19 -0
  61. package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-remove.mdx +21 -0
  62. package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-set.mdx +21 -0
  63. package/docs/docs/cmd/spo/cdn/cdn-get.mdx +19 -0
  64. package/docs/docs/cmd/spo/cdn/cdn-origin-add.mdx +21 -0
  65. package/docs/docs/cmd/spo/cdn/cdn-origin-list.mdx +19 -0
  66. package/docs/docs/cmd/spo/cdn/cdn-origin-remove.mdx +21 -0
  67. package/docs/docs/cmd/spo/cdn/cdn-policy-list.mdx +19 -0
  68. package/docs/docs/cmd/spo/cdn/cdn-policy-set.mdx +21 -0
  69. package/docs/docs/cmd/spo/cdn/cdn-set.mdx +21 -0
  70. package/docs/docs/cmd/spo/contenttype/contenttype-add.mdx +19 -0
  71. package/docs/docs/cmd/spo/contenttype/contenttype-get.mdx +19 -0
  72. package/docs/docs/cmd/spo/contenttype/contenttype-list.mdx +19 -0
  73. package/docs/docs/cmd/spo/contenttype/contenttype-remove.mdx +21 -0
  74. package/docs/docs/cmd/spo/contenttype/contenttype-set.mdx +21 -0
  75. package/docs/docs/cmd/spo/contenttype/contenttype-sync.mdx +19 -0
  76. package/docs/docs/cmd/spo/field/field-add.mdx +19 -0
  77. package/docs/docs/cmd/spo/field/field-get.mdx +19 -0
  78. package/docs/docs/cmd/spo/field/field-list.mdx +19 -0
  79. package/docs/docs/cmd/spo/field/field-remove.mdx +21 -0
  80. package/docs/docs/cmd/spo/field/field-set.mdx +21 -0
  81. package/docs/docs/cmd/spo/file/file-checkout-undo.mdx +21 -0
  82. package/docs/docs/cmd/spo/file/file-retentionlabel-ensure.mdx +21 -0
  83. package/docs/docs/cmd/spo/file/file-retentionlabel-remove.mdx +21 -0
  84. package/docs/docs/cmd/spo/file/file-roleassignment-add.mdx +21 -0
  85. package/docs/docs/cmd/spo/file/file-roleassignment-remove.mdx +21 -0
  86. package/docs/docs/cmd/spo/file/file-roleinheritance-break.mdx +21 -0
  87. package/docs/docs/cmd/spo/file/file-roleinheritance-reset.mdx +21 -0
  88. package/docs/docs/cmd/spo/file/file-sharinginfo-get.mdx +19 -0
  89. package/docs/docs/cmd/spo/homesite/homesite-add.mdx +21 -2
  90. package/docs/docs/cmd/spo/homesite/homesite-get.mdx +19 -0
  91. package/docs/docs/cmd/spo/homesite/homesite-list.mdx +19 -0
  92. package/docs/docs/cmd/spo/homesite/homesite-remove.mdx +24 -3
  93. package/docs/docs/cmd/spo/homesite/homesite-set.mdx +21 -2
  94. package/docs/docs/cmd/spo/hubsite/hubsite-connect.mdx +21 -0
  95. package/docs/docs/cmd/spo/hubsite/hubsite-data-get.mdx +19 -0
  96. package/docs/docs/cmd/spo/hubsite/hubsite-disconnect.mdx +21 -0
  97. package/docs/docs/cmd/spo/hubsite/hubsite-get.mdx +19 -0
  98. package/docs/docs/cmd/spo/hubsite/hubsite-list.mdx +19 -0
  99. package/docs/docs/cmd/spo/hubsite/hubsite-register.mdx +19 -0
  100. package/docs/docs/cmd/spo/hubsite/hubsite-rights-grant.mdx +21 -0
  101. package/docs/docs/cmd/spo/hubsite/hubsite-rights-revoke.mdx +21 -0
  102. package/docs/docs/cmd/spo/hubsite/hubsite-set.mdx +19 -0
  103. package/docs/docs/cmd/spo/hubsite/hubsite-unregister.mdx +21 -0
  104. package/docs/docs/cmd/spo/web/{web-alert-list.mdx → web-rule-list.mdx} +13 -7
  105. package/docs/docs/cmd/spo/web/{web-alert-remove.mdx → web-rule-remove.mdx} +10 -4
  106. package/npm-shrinkwrap.json +1363 -650
  107. package/package.json +16 -16
@@ -1,9 +1,5 @@
1
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
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 _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
- constructor() {
23
- super();
24
- _PlannerTaskSetCommand_instances.add(this);
25
- this.allowedAppliedCategories = ['category1', 'category2', 'category3', 'category4', 'category5', 'category6'];
26
- __classPrivateFieldGet(this, _PlannerTaskSetCommand_instances, "m", _PlannerTaskSetCommand_initTelemetry).call(this);
27
- __classPrivateFieldGet(this, _PlannerTaskSetCommand_instances, "m", _PlannerTaskSetCommand_initOptions).call(this);
28
- __classPrivateFieldGet(this, _PlannerTaskSetCommand_instances, "m", _PlannerTaskSetCommand_initValidators).call(this);
29
- __classPrivateFieldGet(this, _PlannerTaskSetCommand_instances, "m", _PlannerTaskSetCommand_initOptionSets).call(this);
30
- __classPrivateFieldGet(this, _PlannerTaskSetCommand_instances, "m", _PlannerTaskSetCommand_initTypes).call(this);
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
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Webrole.js.map
@@ -0,0 +1,80 @@
1
+ import { globalOptionsZod } from '../../../../Command.js';
2
+ import { powerPlatform } from '../../../../utils/powerPlatform.js';
3
+ import { validation } from '../../../../utils/validation.js';
4
+ import PowerPlatformCommand from '../../../base/PowerPlatformCommand.js';
5
+ import commands from '../../commands.js';
6
+ import { z } from 'zod';
7
+ import request from '../../../../request.js';
8
+ import { cli } from '../../../../cli/cli.js';
9
+ export const options = z.strictObject({
10
+ ...globalOptionsZod.shape,
11
+ url: z.string().optional()
12
+ .refine(url => url === undefined || validation.isValidPowerPagesUrl(url) === true, {
13
+ error: e => `'${e.input}' is not a valid Power Pages URL.`
14
+ })
15
+ .alias('u'),
16
+ id: z.uuid().optional().alias('i'),
17
+ name: z.string().optional().alias('n'),
18
+ environmentName: z.string().alias('e'),
19
+ force: z.boolean().optional().alias('f')
20
+ });
21
+ class PpWebSiteRemoveCommand extends PowerPlatformCommand {
22
+ get name() {
23
+ return commands.WEBSITE_REMOVE;
24
+ }
25
+ get description() {
26
+ return 'Removes the specified Power Pages website from the list of active sites.';
27
+ }
28
+ get schema() {
29
+ return options;
30
+ }
31
+ getRefinedSchema(schema) {
32
+ return schema
33
+ .refine(options => [options.url, options.id, options.name].filter(x => x !== undefined).length === 1, {
34
+ error: `Specify either url, id or name, but not multiple.`
35
+ });
36
+ }
37
+ async commandAction(logger, args) {
38
+ if (args.options.verbose) {
39
+ await logger.logToStderr(`Removing website '${args.options.id || args.options.name || args.options.url}'...`);
40
+ }
41
+ if (args.options.force) {
42
+ await this.deleteWebsite(args);
43
+ }
44
+ else {
45
+ const result = await cli.promptForConfirmation({ message: `Are you sure you want to remove website '${args.options.id || args.options.name || args.options.url}'?` });
46
+ if (result) {
47
+ await this.deleteWebsite(args);
48
+ }
49
+ }
50
+ }
51
+ async getWebsiteId(args) {
52
+ if (args.options.id) {
53
+ return args.options.id;
54
+ }
55
+ if (args.options.name) {
56
+ const website = await powerPlatform.getWebsiteByName(args.options.environmentName, args.options.name);
57
+ return website.id;
58
+ }
59
+ const website = await powerPlatform.getWebsiteByUrl(args.options.environmentName, args.options.url);
60
+ return website.id;
61
+ }
62
+ async deleteWebsite(args) {
63
+ try {
64
+ const websiteId = await this.getWebsiteId(args);
65
+ const requestOptions = {
66
+ url: `https://api.powerplatform.com/powerpages/environments/${args.options.environmentName}/websites/${websiteId}?api-version=2022-03-01-preview`,
67
+ headers: {
68
+ accept: 'application/json;odata.metadata=none'
69
+ },
70
+ responseType: 'json'
71
+ };
72
+ await request.delete(requestOptions);
73
+ }
74
+ catch (err) {
75
+ this.handleRejectedODataJsonPromise(err);
76
+ }
77
+ }
78
+ }
79
+ export default new PpWebSiteRemoveCommand();
80
+ //# sourceMappingURL=website-remove.js.map
@@ -0,0 +1,61 @@
1
+ import { globalOptionsZod } from '../../../../Command.js';
2
+ import { powerPlatform } from '../../../../utils/powerPlatform.js';
3
+ import PowerPlatformCommand from '../../../base/PowerPlatformCommand.js';
4
+ import commands from '../../commands.js';
5
+ import { odata } from '../../../../utils/odata.js';
6
+ import { z } from 'zod';
7
+ export const options = z.strictObject({
8
+ ...globalOptionsZod.shape,
9
+ websiteId: z.uuid().optional(),
10
+ websiteName: z.string().optional(),
11
+ environmentName: z.string().alias('e'),
12
+ asAdmin: z.boolean().optional()
13
+ });
14
+ class PpWebSiteWebRoleListCommand extends PowerPlatformCommand {
15
+ get name() {
16
+ return commands.WEBSITE_WEBROLE_LIST;
17
+ }
18
+ get description() {
19
+ return 'Lists all webroles for the specified Power Pages website.';
20
+ }
21
+ get schema() {
22
+ return options;
23
+ }
24
+ defaultProperties() {
25
+ return ['mspp_webroleid', 'mspp_name', 'statuscode'];
26
+ }
27
+ getRefinedSchema(schema) {
28
+ return schema
29
+ .refine(options => [options.websiteId, options.websiteName].filter(x => x !== undefined).length === 1, {
30
+ error: `Specify either websiteId or websiteName, but not both.`
31
+ });
32
+ }
33
+ async commandAction(logger, args) {
34
+ if (this.verbose) {
35
+ await logger.logToStderr(`Retrieving the webroles for '${args.options.websiteId || args.options.websiteName}'...`);
36
+ }
37
+ try {
38
+ const dynamicsApiUrl = await powerPlatform.getDynamicsInstanceApiUrl(args.options.environmentName, args.options.asAdmin);
39
+ const websiteRecordId = await this.getWebsiteRecordId(args, dynamicsApiUrl);
40
+ const roles = await this.getWebsiteRoles(dynamicsApiUrl, websiteRecordId);
41
+ await logger.log(roles);
42
+ }
43
+ catch (err) {
44
+ this.handleRejectedODataJsonPromise(err);
45
+ }
46
+ }
47
+ async getWebsiteRecordId(args, dynamicsApiUrl) {
48
+ if (args.options.websiteId) {
49
+ const website = await powerPlatform.getWebsiteById(args.options.environmentName, args.options.websiteId);
50
+ return website.websiteRecordId;
51
+ }
52
+ return powerPlatform.getWebsiteIdByUniqueName(dynamicsApiUrl, args.options.websiteName);
53
+ }
54
+ async getWebsiteRoles(dynamicsApiUrl, websiteId) {
55
+ const requestUrl = `${dynamicsApiUrl}/api/data/v9.2/mspp_webroles?$filter=_mspp_websiteid_value eq ${websiteId}`;
56
+ const result = await odata.getAllItems(requestUrl);
57
+ return result;
58
+ }
59
+ }
60
+ export default new PpWebSiteWebRoleListCommand();
61
+ //# sourceMappingURL=website-webrole-list.js.map
@@ -27,6 +27,8 @@ export default {
27
27
  SOLUTION_PUBLISHER_REMOVE: `${prefix} solution publisher remove`,
28
28
  TENANT_SETTINGS_LIST: `${prefix} tenant settings list`,
29
29
  TENANT_SETTINGS_SET: `${prefix} tenant settings set`,
30
- WEBSITE_GET: `${prefix} website get`
30
+ WEBSITE_GET: `${prefix} website get`,
31
+ WEBSITE_REMOVE: `${prefix} website remove`,
32
+ WEBSITE_WEBROLE_LIST: `${prefix} website webrole list`
31
33
  };
32
34
  //# sourceMappingURL=commands.js.map
@@ -1,15 +1,31 @@
1
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
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
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
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 _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
- constructor() {
20
- super();
21
- _PurviewRetentionEventAddCommand_instances.add(this);
22
- __classPrivateFieldGet(this, _PurviewRetentionEventAddCommand_instances, "m", _PurviewRetentionEventAddCommand_initTelemetry).call(this);
23
- __classPrivateFieldGet(this, _PurviewRetentionEventAddCommand_instances, "m", _PurviewRetentionEventAddCommand_initOptions).call(this);
24
- __classPrivateFieldGet(this, _PurviewRetentionEventAddCommand_instances, "m", _PurviewRetentionEventAddCommand_initValidators).call(this);
25
- __classPrivateFieldGet(this, _PurviewRetentionEventAddCommand_instances, "m", _PurviewRetentionEventAddCommand_initOptionSets).call(this);
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