@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.
Files changed (59) hide show
  1. package/allCommands.json +1 -1
  2. package/allCommandsFull.json +1 -1
  3. package/dist/m365/planner/commands/roster/roster-add.js +5 -0
  4. package/dist/m365/planner/commands/roster/roster-get.js +8 -18
  5. package/dist/m365/planner/commands/roster/roster-member-add.js +29 -45
  6. package/dist/m365/planner/commands/roster/roster-member-get.js +28 -44
  7. package/dist/m365/planner/commands/roster/roster-member-list.js +8 -18
  8. package/dist/m365/planner/commands/roster/roster-member-remove.js +30 -48
  9. package/dist/m365/planner/commands/roster/roster-plan-list.js +28 -46
  10. package/dist/m365/planner/commands/roster/roster-remove.js +9 -27
  11. package/dist/m365/planner/commands/task/task-add.js +97 -111
  12. package/dist/m365/planner/commands/task/task-checklistitem-add.js +10 -23
  13. package/dist/m365/planner/commands/task/task-checklistitem-list.js +16 -26
  14. package/dist/m365/planner/commands/task/task-checklistitem-remove.js +10 -23
  15. package/dist/m365/planner/commands/task/task-get.js +46 -69
  16. package/dist/m365/planner/commands/task/task-list.js +33 -69
  17. package/dist/m365/planner/commands/task/task-reference-add.js +15 -35
  18. package/dist/m365/planner/commands/task/task-reference-list.js +8 -18
  19. package/dist/m365/planner/commands/task/task-reference-remove.js +26 -36
  20. package/dist/m365/planner/commands/task/task-remove.js +47 -71
  21. package/dist/m365/planner/commands/task/task-set.js +92 -113
  22. package/dist/m365/purview/commands/auditlog/auditlog-list.js +36 -60
  23. package/dist/m365/purview/commands/retentionevent/retentionevent-add.js +34 -53
  24. package/dist/m365/purview/commands/retentionevent/retentionevent-get.js +10 -23
  25. package/dist/m365/purview/commands/retentionevent/retentionevent-remove.js +11 -32
  26. package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-add.js +9 -24
  27. package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-get.js +10 -23
  28. package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-remove.js +11 -32
  29. package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-set.js +21 -35
  30. package/dist/m365/purview/commands/retentionlabel/retentionlabel-add.js +40 -82
  31. package/dist/m365/purview/commands/retentionlabel/retentionlabel-get.js +10 -23
  32. package/dist/m365/purview/commands/retentionlabel/retentionlabel-remove.js +11 -32
  33. package/dist/m365/purview/commands/retentionlabel/retentionlabel-set.js +35 -78
  34. package/dist/m365/purview/commands/sensitivitylabel/sensitivitylabel-get.js +19 -44
  35. package/dist/m365/purview/commands/sensitivitylabel/sensitivitylabel-list.js +16 -39
  36. package/dist/m365/purview/commands/sensitivitylabel/sensitivitylabel-policysettings-list.js +16 -39
  37. package/dist/m365/purview/commands/threatassessment/threatassessment-add.js +44 -67
  38. package/dist/m365/purview/commands/threatassessment/threatassessment-get.js +11 -33
  39. package/dist/m365/purview/commands/threatassessment/threatassessment-list.js +10 -33
  40. package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-add.mdx +21 -0
  41. package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-get.mdx +19 -0
  42. package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-list.mdx +19 -0
  43. package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-remove.mdx +21 -0
  44. package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-set.mdx +21 -0
  45. package/docs/docs/cmd/spo/cdn/cdn-get.mdx +19 -0
  46. package/docs/docs/cmd/spo/cdn/cdn-origin-add.mdx +21 -0
  47. package/docs/docs/cmd/spo/cdn/cdn-origin-list.mdx +19 -0
  48. package/docs/docs/cmd/spo/cdn/cdn-origin-remove.mdx +21 -0
  49. package/docs/docs/cmd/spo/cdn/cdn-policy-list.mdx +19 -0
  50. package/docs/docs/cmd/spo/cdn/cdn-policy-set.mdx +21 -0
  51. package/docs/docs/cmd/spo/cdn/cdn-set.mdx +21 -0
  52. package/docs/docs/cmd/spo/contenttype/contenttype-add.mdx +19 -0
  53. package/docs/docs/cmd/spo/contenttype/contenttype-get.mdx +19 -0
  54. package/docs/docs/cmd/spo/contenttype/contenttype-list.mdx +19 -0
  55. package/docs/docs/cmd/spo/contenttype/contenttype-remove.mdx +21 -0
  56. package/docs/docs/cmd/spo/contenttype/contenttype-set.mdx +21 -0
  57. package/docs/docs/cmd/spo/contenttype/contenttype-sync.mdx +19 -0
  58. package/npm-shrinkwrap.json +2 -2
  59. package/package.json +2 -2
