@pnp/cli-microsoft365 12.1.0-beta.0c2915d → 12.1.0-beta.81e442d

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 (83) hide show
  1. package/allCommands.json +1 -1
  2. package/allCommandsFull.json +1 -1
  3. package/dist/cli/cli.js +12 -7
  4. package/dist/m365/entra/commands/app/app-add.js +106 -150
  5. package/dist/m365/entra/commands/app/app-get.js +22 -38
  6. package/dist/m365/entra/commands/app/app-list.js +10 -22
  7. package/dist/m365/entra/commands/app/app-permission-add.js +36 -50
  8. package/dist/m365/entra/commands/app/app-permission-list.js +29 -48
  9. package/dist/m365/entra/commands/app/app-permission-remove.js +44 -82
  10. package/dist/m365/entra/commands/app/app-remove.js +21 -38
  11. package/dist/m365/entra/commands/app/app-role-add.js +32 -46
  12. package/dist/m365/entra/commands/app/app-role-list.js +20 -25
  13. package/dist/m365/entra/commands/app/app-role-remove.js +33 -41
  14. package/dist/m365/entra/commands/app/app-set.js +46 -69
  15. package/dist/m365/spfx/commands/package/package-generate.js +30 -51
  16. package/dist/m365/spfx/commands/project/project-azuredevops-pipeline-add.js +27 -62
  17. package/dist/m365/spfx/commands/project/project-doctor.js +20 -51
  18. package/dist/m365/spfx/commands/project/project-externalize.js +16 -26
  19. package/dist/m365/spfx/commands/project/project-github-workflow-add.js +28 -65
  20. package/dist/m365/spfx/commands/project/project-permissions-grant.js +4 -2
  21. package/dist/m365/spfx/commands/project/project-rename.js +17 -29
  22. package/dist/m365/spfx/commands/project/project-upgrade.js +0 -3
  23. package/dist/m365/spfx/commands/spfx-doctor.js +23 -47
  24. package/dist/m365/spo/commands/page/page-add.js +31 -68
  25. package/dist/m365/spo/commands/page/page-clientsidewebpart-add.js +74 -101
  26. package/dist/m365/spo/commands/page/page-column-get.js +15 -32
  27. package/dist/m365/spo/commands/page/page-column-list.js +14 -27
  28. package/dist/m365/spo/commands/page/page-control-get.js +18 -27
  29. package/dist/m365/spo/commands/page/page-control-list.js +13 -20
  30. package/dist/m365/spo/commands/page/page-control-remove.js +1 -1
  31. package/dist/m365/spo/commands/page/page-control-set.js +51 -61
  32. package/dist/m365/spo/commands/page/page-copy.js +15 -31
  33. package/dist/m365/spo/commands/page/page-header-set.js +25 -89
  34. package/dist/m365/spo/commands/page/page-list.js +12 -18
  35. package/dist/m365/spo/commands/page/page-remove.js +16 -39
  36. package/dist/m365/spo/commands/page/page-section-add.js +108 -173
  37. package/dist/m365/spo/commands/page/page-section-get.js +17 -27
  38. package/dist/m365/spo/commands/page/page-section-list.js +13 -20
  39. package/dist/m365/spo/commands/page/page-section-remove.js +4 -1
  40. package/dist/m365/spo/commands/page/page-set.js +50 -100
  41. package/dist/m365/spo/commands/page/page-template-list.js +12 -18
  42. package/dist/m365/spo/commands/page/page-text-add.js +23 -45
  43. package/dist/m365/viva/commands/connections/connections-app-create.js +36 -42
  44. package/dist/m365/viva/commands/engage/engage-community-add.js +75 -71
  45. package/dist/m365/viva/commands/engage/engage-community-get.js +8 -16
  46. package/dist/m365/viva/commands/engage/engage-community-list.js +5 -0
  47. package/dist/m365/viva/commands/engage/engage-community-remove.js +28 -48
  48. package/dist/m365/viva/commands/engage/engage-community-set.js +43 -66
  49. package/dist/m365/viva/commands/engage/engage-community-user-add.js +7 -12
  50. package/dist/m365/viva/commands/engage/engage-community-user-list.js +1 -1
  51. package/dist/m365/viva/commands/engage/engage-community-user-remove.js +4 -2
  52. package/dist/m365/viva/commands/engage/engage-message-add.js +22 -52
  53. package/dist/m365/viva/commands/engage/engage-message-get.js +8 -23
  54. package/dist/m365/viva/commands/engage/engage-message-like-set.js +10 -39
  55. package/dist/m365/viva/commands/engage/engage-message-list.js +22 -66
  56. package/dist/m365/viva/commands/engage/engage-message-remove.js +9 -32
  57. package/dist/m365/viva/commands/engage/engage-network-list.js +8 -22
  58. package/dist/m365/viva/commands/engage/engage-report-activitycounts.js +2 -1
  59. package/dist/m365/viva/commands/engage/engage-report-activityusercounts.js +2 -1
  60. package/dist/m365/viva/commands/engage/engage-report-activityuserdetail.js +2 -1
  61. package/dist/m365/viva/commands/engage/engage-report-deviceusagedistributionusercounts.js +2 -1
  62. package/dist/m365/viva/commands/engage/engage-report-deviceusageusercounts.js +2 -1
  63. package/dist/m365/viva/commands/engage/engage-report-deviceusageuserdetail.js +2 -1
  64. package/dist/m365/viva/commands/engage/engage-report-groupsactivitycounts.js +2 -1
  65. package/dist/m365/viva/commands/engage/engage-report-groupsactivitydetail.js +2 -1
  66. package/dist/m365/viva/commands/engage/engage-report-groupsactivitygroupcounts.js +2 -1
  67. package/dist/m365/viva/commands/engage/engage-role-list.js +5 -0
  68. package/dist/m365/viva/commands/engage/engage-role-member-add.js +3 -5
  69. package/dist/m365/viva/commands/engage/engage-role-member-list.js +1 -1
  70. package/dist/m365/viva/commands/engage/engage-role-member-remove.js +4 -2
  71. package/dist/m365/viva/commands/engage/engage-search.js +16 -65
  72. package/dist/m365/viva/commands/engage/engage-user-get.js +15 -33
  73. package/dist/m365/viva/commands/engage/engage-user-list.js +22 -57
  74. package/docs/docs/cmd/spo/listitem/listitem-record-declare.mdx +19 -0
  75. package/docs/docs/cmd/spo/listitem/listitem-record-lock.mdx +21 -0
  76. package/docs/docs/cmd/spo/listitem/listitem-record-undeclare.mdx +21 -0
  77. package/docs/docs/cmd/spo/listitem/listitem-record-unlock.mdx +21 -0
  78. package/docs/docs/cmd/spo/page/page-text-add.mdx +1 -1
  79. package/docs/docs/cmd/viva/engage/engage-community-add.mdx +19 -0
  80. package/docs/docs/cmd/viva/engage/engage-community-get.mdx +19 -0
  81. package/docs/docs/cmd/viva/engage/engage-community-remove.mdx +21 -0
  82. package/docs/docs/cmd/viva/engage/engage-community-set.mdx +19 -0
  83. package/package.json +1 -1
