@pnp/cli-microsoft365 11.9.0-beta.8c1ee05 → 11.9.0-beta.9bd71dd

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 (153) hide show
  1. package/.devcontainer/Dockerfile +2 -2
  2. package/.devproxy/api-specs/sharepoint.yaml +166 -0
  3. package/allCommands.json +1 -1
  4. package/allCommandsFull.json +1 -1
  5. package/dist/m365/cli/commands/app/app-reconsent.js +8 -0
  6. package/dist/m365/cli/commands/cli-consent.js +8 -31
  7. package/dist/m365/cli/commands/cli-doctor.js +6 -1
  8. package/dist/m365/cli/commands/cli-issue.js +8 -36
  9. package/dist/m365/cli/commands/completion/completion-clink-update.js +8 -0
  10. package/dist/m365/cli/commands/completion/completion-pwsh-setup.js +8 -16
  11. package/dist/m365/cli/commands/completion/completion-pwsh-update.js +8 -0
  12. package/dist/m365/cli/commands/completion/completion-sh-setup.js +8 -0
  13. package/dist/m365/cli/commands/completion/completion-sh-update.js +8 -0
  14. package/dist/m365/cli/commands/config/config-get.js +9 -32
  15. package/dist/m365/cli/commands/config/config-list.js +8 -0
  16. package/dist/m365/cli/commands/config/config-reset.js +9 -34
  17. package/dist/m365/cli/commands/config/config-set.js +86 -70
  18. package/dist/m365/commands/request.js +26 -60
  19. package/dist/m365/commands/search.js +59 -77
  20. package/dist/m365/commands/setup.js +16 -31
  21. package/dist/m365/commands/version.js +6 -0
  22. package/dist/m365/connection/commands/connection-remove.js +9 -29
  23. package/dist/m365/connection/commands/connection-use.js +8 -26
  24. package/dist/m365/context/commands/context-init.js +6 -0
  25. package/dist/m365/context/commands/option/option-set.js +9 -18
  26. package/dist/m365/entra/commands/administrativeunit/administrativeunit-member-add.js +32 -63
  27. package/dist/m365/entra/commands/administrativeunit/administrativeunit-member-get.js +21 -45
  28. package/dist/m365/entra/commands/administrativeunit/administrativeunit-member-list.js +32 -53
  29. package/dist/m365/entra/commands/administrativeunit/administrativeunit-member-remove.js +34 -74
  30. package/dist/m365/entra/commands/administrativeunit/administrativeunit-roleassignment-add.js +37 -57
  31. package/dist/m365/entra/commands/approleassignment/approleassignment-add.js +23 -48
  32. package/dist/m365/entra/commands/approleassignment/approleassignment-list.js +20 -43
  33. package/dist/m365/entra/commands/approleassignment/approleassignment-remove.js +24 -51
  34. package/dist/m365/entra/commands/enterpriseapp/enterpriseapp-add.js +20 -43
  35. package/dist/m365/entra/commands/enterpriseapp/enterpriseapp-get.js +20 -43
  36. package/dist/m365/entra/commands/enterpriseapp/enterpriseapp-list.js +9 -25
  37. package/dist/m365/entra/commands/enterpriseapp/enterpriseapp-remove.js +21 -50
  38. package/dist/m365/entra/commands/groupsetting/groupsetting-add.js +9 -25
  39. package/dist/m365/entra/commands/groupsetting/groupsetting-get.js +8 -24
  40. package/dist/m365/entra/commands/groupsetting/groupsetting-list.js +6 -0
  41. package/dist/m365/entra/commands/groupsetting/groupsetting-remove.js +9 -33
  42. package/dist/m365/entra/commands/groupsetting/groupsetting-set.js +8 -24
  43. package/dist/m365/entra/commands/groupsettingtemplate/groupsettingtemplate-get.js +19 -38
  44. package/dist/m365/entra/commands/groupsettingtemplate/groupsettingtemplate-list.js +6 -0
  45. package/dist/m365/entra/commands/multitenant/multitenant-get.js +8 -1
  46. package/dist/m365/entra/commands/multitenant/multitenant-remove.js +8 -22
  47. package/dist/m365/entra/commands/multitenant/multitenant-set.js +15 -36
  48. package/dist/m365/entra/commands/oauth2grant/oauth2grant-add.js +10 -31
  49. package/dist/m365/entra/commands/oauth2grant/oauth2grant-list.js +8 -24
  50. package/dist/m365/entra/commands/oauth2grant/oauth2grant-remove.js +9 -17
  51. package/dist/m365/entra/commands/oauth2grant/oauth2grant-set.js +9 -17
  52. package/dist/m365/entra/commands/pim/pim-role-assignment-add.js +68 -114
  53. package/dist/m365/entra/commands/pim/pim-role-assignment-eligibility-list.js +28 -55
  54. package/dist/m365/entra/commands/pim/pim-role-assignment-list.js +30 -57
  55. package/dist/m365/entra/commands/pim/pim-role-assignment-remove.js +50 -90
  56. package/dist/m365/entra/commands/pim/pim-role-request-list.js +36 -69
  57. package/dist/m365/entra/commands/policy/policy-list.js +13 -56
  58. package/dist/m365/entra/commands/user/user-add.js +39 -118
  59. package/dist/m365/entra/commands/user/user-get.js +24 -49
  60. package/dist/m365/entra/commands/user/user-groupmembership-list.js +25 -48
  61. package/dist/m365/entra/commands/user/user-guest-add.js +14 -39
  62. package/dist/m365/entra/commands/user/user-hibp.js +12 -34
  63. package/dist/m365/entra/commands/user/user-license-add.js +23 -42
  64. package/dist/m365/entra/commands/user/user-license-list.js +21 -42
  65. package/dist/m365/entra/commands/user/user-license-remove.js +25 -47
  66. package/dist/m365/entra/commands/user/user-list.js +12 -39
  67. package/dist/m365/entra/commands/user/user-password-validate.js +8 -15
  68. package/dist/m365/entra/commands/user/user-recyclebinitem-clear.js +8 -22
  69. package/dist/m365/entra/commands/user/user-recyclebinitem-remove.js +9 -33
  70. package/dist/m365/entra/commands/user/user-recyclebinitem-restore.js +8 -24
  71. package/dist/m365/entra/commands/user/user-registrationdetails-list.js +43 -113
  72. package/dist/m365/entra/commands/user/user-remove.js +22 -42
  73. package/dist/m365/entra/commands/user/user-set.js +69 -149
  74. package/dist/m365/entra/commands/user/user-signin-list.js +22 -51
  75. package/dist/m365/external/commands/connection/connection-add.js +40 -65
  76. package/dist/m365/external/commands/connection/connection-doctor.js +14 -30
  77. package/dist/m365/external/commands/connection/connection-get.js +19 -28
  78. package/dist/m365/external/commands/connection/connection-remove.js +20 -25
  79. package/dist/m365/external/commands/connection/connection-schema-add.js +53 -42
  80. package/dist/m365/external/commands/connection/connection-urltoitemresolver-add.js +12 -23
  81. package/dist/m365/external/commands/item/item-add.js +37 -60
  82. package/dist/m365/file/commands/convert/convert-pdf.js +18 -33
  83. package/dist/m365/file/commands/file-add.js +28 -34
  84. package/dist/m365/file/commands/file-copy.js +18 -34
  85. package/dist/m365/file/commands/file-list.js +18 -24
  86. package/dist/m365/file/commands/file-move.js +22 -35
  87. package/dist/m365/flow/commands/flow-disable.js +10 -26
  88. package/dist/m365/flow/commands/flow-enable.js +10 -26
  89. package/dist/m365/flow/commands/flow-export.js +45 -71
  90. package/dist/m365/flow/commands/flow-get.js +10 -26
  91. package/dist/m365/flow/commands/flow-list.js +17 -48
  92. package/dist/m365/flow/commands/flow-remove.js +11 -38
  93. package/dist/m365/flow/commands/owner/owner-ensure.js +30 -65
  94. package/dist/m365/flow/commands/owner/owner-list.js +10 -35
  95. package/dist/m365/flow/commands/owner/owner-remove.js +30 -61
  96. package/dist/m365/flow/commands/run/run-cancel.js +11 -37
  97. package/dist/m365/flow/commands/run/run-get.js +12 -43
  98. package/dist/m365/flow/commands/run/run-list.js +29 -61
  99. package/dist/m365/flow/commands/run/run-resubmit.js +11 -37
  100. package/dist/m365/graph/commands/changelog/changelog-list.js +68 -67
  101. package/dist/m365/graph/commands/schemaextension/schemaextension-add.js +25 -31
  102. package/dist/m365/graph/commands/schemaextension/schemaextension-get.js +8 -15
  103. package/dist/m365/graph/commands/schemaextension/schemaextension-list.js +26 -50
  104. package/dist/m365/graph/commands/schemaextension/schemaextension-remove.js +9 -24
  105. package/dist/m365/graph/commands/schemaextension/schemaextension-set.js +32 -53
  106. package/dist/m365/graph/commands/subscription/subscription-add.js +63 -89
  107. package/dist/m365/outlook/commands/calendar/calendar-get.js +1 -1
  108. package/dist/m365/outlook/commands/calendar/calendar-list.js +64 -0
  109. package/dist/m365/outlook/commands/mail/mail-send.js +55 -84
  110. package/dist/m365/outlook/commands/message/message-get.js +27 -27
  111. package/dist/m365/outlook/commands/message/message-list.js +53 -80
  112. package/dist/m365/outlook/commands/message/message-move.js +43 -40
  113. package/dist/m365/outlook/commands/message/message-remove.js +17 -45
  114. package/dist/m365/outlook/commands.js +1 -0
  115. package/dist/m365/spe/commands/container/container-get.js +54 -26
  116. package/dist/m365/spe/commands/container/container-permission-list.js +43 -4
  117. package/dist/m365/spe/commands/container/container-set.js +77 -0
  118. package/dist/m365/spe/commands.js +1 -0
  119. package/dist/m365/spo/commands/file/file-unarchive.js +83 -0
  120. package/dist/m365/spo/commands/folder/folder-archive.js +89 -0
  121. package/dist/m365/spo/commands/list/list-sensitivitylabel-remove.js +83 -0
  122. package/dist/m365/spo/commands.js +3 -0
  123. package/dist/m365/viva/commands/engage/engage-role-member-add.js +79 -0
  124. package/dist/m365/viva/commands.js +1 -0
  125. package/docs/docs/cmd/outlook/calendar/calendar-get.mdx +7 -7
  126. package/docs/docs/cmd/outlook/calendar/calendar-list.mdx +155 -0
  127. package/docs/docs/cmd/spe/container/container-get.mdx +24 -3
  128. package/docs/docs/cmd/spe/container/container-permission-list.mdx +24 -3
  129. package/docs/docs/cmd/spe/container/container-set.mdx +160 -0
  130. package/docs/docs/cmd/spo/app/app-add.mdx +19 -0
  131. package/docs/docs/cmd/spo/app/app-deploy.mdx +21 -0
  132. package/docs/docs/cmd/spo/app/app-get.mdx +19 -0
  133. package/docs/docs/cmd/spo/app/app-install.mdx +21 -0
  134. package/docs/docs/cmd/spo/app/app-instance-list.mdx +19 -0
  135. package/docs/docs/cmd/spo/app/app-list.mdx +19 -0
  136. package/docs/docs/cmd/spo/app/app-remove.mdx +21 -0
  137. package/docs/docs/cmd/spo/app/app-retract.mdx +21 -0
  138. package/docs/docs/cmd/spo/app/app-teamspackage-download.mdx +21 -0
  139. package/docs/docs/cmd/spo/app/app-uninstall.mdx +21 -0
  140. package/docs/docs/cmd/spo/app/app-upgrade.mdx +21 -0
  141. package/docs/docs/cmd/spo/apppage/apppage-add.mdx +19 -1
  142. package/docs/docs/cmd/spo/apppage/apppage-set.mdx +21 -0
  143. package/docs/docs/cmd/spo/commandset/commandset-add.mdx +19 -0
  144. package/docs/docs/cmd/spo/commandset/commandset-get.mdx +19 -0
  145. package/docs/docs/cmd/spo/commandset/commandset-list.mdx +19 -0
  146. package/docs/docs/cmd/spo/commandset/commandset-remove.mdx +21 -0
  147. package/docs/docs/cmd/spo/commandset/commandset-set.mdx +21 -0
  148. package/docs/docs/cmd/spo/file/file-unarchive.mdx +68 -0
  149. package/docs/docs/cmd/spo/folder/folder-archive.mdx +73 -0
  150. package/docs/docs/cmd/spo/list/list-sensitivitylabel-remove.mdx +77 -0
  151. package/docs/docs/cmd/viva/engage/engage-role-member-add.mdx +76 -0
  152. package/npm-shrinkwrap.json +280 -128
  153. package/package.json +18 -18