@@ -1,6 +1,8 @@
1
+ import { globalOptionsZod } from '../../../../Command.js';
1
2
  import request from '../../../../request.js';
2
3
  import GraphCommand from '../../../base/GraphCommand.js';
3
4
  import commands from '../../commands.js';
5
+ export const options = globalOptionsZod.strict();
4
6
  class PlannerRosterAddCommand extends GraphCommand {
5
7
  get name() {
6
8
  return commands.ROSTER_ADD;
@@ -8,6 +10,9 @@ class PlannerRosterAddCommand extends GraphCommand {
8
10
  get description() {
9
11
  return 'Creates a new Microsoft Planner Roster';
10
12
  }
13
+ get schema() {
14
+ return options;
15
+ }
11
16
  async commandAction(logger) {
12
17
  if (this.verbose) {
13
18
  await logger.logToStderr('Creating a new Microsoft Planner Roster');
@@ -1,12 +1,12 @@
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 _PlannerRosterGetCommand_instances, _PlannerRosterGetCommand_initOptions, _PlannerRosterGetCommand_initTypes;
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
7
3
  import request from '../../../../request.js';
8
4
  import GraphCommand from '../../../base/GraphCommand.js';
9
5
  import commands from '../../commands.js';
6
+ export const options = z.strictObject({
7
+ ...globalOptionsZod.shape,
8
+ id: z.string()
9
+ });
10
10
  class PlannerRosterGetCommand extends GraphCommand {
11
11
  get name() {
12
12
  return commands.ROSTER_GET;
@@ -14,11 +14,8 @@ class PlannerRosterGetCommand extends GraphCommand {
14
14
  get description() {
15
15
  return 'Gets information about the specific Microsoft Planner Roster';
16
16
  }
17
- constructor() {
18
- super();
19
- _PlannerRosterGetCommand_instances.add(this);
20
- __classPrivateFieldGet(this, _PlannerRosterGetCommand_instances, "m", _PlannerRosterGetCommand_initOptions).call(this);
21
- __classPrivateFieldGet(this, _PlannerRosterGetCommand_instances, "m", _PlannerRosterGetCommand_initTypes).call(this);
17
+ get schema() {
18
+ return options;
22
19
  }
23
20
  async commandAction(logger, args) {
24
21
  if (this.verbose) {
@@ -40,12 +37,5 @@ class PlannerRosterGetCommand extends GraphCommand {
40
37
  }
41
38
  }
42
39
  }
43
- _PlannerRosterGetCommand_instances = new WeakSet(), _PlannerRosterGetCommand_initOptions = function _PlannerRosterGetCommand_initOptions() {
44
- this.options.unshift({
45
- option: '--id <id>'
46
- });
47
- }, _PlannerRosterGetCommand_initTypes = function _PlannerRosterGetCommand_initTypes() {
48
- this.types.string.push('id');
49
- };
50
40
  export default new PlannerRosterGetCommand();
51
41
  //# sourceMappingURL=roster-get.js.map
@@ -1,14 +1,24 @@
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 _PlannerRosterMemberAddCommand_instances, _PlannerRosterMemberAddCommand_initTelemetry, _PlannerRosterMemberAddCommand_initOptions, _PlannerRosterMemberAddCommand_initOptionSets, _PlannerRosterMemberAddCommand_initValidators, _PlannerRosterMemberAddCommand_initTypes;
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
7
3
  import request from '../../../../request.js';
8
4
  import { entraUser } from '../../../../utils/entraUser.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
+ rosterId: z.string(),
11
+ userId: z.string()
12
+ .refine(val => validation.isValidGuid(val), {
13
+ message: 'The value is not a valid GUID.'
14
+ })
15
+ .optional(),
16
+ userName: z.string()
17
+ .refine(val => validation.isValidUserPrincipalName(val), {
18
+ message: 'The value is not a valid user principal name (UPN).'
19
+ })
20
+ .optional()
21
+ });
12
22
  class PlannerRosterMemberAddCommand extends GraphCommand {
13
23
  get name() {
14
24
  return commands.ROSTER_MEMBER_ADD;
@@ -16,14 +26,18 @@ class PlannerRosterMemberAddCommand extends GraphCommand {
16
26
  get description() {
17
27
  return 'Adds a user to a Microsoft Planner Roster';
18
28
  }
19
- constructor() {
20
- super();
21
- _PlannerRosterMemberAddCommand_instances.add(this);
22
- __classPrivateFieldGet(this, _PlannerRosterMemberAddCommand_instances, "m", _PlannerRosterMemberAddCommand_initTelemetry).call(this);
23
- __classPrivateFieldGet(this, _PlannerRosterMemberAddCommand_instances, "m", _PlannerRosterMemberAddCommand_initOptions).call(this);
24
- __classPrivateFieldGet(this, _PlannerRosterMemberAddCommand_instances, "m", _PlannerRosterMemberAddCommand_initValidators).call(this);
25
- __classPrivateFieldGet(this, _PlannerRosterMemberAddCommand_instances, "m", _PlannerRosterMemberAddCommand_initOptionSets).call(this);
26
- __classPrivateFieldGet(this, _PlannerRosterMemberAddCommand_instances, "m", _PlannerRosterMemberAddCommand_initTypes).call(this);
29
+ get schema() {
30
+ return options;
31
+ }
32
+ getRefinedSchema(schema) {
33
+ return schema
34
+ .refine(opts => [opts.userId, opts.userName].filter(x => x !== undefined).length === 1, {
35
+ message: `Specify exactly one of the following options: 'userId' or 'userName'.`,
36
+ params: {
37
+ customCode: 'optionSet',
38
+ options: ['userId', 'userName']
39
+ }
40
+ });
27
41
  }
28
42
  async commandAction(logger, args) {
29
43
  if (this.verbose) {
@@ -50,7 +64,7 @@ class PlannerRosterMemberAddCommand extends GraphCommand {
50
64
  }
51
65
  async getUserId(logger, args) {
52
66
  if (this.verbose) {
53
- await logger.logToStderr("Getting the user ID");
67
+ await logger.logToStderr('Getting the user ID');
54
68
  }
55
69
  if (args.options.userId) {
56
70
  return args.options.userId;
@@ -59,35 +73,5 @@ class PlannerRosterMemberAddCommand extends GraphCommand {
59
73
  return userId;
60
74
  }
61
75
  }
62
- _PlannerRosterMemberAddCommand_instances = new WeakSet(), _PlannerRosterMemberAddCommand_initTelemetry = function _PlannerRosterMemberAddCommand_initTelemetry() {
63
- this.telemetry.push((args) => {
64
- Object.assign(this.telemetryProperties, {
65
- userId: typeof args.options.userId !== 'undefined',
66
- userName: typeof args.options.userName !== 'undefined'
67
- });
68
- });
69
- }, _PlannerRosterMemberAddCommand_initOptions = function _PlannerRosterMemberAddCommand_initOptions() {
70
- this.options.unshift({
71
- option: '--rosterId <rosterId>'
72
- }, {
73
- option: '--userId [userId]'
74
- }, {
75
- option: '--userName [userName]'
76
- });
77
- }, _PlannerRosterMemberAddCommand_initOptionSets = function _PlannerRosterMemberAddCommand_initOptionSets() {
78
- this.optionSets.push({ options: ['userId', 'userName'] });
79
- }, _PlannerRosterMemberAddCommand_initValidators = function _PlannerRosterMemberAddCommand_initValidators() {
80
- this.validators.push(async (args) => {
81
- if (args.options.userId && !validation.isValidGuid(args.options.userId)) {
82
- return `${args.options.userId} is not a valid GUID`;
83
- }
84
- if (args.options.userName && !validation.isValidUserPrincipalName(args.options.userName)) {
85
- return `${args.options.userName} is not a valid user principal name (UPN)`;
86
- }
87
- return true;
88
- });
89
- }, _PlannerRosterMemberAddCommand_initTypes = function _PlannerRosterMemberAddCommand_initTypes() {
90
- this.types.string.push('rosterId', 'userId', 'userName');
91
- };
92
76
  export default new PlannerRosterMemberAddCommand();
93
77
  //# sourceMappingURL=roster-member-add.js.map
@@ -1,14 +1,24 @@
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 _PlannerRosterMemberGetCommand_instances, _PlannerRosterMemberGetCommand_initTelemetry, _PlannerRosterMemberGetCommand_initOptions, _PlannerRosterMemberGetCommand_initOptionSets, _PlannerRosterMemberGetCommand_initValidators, _PlannerRosterMemberGetCommand_initTypes;
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';
11
7
  import { entraUser } from '../../../../utils/entraUser.js';
8
+ export const options = z.strictObject({
9
+ ...globalOptionsZod.shape,
10
+ rosterId: z.string(),
11
+ userId: z.string()
12
+ .refine(val => validation.isValidGuid(val), {
13
+ message: 'The value is not a valid GUID.'
14
+ })
15
+ .optional(),
16
+ userName: z.string()
17
+ .refine(val => validation.isValidUserPrincipalName(val), {
18
+ message: 'The value is not a valid user principal name (UPN).'
19
+ })
20
+ .optional()
21
+ });
12
22
  class PlannerRosterMemberGetCommand extends GraphCommand {
13
23
  get name() {
14
24
  return commands.ROSTER_MEMBER_GET;
@@ -16,14 +26,18 @@ class PlannerRosterMemberGetCommand extends GraphCommand {
16
26
  get description() {
17
27
  return 'Gets a member of the specified Microsoft Planner Roster';
18
28
  }
19
- constructor() {
20
- super();
21
- _PlannerRosterMemberGetCommand_instances.add(this);
22
- __classPrivateFieldGet(this, _PlannerRosterMemberGetCommand_instances, "m", _PlannerRosterMemberGetCommand_initTelemetry).call(this);
23
- __classPrivateFieldGet(this, _PlannerRosterMemberGetCommand_instances, "m", _PlannerRosterMemberGetCommand_initOptions).call(this);
24
- __classPrivateFieldGet(this, _PlannerRosterMemberGetCommand_instances, "m", _PlannerRosterMemberGetCommand_initValidators).call(this);
25
- __classPrivateFieldGet(this, _PlannerRosterMemberGetCommand_instances, "m", _PlannerRosterMemberGetCommand_initOptionSets).call(this);
26
- __classPrivateFieldGet(this, _PlannerRosterMemberGetCommand_instances, "m", _PlannerRosterMemberGetCommand_initTypes).call(this);
29
+ get schema() {
30
+ return options;
31
+ }
32
+ getRefinedSchema(schema) {
33
+ return schema
34
+ .refine(opts => [opts.userId, opts.userName].filter(x => x !== undefined).length === 1, {
35
+ message: `Specify exactly one of the following options: 'userId' or 'userName'.`,
36
+ params: {
37
+ customCode: 'optionSet',
38
+ options: ['userId', 'userName']
39
+ }
40
+ });
27
41
  }
28
42
  async commandAction(logger, args) {
29
43
  if (this.verbose) {
@@ -52,35 +66,5 @@ class PlannerRosterMemberGetCommand extends GraphCommand {
52
66
  return entraUser.getUserIdByUpn(args.options.userName);
53
67
  }
54
68
  }
55
- _PlannerRosterMemberGetCommand_instances = new WeakSet(), _PlannerRosterMemberGetCommand_initTelemetry = function _PlannerRosterMemberGetCommand_initTelemetry() {
56
- this.telemetry.push((args) => {
57
- Object.assign(this.telemetryProperties, {
58
- userId: typeof args.options.userId !== 'undefined',
59
- userName: typeof args.options.userName !== 'undefined'
60
- });
61
- });
62
- }, _PlannerRosterMemberGetCommand_initOptions = function _PlannerRosterMemberGetCommand_initOptions() {
63
- this.options.unshift({
64
- option: '--rosterId <rosterId>'
65
- }, {
66
- option: '--userId [userId]'
67
- }, {
68
- option: '--userName [userName]'
69
- });
70
- }, _PlannerRosterMemberGetCommand_initOptionSets = function _PlannerRosterMemberGetCommand_initOptionSets() {
71
- this.optionSets.push({ options: ['userId', 'userName'] });
72
- }, _PlannerRosterMemberGetCommand_initValidators = function _PlannerRosterMemberGetCommand_initValidators() {
73
- this.validators.push(async (args) => {
74
- if (args.options.userId && !validation.isValidGuid(args.options.userId)) {
75
- return `${args.options.userId} is not a valid GUID`;
76
- }
77
- if (args.options.userName && !validation.isValidUserPrincipalName(args.options.userName)) {
78
- return `${args.options.userName} is not a valid userName`;
79
- }
80
- return true;
81
- });
82
- }, _PlannerRosterMemberGetCommand_initTypes = function _PlannerRosterMemberGetCommand_initTypes() {
83
- this.types.string.push('rosterId', 'userId', 'userName');
84
- };
85
69
  export default new PlannerRosterMemberGetCommand();
86
70
  //# sourceMappingURL=roster-member-get.js.map
@@ -1,12 +1,12 @@
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 _PlannerRosterMemberListCommand_instances, _PlannerRosterMemberListCommand_initOptions, _PlannerRosterMemberListCommand_initTypes;
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
7
3
  import { odata } from '../../../../utils/odata.js';
8
4
  import GraphCommand from '../../../base/GraphCommand.js';
9
5
  import commands from '../../commands.js';
6
+ export const options = z.strictObject({
7
+ ...globalOptionsZod.shape,
8
+ rosterId: z.string()
9
+ });
10
10
  class PlannerRosterMemberListCommand extends GraphCommand {
11
11
  get name() {
12
12
  return commands.ROSTER_MEMBER_LIST;
@@ -14,11 +14,8 @@ class PlannerRosterMemberListCommand extends GraphCommand {
14
14
  get description() {
15
15
  return 'Lists members of the specified Microsoft Planner Roster';
16
16
  }
17
- constructor() {
18
- super();
19
- _PlannerRosterMemberListCommand_instances.add(this);
20
- __classPrivateFieldGet(this, _PlannerRosterMemberListCommand_instances, "m", _PlannerRosterMemberListCommand_initOptions).call(this);
21
- __classPrivateFieldGet(this, _PlannerRosterMemberListCommand_instances, "m", _PlannerRosterMemberListCommand_initTypes).call(this);
17
+ get schema() {
18
+ return options;
22
19
  }
23
20
  async commandAction(logger, args) {
24
21
  if (this.verbose) {
@@ -33,12 +30,5 @@ class PlannerRosterMemberListCommand extends GraphCommand {
33
30
  }
34
31
  }
35
32
  }
36
- _PlannerRosterMemberListCommand_instances = new WeakSet(), _PlannerRosterMemberListCommand_initOptions = function _PlannerRosterMemberListCommand_initOptions() {
37
- this.options.unshift({
38
- option: '--rosterId <rosterId>'
39
- });
40
- }, _PlannerRosterMemberListCommand_initTypes = function _PlannerRosterMemberListCommand_initTypes() {
41
- this.types.string.push('rosterId');
42
- };
43
33
  export default new PlannerRosterMemberListCommand();
44
34
  //# sourceMappingURL=roster-member-list.js.map
@@ -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 _PlannerRosterMemberRemoveCommand_instances, _PlannerRosterMemberRemoveCommand_initTelemetry, _PlannerRosterMemberRemoveCommand_initOptions, _PlannerRosterMemberRemoveCommand_initOptionSets, _PlannerRosterMemberRemoveCommand_initValidators, _PlannerRosterMemberRemoveCommand_initTypes;
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
7
3
  import { cli } from '../../../../cli/cli.js';
8
4
  import request from '../../../../request.js';
9
5
  import { entraUser } from '../../../../utils/entraUser.js';
@@ -11,6 +7,21 @@ import { odata } from '../../../../utils/odata.js';
11
7
  import { validation } from '../../../../utils/validation.js';
12
8
  import GraphCommand from '../../../base/GraphCommand.js';
13
9
  import commands from '../../commands.js';
10
+ export const options = z.strictObject({
11
+ ...globalOptionsZod.shape,
12
+ rosterId: z.string(),
13
+ userId: z.string()
14
+ .refine(val => validation.isValidGuid(val), {
15
+ message: 'The value is not a valid GUID.'
16
+ })
17
+ .optional(),
18
+ userName: z.string()
19
+ .refine(val => validation.isValidUserPrincipalName(val), {
20
+ message: 'The value is not a valid user principal name (UPN).'
21
+ })
22
+ .optional(),
23
+ force: z.boolean().optional().alias('f')
24
+ });
14
25
  class PlannerRosterMemberRemoveCommand extends GraphCommand {
15
26
  get name() {
16
27
  return commands.ROSTER_MEMBER_REMOVE;
@@ -18,14 +29,18 @@ class PlannerRosterMemberRemoveCommand extends GraphCommand {
18
29
  get description() {
19
30
  return 'Removes a member from a Microsoft Planner Roster';
20
31
  }
21
- constructor() {
22
- super();
23
- _PlannerRosterMemberRemoveCommand_instances.add(this);
24
- __classPrivateFieldGet(this, _PlannerRosterMemberRemoveCommand_instances, "m", _PlannerRosterMemberRemoveCommand_initTelemetry).call(this);
25
- __classPrivateFieldGet(this, _PlannerRosterMemberRemoveCommand_instances, "m", _PlannerRosterMemberRemoveCommand_initOptions).call(this);
26
- __classPrivateFieldGet(this, _PlannerRosterMemberRemoveCommand_instances, "m", _PlannerRosterMemberRemoveCommand_initValidators).call(this);
27
- __classPrivateFieldGet(this, _PlannerRosterMemberRemoveCommand_instances, "m", _PlannerRosterMemberRemoveCommand_initOptionSets).call(this);
28
- __classPrivateFieldGet(this, _PlannerRosterMemberRemoveCommand_instances, "m", _PlannerRosterMemberRemoveCommand_initTypes).call(this);
32
+ get schema() {
33
+ return options;
34
+ }
35
+ getRefinedSchema(schema) {
36
+ return schema
37
+ .refine(opts => [opts.userId, opts.userName].filter(x => x !== undefined).length === 1, {
38
+ message: `Specify exactly one of the following options: 'userId' or 'userName'.`,
39
+ params: {
40
+ customCode: 'optionSet',
41
+ options: ['userId', 'userName']
42
+ }
43
+ });
29
44
  }
30
45
  async commandAction(logger, args) {
31
46
  if (this.verbose) {
@@ -70,45 +85,12 @@ class PlannerRosterMemberRemoveCommand extends GraphCommand {
70
85
  if (!args.options.force) {
71
86
  const rosterMembers = await odata.getAllItems(`${this.resource}/beta/planner/rosters/${args.options.rosterId}/members?$select=Id`);
72
87
  if (rosterMembers.length === 1) {
73
- const result = await cli.promptForConfirmation({ message: `You are about to remove the last member of this Roster. When this happens, the Roster and all its contents will be deleted within 30 days. Are you sure you want to proceed?` });
88
+ const result = await cli.promptForConfirmation({ message: 'You are about to remove the last member of this Roster. When this happens, the Roster and all its contents will be deleted within 30 days. Are you sure you want to proceed?' });
74
89
  return result;
75
90
  }
76
91
  }
77
92
  return true;
78
93
  }
79
94
  }
80
- _PlannerRosterMemberRemoveCommand_instances = new WeakSet(), _PlannerRosterMemberRemoveCommand_initTelemetry = function _PlannerRosterMemberRemoveCommand_initTelemetry() {
81
- this.telemetry.push((args) => {
82
- Object.assign(this.telemetryProperties, {
83
- userId: typeof args.options.userId !== 'undefined',
84
- userName: typeof args.options.userName !== 'undefined',
85
- force: !!args.options.force
86
- });
87
- });
88
- }, _PlannerRosterMemberRemoveCommand_initOptions = function _PlannerRosterMemberRemoveCommand_initOptions() {
89
- this.options.unshift({
90
- option: '--rosterId <rosterId>'
91
- }, {
92
- option: '--userId [userId]'
93
- }, {
94
- option: '--userName [userName]'
95
- }, {
96
- option: '-f, --force'
97
- });
98
- }, _PlannerRosterMemberRemoveCommand_initOptionSets = function _PlannerRosterMemberRemoveCommand_initOptionSets() {
99
- this.optionSets.push({ options: ['userId', 'userName'] });
100
- }, _PlannerRosterMemberRemoveCommand_initValidators = function _PlannerRosterMemberRemoveCommand_initValidators() {
101
- this.validators.push(async (args) => {
102
- if (args.options.userId && !validation.isValidGuid(args.options.userId)) {
103
- return `${args.options.userId} is not a valid GUID`;
104
- }
105
- if (args.options.userName && !validation.isValidUserPrincipalName(args.options.userName)) {
106
- return `${args.options.userName} is not a valid userName`;
107
- }
108
- return true;
109
- });
110
- }, _PlannerRosterMemberRemoveCommand_initTypes = function _PlannerRosterMemberRemoveCommand_initTypes() {
111
- this.types.string.push('rosterId', 'userId', 'userName');
112
- };
113
95
  export default new PlannerRosterMemberRemoveCommand();
114
96
  //# sourceMappingURL=roster-member-remove.js.map
@@ -1,15 +1,24 @@
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 _PlannerRosterPlanListCommand_instances, _PlannerRosterPlanListCommand_initTelemetry, _PlannerRosterPlanListCommand_initOptions, _PlannerRosterPlanListCommand_initValidators, _PlannerRosterPlanListCommand_initTypes, _PlannerRosterPlanListCommand_initOptionSets;
7
1
  import auth from '../../../../Auth.js';
2
+ import { z } from 'zod';
3
+ import { globalOptionsZod } from '../../../../Command.js';
8
4
  import GraphCommand from '../../../base/GraphCommand.js';
9
5
  import commands from '../../commands.js';
10
6
  import { validation } from '../../../../utils/validation.js';
11
7
  import { accessToken } from '../../../../utils/accessToken.js';
12
8
  import { odata } from '../../../../utils/odata.js';
9
+ export const options = z.strictObject({
10
+ ...globalOptionsZod.shape,
11
+ userId: z.string()
12
+ .refine(val => validation.isValidGuid(val), {
13
+ message: 'The value is not a valid GUID.'
14
+ })
15
+ .optional(),
16
+ userName: z.string()
17
+ .refine(val => validation.isValidUserPrincipalName(val), {
18
+ message: 'The value is not a valid user principal name (UPN).'
19
+ })
20
+ .optional()
21
+ });
13
22
  class PlannerRosterPlanListCommand extends GraphCommand {
14
23
  get name() {
15
24
  return commands.ROSTER_PLAN_LIST;
@@ -17,14 +26,18 @@ class PlannerRosterPlanListCommand extends GraphCommand {
17
26
  get description() {
18
27
  return 'Lists all Microsoft Planner Roster plans for a specific user';
19
28
  }
20
- constructor() {
21
- super();
22
- _PlannerRosterPlanListCommand_instances.add(this);
23
- __classPrivateFieldGet(this, _PlannerRosterPlanListCommand_instances, "m", _PlannerRosterPlanListCommand_initTelemetry).call(this);
24
- __classPrivateFieldGet(this, _PlannerRosterPlanListCommand_instances, "m", _PlannerRosterPlanListCommand_initOptions).call(this);
25
- __classPrivateFieldGet(this, _PlannerRosterPlanListCommand_instances, "m", _PlannerRosterPlanListCommand_initValidators).call(this);
26
- __classPrivateFieldGet(this, _PlannerRosterPlanListCommand_instances, "m", _PlannerRosterPlanListCommand_initOptionSets).call(this);
27
- __classPrivateFieldGet(this, _PlannerRosterPlanListCommand_instances, "m", _PlannerRosterPlanListCommand_initTypes).call(this);
29
+ get schema() {
30
+ return options;
31
+ }
32
+ getRefinedSchema(schema) {
33
+ return schema
34
+ .refine(opts => !opts.userId || !opts.userName, {
35
+ message: `Specify either 'userId' or 'userName', but not both.`,
36
+ params: {
37
+ customCode: 'optionSet',
38
+ options: ['userId', 'userName']
39
+ }
40
+ });
28
41
  }
29
42
  defaultProperties() {
30
43
  return ['id', 'title', 'createdDateTime', 'owner'];
@@ -47,7 +60,7 @@ class PlannerRosterPlanListCommand extends GraphCommand {
47
60
  else {
48
61
  requestUrl += 'me';
49
62
  }
50
- requestUrl += `/planner/rosterPlans`;
63
+ requestUrl += '/planner/rosterPlans';
51
64
  try {
52
65
  const items = await odata.getAllItems(requestUrl);
53
66
  await logger.log(items);
@@ -57,36 +70,5 @@ class PlannerRosterPlanListCommand extends GraphCommand {
57
70
  }
58
71
  }
59
72
  }
60
- _PlannerRosterPlanListCommand_instances = new WeakSet(), _PlannerRosterPlanListCommand_initTelemetry = function _PlannerRosterPlanListCommand_initTelemetry() {
61
- this.telemetry.push((args) => {
62
- Object.assign(this.telemetryProperties, {
63
- userId: typeof args.options.userId !== 'undefined',
64
- userName: typeof args.options.userName !== 'undefined'
65
- });
66
- });
67
- }, _PlannerRosterPlanListCommand_initOptions = function _PlannerRosterPlanListCommand_initOptions() {
68
- this.options.unshift({
69
- option: '--userId [userId]'
70
- }, {
71
- option: '--userName [userName]'
72
- });
73
- }, _PlannerRosterPlanListCommand_initValidators = function _PlannerRosterPlanListCommand_initValidators() {
74
- this.validators.push(async (args) => {
75
- if (args.options.userId && !validation.isValidGuid(args.options.userId)) {
76
- return `${args.options.userId} is not a valid GUID`;
77
- }
78
- if (args.options.userName && !validation.isValidUserPrincipalName(args.options.userName)) {
79
- return `${args.options.userName} is not a valid user principal name (UPN)`;
80
- }
81
- return true;
82
- });
83
- }, _PlannerRosterPlanListCommand_initTypes = function _PlannerRosterPlanListCommand_initTypes() {
84
- this.types.string.push('userId', 'userName');
85
- }, _PlannerRosterPlanListCommand_initOptionSets = function _PlannerRosterPlanListCommand_initOptionSets() {
86
- this.optionSets.push({
87
- options: ['userId', 'userName'],
88
- runsWhen: (args) => args.options.userId || args.options.userName
89
- });
90
- };
91
73
  export default new PlannerRosterPlanListCommand();
92
74
  //# sourceMappingURL=roster-plan-list.js.map
@@ -1,13 +1,14 @@
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 _PlannerRosterRemoveCommand_instances, _PlannerRosterRemoveCommand_initTelemetry, _PlannerRosterRemoveCommand_initOptions, _PlannerRosterRemoveCommand_initTypes;
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
7
3
  import { cli } from '../../../../cli/cli.js';
8
4
  import request from '../../../../request.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(),
10
+ force: z.boolean().optional().alias('f')
11
+ });
11
12
  class PlannerRosterRemoveCommand extends GraphCommand {
12
13
  get name() {
13
14
  return commands.ROSTER_REMOVE;
@@ -15,12 +16,8 @@ class PlannerRosterRemoveCommand extends GraphCommand {
15
16
  get description() {
16
17
  return 'Removes a Microsoft Planner Roster';
17
18
  }
18
- constructor() {
19
- super();
20
- _PlannerRosterRemoveCommand_instances.add(this);
21
- __classPrivateFieldGet(this, _PlannerRosterRemoveCommand_instances, "m", _PlannerRosterRemoveCommand_initTelemetry).call(this);
22
- __classPrivateFieldGet(this, _PlannerRosterRemoveCommand_instances, "m", _PlannerRosterRemoveCommand_initOptions).call(this);
23
- __classPrivateFieldGet(this, _PlannerRosterRemoveCommand_instances, "m", _PlannerRosterRemoveCommand_initTypes).call(this);
19
+ get schema() {
20
+ return options;
24
21
  }
25
22
  async commandAction(logger, args) {
26
23
  if (args.options.force) {
@@ -52,20 +49,5 @@ class PlannerRosterRemoveCommand extends GraphCommand {
52
49
  }
53
50
  }
54
51
  }
55
- _PlannerRosterRemoveCommand_instances = new WeakSet(), _PlannerRosterRemoveCommand_initTelemetry = function _PlannerRosterRemoveCommand_initTelemetry() {
56
- this.telemetry.push((args) => {
57
- Object.assign(this.telemetryProperties, {
58
- force: !!args.options.force
59
- });
60
- });
61
- }, _PlannerRosterRemoveCommand_initOptions = function _PlannerRosterRemoveCommand_initOptions() {
62
- this.options.unshift({
63
- option: '--id <id>'
64
- }, {
65
- option: '-f, --force'
66
- });
67
- }, _PlannerRosterRemoveCommand_initTypes = function _PlannerRosterRemoveCommand_initTypes() {
68
- this.types.string.push('id');
69
- };
70
52
  export default new PlannerRosterRemoveCommand();
71
53
  //# sourceMappingURL=roster-remove.js.map