@@ -1,14 +1,18 @@
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 _EntraAppPermissionListCommand_instances, _EntraAppPermissionListCommand_initTelemetry, _EntraAppPermissionListCommand_initOptions, _EntraAppPermissionListCommand_initValidators, _EntraAppPermissionListCommand_initOptionSets;
7
- import GraphCommand from "../../../base/GraphCommand.js";
8
- import commands from "../../commands.js";
9
- import request from "../../../../request.js";
10
- import { validation } from "../../../../utils/validation.js";
11
- import { entraApp } from "../../../../utils/entraApp.js";
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
3
+ import GraphCommand from '../../../base/GraphCommand.js';
4
+ import commands from '../../commands.js';
5
+ import request from '../../../../request.js';
6
+ import { entraApp } from '../../../../utils/entraApp.js';
7
+ import { zod } from '../../../../utils/zod.js';
8
+ const allowedTypes = { delegated: 'delegated', application: 'application', all: 'all' };
9
+ export const options = z.strictObject({
10
+ ...globalOptionsZod.shape,
11
+ appId: z.guid().optional().alias('i'),
12
+ appName: z.string().optional().alias('n'),
13
+ appObjectId: z.guid().optional(),
14
+ type: zod.coercedEnum(allowedTypes).optional()
15
+ });
12
16
  class EntraAppPermissionListCommand extends GraphCommand {
13
17
  get name() {
14
18
  return commands.APP_PERMISSION_LIST;
@@ -16,14 +20,18 @@ class EntraAppPermissionListCommand extends GraphCommand {
16
20
  get description() {
17
21
  return 'Lists the application and delegated permissions for a specified Entra Application Registration';
18
22
  }
19
- constructor() {
20
- super();
21
- _EntraAppPermissionListCommand_instances.add(this);
22
- this.allowedTypes = ['delegated', 'application', 'all'];
23
- __classPrivateFieldGet(this, _EntraAppPermissionListCommand_instances, "m", _EntraAppPermissionListCommand_initTelemetry).call(this);
24
- __classPrivateFieldGet(this, _EntraAppPermissionListCommand_instances, "m", _EntraAppPermissionListCommand_initOptions).call(this);
25
- __classPrivateFieldGet(this, _EntraAppPermissionListCommand_instances, "m", _EntraAppPermissionListCommand_initValidators).call(this);
26
- __classPrivateFieldGet(this, _EntraAppPermissionListCommand_instances, "m", _EntraAppPermissionListCommand_initOptionSets).call(this);
23
+ get schema() {
24
+ return options;
25
+ }
26
+ getRefinedSchema(schema) {
27
+ return schema
28
+ .refine(options => [options.appId, options.appName, options.appObjectId].filter(o => o !== undefined).length === 1, {
29
+ error: 'Specify either appId, appName, or appObjectId',
30
+ params: {
31
+ customCode: 'optionSet',
32
+ options: ['appId', 'appName', 'appObjectId']
33
+ }
34
+ });
27
35
  }
28
36
  async commandAction(logger, args) {
29
37
  try {
@@ -45,11 +53,11 @@ class EntraAppPermissionListCommand extends GraphCommand {
45
53
  await logger.logToStderr(`Retrieving information about Microsoft Entra app ${appId ? appId : appName}...`);
46
54
  }
47
55
  if (appId) {
48
- const app = await entraApp.getAppRegistrationByAppId(appId, ["id"]);
56
+ const app = await entraApp.getAppRegistrationByAppId(appId, ['id']);
49
57
  return app.id;
50
58
  }
51
59
  else {
52
- const app = await entraApp.getAppRegistrationByAppName(appName, ["id"]);
60
+ const app = await entraApp.getAppRegistrationByAppName(appName, ['id']);
53
61
  return app.id;
54
62
  }
55
63
  }
@@ -152,32 +160,5 @@ class EntraAppPermissionListCommand extends GraphCommand {
152
160
  return servicePrincipal;
153
161
  }
154
162
  }
155
- _EntraAppPermissionListCommand_instances = new WeakSet(), _EntraAppPermissionListCommand_initTelemetry = function _EntraAppPermissionListCommand_initTelemetry() {
156
- this.telemetry.push((args) => {
157
- Object.assign(this.telemetryProperties, {
158
- appId: typeof args.options.appId !== 'undefined',
159
- appName: typeof args.options.appName !== 'undefined',
160
- appObjectId: typeof args.options.appObjectId !== 'undefined',
161
- type: typeof args.options.type !== 'undefined'
162
- });
163
- });
164
- }, _EntraAppPermissionListCommand_initOptions = function _EntraAppPermissionListCommand_initOptions() {
165
- this.options.unshift({ option: '-i, --appId [appId]' }, { option: '-n, --appName [appName]' }, { option: '--appObjectId [appObjectId]' }, { option: '--type [type]', autocomplete: this.allowedTypes });
166
- }, _EntraAppPermissionListCommand_initValidators = function _EntraAppPermissionListCommand_initValidators() {
167
- this.validators.push(async (args) => {
168
- if (args.options.appId && !validation.isValidGuid(args.options.appId)) {
169
- return `${args.options.appId} is not a valid GUID`;
170
- }
171
- if (args.options.appObjectId && !validation.isValidGuid(args.options.appObjectId)) {
172
- return `${args.options.appObjectId} is not a valid GUID`;
173
- }
174
- if (args.options.type && this.allowedTypes.indexOf(args.options.type.toLowerCase()) === -1) {
175
- return `${args.options.type} is not a valid type. Allowed types are ${this.allowedTypes.join(', ')}`;
176
- }
177
- return true;
178
- });
179
- }, _EntraAppPermissionListCommand_initOptionSets = function _EntraAppPermissionListCommand_initOptionSets() {
180
- this.optionSets.push({ options: ['appId', 'appName', 'appObjectId'] });
181
- };
182
163
  export default new EntraAppPermissionListCommand();
183
164
  //# sourceMappingURL=app-permission-list.js.map
@@ -1,16 +1,28 @@
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 _EntraAppPermissionRemoveCommand_instances, _EntraAppPermissionRemoveCommand_initTelemetry, _EntraAppPermissionRemoveCommand_initOptions, _EntraAppPermissionRemoveCommand_initValidators, _EntraAppPermissionRemoveCommand_initOptionSets, _EntraAppPermissionRemoveCommand_initTypes;
7
- import { odata } from "../../../../utils/odata.js";
8
- import GraphCommand from "../../../base/GraphCommand.js";
9
- import commands from "../../commands.js";
10
- import request from "../../../../request.js";
11
- import { validation } from "../../../../utils/validation.js";
12
- import { cli } from "../../../../cli/cli.js";
13
- import { entraApp } from "../../../../utils/entraApp.js";
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
3
+ import { odata } from '../../../../utils/odata.js';
4
+ import GraphCommand from '../../../base/GraphCommand.js';
5
+ import commands from '../../commands.js';
6
+ import request from '../../../../request.js';
7
+ import { validation } from '../../../../utils/validation.js';
8
+ import { cli } from '../../../../cli/cli.js';
9
+ import { entraApp } from '../../../../utils/entraApp.js';
10
+ export const options = z.strictObject({
11
+ ...globalOptionsZod.shape,
12
+ appId: z.guid().optional().alias('i'),
13
+ appObjectId: z.guid().optional(),
14
+ appName: z.string().optional().alias('n'),
15
+ applicationPermissions: z.string()
16
+ .refine(permissions => validation.isValidPermission(permissions) === true, {
17
+ error: e => `Application permission(s) ${validation.isValidPermission(e.input).join(', ')} are not fully-qualified`
18
+ }).optional().alias('a'),
19
+ delegatedPermissions: z.string()
20
+ .refine(permissions => validation.isValidPermission(permissions) === true, {
21
+ error: e => `Delegated permission(s) ${validation.isValidPermission(e.input).join(', ')} are not fully-qualified`
22
+ }).optional().alias('d'),
23
+ revokeAdminConsent: z.boolean().optional(),
24
+ force: z.boolean().optional()
25
+ });
14
26
  var ScopeType;
15
27
  (function (ScopeType) {
16
28
  ScopeType["Role"] = "Role";
@@ -23,14 +35,25 @@ class EntraAppPermissionRemoveCommand extends GraphCommand {
23
35
  get description() {
24
36
  return 'Removes the specified application and/or delegated permissions from a specified Microsoft Entra app';
25
37
  }
26
- constructor() {
27
- super();
28
- _EntraAppPermissionRemoveCommand_instances.add(this);
29
- __classPrivateFieldGet(this, _EntraAppPermissionRemoveCommand_instances, "m", _EntraAppPermissionRemoveCommand_initTelemetry).call(this);
30
- __classPrivateFieldGet(this, _EntraAppPermissionRemoveCommand_instances, "m", _EntraAppPermissionRemoveCommand_initOptions).call(this);
31
- __classPrivateFieldGet(this, _EntraAppPermissionRemoveCommand_instances, "m", _EntraAppPermissionRemoveCommand_initValidators).call(this);
32
- __classPrivateFieldGet(this, _EntraAppPermissionRemoveCommand_instances, "m", _EntraAppPermissionRemoveCommand_initOptionSets).call(this);
33
- __classPrivateFieldGet(this, _EntraAppPermissionRemoveCommand_instances, "m", _EntraAppPermissionRemoveCommand_initTypes).call(this);
38
+ get schema() {
39
+ return options;
40
+ }
41
+ getRefinedSchema(schema) {
42
+ return schema
43
+ .refine(options => [options.appId, options.appObjectId, options.appName].filter(o => o !== undefined).length === 1, {
44
+ error: 'Specify either appId, appObjectId, or appName',
45
+ params: {
46
+ customCode: 'optionSet',
47
+ options: ['appId', 'appObjectId', 'appName']
48
+ }
49
+ })
50
+ .refine(options => options.applicationPermissions !== undefined || options.delegatedPermissions !== undefined, {
51
+ error: 'Specify either applicationPermissions or delegatedPermissions',
52
+ params: {
53
+ customCode: 'optionSet',
54
+ options: ['applicationPermissions', 'delegatedPermissions']
55
+ }
56
+ });
34
57
  }
35
58
  async commandAction(logger, args) {
36
59
  const removeAppPermissions = async () => {
@@ -237,66 +260,5 @@ class EntraAppPermissionRemoveCommand extends GraphCommand {
237
260
  });
238
261
  }
239
262
  }
240
- _EntraAppPermissionRemoveCommand_instances = new WeakSet(), _EntraAppPermissionRemoveCommand_initTelemetry = function _EntraAppPermissionRemoveCommand_initTelemetry() {
241
- this.telemetry.push((args) => {
242
- Object.assign(this.telemetryProperties, {
243
- appId: typeof args.options.appId !== 'undefined',
244
- appObjectId: typeof args.options.appObjectId !== 'undefined',
245
- appName: typeof args.options.appName !== 'undefined',
246
- applicationPermissions: typeof args.options.applicationPermissions !== 'undefined',
247
- delegatedPermissions: typeof args.options.delegatedPermissions !== 'undefined',
248
- revokeAdminConsent: !!args.options.revokeAdminConsent,
249
- force: !!args.options.force
250
- });
251
- });
252
- }, _EntraAppPermissionRemoveCommand_initOptions = function _EntraAppPermissionRemoveCommand_initOptions() {
253
- this.options.unshift({
254
- option: '-i, --appId [appId]'
255
- }, {
256
- option: '--appObjectId [appObjectId]'
257
- }, {
258
- option: '-n, --appName [appName]'
259
- }, {
260
- option: '-a, --applicationPermissions [applicationPermissions]'
261
- }, {
262
- option: '-d, --delegatedPermissions [delegatedPermissions]'
263
- }, {
264
- option: '--revokeAdminConsent'
265
- }, {
266
- option: '--force'
267
- });
268
- }, _EntraAppPermissionRemoveCommand_initValidators = function _EntraAppPermissionRemoveCommand_initValidators() {
269
- this.validators.push(async (args) => {
270
- if (args.options.appId && !validation.isValidGuid(args.options.appId)) {
271
- return `${args.options.appId} is not a valid GUID`;
272
- }
273
- if (args.options.appObjectId && !validation.isValidGuid(args.options.appObjectId)) {
274
- return `${args.options.appObjectId} is not a valid GUID`;
275
- }
276
- if (args.options.delegatedPermissions) {
277
- const invalidPermissions = validation.isValidPermission(args.options.delegatedPermissions);
278
- if (Array.isArray(invalidPermissions)) {
279
- return `Delegated permission(s) ${invalidPermissions.join(', ')} are not fully-qualified`;
280
- }
281
- }
282
- if (args.options.applicationPermissions) {
283
- const invalidPermissions = validation.isValidPermission(args.options.applicationPermissions);
284
- if (Array.isArray(invalidPermissions)) {
285
- return `Application permission(s) ${invalidPermissions.join(', ')} are not fully-qualified`;
286
- }
287
- }
288
- return true;
289
- });
290
- }, _EntraAppPermissionRemoveCommand_initOptionSets = function _EntraAppPermissionRemoveCommand_initOptionSets() {
291
- this.optionSets.push({
292
- options: ['appId', 'appObjectId', 'appName']
293
- }, {
294
- options: ['applicationPermissions', 'delegatedPermissions'],
295
- runsWhen: (args) => args.options.delegatedPermissions === undefined && args.options.applicationPermissions === undefined
296
- });
297
- }, _EntraAppPermissionRemoveCommand_initTypes = function _EntraAppPermissionRemoveCommand_initTypes() {
298
- this.types.string.push('appId', 'appObjectId', 'appName', 'applicationPermissions', 'delegatedPermissions');
299
- this.types.boolean.push('revokeAdminConsent');
300
- };
301
263
  export default new EntraAppPermissionRemoveCommand();
302
264
  //# sourceMappingURL=app-permission-remove.js.map
@@ -1,15 +1,17 @@
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 _EntraAppRemoveCommand_instances, _EntraAppRemoveCommand_initTelemetry, _EntraAppRemoveCommand_initOptions, _EntraAppRemoveCommand_initValidators, _EntraAppRemoveCommand_initOptionSets;
1
+ import { z } from 'zod';
7
2
  import { cli } from '../../../../cli/cli.js';
3
+ import { globalOptionsZod } from '../../../../Command.js';
8
4
  import request from '../../../../request.js';
9
5
  import { entraApp } from '../../../../utils/entraApp.js';
10
- import { validation } from '../../../../utils/validation.js';
11
6
  import GraphCommand from '../../../base/GraphCommand.js';
12
7
  import commands from '../../commands.js';
8
+ export const options = z.strictObject({
9
+ ...globalOptionsZod.shape,
10
+ appId: z.guid().optional(),
11
+ objectId: z.guid().optional(),
12
+ name: z.string().optional(),
13
+ force: z.boolean().optional().alias('f')
14
+ });
13
15
  class EntraAppRemoveCommand extends GraphCommand {
14
16
  get name() {
15
17
  return commands.APP_REMOVE;
@@ -17,13 +19,18 @@ class EntraAppRemoveCommand extends GraphCommand {
17
19
  get description() {
18
20
  return 'Removes an Entra app registration';
19
21
  }
20
- constructor() {
21
- super();
22
- _EntraAppRemoveCommand_instances.add(this);
23
- __classPrivateFieldGet(this, _EntraAppRemoveCommand_instances, "m", _EntraAppRemoveCommand_initTelemetry).call(this);
24
- __classPrivateFieldGet(this, _EntraAppRemoveCommand_instances, "m", _EntraAppRemoveCommand_initOptions).call(this);
25
- __classPrivateFieldGet(this, _EntraAppRemoveCommand_instances, "m", _EntraAppRemoveCommand_initValidators).call(this);
26
- __classPrivateFieldGet(this, _EntraAppRemoveCommand_instances, "m", _EntraAppRemoveCommand_initOptionSets).call(this);
22
+ get schema() {
23
+ return options;
24
+ }
25
+ getRefinedSchema(schema) {
26
+ return schema
27
+ .refine(options => [options.appId, options.objectId, options.name].filter(o => o !== undefined).length === 1, {
28
+ error: 'Specify either appId, objectId, or name',
29
+ params: {
30
+ customCode: 'optionSet',
31
+ options: ['appId', 'objectId', 'name']
32
+ }
33
+ });
27
34
  }
28
35
  async commandAction(logger, args) {
29
36
  const deleteApp = async () => {
@@ -73,29 +80,5 @@ class EntraAppRemoveCommand extends GraphCommand {
73
80
  }
74
81
  }
75
82
  }
76
- _EntraAppRemoveCommand_instances = new WeakSet(), _EntraAppRemoveCommand_initTelemetry = function _EntraAppRemoveCommand_initTelemetry() {
77
- this.telemetry.push((args) => {
78
- Object.assign(this.telemetryProperties, {
79
- appId: typeof args.options.appId !== 'undefined',
80
- objectId: typeof args.options.objectId !== 'undefined',
81
- name: typeof args.options.name !== 'undefined',
82
- force: (!(!args.options.force)).toString()
83
- });
84
- });
85
- }, _EntraAppRemoveCommand_initOptions = function _EntraAppRemoveCommand_initOptions() {
86
- this.options.unshift({ option: '--appId [appId]' }, { option: '--objectId [objectId]' }, { option: '--name [name]' }, { option: '-f, --force' });
87
- }, _EntraAppRemoveCommand_initValidators = function _EntraAppRemoveCommand_initValidators() {
88
- this.validators.push(async (args) => {
89
- if (args.options.appId && !validation.isValidGuid(args.options.appId)) {
90
- return `${args.options.appId} is not a valid GUID`;
91
- }
92
- if (args.options.objectId && !validation.isValidGuid(args.options.objectId)) {
93
- return `${args.options.objectId} is not a valid GUID`;
94
- }
95
- return true;
96
- });
97
- }, _EntraAppRemoveCommand_initOptionSets = function _EntraAppRemoveCommand_initOptionSets() {
98
- this.optionSets.push({ options: ['appId', 'objectId', 'name'] });
99
- };
100
83
  export default new EntraAppRemoveCommand();
101
84
  //# sourceMappingURL=app-remove.js.map
@@ -1,14 +1,28 @@
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 _EntraAppRoleAddCommand_instances, _a, _EntraAppRoleAddCommand_initTelemetry, _EntraAppRoleAddCommand_initOptions, _EntraAppRoleAddCommand_initValidators, _EntraAppRoleAddCommand_initOptionSets;
7
1
  import { v4 } from 'uuid';
2
+ import { z } from 'zod';
3
+ import { globalOptionsZod } from '../../../../Command.js';
8
4
  import request from '../../../../request.js';
9
5
  import GraphCommand from '../../../base/GraphCommand.js';
10
6
  import commands from '../../commands.js';
11
7
  import { entraApp } from '../../../../utils/entraApp.js';
8
+ export const options = z.strictObject({
9
+ ...globalOptionsZod.shape,
10
+ appId: z.guid().optional(),
11
+ appObjectId: z.guid().optional(),
12
+ appName: z.string().optional(),
13
+ name: z.string().alias('n'),
14
+ description: z.string().alias('d'),
15
+ allowedMembers: z.enum(['usersGroups', 'applications', 'both']).alias('m'),
16
+ claim: z.string()
17
+ .max(120, `Claim must not be longer than 120 characters`)
18
+ .refine(claim => !claim.startsWith('.'), {
19
+ error: 'Claim must not begin with .'
20
+ })
21
+ .refine(claim => /^[\w:!#$%&'()*+,-./:;<=>?@[\]^+_`{|}~]+$/.test(claim), {
22
+ error: `Claim can contain only the following characters a-z, A-Z, 0-9, :!#$%&'()*+,-./:;<=>?@[]^+_\`{|}~]+`
23
+ })
24
+ .alias('c')
25
+ });
12
26
  class EntraAppRoleAddCommand extends GraphCommand {
13
27
  get name() {
14
28
  return commands.APP_ROLE_ADD;
@@ -16,13 +30,18 @@ class EntraAppRoleAddCommand extends GraphCommand {
16
30
  get description() {
17
31
  return 'Adds role to the specified Entra app registration';
18
32
  }
19
- constructor() {
20
- super();
21
- _EntraAppRoleAddCommand_instances.add(this);
22
- __classPrivateFieldGet(this, _EntraAppRoleAddCommand_instances, "m", _EntraAppRoleAddCommand_initTelemetry).call(this);
23
- __classPrivateFieldGet(this, _EntraAppRoleAddCommand_instances, "m", _EntraAppRoleAddCommand_initOptions).call(this);
24
- __classPrivateFieldGet(this, _EntraAppRoleAddCommand_instances, "m", _EntraAppRoleAddCommand_initValidators).call(this);
25
- __classPrivateFieldGet(this, _EntraAppRoleAddCommand_instances, "m", _EntraAppRoleAddCommand_initOptionSets).call(this);
33
+ get schema() {
34
+ return options;
35
+ }
36
+ getRefinedSchema(schema) {
37
+ return schema
38
+ .refine(options => [options.appId, options.appObjectId, options.appName].filter(o => o !== undefined).length === 1, {
39
+ error: 'Specify either appId, appObjectId, or appName',
40
+ params: {
41
+ customCode: 'optionSet',
42
+ options: ['appId', 'appObjectId', 'appName']
43
+ }
44
+ });
26
45
  }
27
46
  async commandAction(logger, args) {
28
47
  try {
@@ -80,38 +99,5 @@ class EntraAppRoleAddCommand extends GraphCommand {
80
99
  }
81
100
  }
82
101
  }
83
- _a = EntraAppRoleAddCommand, _EntraAppRoleAddCommand_instances = new WeakSet(), _EntraAppRoleAddCommand_initTelemetry = function _EntraAppRoleAddCommand_initTelemetry() {
84
- this.telemetry.push((args) => {
85
- Object.assign(this.telemetryProperties, {
86
- appId: typeof args.options.appId !== 'undefined',
87
- appObjectId: typeof args.options.appObjectId !== 'undefined',
88
- appName: typeof args.options.appName !== 'undefined'
89
- });
90
- });
91
- }, _EntraAppRoleAddCommand_initOptions = function _EntraAppRoleAddCommand_initOptions() {
92
- this.options.unshift({ option: '--appId [appId]' }, { option: '--appObjectId [appObjectId]' }, { option: '--appName [appName]' }, { option: '-n, --name <name>' }, { option: '-d, --description <description>' }, {
93
- option: '-m, --allowedMembers <allowedMembers>', autocomplete: _a.allowedMembers
94
- }, { option: '-c, --claim <claim>' });
95
- }, _EntraAppRoleAddCommand_initValidators = function _EntraAppRoleAddCommand_initValidators() {
96
- this.validators.push(async (args) => {
97
- const { allowedMembers, claim } = args.options;
98
- if (_a.allowedMembers.indexOf(allowedMembers) < 0) {
99
- return `${allowedMembers} is not a valid value for allowedMembers. Valid values are ${_a.allowedMembers.join(', ')}`;
100
- }
101
- if (claim.length > 120) {
102
- return `Claim must not be longer than 120 characters`;
103
- }
104
- if (claim.startsWith('.')) {
105
- return 'Claim must not begin with .';
106
- }
107
- if (!/^[\w:!#$%&'()*+,-./:;<=>?@[\]^+_`{|}~]+$/.test(claim)) {
108
- return `Claim can contain only the following characters a-z, A-Z, 0-9, :!#$%&'()*+,-./:;<=>?@[]^+_\`{|}~]+`;
109
- }
110
- return true;
111
- });
112
- }, _EntraAppRoleAddCommand_initOptionSets = function _EntraAppRoleAddCommand_initOptionSets() {
113
- this.optionSets.push({ options: ['appId', 'appObjectId', 'appName'] });
114
- };
115
- EntraAppRoleAddCommand.allowedMembers = ['usersGroups', 'applications', 'both'];
116
102
  export default new EntraAppRoleAddCommand();
117
103
  //# sourceMappingURL=app-role-add.js.map
@@ -1,13 +1,15 @@
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 _EntraAppRoleListCommand_instances, _EntraAppRoleListCommand_initTelemetry, _EntraAppRoleListCommand_initOptions, _EntraAppRoleListCommand_initOptionSets;
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';
10
6
  import { entraApp } from '../../../../utils/entraApp.js';
7
+ export const options = z.strictObject({
8
+ ...globalOptionsZod.shape,
9
+ appId: z.guid().optional(),
10
+ appObjectId: z.guid().optional(),
11
+ appName: z.string().optional()
12
+ });
11
13
  class EntraAppRoleListCommand extends GraphCommand {
12
14
  get name() {
13
15
  return commands.APP_ROLE_LIST;
@@ -15,12 +17,18 @@ class EntraAppRoleListCommand extends GraphCommand {
15
17
  get description() {
16
18
  return 'Gets Entra app registration roles';
17
19
  }
18
- constructor() {
19
- super();
20
- _EntraAppRoleListCommand_instances.add(this);
21
- __classPrivateFieldGet(this, _EntraAppRoleListCommand_instances, "m", _EntraAppRoleListCommand_initTelemetry).call(this);
22
- __classPrivateFieldGet(this, _EntraAppRoleListCommand_instances, "m", _EntraAppRoleListCommand_initOptions).call(this);
23
- __classPrivateFieldGet(this, _EntraAppRoleListCommand_instances, "m", _EntraAppRoleListCommand_initOptionSets).call(this);
20
+ get schema() {
21
+ return options;
22
+ }
23
+ getRefinedSchema(schema) {
24
+ return schema
25
+ .refine(options => [options.appId, options.appObjectId, options.appName].filter(o => o !== undefined).length === 1, {
26
+ error: 'Specify either appId, appObjectId, or appName',
27
+ params: {
28
+ customCode: 'optionSet',
29
+ options: ['appId', 'appObjectId', 'appName']
30
+ }
31
+ });
24
32
  }
25
33
  defaultProperties() {
26
34
  return ['displayName', 'description', 'id'];
@@ -53,18 +61,5 @@ class EntraAppRoleListCommand extends GraphCommand {
53
61
  }
54
62
  }
55
63
  }
56
- _EntraAppRoleListCommand_instances = new WeakSet(), _EntraAppRoleListCommand_initTelemetry = function _EntraAppRoleListCommand_initTelemetry() {
57
- this.telemetry.push((args) => {
58
- Object.assign(this.telemetryProperties, {
59
- appId: typeof args.options.appId !== 'undefined',
60
- appObjectId: typeof args.options.appObjectId !== 'undefined',
61
- appName: typeof args.options.appName !== 'undefined'
62
- });
63
- });
64
- }, _EntraAppRoleListCommand_initOptions = function _EntraAppRoleListCommand_initOptions() {
65
- this.options.unshift({ option: '--appId [appId]' }, { option: '--appObjectId [appObjectId]' }, { option: '--appName [appName]' });
66
- }, _EntraAppRoleListCommand_initOptionSets = function _EntraAppRoleListCommand_initOptionSets() {
67
- this.optionSets.push({ options: ['appId', 'appObjectId', 'appName'] });
68
- };
69
64
  export default new EntraAppRoleListCommand();
70
65
  //# sourceMappingURL=app-role-list.js.map
@@ -1,16 +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 _EntraAppRoleRemoveCommand_instances, _EntraAppRoleRemoveCommand_initTelemetry, _EntraAppRoleRemoveCommand_initOptions, _EntraAppRoleRemoveCommand_initValidators, _EntraAppRoleRemoveCommand_initOptionSets;
1
+ import { z } from 'zod';
7
2
  import { cli } from '../../../../cli/cli.js';
3
+ import { globalOptionsZod } from '../../../../Command.js';
8
4
  import request from '../../../../request.js';
9
- import { formatting } from "../../../../utils/formatting.js";
10
- import { validation } from '../../../../utils/validation.js';
5
+ import { formatting } from '../../../../utils/formatting.js';
11
6
  import GraphCommand from '../../../base/GraphCommand.js';
12
7
  import commands from '../../commands.js';
13
- import { entraApp } from "../../../../utils/entraApp.js";
8
+ import { entraApp } from '../../../../utils/entraApp.js';
9
+ export const options = z.strictObject({
10
+ ...globalOptionsZod.shape,
11
+ appId: z.guid().optional(),
12
+ appObjectId: z.guid().optional(),
13
+ appName: z.string().optional(),
14
+ claim: z.string().optional().alias('c'),
15
+ name: z.string().optional().alias('n'),
16
+ id: z.guid().optional().alias('i'),
17
+ force: z.boolean().optional().alias('f')
18
+ });
14
19
  class EntraAppRoleRemoveCommand extends GraphCommand {
15
20
  get name() {
16
21
  return commands.APP_ROLE_REMOVE;
@@ -18,13 +23,25 @@ class EntraAppRoleRemoveCommand extends GraphCommand {
18
23
  get description() {
19
24
  return 'Removes role from the specified Entra app registration';
20
25
  }
21
- constructor() {
22
- super();
23
- _EntraAppRoleRemoveCommand_instances.add(this);
24
- __classPrivateFieldGet(this, _EntraAppRoleRemoveCommand_instances, "m", _EntraAppRoleRemoveCommand_initTelemetry).call(this);
25
- __classPrivateFieldGet(this, _EntraAppRoleRemoveCommand_instances, "m", _EntraAppRoleRemoveCommand_initOptions).call(this);
26
- __classPrivateFieldGet(this, _EntraAppRoleRemoveCommand_instances, "m", _EntraAppRoleRemoveCommand_initValidators).call(this);
27
- __classPrivateFieldGet(this, _EntraAppRoleRemoveCommand_instances, "m", _EntraAppRoleRemoveCommand_initOptionSets).call(this);
26
+ get schema() {
27
+ return options;
28
+ }
29
+ getRefinedSchema(schema) {
30
+ return schema
31
+ .refine(options => [options.appId, options.appObjectId, options.appName].filter(o => o !== undefined).length === 1, {
32
+ error: 'Specify either appId, appObjectId, or appName',
33
+ params: {
34
+ customCode: 'optionSet',
35
+ options: ['appId', 'appObjectId', 'appName']
36
+ }
37
+ })
38
+ .refine(options => [options.name, options.claim, options.id].filter(o => o !== undefined).length === 1, {
39
+ error: 'Specify either name, claim, or id',
40
+ params: {
41
+ customCode: 'optionSet',
42
+ options: ['name', 'claim', 'id']
43
+ }
44
+ });
28
45
  }
29
46
  async commandAction(logger, args) {
30
47
  const deleteAppRole = async () => {
@@ -124,30 +141,5 @@ class EntraAppRoleRemoveCommand extends GraphCommand {
124
141
  }
125
142
  }
126
143
  }
127
- _EntraAppRoleRemoveCommand_instances = new WeakSet(), _EntraAppRoleRemoveCommand_initTelemetry = function _EntraAppRoleRemoveCommand_initTelemetry() {
128
- this.telemetry.push((args) => {
129
- Object.assign(this.telemetryProperties, {
130
- appId: typeof args.options.appId !== 'undefined',
131
- appObjectId: typeof args.options.appObjectId !== 'undefined',
132
- appName: typeof args.options.appName !== 'undefined',
133
- claim: typeof args.options.claim !== 'undefined',
134
- name: typeof args.options.name !== 'undefined',
135
- id: typeof args.options.id !== 'undefined'
136
- });
137
- });
138
- }, _EntraAppRoleRemoveCommand_initOptions = function _EntraAppRoleRemoveCommand_initOptions() {
139
- this.options.unshift({ option: '--appId [appId]' }, { option: '--appObjectId [appObjectId]' }, { option: '--appName [appName]' }, { option: '-n, --name [name]' }, { option: '-i, --id [id]' }, { option: '-c, --claim [claim]' }, { option: '-f, --force' });
140
- }, _EntraAppRoleRemoveCommand_initValidators = function _EntraAppRoleRemoveCommand_initValidators() {
141
- this.validators.push(async (args) => {
142
- if (args.options.id) {
143
- if (!validation.isValidGuid(args.options.id)) {
144
- return `${args.options.id} is not a valid GUID`;
145
- }
146
- }
147
- return true;
148
- });
149
- }, _EntraAppRoleRemoveCommand_initOptionSets = function _EntraAppRoleRemoveCommand_initOptionSets() {
150
- this.optionSets.push({ options: ['appId', 'appObjectId', 'appName'] }, { options: ['name', 'claim', 'id'] });
151
- };
152
144
  export default new EntraAppRoleRemoveCommand();
153
145
  //# sourceMappingURL=app-role-remove.js.map