@@ -1,15 +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 _EntraPimRoleRequestListCommand_instances, _EntraPimRoleRequestListCommand_initTelemetry, _EntraPimRoleRequestListCommand_initOptions, _EntraPimRoleRequestListCommand_initValidators, _EntraPimRoleRequestListCommand_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 { validation } from '../../../../utils/validation.js';
10
6
  import { entraUser } from '../../../../utils/entraUser.js';
11
7
  import { entraGroup } from '../../../../utils/entraGroup.js';
12
8
  import { odata } from '../../../../utils/odata.js';
9
+ const allowedStatuses = ['Canceled', 'Denied', 'Failed', 'Granted', 'PendingAdminDecision', 'PendingApproval', 'PendingProvisioning', 'PendingScheduleCreation', 'Provisioned', 'Revoked', 'ScheduleCreated'];
10
+ export const options = z.strictObject({
11
+ ...globalOptionsZod.shape,
12
+ userId: z.uuid().optional(),
13
+ userName: z.string().refine(upn => validation.isValidUserPrincipalName(upn), {
14
+ error: e => `'${e.input}' is not a valid user principal name for option 'userName'.`
15
+ }).optional(),
16
+ groupId: z.uuid().optional(),
17
+ groupName: z.string().optional(),
18
+ createdDateTime: z.string().refine(date => validation.isValidISODateTime(date), {
19
+ error: e => `'${e.input}' is not a valid ISO 8601 date time string for option 'createdDateTime'.`
20
+ }).optional().alias('c'),
21
+ status: z.preprocess(val => {
22
+ const target = String(val).toLowerCase();
23
+ return allowedStatuses.find(s => s.toLowerCase() === target) ?? val;
24
+ }, z.enum(allowedStatuses)).optional().alias('s'),
25
+ withPrincipalDetails: z.boolean().default(false)
26
+ });
13
27
  class EntraPimRoleRequestListCommand extends GraphCommand {
14
28
  get name() {
15
29
  return commands.PIM_ROLE_REQUEST_LIST;
@@ -17,18 +31,25 @@ class EntraPimRoleRequestListCommand extends GraphCommand {
17
31
  get description() {
18
32
  return 'Retrieves a list of PIM requests for roles';
19
33
  }
34
+ get schema() {
35
+ return options;
36
+ }
37
+ getRefinedSchema(schema) {
38
+ return schema
39
+ .refine(options => {
40
+ const specified = [options.userId, options.userName, options.groupId, options.groupName].filter(o => o !== undefined).length;
41
+ return specified <= 1;
42
+ }, {
43
+ message: 'Specify only one of the following options: userId, userName, groupId, groupName',
44
+ params: {
45
+ customCode: 'optionSet',
46
+ options: ['userId', 'userName', 'groupId', 'groupName']
47
+ }
48
+ });
49
+ }
20
50
  defaultProperties() {
21
51
  return ['id', 'roleDefinitionName', 'principalId'];
22
52
  }
23
- constructor() {
24
- super();
25
- _EntraPimRoleRequestListCommand_instances.add(this);
26
- this.allowedStatuses = ['Canceled', 'Denied', 'Failed', 'Granted', 'PendingAdminDecision', 'PendingApproval', 'PendingProvisioning', 'PendingScheduleCreation', 'Provisioned', 'Revoked', 'ScheduleCreated'];
27
- __classPrivateFieldGet(this, _EntraPimRoleRequestListCommand_instances, "m", _EntraPimRoleRequestListCommand_initTelemetry).call(this);
28
- __classPrivateFieldGet(this, _EntraPimRoleRequestListCommand_instances, "m", _EntraPimRoleRequestListCommand_initOptions).call(this);
29
- __classPrivateFieldGet(this, _EntraPimRoleRequestListCommand_instances, "m", _EntraPimRoleRequestListCommand_initValidators).call(this);
30
- __classPrivateFieldGet(this, _EntraPimRoleRequestListCommand_instances, "m", _EntraPimRoleRequestListCommand_initOptionSets).call(this);
31
- }
32
53
  async commandAction(logger, args) {
33
54
  if (this.verbose) {
34
55
  await logger.logToStderr(`Retrieving list of PIM roles requests for ${args.options.userId || args.options.userName || args.options.groupId || args.options.groupName || 'all users'}...`);
@@ -91,59 +112,5 @@ class EntraPimRoleRequestListCommand extends GraphCommand {
91
112
  return principalId;
92
113
  }
93
114
  }
94
- _EntraPimRoleRequestListCommand_instances = new WeakSet(), _EntraPimRoleRequestListCommand_initTelemetry = function _EntraPimRoleRequestListCommand_initTelemetry() {
95
- this.telemetry.push((args) => {
96
- Object.assign(this.telemetryProperties, {
97
- userId: typeof args.options.userId !== 'undefined',
98
- userName: typeof args.options.userName !== 'undefined',
99
- groupId: typeof args.options.groupId !== 'undefined',
100
- groupName: typeof args.options.groupName !== 'undefined',
101
- createdDateTime: typeof args.options.createdDateTime !== 'undefined',
102
- status: typeof args.options.status !== 'undefined',
103
- withPrincipalDetails: !!args.options.withPrincipalDetails
104
- });
105
- });
106
- }, _EntraPimRoleRequestListCommand_initOptions = function _EntraPimRoleRequestListCommand_initOptions() {
107
- this.options.unshift({
108
- option: '--userId [userId]'
109
- }, {
110
- option: '--userName [userName]'
111
- }, {
112
- option: '--groupId [groupId]'
113
- }, {
114
- option: '--groupName [groupName]'
115
- }, {
116
- option: '-c, --createdDateTime [createdDateTime]'
117
- }, {
118
- option: '-s, --status [status]',
119
- autocomplete: this.allowedStatuses
120
- }, {
121
- option: '--withPrincipalDetails'
122
- });
123
- }, _EntraPimRoleRequestListCommand_initValidators = function _EntraPimRoleRequestListCommand_initValidators() {
124
- this.validators.push(async (args) => {
125
- if (args.options.userId && !validation.isValidGuid(args.options.userId)) {
126
- return `'${args.options.userId}' is not a valid GUID for option 'userId'`;
127
- }
128
- if (args.options.userName && !validation.isValidUserPrincipalName(args.options.userName)) {
129
- return `'${args.options.userName}' is not a valid user principal name for option 'userName'.`;
130
- }
131
- if (args.options.groupId && !validation.isValidGuid(args.options.groupId)) {
132
- return `'${args.options.groupId}' is not a valid GUID for option 'groupId'`;
133
- }
134
- if (args.options.createdDateTime && !validation.isValidISODateTime(args.options.createdDateTime)) {
135
- return `'${args.options.createdDateTime}' is not a valid ISO 8601 date time string for option 'createdDateTime'`;
136
- }
137
- if (args.options.status && !this.allowedStatuses.some(status => status.toLowerCase() === args.options.status.toLowerCase())) {
138
- return `'${args.options.status}' for option 'status' must be one of the following values: ${this.allowedStatuses.join(', ')}.`;
139
- }
140
- return true;
141
- });
142
- }, _EntraPimRoleRequestListCommand_initOptionSets = function _EntraPimRoleRequestListCommand_initOptionSets() {
143
- this.optionSets.push({
144
- options: ['userId', 'userName', 'groupId', 'groupName'],
145
- runsWhen: (args) => args.options.userId || args.options.userName || args.options.groupId || args.options.groupName
146
- });
147
- };
148
115
  export default new EntraPimRoleRequestListCommand();
149
116
  //# sourceMappingURL=pim-role-request-list.js.map
@@ -1,16 +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 _EntraPolicyListCommand_instances, _a, _EntraPolicyListCommand_initTelemetry, _EntraPolicyListCommand_initOptions, _EntraPolicyListCommand_initValidators;
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';
10
6
  const policyEndPoints = {
11
7
  activitybasedtimeout: "activityBasedTimeoutPolicies",
12
8
  adminconsentrequest: "adminConsentRequestPolicy",
13
- appManagement: "appManagementPolicies",
9
+ appmanagement: "appManagementPolicies",
14
10
  authenticationflows: "authenticationFlowsPolicy",
15
11
  authenticationmethods: "authenticationMethodsPolicy",
16
12
  authenticationstrength: "authenticationStrengthPolicies",
@@ -28,6 +24,14 @@ const policyEndPoints = {
28
24
  tokenissuance: "tokenIssuancePolicies",
29
25
  tokenlifetime: "tokenLifetimePolicies"
30
26
  };
27
+ const supportedPolicyTypes = ['activityBasedTimeout', 'adminConsentRequest', 'appManagement', 'authenticationFlows', 'authenticationMethods', 'authenticationStrength', 'authorization', 'claimsMapping', 'conditionalAccess', 'crossTenantAccess', 'defaultAppManagement', 'deviceRegistration', 'featureRolloutPolicy', 'homeRealmDiscovery', 'identitySecurityDefaultsEnforcement', 'permissionGrant', 'roleManagement', 'tokenIssuance', 'tokenLifetime'];
28
+ export const options = z.strictObject({
29
+ ...globalOptionsZod.shape,
30
+ type: z.preprocess(val => {
31
+ const target = String(val).toLowerCase();
32
+ return supportedPolicyTypes.find(t => t.toLowerCase() === target) ?? val;
33
+ }, z.enum(supportedPolicyTypes)).optional().alias('t')
34
+ });
31
35
  class EntraPolicyListCommand extends GraphCommand {
32
36
  get name() {
33
37
  return commands.POLICY_LIST;
@@ -35,12 +39,8 @@ class EntraPolicyListCommand extends GraphCommand {
35
39
  get description() {
36
40
  return 'Returns policies from Entra ID';
37
41
  }
38
- constructor() {
39
- super();
40
- _EntraPolicyListCommand_instances.add(this);
41
- __classPrivateFieldGet(this, _EntraPolicyListCommand_instances, "m", _EntraPolicyListCommand_initTelemetry).call(this);
42
- __classPrivateFieldGet(this, _EntraPolicyListCommand_instances, "m", _EntraPolicyListCommand_initOptions).call(this);
43
- __classPrivateFieldGet(this, _EntraPolicyListCommand_instances, "m", _EntraPolicyListCommand_initValidators).call(this);
42
+ get schema() {
43
+ return options;
44
44
  }
45
45
  defaultProperties() {
46
46
  return ['id', 'displayName', 'isOrganizationDefault'];
@@ -96,48 +96,5 @@ class EntraPolicyListCommand extends GraphCommand {
96
96
  }
97
97
  }
98
98
  }
99
- _a = EntraPolicyListCommand, _EntraPolicyListCommand_instances = new WeakSet(), _EntraPolicyListCommand_initTelemetry = function _EntraPolicyListCommand_initTelemetry() {
100
- this.telemetry.push((args) => {
101
- Object.assign(this.telemetryProperties, {
102
- policyType: args.options.type || 'all'
103
- });
104
- });
105
- }, _EntraPolicyListCommand_initOptions = function _EntraPolicyListCommand_initOptions() {
106
- this.options.unshift({
107
- option: '-t, --type [type]',
108
- autocomplete: _a.supportedPolicyTypes
109
- });
110
- }, _EntraPolicyListCommand_initValidators = function _EntraPolicyListCommand_initValidators() {
111
- this.validators.push(async (args) => {
112
- if (args.options.type) {
113
- const policyType = args.options.type.toLowerCase();
114
- if (!_a.supportedPolicyTypes.find(p => p.toLowerCase() === policyType)) {
115
- return `${args.options.type} is not a valid type. Allowed values are ${_a.supportedPolicyTypes.join(', ')}`;
116
- }
117
- }
118
- return true;
119
- });
120
- };
121
- EntraPolicyListCommand.supportedPolicyTypes = [
122
- 'activityBasedTimeout',
123
- 'adminConsentRequest',
124
- 'appManagement',
125
- 'authenticationFlows',
126
- 'authenticationMethods',
127
- 'authenticationStrength',
128
- 'authorization',
129
- 'claimsMapping',
130
- 'conditionalAccess',
131
- 'crossTenantAccess',
132
- 'defaultAppManagement',
133
- 'deviceRegistration',
134
- 'featureRolloutPolicy',
135
- 'homeRealmDiscovery',
136
- 'identitySecurityDefaultsEnforcement',
137
- 'permissionGrant',
138
- 'roleManagement',
139
- 'tokenIssuance',
140
- 'tokenLifetime'
141
- ];
142
99
  export default new EntraPolicyListCommand();
143
100
  //# sourceMappingURL=policy-list.js.map
@@ -1,13 +1,33 @@
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 _EntraUserAddCommand_instances, _EntraUserAddCommand_initTelemetry, _EntraUserAddCommand_initOptions, _EntraUserAddCommand_initValidators, _EntraUserAddCommand_initOptionSets, _EntraUserAddCommand_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';
7
+ export const options = z.looseObject({
8
+ ...globalOptionsZod.shape,
9
+ displayName: z.string(),
10
+ userName: z.string().refine(name => validation.isValidUserPrincipalName(name), {
11
+ error: e => `'${e.input}' is not a valid userName.`
12
+ }),
13
+ accountEnabled: z.boolean().optional(),
14
+ mailNickname: z.string().optional(),
15
+ password: z.string().optional(),
16
+ firstName: z.string().max(64, { error: `The maximum amount of characters for 'firstName' is 64.` }).optional(),
17
+ lastName: z.string().max(64, { error: `The maximum amount of characters for 'lastName' is 64.` }).optional(),
18
+ forceChangePasswordNextSignIn: z.boolean().optional(),
19
+ forceChangePasswordNextSignInWithMfa: z.boolean().optional(),
20
+ usageLocation: z.string().regex(/^[a-zA-Z]{2}$/, { error: e => `'${e.input}' is not a valid usageLocation.` }).optional(),
21
+ officeLocation: z.string().optional(),
22
+ jobTitle: z.string().max(128, { error: `The maximum amount of characters for 'jobTitle' is 128.` }).optional(),
23
+ companyName: z.string().max(64, { error: `The maximum amount of characters for 'companyName' is 64.` }).optional(),
24
+ department: z.string().max(64, { error: `The maximum amount of characters for 'department' is 64.` }).optional(),
25
+ preferredLanguage: z.string().min(2, { error: e => `'${e.input}' is not a valid preferredLanguage.` }).optional(),
26
+ managerUserId: z.uuid().optional(),
27
+ managerUserName: z.string().refine(name => validation.isValidUserPrincipalName(name), {
28
+ error: e => `'${e.input}' is not a valid user principal name.`
29
+ }).optional()
30
+ });
11
31
  class EntraUserAddCommand extends GraphCommand {
12
32
  get name() {
13
33
  return commands.USER_ADD;
@@ -18,14 +38,18 @@ class EntraUserAddCommand extends GraphCommand {
18
38
  allowUnknownOptions() {
19
39
  return true;
20
40
  }
21
- constructor() {
22
- super();
23
- _EntraUserAddCommand_instances.add(this);
24
- __classPrivateFieldGet(this, _EntraUserAddCommand_instances, "m", _EntraUserAddCommand_initTelemetry).call(this);
25
- __classPrivateFieldGet(this, _EntraUserAddCommand_instances, "m", _EntraUserAddCommand_initOptions).call(this);
26
- __classPrivateFieldGet(this, _EntraUserAddCommand_instances, "m", _EntraUserAddCommand_initValidators).call(this);
27
- __classPrivateFieldGet(this, _EntraUserAddCommand_instances, "m", _EntraUserAddCommand_initOptionSets).call(this);
28
- __classPrivateFieldGet(this, _EntraUserAddCommand_instances, "m", _EntraUserAddCommand_initTypes).call(this);
41
+ get schema() {
42
+ return options;
43
+ }
44
+ getRefinedSchema(schema) {
45
+ return schema
46
+ .refine(options => !(options.managerUserId && options.managerUserName), {
47
+ error: `Specify either 'managerUserId' or 'managerUserName', but not both.`,
48
+ params: {
49
+ customCode: 'optionSet',
50
+ options: ['managerUserId', 'managerUserName']
51
+ }
52
+ });
29
53
  }
30
54
  async commandAction(logger, args) {
31
55
  if (this.verbose) {
@@ -81,7 +105,7 @@ class EntraUserAddCommand extends GraphCommand {
81
105
  department: options.department,
82
106
  preferredLanguage: options.preferredLanguage
83
107
  };
84
- this.addUnknownOptionsToPayload(requestBody, options);
108
+ this.addUnknownOptionsToPayloadZod(requestBody, options);
85
109
  return requestBody;
86
110
  }
87
111
  /**
@@ -112,108 +136,5 @@ class EntraUserAddCommand extends GraphCommand {
112
136
  return characterArray;
113
137
  }
114
138
  }
115
- _EntraUserAddCommand_instances = new WeakSet(), _EntraUserAddCommand_initTelemetry = function _EntraUserAddCommand_initTelemetry() {
116
- this.telemetry.push((args) => {
117
- Object.assign(this.telemetryProperties, {
118
- accountEnabled: typeof args.options.accountEnabled !== 'undefined',
119
- mailNickname: typeof args.options.mailNickname !== 'undefined',
120
- password: typeof args.options.password !== 'undefined',
121
- firstName: typeof args.options.firstName !== 'undefined',
122
- lastName: typeof args.options.lastName !== 'undefined',
123
- forceChangePasswordNextSignIn: !!args.options.forceChangePasswordNextSignIn,
124
- forceChangePasswordNextSignInWithMfa: !!args.options.forceChangePasswordNextSignInWithMfa,
125
- usageLocation: typeof args.options.usageLocation !== 'undefined',
126
- officeLocation: typeof args.options.officeLocation !== 'undefined',
127
- jobTitle: typeof args.options.jobTitle !== 'undefined',
128
- companyName: typeof args.options.companyName !== 'undefined',
129
- department: typeof args.options.department !== 'undefined',
130
- preferredLanguage: typeof args.options.preferredLanguage !== 'undefined',
131
- managerUserId: typeof args.options.managerUserId !== 'undefined',
132
- managerUserName: typeof args.options.managerUserName !== 'undefined'
133
- });
134
- this.trackUnknownOptions(this.telemetryProperties, args.options);
135
- });
136
- }, _EntraUserAddCommand_initOptions = function _EntraUserAddCommand_initOptions() {
137
- this.options.unshift({
138
- option: '--displayName <displayName>'
139
- }, {
140
- option: '--userName <userName>'
141
- }, {
142
- option: '--accountEnabled [accountEnabled]',
143
- autocomplete: ['true', 'false']
144
- }, {
145
- option: '--mailNickname [mailNickname]'
146
- }, {
147
- option: '--password [password]'
148
- }, {
149
- option: '--firstName [firstName]'
150
- }, {
151
- option: '--lastName [lastName]'
152
- }, {
153
- option: '--forceChangePasswordNextSignIn'
154
- }, {
155
- option: '--forceChangePasswordNextSignInWithMfa'
156
- }, {
157
- option: '--usageLocation [usageLocation]'
158
- }, {
159
- option: '--officeLocation [officeLocation]'
160
- }, {
161
- option: '--jobTitle [jobTitle]'
162
- }, {
163
- option: '--companyName [companyName]'
164
- }, {
165
- option: '--department [department]'
166
- }, {
167
- option: '--preferredLanguage [preferredLanguage]'
168
- }, {
169
- option: '--managerUserId [managerUserId]'
170
- }, {
171
- option: '--managerUserName [managerUserName]'
172
- });
173
- }, _EntraUserAddCommand_initValidators = function _EntraUserAddCommand_initValidators() {
174
- this.validators.push(async (args) => {
175
- if (!validation.isValidUserPrincipalName(args.options.userName)) {
176
- return `${args.options.userName} is not a valid userName`;
177
- }
178
- if (args.options.usageLocation) {
179
- const regex = new RegExp('^[a-zA-Z]{2}$');
180
- if (!regex.test(args.options.usageLocation)) {
181
- return `'${args.options.usageLocation}' is not a valid usageLocation.`;
182
- }
183
- }
184
- if (args.options.preferredLanguage && args.options.preferredLanguage.length < 2) {
185
- return `'${args.options.preferredLanguage}' is not a valid preferredLanguage`;
186
- }
187
- if (args.options.firstName && args.options.firstName.length > 64) {
188
- return `The maximum amount of characters for 'firstName' is 64.`;
189
- }
190
- if (args.options.lastName && args.options.lastName.length > 64) {
191
- return `The maximum amount of characters for 'lastName' is 64.`;
192
- }
193
- if (args.options.jobTitle && args.options.jobTitle.length > 128) {
194
- return `The maximum amount of characters for 'jobTitle' is 128.`;
195
- }
196
- if (args.options.companyName && args.options.companyName.length > 64) {
197
- return `The maximum amount of characters for 'companyName' is 64.`;
198
- }
199
- if (args.options.department && args.options.department.length > 64) {
200
- return `The maximum amount of characters for 'department' is 64.`;
201
- }
202
- if (args.options.managerUserName && !validation.isValidUserPrincipalName(args.options.managerUserName)) {
203
- return `'${args.options.managerUserName}' is not a valid user principal name.`;
204
- }
205
- if (args.options.managerUserId && !validation.isValidGuid(args.options.managerUserId)) {
206
- return `'${args.options.managerUserId}' is not a valid GUID.`;
207
- }
208
- return true;
209
- });
210
- }, _EntraUserAddCommand_initOptionSets = function _EntraUserAddCommand_initOptionSets() {
211
- this.optionSets.push({
212
- options: ['managerUserId', 'managerUserName'],
213
- runsWhen: (args) => args.options.managerId || args.options.managerUserName
214
- });
215
- }, _EntraUserAddCommand_initTypes = function _EntraUserAddCommand_initTypes() {
216
- this.types.boolean.push('accountEnabled');
217
- };
218
139
  export default new EntraUserAddCommand();
219
140
  //# sourceMappingURL=user-add.js.map
@@ -1,15 +1,21 @@
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 _EntraUserGetCommand_instances, _EntraUserGetCommand_initTelemetry, _EntraUserGetCommand_initOptions, _EntraUserGetCommand_initValidators, _EntraUserGetCommand_initOptionSets;
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';
12
8
  import { formatting } from '../../../../utils/formatting.js';
9
+ export const options = z.strictObject({
10
+ ...globalOptionsZod.shape,
11
+ id: z.uuid().optional().alias('i'),
12
+ userName: z.string().refine(name => validation.isValidUserPrincipalName(name), {
13
+ error: e => `'${e.input}' is not a valid userName.`
14
+ }).optional().alias('n'),
15
+ email: z.string().optional(),
16
+ properties: z.string().optional().alias('p'),
17
+ withManager: z.boolean().optional()
18
+ });
13
19
  class EntraUserGetCommand extends GraphCommand {
14
20
  get name() {
15
21
  return commands.USER_GET;
@@ -17,13 +23,18 @@ class EntraUserGetCommand extends GraphCommand {
17
23
  get description() {
18
24
  return 'Gets information about the specified user';
19
25
  }
20
- constructor() {
21
- super();
22
- _EntraUserGetCommand_instances.add(this);
23
- __classPrivateFieldGet(this, _EntraUserGetCommand_instances, "m", _EntraUserGetCommand_initTelemetry).call(this);
24
- __classPrivateFieldGet(this, _EntraUserGetCommand_instances, "m", _EntraUserGetCommand_initOptions).call(this);
25
- __classPrivateFieldGet(this, _EntraUserGetCommand_instances, "m", _EntraUserGetCommand_initValidators).call(this);
26
- __classPrivateFieldGet(this, _EntraUserGetCommand_instances, "m", _EntraUserGetCommand_initOptionSets).call(this);
26
+ get schema() {
27
+ return options;
28
+ }
29
+ getRefinedSchema(schema) {
30
+ return schema
31
+ .refine(options => [options.id, options.userName, options.email].filter(o => o !== undefined).length === 1, {
32
+ error: `Specify either 'id', 'userName', or 'email'.`,
33
+ params: {
34
+ customCode: 'optionSet',
35
+ options: ['id', 'userName', 'email']
36
+ }
37
+ });
27
38
  }
28
39
  async commandAction(logger, args) {
29
40
  try {
@@ -71,41 +82,5 @@ class EntraUserGetCommand extends GraphCommand {
71
82
  : `${this.resource}/v1.0/users/${userIdOrPrincipalName}${queryString}`;
72
83
  }
73
84
  }
74
- _EntraUserGetCommand_instances = new WeakSet(), _EntraUserGetCommand_initTelemetry = function _EntraUserGetCommand_initTelemetry() {
75
- this.telemetry.push((args) => {
76
- Object.assign(this.telemetryProperties, {
77
- id: typeof args.options.id !== 'undefined',
78
- userName: typeof args.options.userName !== 'undefined',
79
- email: typeof args.options.email !== 'undefined',
80
- properties: args.options.properties,
81
- withManager: typeof args.options.withManager !== 'undefined'
82
- });
83
- });
84
- }, _EntraUserGetCommand_initOptions = function _EntraUserGetCommand_initOptions() {
85
- this.options.unshift({
86
- option: '-i, --id [id]'
87
- }, {
88
- option: '-n, --userName [userName]'
89
- }, {
90
- option: '--email [email]'
91
- }, {
92
- option: '-p, --properties [properties]'
93
- }, {
94
- option: '--withManager'
95
- });
96
- }, _EntraUserGetCommand_initValidators = function _EntraUserGetCommand_initValidators() {
97
- this.validators.push(async (args) => {
98
- if (args.options.id &&
99
- !validation.isValidGuid(args.options.id)) {
100
- return `${args.options.id} is not a valid GUID`;
101
- }
102
- if (args.options.userName && !validation.isValidUserPrincipalName(args.options.userName)) {
103
- return `${args.options.userName} is not a valid userName`;
104
- }
105
- return true;
106
- });
107
- }, _EntraUserGetCommand_initOptionSets = function _EntraUserGetCommand_initOptionSets() {
108
- this.optionSets.push({ options: ['id', 'userName', 'email'] });
109
- };
110
85
  export default new EntraUserGetCommand();
111
86
  //# sourceMappingURL=user-get.js.map
@@ -1,14 +1,21 @@
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 _EntraUserGroupmembershipListCommand_instances, _EntraUserGroupmembershipListCommand_initTelemetry, _EntraUserGroupmembershipListCommand_initOptions, _EntraUserGroupmembershipListCommand_initValidators, _EntraUserGroupmembershipListCommand_initOptionSets;
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
+ userId: z.uuid().optional().alias('i'),
11
+ userName: z.string().refine(name => validation.isValidUserPrincipalName(name), {
12
+ error: e => `'${e.input}' is not a valid user principal name.`
13
+ }).optional().alias('n'),
14
+ userEmail: z.string().refine(email => validation.isValidUserPrincipalName(email), {
15
+ error: e => `'${e.input}' is not a valid user email.`
16
+ }).optional().alias('e'),
17
+ securityEnabledOnly: z.boolean().optional()
18
+ });
12
19
  class EntraUserGroupmembershipListCommand extends GraphCommand {
13
20
  get name() {
14
21
  return commands.USER_GROUPMEMBERSHIP_LIST;
@@ -16,13 +23,18 @@ class EntraUserGroupmembershipListCommand extends GraphCommand {
16
23
  get description() {
17
24
  return 'Retrieves all groups where the user is a member of';
18
25
  }
19
- constructor() {
20
- super();
21
- _EntraUserGroupmembershipListCommand_instances.add(this);
22
- __classPrivateFieldGet(this, _EntraUserGroupmembershipListCommand_instances, "m", _EntraUserGroupmembershipListCommand_initTelemetry).call(this);
23
- __classPrivateFieldGet(this, _EntraUserGroupmembershipListCommand_instances, "m", _EntraUserGroupmembershipListCommand_initOptions).call(this);
24
- __classPrivateFieldGet(this, _EntraUserGroupmembershipListCommand_instances, "m", _EntraUserGroupmembershipListCommand_initValidators).call(this);
25
- __classPrivateFieldGet(this, _EntraUserGroupmembershipListCommand_instances, "m", _EntraUserGroupmembershipListCommand_initOptionSets).call(this);
26
+ get schema() {
27
+ return options;
28
+ }
29
+ getRefinedSchema(schema) {
30
+ return schema
31
+ .refine(options => [options.userId, options.userName, options.userEmail].filter(o => o !== undefined).length === 1, {
32
+ error: `Specify either 'userId', 'userName', or 'userEmail'.`,
33
+ params: {
34
+ customCode: 'optionSet',
35
+ options: ['userId', 'userName', 'userEmail']
36
+ }
37
+ });
26
38
  }
27
39
  async commandAction(logger, args) {
28
40
  let userId = args.options.userId;
@@ -53,40 +65,5 @@ class EntraUserGroupmembershipListCommand extends GraphCommand {
53
65
  }
54
66
  }
55
67
  }
56
- _EntraUserGroupmembershipListCommand_instances = new WeakSet(), _EntraUserGroupmembershipListCommand_initTelemetry = function _EntraUserGroupmembershipListCommand_initTelemetry() {
57
- this.telemetry.push((args) => {
58
- Object.assign(this.telemetryProperties, {
59
- userId: typeof args.options.userId !== 'undefined',
60
- userName: typeof args.options.userName !== 'undefined',
61
- userEmail: typeof args.options.userEmail !== 'undefined',
62
- securityEnabledOnly: !!args.options.securityEnabledOnly
63
- });
64
- });
65
- }, _EntraUserGroupmembershipListCommand_initOptions = function _EntraUserGroupmembershipListCommand_initOptions() {
66
- this.options.unshift({
67
- option: '-i, --userId [userId]'
68
- }, {
69
- option: '-n, --userName [userName]'
70
- }, {
71
- option: '-e, --userEmail [userEmail]'
72
- }, {
73
- option: '--securityEnabledOnly [securityEnabledOnly]'
74
- });
75
- }, _EntraUserGroupmembershipListCommand_initValidators = function _EntraUserGroupmembershipListCommand_initValidators() {
76
- this.validators.push(async (args) => {
77
- if (args.options.userId && !validation.isValidGuid(args.options.userId)) {
78
- return `${args.options.userId} is not a valid GUID`;
79
- }
80
- if (args.options.userName && !validation.isValidUserPrincipalName(args.options.userName)) {
81
- return `${args.options.userName} is not a valid user principal name`;
82
- }
83
- if (args.options.userEmail && !validation.isValidUserPrincipalName(args.options.userEmail)) {
84
- return `${args.options.userEmail} is not a valid user email`;
85
- }
86
- return true;
87
- });
88
- }, _EntraUserGroupmembershipListCommand_initOptionSets = function _EntraUserGroupmembershipListCommand_initOptionSets() {
89
- this.optionSets.push({ options: ['userId', 'userName', 'userEmail'] });
90
- };
91
68
  export default new EntraUserGroupmembershipListCommand();
92
69
  //# sourceMappingURL=user-groupmembership-list.js.map