@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,13 +1,29 @@
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 _PurviewRetentionLabelSetCommand_instances, _PurviewRetentionLabelSetCommand_initTelemetry, _PurviewRetentionLabelSetCommand_initOptions, _PurviewRetentionLabelSetCommand_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
+ const behaviorDuringRetentionPeriodValues = ['doNotRetain', 'retain', 'retainAsRecord', 'retainAsRegulatoryRecord'];
8
+ const actionAfterRetentionPeriodValues = ['none', 'delete', 'startDispositionReview'];
9
+ const retentionTriggerValues = ['dateLabeled', 'dateCreated', 'dateModified', 'dateOfEvent'];
10
+ const defaultRecordBehaviorValues = ['startLocked', 'startUnlocked'];
11
+ export const options = z.strictObject({
12
+ ...globalOptionsZod.shape,
13
+ id: z.string().refine(val => validation.isValidGuid(val), {
14
+ error: 'The value must be a valid GUID.'
15
+ }).alias('i'),
16
+ behaviorDuringRetentionPeriod: z.enum(behaviorDuringRetentionPeriodValues).optional(),
17
+ actionAfterRetentionPeriod: z.enum(actionAfterRetentionPeriodValues).optional(),
18
+ retentionDuration: z.string().refine(val => !isNaN(Number(val)), {
19
+ error: 'retentionDuration must be a number'
20
+ }).optional(),
21
+ retentionTrigger: z.enum(retentionTriggerValues).optional().alias('t'),
22
+ defaultRecordBehavior: z.enum(defaultRecordBehaviorValues).optional(),
23
+ descriptionForUsers: z.string().optional(),
24
+ descriptionForAdmins: z.string().optional(),
25
+ labelToBeApplied: z.string().optional()
26
+ });
11
27
  class PurviewRetentionLabelSetCommand extends GraphCommand {
12
28
  get name() {
13
29
  return commands.RETENTIONLABEL_SET;
@@ -15,16 +31,18 @@ class PurviewRetentionLabelSetCommand extends GraphCommand {
15
31
  get description() {
16
32
  return 'Updates a retention label';
17
33
  }
18
- constructor() {
19
- super();
20
- _PurviewRetentionLabelSetCommand_instances.add(this);
21
- this.allowedBehaviorDuringRetentionPeriodValues = ['doNotRetain', 'retain', 'retainAsRecord', 'retainAsRegulatoryRecord'];
22
- this.allowedActionAfterRetentionPeriodValues = ['none', 'delete', 'startDispositionReview'];
23
- this.allowedRetentionTriggerValues = ['dateLabeled', 'dateCreated', 'dateModified', 'dateOfEvent'];
24
- this.allowedDefaultRecordBehaviorValues = ['startLocked', 'startUnlocked'];
25
- __classPrivateFieldGet(this, _PurviewRetentionLabelSetCommand_instances, "m", _PurviewRetentionLabelSetCommand_initTelemetry).call(this);
26
- __classPrivateFieldGet(this, _PurviewRetentionLabelSetCommand_instances, "m", _PurviewRetentionLabelSetCommand_initOptions).call(this);
27
- __classPrivateFieldGet(this, _PurviewRetentionLabelSetCommand_instances, "m", _PurviewRetentionLabelSetCommand_initValidators).call(this);
34
+ get schema() {
35
+ return options;
36
+ }
37
+ getRefinedSchema(schema) {
38
+ return schema
39
+ .refine(opts => opts.behaviorDuringRetentionPeriod || opts.actionAfterRetentionPeriod || opts.retentionDuration || opts.retentionTrigger || opts.defaultRecordBehavior || opts.descriptionForUsers || opts.descriptionForAdmins || opts.labelToBeApplied, {
40
+ error: 'Specify at least one property to update.',
41
+ params: {
42
+ customCode: 'optionSet',
43
+ options: ['behaviorDuringRetentionPeriod', 'actionAfterRetentionPeriod', 'retentionDuration', 'retentionTrigger', 'defaultRecordBehavior', 'descriptionForUsers', 'descriptionForAdmins', 'labelToBeApplied']
44
+ }
45
+ });
28
46
  }
29
47
  async commandAction(logger, args) {
30
48
  if (this.verbose) {
@@ -63,72 +81,11 @@ class PurviewRetentionLabelSetCommand extends GraphCommand {
63
81
  if (options.retentionDuration) {
64
82
  requestBody['retentionDuration'] = {
65
83
  '@odata.type': 'microsoft.graph.security.retentionDurationInDays',
66
- 'days': options.retentionDuration
84
+ 'days': Number(options.retentionDuration)
67
85
  };
68
86
  }
69
87
  return requestBody;
70
88
  }
71
89
  }
72
- _PurviewRetentionLabelSetCommand_instances = new WeakSet(), _PurviewRetentionLabelSetCommand_initTelemetry = function _PurviewRetentionLabelSetCommand_initTelemetry() {
73
- this.telemetry.push((args) => {
74
- Object.assign(this.telemetryProperties, {
75
- behaviorDuringRetentionPeriod: typeof args.options.behaviorDuringRetentionPeriod !== 'undefined',
76
- actionAfterRetentionPeriod: typeof args.options.actionAfterRetentionPeriod !== 'undefined',
77
- retentionDuration: typeof args.options.retentionDuration !== 'undefined',
78
- retentionTrigger: typeof args.options.retentionTrigger !== 'undefined',
79
- defaultRecordBehavior: typeof args.options.defaultRecordBehavior !== 'undefined',
80
- descriptionForUsers: typeof args.options.descriptionForUsers !== 'undefined',
81
- descriptionForAdmins: typeof args.options.descriptionForAdmins !== 'undefined',
82
- labelToBeApplied: typeof args.options.labelToBeApplied !== 'undefined'
83
- });
84
- });
85
- }, _PurviewRetentionLabelSetCommand_initOptions = function _PurviewRetentionLabelSetCommand_initOptions() {
86
- this.options.unshift({
87
- option: '-i, --id <id>'
88
- }, {
89
- option: '--behaviorDuringRetentionPeriod [behaviorDuringRetentionPeriod]',
90
- autocomplete: this.allowedBehaviorDuringRetentionPeriodValues
91
- }, {
92
- option: '--actionAfterRetentionPeriod [actionAfterRetentionPeriod]',
93
- autocomplete: this.allowedActionAfterRetentionPeriodValues
94
- }, {
95
- option: '--retentionDuration [retentionDuration]'
96
- }, {
97
- option: '-t, --retentionTrigger [retentionTrigger]',
98
- autocomplete: this.allowedRetentionTriggerValues
99
- }, {
100
- option: '--defaultRecordBehavior [defaultRecordBehavior]',
101
- autocomplete: this.allowedDefaultRecordBehaviorValues
102
- }, {
103
- option: '--descriptionForUsers [descriptionForUsers]'
104
- }, {
105
- option: '--descriptionForAdmins [descriptionForAdmins]'
106
- }, {
107
- option: '--labelToBeApplied [labelToBeApplied]'
108
- });
109
- }, _PurviewRetentionLabelSetCommand_initValidators = function _PurviewRetentionLabelSetCommand_initValidators() {
110
- this.validators.push(async (args) => {
111
- if (!validation.isValidGuid(args.options.id)) {
112
- return `'${args.options.id}' is not a valid GUID.`;
113
- }
114
- const { actionAfterRetentionPeriod, behaviorDuringRetentionPeriod, defaultRecordBehavior, descriptionForAdmins, descriptionForUsers, labelToBeApplied, retentionDuration, retentionTrigger } = args.options;
115
- if ([actionAfterRetentionPeriod, behaviorDuringRetentionPeriod, defaultRecordBehavior, descriptionForAdmins, descriptionForUsers, labelToBeApplied, retentionDuration, retentionTrigger].every(i => typeof i === 'undefined')) {
116
- return `Specify at least one property to update.`;
117
- }
118
- if (behaviorDuringRetentionPeriod && this.allowedBehaviorDuringRetentionPeriodValues.indexOf(behaviorDuringRetentionPeriod) === -1) {
119
- return `'${behaviorDuringRetentionPeriod}' is not a valid value for the behaviorDuringRetentionPeriod option. Allowed values are ${this.allowedBehaviorDuringRetentionPeriodValues.join('|')}`;
120
- }
121
- if (actionAfterRetentionPeriod && this.allowedActionAfterRetentionPeriodValues.indexOf(actionAfterRetentionPeriod) === -1) {
122
- return `'${actionAfterRetentionPeriod}' is not a valid value for the actionAfterRetentionPeriod option. Allowed values are ${this.allowedActionAfterRetentionPeriodValues.join('|')}`;
123
- }
124
- if (retentionTrigger && this.allowedRetentionTriggerValues.indexOf(retentionTrigger) === -1) {
125
- return `'${retentionTrigger}' is not a valid value for the retentionTrigger option. Allowed values are ${this.allowedRetentionTriggerValues.join('|')}`;
126
- }
127
- if (defaultRecordBehavior && this.allowedDefaultRecordBehaviorValues.indexOf(defaultRecordBehavior) === -1) {
128
- return `'${defaultRecordBehavior}' is not a valid value for the defaultRecordBehavior option. Allowed values are ${this.allowedDefaultRecordBehaviorValues.join('|')}`;
129
- }
130
- return true;
131
- });
132
- };
133
90
  export default new PurviewRetentionLabelSetCommand();
134
91
  //# sourceMappingURL=retentionlabel-set.js.map
@@ -1,15 +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 _PurviewSensitivityLabelGetCommand_instances, _PurviewSensitivityLabelGetCommand_initTelemetry, _PurviewSensitivityLabelGetCommand_initOptions, _PurviewSensitivityLabelGetCommand_initValidators;
1
+ import { z } from 'zod';
7
2
  import auth from '../../../../Auth.js';
8
- import GraphCommand from '../../../base/GraphCommand.js';
9
- import commands from '../../commands.js';
3
+ import { globalOptionsZod } from '../../../../Command.js';
10
4
  import request from '../../../../request.js';
11
- import { validation } from '../../../../utils/validation.js';
12
5
  import { accessToken } from '../../../../utils/accessToken.js';
6
+ import { validation } from '../../../../utils/validation.js';
7
+ import GraphCommand from '../../../base/GraphCommand.js';
8
+ import commands from '../../commands.js';
9
+ export const options = z.strictObject({
10
+ ...globalOptionsZod.shape,
11
+ id: z.string().refine(val => validation.isValidGuid(val), {
12
+ error: 'The value must be a valid GUID.'
13
+ }).alias('i'),
14
+ userId: z.string().refine(val => validation.isValidGuid(val), {
15
+ error: 'The value must be a valid GUID.'
16
+ }).optional(),
17
+ userName: z.string().refine(val => validation.isValidUserPrincipalName(val), {
18
+ error: 'The value must be a valid user principal name (UPN).'
19
+ }).optional()
20
+ });
13
21
  class PurviewSensitivityLabelGetCommand extends GraphCommand {
14
22
  get name() {
15
23
  return commands.SENSITIVITYLABEL_GET;
@@ -17,12 +25,8 @@ class PurviewSensitivityLabelGetCommand extends GraphCommand {
17
25
  get description() {
18
26
  return 'Retrieves the specified sensitivity label';
19
27
  }
20
- constructor() {
21
- super();
22
- _PurviewSensitivityLabelGetCommand_instances.add(this);
23
- __classPrivateFieldGet(this, _PurviewSensitivityLabelGetCommand_instances, "m", _PurviewSensitivityLabelGetCommand_initTelemetry).call(this);
24
- __classPrivateFieldGet(this, _PurviewSensitivityLabelGetCommand_instances, "m", _PurviewSensitivityLabelGetCommand_initOptions).call(this);
25
- __classPrivateFieldGet(this, _PurviewSensitivityLabelGetCommand_instances, "m", _PurviewSensitivityLabelGetCommand_initValidators).call(this);
28
+ get schema() {
29
+ return options;
26
30
  }
27
31
  async commandAction(logger, args) {
28
32
  const isAppOnlyAccessToken = accessToken.isAppOnlyAccessToken(auth.connection.accessTokens[this.resource].accessToken);
@@ -51,34 +55,5 @@ class PurviewSensitivityLabelGetCommand extends GraphCommand {
51
55
  }
52
56
  }
53
57
  }
54
- _PurviewSensitivityLabelGetCommand_instances = new WeakSet(), _PurviewSensitivityLabelGetCommand_initTelemetry = function _PurviewSensitivityLabelGetCommand_initTelemetry() {
55
- this.telemetry.push((args) => {
56
- Object.assign(this.telemetryProperties, {
57
- userId: typeof args.options.userId !== 'undefined',
58
- userName: typeof args.options.userName !== 'undefined'
59
- });
60
- });
61
- }, _PurviewSensitivityLabelGetCommand_initOptions = function _PurviewSensitivityLabelGetCommand_initOptions() {
62
- this.options.unshift({
63
- option: '-i, --id <id>'
64
- }, {
65
- option: '--userId [userId]'
66
- }, {
67
- option: '--userName [userName]'
68
- });
69
- }, _PurviewSensitivityLabelGetCommand_initValidators = function _PurviewSensitivityLabelGetCommand_initValidators() {
70
- this.validators.push(async (args) => {
71
- if (!validation.isValidGuid(args.options.id)) {
72
- return `'${args.options.id}' is not a valid GUID.`;
73
- }
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 user principal name (UPN)`;
79
- }
80
- return true;
81
- });
82
- };
83
58
  export default new PurviewSensitivityLabelGetCommand();
84
59
  //# sourceMappingURL=sensitivitylabel-get.js.map
@@ -1,15 +1,20 @@
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 _PurviewSensitivityLabelListCommand_instances, _PurviewSensitivityLabelListCommand_initTelemetry, _PurviewSensitivityLabelListCommand_initOptions, _PurviewSensitivityLabelListCommand_initValidators;
1
+ import { z } from 'zod';
7
2
  import auth from '../../../../Auth.js';
8
- import GraphCommand from '../../../base/GraphCommand.js';
9
- import commands from '../../commands.js';
10
- import { validation } from '../../../../utils/validation.js';
3
+ import { globalOptionsZod } from '../../../../Command.js';
11
4
  import { accessToken } from '../../../../utils/accessToken.js';
12
5
  import { odata } from '../../../../utils/odata.js';
6
+ import { validation } from '../../../../utils/validation.js';
7
+ import GraphCommand from '../../../base/GraphCommand.js';
8
+ import commands from '../../commands.js';
9
+ export const options = z.strictObject({
10
+ ...globalOptionsZod.shape,
11
+ userId: z.string().refine(val => validation.isValidGuid(val), {
12
+ error: 'The value must be a valid GUID.'
13
+ }).optional(),
14
+ userName: z.string().refine(val => validation.isValidUserPrincipalName(val), {
15
+ error: 'The value must be a valid user principal name (UPN).'
16
+ }).optional()
17
+ });
13
18
  class PurviewSensitivityLabelListCommand extends GraphCommand {
14
19
  get name() {
15
20
  return commands.SENSITIVITYLABEL_LIST;
@@ -17,12 +22,8 @@ class PurviewSensitivityLabelListCommand extends GraphCommand {
17
22
  get description() {
18
23
  return 'Gets a list of sensitivity labels';
19
24
  }
20
- constructor() {
21
- super();
22
- _PurviewSensitivityLabelListCommand_instances.add(this);
23
- __classPrivateFieldGet(this, _PurviewSensitivityLabelListCommand_instances, "m", _PurviewSensitivityLabelListCommand_initTelemetry).call(this);
24
- __classPrivateFieldGet(this, _PurviewSensitivityLabelListCommand_instances, "m", _PurviewSensitivityLabelListCommand_initOptions).call(this);
25
- __classPrivateFieldGet(this, _PurviewSensitivityLabelListCommand_instances, "m", _PurviewSensitivityLabelListCommand_initValidators).call(this);
25
+ get schema() {
26
+ return options;
26
27
  }
27
28
  defaultProperties() {
28
29
  return ['id', 'name', 'isActive'];
@@ -44,29 +45,5 @@ class PurviewSensitivityLabelListCommand extends GraphCommand {
44
45
  }
45
46
  }
46
47
  }
47
- _PurviewSensitivityLabelListCommand_instances = new WeakSet(), _PurviewSensitivityLabelListCommand_initTelemetry = function _PurviewSensitivityLabelListCommand_initTelemetry() {
48
- this.telemetry.push((args) => {
49
- Object.assign(this.telemetryProperties, {
50
- userId: typeof args.options.userId !== 'undefined',
51
- userName: typeof args.options.userName !== 'undefined'
52
- });
53
- });
54
- }, _PurviewSensitivityLabelListCommand_initOptions = function _PurviewSensitivityLabelListCommand_initOptions() {
55
- this.options.unshift({
56
- option: '--userId [userId]'
57
- }, {
58
- option: '--userName [userName]'
59
- });
60
- }, _PurviewSensitivityLabelListCommand_initValidators = function _PurviewSensitivityLabelListCommand_initValidators() {
61
- this.validators.push(async (args) => {
62
- if (args.options.userId && !validation.isValidGuid(args.options.userId)) {
63
- return `${args.options.userId} is not a valid GUID`;
64
- }
65
- if (args.options.userName && !validation.isValidUserPrincipalName(args.options.userName)) {
66
- return `${args.options.userName} is not a valid user principal name (UPN)`;
67
- }
68
- return true;
69
- });
70
- };
71
48
  export default new PurviewSensitivityLabelListCommand();
72
49
  //# sourceMappingURL=sensitivitylabel-list.js.map
@@ -1,15 +1,20 @@
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 _PurviewSensitivityLabelPolicySettingsListCommand_instances, _PurviewSensitivityLabelPolicySettingsListCommand_initTelemetry, _PurviewSensitivityLabelPolicySettingsListCommand_initOptions, _PurviewSensitivityLabelPolicySettingsListCommand_initValidators;
1
+ import { z } from 'zod';
7
2
  import auth from '../../../../Auth.js';
8
- import GraphCommand from '../../../base/GraphCommand.js';
9
- import commands from '../../commands.js';
3
+ import { globalOptionsZod } from '../../../../Command.js';
10
4
  import request from '../../../../request.js';
11
- import { validation } from '../../../../utils/validation.js';
12
5
  import { accessToken } from '../../../../utils/accessToken.js';
6
+ import { validation } from '../../../../utils/validation.js';
7
+ import GraphCommand from '../../../base/GraphCommand.js';
8
+ import commands from '../../commands.js';
9
+ export const options = z.strictObject({
10
+ ...globalOptionsZod.shape,
11
+ userId: z.string().refine(val => validation.isValidGuid(val), {
12
+ error: 'The value must be a valid GUID.'
13
+ }).optional(),
14
+ userName: z.string().refine(val => validation.isValidUserPrincipalName(val), {
15
+ error: 'The value must be a valid user principal name (UPN).'
16
+ }).optional()
17
+ });
13
18
  class PurviewSensitivityLabelPolicySettingsListCommand extends GraphCommand {
14
19
  get name() {
15
20
  return commands.SENSITIVITYLABEL_POLICYSETTINGS_LIST;
@@ -17,12 +22,8 @@ class PurviewSensitivityLabelPolicySettingsListCommand extends GraphCommand {
17
22
  get description() {
18
23
  return 'Gets a list of policy settings for a sensitivity label';
19
24
  }
20
- constructor() {
21
- super();
22
- _PurviewSensitivityLabelPolicySettingsListCommand_instances.add(this);
23
- __classPrivateFieldGet(this, _PurviewSensitivityLabelPolicySettingsListCommand_instances, "m", _PurviewSensitivityLabelPolicySettingsListCommand_initTelemetry).call(this);
24
- __classPrivateFieldGet(this, _PurviewSensitivityLabelPolicySettingsListCommand_instances, "m", _PurviewSensitivityLabelPolicySettingsListCommand_initOptions).call(this);
25
- __classPrivateFieldGet(this, _PurviewSensitivityLabelPolicySettingsListCommand_instances, "m", _PurviewSensitivityLabelPolicySettingsListCommand_initValidators).call(this);
25
+ get schema() {
26
+ return options;
26
27
  }
27
28
  async commandAction(logger, args) {
28
29
  const isAppOnlyAccessToken = accessToken.isAppOnlyAccessToken(auth.connection.accessTokens[this.resource].accessToken);
@@ -48,29 +49,5 @@ class PurviewSensitivityLabelPolicySettingsListCommand extends GraphCommand {
48
49
  }
49
50
  }
50
51
  }
51
- _PurviewSensitivityLabelPolicySettingsListCommand_instances = new WeakSet(), _PurviewSensitivityLabelPolicySettingsListCommand_initTelemetry = function _PurviewSensitivityLabelPolicySettingsListCommand_initTelemetry() {
52
- this.telemetry.push((args) => {
53
- Object.assign(this.telemetryProperties, {
54
- userId: typeof args.options.userId !== 'undefined',
55
- userName: typeof args.options.userName !== 'undefined'
56
- });
57
- });
58
- }, _PurviewSensitivityLabelPolicySettingsListCommand_initOptions = function _PurviewSensitivityLabelPolicySettingsListCommand_initOptions() {
59
- this.options.unshift({
60
- option: '--userId [userId]'
61
- }, {
62
- option: '--userName [userName]'
63
- });
64
- }, _PurviewSensitivityLabelPolicySettingsListCommand_initValidators = function _PurviewSensitivityLabelPolicySettingsListCommand_initValidators() {
65
- this.validators.push(async (args) => {
66
- if (args.options.userId && !validation.isValidGuid(args.options.userId)) {
67
- return `${args.options.userId} is not a valid GUID`;
68
- }
69
- if (args.options.userName && !validation.isValidUserPrincipalName(args.options.userName)) {
70
- return `${args.options.userName} is not a valid user principal name (UPN)`;
71
- }
72
- return true;
73
- });
74
- };
75
52
  export default new PurviewSensitivityLabelPolicySettingsListCommand();
76
53
  //# sourceMappingURL=sensitivitylabel-policysettings-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 _PurviewThreatAssessmentAddCommand_instances, _PurviewThreatAssessmentAddCommand_initTelemetry, _PurviewThreatAssessmentAddCommand_initOptions, _PurviewThreatAssessmentAddCommand_initValidators, _PurviewThreatAssessmentAddCommand_initOptionSets;
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
7
3
  import request from '../../../../request.js';
8
4
  import { accessToken } from '../../../../utils/accessToken.js';
9
5
  import GraphCommand from '../../../base/GraphCommand.js';
@@ -11,6 +7,19 @@ import commands from '../../commands.js';
11
7
  import auth from '../../../../Auth.js';
12
8
  import fs from 'fs';
13
9
  import path from 'path';
10
+ const allowedTypes = ['file', 'url'];
11
+ const allowedExpectedAssessments = ['block', 'unblock'];
12
+ const allowedCategories = ['spam', 'phishing', 'malware'];
13
+ export const options = z.strictObject({
14
+ ...globalOptionsZod.shape,
15
+ type: z.enum(allowedTypes).alias('t'),
16
+ expectedAssessment: z.enum(allowedExpectedAssessments).alias('e'),
17
+ category: z.enum(allowedCategories).alias('c'),
18
+ path: z.string().refine(val => fs.existsSync(val), {
19
+ error: 'Specified file does not exist.'
20
+ }).optional().alias('p'),
21
+ url: z.string().optional().alias('u')
22
+ });
14
23
  class PurviewThreatAssessmentAddCommand extends GraphCommand {
15
24
  get name() {
16
25
  return commands.THREATASSESSMENT_ADD;
@@ -18,16 +27,35 @@ class PurviewThreatAssessmentAddCommand extends GraphCommand {
18
27
  get description() {
19
28
  return 'Creates a threat assessment';
20
29
  }
21
- constructor() {
22
- super();
23
- _PurviewThreatAssessmentAddCommand_instances.add(this);
24
- this.allowedTypes = ['file', 'url'];
25
- this.allowedExpectedAssessments = ['block', 'unblock'];
26
- this.allowedCategories = ['spam', 'phishing', 'malware'];
27
- __classPrivateFieldGet(this, _PurviewThreatAssessmentAddCommand_instances, "m", _PurviewThreatAssessmentAddCommand_initTelemetry).call(this);
28
- __classPrivateFieldGet(this, _PurviewThreatAssessmentAddCommand_instances, "m", _PurviewThreatAssessmentAddCommand_initOptions).call(this);
29
- __classPrivateFieldGet(this, _PurviewThreatAssessmentAddCommand_instances, "m", _PurviewThreatAssessmentAddCommand_initValidators).call(this);
30
- __classPrivateFieldGet(this, _PurviewThreatAssessmentAddCommand_instances, "m", _PurviewThreatAssessmentAddCommand_initOptionSets).call(this);
30
+ get schema() {
31
+ return options;
32
+ }
33
+ getRefinedSchema(schema) {
34
+ return schema
35
+ .refine(opts => {
36
+ if (opts.type === 'file') {
37
+ return opts.path !== undefined;
38
+ }
39
+ return true;
40
+ }, {
41
+ error: `'path' is required when type is 'file'.`,
42
+ path: ['path'],
43
+ params: {
44
+ customCode: 'required'
45
+ }
46
+ })
47
+ .refine(opts => {
48
+ if (opts.type === 'url') {
49
+ return opts.url !== undefined;
50
+ }
51
+ return true;
52
+ }, {
53
+ error: `'url' is required when type is 'url'.`,
54
+ path: ['url'],
55
+ params: {
56
+ customCode: 'required'
57
+ }
58
+ });
31
59
  }
32
60
  async commandAction(logger, args) {
33
61
  try {
@@ -68,56 +96,5 @@ class PurviewThreatAssessmentAddCommand extends GraphCommand {
68
96
  }
69
97
  }
70
98
  }
71
- _PurviewThreatAssessmentAddCommand_instances = new WeakSet(), _PurviewThreatAssessmentAddCommand_initTelemetry = function _PurviewThreatAssessmentAddCommand_initTelemetry() {
72
- this.telemetry.push((args) => {
73
- Object.assign(this.telemetryProperties, {
74
- path: typeof args.options.path !== 'undefined',
75
- url: typeof args.options.url !== 'undefined'
76
- });
77
- });
78
- }, _PurviewThreatAssessmentAddCommand_initOptions = function _PurviewThreatAssessmentAddCommand_initOptions() {
79
- this.options.unshift({
80
- option: '-t, --type <type>',
81
- autocomplete: this.allowedTypes
82
- }, {
83
- option: '-e, --expectedAssessment <expectedAssessment>',
84
- autocomplete: this.allowedExpectedAssessments
85
- }, {
86
- option: '-c, --category <category>',
87
- autocomplete: this.allowedCategories
88
- }, {
89
- option: '-p, --path [path]'
90
- }, {
91
- option: '-u, --url [url]'
92
- });
93
- }, _PurviewThreatAssessmentAddCommand_initValidators = function _PurviewThreatAssessmentAddCommand_initValidators() {
94
- this.validators.push(async (args) => {
95
- if (!this.allowedTypes.some(type => type === args.options.type)) {
96
- return `${args.options.type} is not an allowed type. Allowed types are ${this.allowedTypes.join('|')}`;
97
- }
98
- if (!this.allowedExpectedAssessments.some(expectedAssessment => expectedAssessment === args.options.expectedAssessment)) {
99
- return `${args.options.expectedAssessment} is not an allowed expected assessment. Allowed expected assessments are ${this.allowedExpectedAssessments.join('|')}`;
100
- }
101
- if (!this.allowedCategories.some(category => category === args.options.category)) {
102
- return `${args.options.category} is not an allowed category. Allowed categories are ${this.allowedCategories.join('|')}`;
103
- }
104
- if (args.options.path && !fs.existsSync(args.options.path)) {
105
- return `File '${args.options.path}' not found. Please provide a valid path to the file.`;
106
- }
107
- return true;
108
- });
109
- }, _PurviewThreatAssessmentAddCommand_initOptionSets = function _PurviewThreatAssessmentAddCommand_initOptionSets() {
110
- this.optionSets.push({
111
- options: ['path'],
112
- runsWhen: (args) => {
113
- return args.options.type === 'file';
114
- }
115
- }, {
116
- options: ['url'],
117
- runsWhen: (args) => {
118
- return args.options.type === 'url';
119
- }
120
- });
121
- };
122
99
  export default new PurviewThreatAssessmentAddCommand();
123
100
  //# sourceMappingURL=threatassessment-add.js.map
@@ -1,13 +1,16 @@
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 _PurviewThreatAssessmentGetCommand_instances, _PurviewThreatAssessmentGetCommand_initTelemetry, _PurviewThreatAssessmentGetCommand_initOptions, _PurviewThreatAssessmentGetCommand_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
+ error: 'The value must be a valid GUID.'
11
+ }).alias('i'),
12
+ withResults: z.boolean().optional()
13
+ });
11
14
  class PurviewThreatAssessmentGetCommand extends GraphCommand {
12
15
  get name() {
13
16
  return commands.THREATASSESSMENT_GET;
@@ -15,12 +18,8 @@ class PurviewThreatAssessmentGetCommand extends GraphCommand {
15
18
  get description() {
16
19
  return 'Gets a threat assessment';
17
20
  }
18
- constructor() {
19
- super();
20
- _PurviewThreatAssessmentGetCommand_instances.add(this);
21
- __classPrivateFieldGet(this, _PurviewThreatAssessmentGetCommand_instances, "m", _PurviewThreatAssessmentGetCommand_initTelemetry).call(this);
22
- __classPrivateFieldGet(this, _PurviewThreatAssessmentGetCommand_instances, "m", _PurviewThreatAssessmentGetCommand_initOptions).call(this);
23
- __classPrivateFieldGet(this, _PurviewThreatAssessmentGetCommand_instances, "m", _PurviewThreatAssessmentGetCommand_initValidators).call(this);
21
+ get schema() {
22
+ return options;
24
23
  }
25
24
  async commandAction(logger, args) {
26
25
  try {
@@ -42,26 +41,5 @@ class PurviewThreatAssessmentGetCommand extends GraphCommand {
42
41
  }
43
42
  }
44
43
  }
45
- _PurviewThreatAssessmentGetCommand_instances = new WeakSet(), _PurviewThreatAssessmentGetCommand_initTelemetry = function _PurviewThreatAssessmentGetCommand_initTelemetry() {
46
- this.telemetry.push((args) => {
47
- Object.assign(this.telemetryProperties, {
48
- includeResults: !!args.options.includeResults,
49
- withResults: !!args.options.withResults
50
- });
51
- });
52
- }, _PurviewThreatAssessmentGetCommand_initOptions = function _PurviewThreatAssessmentGetCommand_initOptions() {
53
- this.options.unshift({
54
- option: '-i, --id <id>'
55
- }, {
56
- option: '--withResults'
57
- });
58
- }, _PurviewThreatAssessmentGetCommand_initValidators = function _PurviewThreatAssessmentGetCommand_initValidators() {
59
- this.validators.push(async (args) => {
60
- if (!validation.isValidGuid(args.options.id)) {
61
- return `${args.options.id} is not a valid GUID.`;
62
- }
63
- return true;
64
- });
65
- };
66
44
  export default new PurviewThreatAssessmentGetCommand();
67
45
  //# sourceMappingURL=threatassessment-get.js.map
@@ -1,12 +1,13 @@
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 _PurviewThreatAssessmentListCommand_instances, _a, _PurviewThreatAssessmentListCommand_initTelemetry, _PurviewThreatAssessmentListCommand_initOptions, _PurviewThreatAssessmentListCommand_initValidators;
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
+ const allowedTypes = ['mail', 'file', 'emailFile', 'url'];
7
+ export const options = z.strictObject({
8
+ ...globalOptionsZod.shape,
9
+ type: z.enum(allowedTypes).optional().alias('t')
10
+ });
10
11
  class PurviewThreatAssessmentListCommand extends GraphCommand {
11
12
  get name() {
12
13
  return commands.THREATASSESSMENT_LIST;
@@ -14,16 +15,12 @@ class PurviewThreatAssessmentListCommand extends GraphCommand {
14
15
  get description() {
15
16
  return 'Gets a list of threat assessments';
16
17
  }
18
+ get schema() {
19
+ return options;
20
+ }
17
21
  defaultProperties() {
18
22
  return ['id', 'type', 'category'];
19
23
  }
20
- constructor() {
21
- super();
22
- _PurviewThreatAssessmentListCommand_instances.add(this);
23
- __classPrivateFieldGet(this, _PurviewThreatAssessmentListCommand_instances, "m", _PurviewThreatAssessmentListCommand_initTelemetry).call(this);
24
- __classPrivateFieldGet(this, _PurviewThreatAssessmentListCommand_instances, "m", _PurviewThreatAssessmentListCommand_initOptions).call(this);
25
- __classPrivateFieldGet(this, _PurviewThreatAssessmentListCommand_instances, "m", _PurviewThreatAssessmentListCommand_initValidators).call(this);
26
- }
27
24
  async commandAction(logger, args) {
28
25
  if (this.verbose) {
29
26
  await logger.logToStderr('Retrieving a list of threat assessments');
@@ -80,25 +77,5 @@ class PurviewThreatAssessmentListCommand extends GraphCommand {
80
77
  }
81
78
  }
82
79
  }
83
- _a = PurviewThreatAssessmentListCommand, _PurviewThreatAssessmentListCommand_instances = new WeakSet(), _PurviewThreatAssessmentListCommand_initTelemetry = function _PurviewThreatAssessmentListCommand_initTelemetry() {
84
- this.telemetry.push((args) => {
85
- Object.assign(this.telemetryProperties, {
86
- type: typeof args.options.type !== 'undefined'
87
- });
88
- });
89
- }, _PurviewThreatAssessmentListCommand_initOptions = function _PurviewThreatAssessmentListCommand_initOptions() {
90
- this.options.unshift({
91
- option: '-t, --type [type]',
92
- autocomplete: _a.allowedTypes
93
- });
94
- }, _PurviewThreatAssessmentListCommand_initValidators = function _PurviewThreatAssessmentListCommand_initValidators() {
95
- this.validators.push(async (args) => {
96
- if (args.options.type && _a.allowedTypes.indexOf(args.options.type) < 0) {
97
- return `${args.options.type} is not a valid type. Allowed values are ${_a.allowedTypes.join(', ')}`;
98
- }
99
- return true;
100
- });
101
- };
102
- PurviewThreatAssessmentListCommand.allowedTypes = ['mail', 'file', 'emailFile', 'url'];
103
80
  export default new PurviewThreatAssessmentListCommand();
104
81
  //# sourceMappingURL=threatassessment-list.js.map
@@ -20,7 +20,7 @@ class SpoHomeSiteRemoveCommand extends SpoCommand {
20
20
  return commands.HOMESITE_REMOVE;
21
21
  }
22
22
  get description() {
23
- return 'Removes a Home Site';
23
+ return 'Removes a home site';
24
24
  }
25
25
  get schema() {
26
26
  return options;