@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
package/dist/cli/cli.js CHANGED
@@ -48,7 +48,7 @@ const yargsConfiguration = {
48
48
  'camel-case-expansion': false
49
49
  };
50
50
  function isMissingRequiredValueError(error, options) {
51
- if (error.code !== 'invalid_type') {
51
+ if (error.code !== 'invalid_type' && error.code !== 'invalid_value') {
52
52
  return false;
53
53
  }
54
54
  let currentValue = options;
@@ -173,12 +173,17 @@ async function execute(rawArgs) {
173
173
  else {
174
174
  const shouldPrompt = cli.getSettingWithDefaultValue(settingsNames.prompt, true);
175
175
  if (!shouldPrompt) {
176
- result.error.issues.forEach(e => {
177
- if (isMissingRequiredValueError(e, cli.optionsFromArgs.options)) {
178
- e.message = `Required option not specified`;
179
- }
180
- });
181
- return cli.closeWithError(result.error, cli.optionsFromArgs, true);
176
+ const errorMessage = result.error.issues
177
+ .map(issue => {
178
+ const message = isMissingRequiredValueError(issue, cli.optionsFromArgs.options)
179
+ ? 'Required option not specified'
180
+ : issue.message;
181
+ return issue.path.length > 0
182
+ ? `${issue.path.join('.')}: ${message}`
183
+ : message;
184
+ })
185
+ .join(os.EOL);
186
+ return cli.closeWithError(errorMessage, cli.optionsFromArgs, true);
182
187
  }
183
188
  const missingRequiredValuesErrors = result.error.issues
184
189
  .filter(e => isMissingRequiredValueError(e, cli.optionsFromArgs.options) ||
@@ -1,19 +1,47 @@
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 _EntraAppAddCommand_instances, _a, _EntraAppAddCommand_initTelemetry, _EntraAppAddCommand_initOptions, _EntraAppAddCommand_initValidators, _EntraAppAddCommand_initOptionSets;
7
1
  import fs from 'fs';
8
2
  import { v4 } from 'uuid';
3
+ import { z } from 'zod';
9
4
  import auth from '../../../../Auth.js';
5
+ import { globalOptionsZod } from '../../../../Command.js';
10
6
  import request from '../../../../request.js';
11
7
  import { accessToken } from '../../../../utils/accessToken.js';
12
8
  import { entraApp } from '../../../../utils/entraApp.js';
9
+ import { optionsUtils } from '../../../../utils/optionsUtils.js';
10
+ import { zod } from '../../../../utils/zod.js';
13
11
  import GraphCommand from '../../../base/GraphCommand.js';
14
12
  import commands from '../../commands.js';
15
- import { optionsUtils } from '../../../../utils/optionsUtils.js';
13
+ const entraApplicationPlatform = ['spa', 'web', 'publicClient', 'apple', 'android'];
14
+ const entraAppScopeConsentBy = ['admins', 'adminsAndUsers'];
15
+ export const options = z.looseObject({
16
+ ...globalOptionsZod.shape,
17
+ name: z.string().optional().alias('n'),
18
+ multitenant: z.boolean().optional(),
19
+ redirectUris: z.string().optional().alias('r'),
20
+ platform: z.enum(entraApplicationPlatform).optional().alias('p'),
21
+ implicitFlow: z.boolean().optional(),
22
+ withSecret: z.boolean().optional().alias('s'),
23
+ apisDelegated: z.string().optional(),
24
+ apisApplication: z.string().optional(),
25
+ uri: z.string().optional().alias('u'),
26
+ scopeName: z.string().optional(),
27
+ scopeConsentBy: z.enum(entraAppScopeConsentBy).optional(),
28
+ scopeAdminConsentDisplayName: z.string().optional(),
29
+ scopeAdminConsentDescription: z.string().optional(),
30
+ certificateFile: z.string().optional(),
31
+ certificateBase64Encoded: z.string().optional(),
32
+ certificateDisplayName: z.string().optional(),
33
+ manifest: z.string().optional(),
34
+ bundleId: z.string().optional(),
35
+ signatureHash: z.string().optional(),
36
+ save: z.boolean().optional(),
37
+ grantAdminConsent: z.boolean().optional(),
38
+ allowPublicClientFlows: z.boolean().optional()
39
+ });
16
40
  class EntraAppAddCommand extends GraphCommand {
41
+ constructor() {
42
+ super(...arguments);
43
+ this.appName = '';
44
+ }
17
45
  get name() {
18
46
  return commands.APP_ADD;
19
47
  }
@@ -23,31 +51,90 @@ class EntraAppAddCommand extends GraphCommand {
23
51
  allowUnknownOptions() {
24
52
  return true;
25
53
  }
26
- constructor() {
27
- super();
28
- _EntraAppAddCommand_instances.add(this);
29
- this.appName = '';
30
- __classPrivateFieldGet(this, _EntraAppAddCommand_instances, "m", _EntraAppAddCommand_initTelemetry).call(this);
31
- __classPrivateFieldGet(this, _EntraAppAddCommand_instances, "m", _EntraAppAddCommand_initOptions).call(this);
32
- __classPrivateFieldGet(this, _EntraAppAddCommand_instances, "m", _EntraAppAddCommand_initValidators).call(this);
33
- __classPrivateFieldGet(this, _EntraAppAddCommand_instances, "m", _EntraAppAddCommand_initOptionSets).call(this);
54
+ get schema() {
55
+ return options;
56
+ }
57
+ getRefinedSchema(schema) {
58
+ return schema
59
+ .refine(options => [options.name, options.manifest].filter(x => x !== undefined).length === 1, {
60
+ error: 'Specify either name or manifest, but not both',
61
+ params: {
62
+ customCode: 'optionSet',
63
+ options: ['name', 'manifest']
64
+ }
65
+ })
66
+ .refine(options => !options.redirectUris || !!options.platform, {
67
+ error: 'When you specify redirectUris you also need to specify platform'
68
+ })
69
+ .refine(options => !options.platform || !['spa', 'web', 'publicClient'].includes(options.platform) || !!options.redirectUris, {
70
+ error: `When you use platform spa, web or publicClient, you'll need to specify redirectUris`
71
+ })
72
+ .refine(options => !(options.certificateFile && options.certificateBase64Encoded), {
73
+ error: 'Specify either certificateFile or certificateBase64Encoded but not both'
74
+ })
75
+ .refine(options => !options.certificateDisplayName || !!options.certificateFile || !!options.certificateBase64Encoded, {
76
+ error: 'When you specify certificateDisplayName you also need to specify certificateFile or certificateBase64Encoded'
77
+ })
78
+ .refine(options => !options.certificateFile || fs.existsSync(options.certificateFile), {
79
+ error: 'Certificate file not found'
80
+ })
81
+ .refine(options => !options.scopeName || !!options.uri, {
82
+ error: 'When you specify scopeName you also need to specify uri'
83
+ })
84
+ .refine(options => !options.scopeName || !!options.scopeAdminConsentDescription, {
85
+ error: 'When you specify scopeName you also need to specify scopeAdminConsentDescription'
86
+ })
87
+ .refine(options => !options.scopeName || !!options.scopeAdminConsentDisplayName, {
88
+ error: 'When you specify scopeName you also need to specify scopeAdminConsentDisplayName'
89
+ })
90
+ .refine(options => {
91
+ if (!options.manifest) {
92
+ return true;
93
+ }
94
+ try {
95
+ const manifest = JSON.parse(options.manifest);
96
+ return !!options.name || !!manifest.name;
97
+ }
98
+ catch {
99
+ return false;
100
+ }
101
+ }, {
102
+ error: e => {
103
+ try {
104
+ JSON.parse(e.input.manifest);
105
+ return `Specify the name of the app to create either through the 'name' option or the 'name' property in the manifest`;
106
+ }
107
+ catch (err) {
108
+ return `Error while parsing the specified manifest: ${err}`;
109
+ }
110
+ }
111
+ })
112
+ .refine(options => options.platform !== 'apple' || !!options.bundleId, {
113
+ error: `When you use platform apple, you'll need to specify bundleId`
114
+ })
115
+ .refine(options => options.platform !== 'android' || (!!options.bundleId && !!options.signatureHash), {
116
+ error: `When you use platform android, you'll need to specify bundleId and signatureHash`
117
+ });
34
118
  }
35
119
  async commandAction(logger, args) {
36
- if (!args.options.name && this.manifest) {
37
- args.options.name = this.manifest.name;
120
+ const manifest = args.options.manifest
121
+ ? JSON.parse(args.options.manifest)
122
+ : undefined;
123
+ if (!args.options.name && manifest) {
124
+ args.options.name = manifest.name;
38
125
  }
39
126
  this.appName = args.options.name;
40
127
  try {
41
128
  const apis = await entraApp.resolveApis({
42
129
  options: args.options,
43
- manifest: this.manifest,
130
+ manifest,
44
131
  logger,
45
132
  verbose: this.verbose,
46
133
  debug: this.debug
47
134
  });
48
135
  let appInfo = await entraApp.createAppRegistration({
49
136
  options: args.options,
50
- unknownOptions: optionsUtils.getUnknownOptions(args.options, this.options),
137
+ unknownOptions: optionsUtils.getUnknownOptions(args.options, zod.schemaToOptions(this.schema)),
51
138
  apis,
52
139
  logger,
53
140
  verbose: this.verbose,
@@ -407,136 +494,5 @@ class EntraAppAddCommand extends GraphCommand {
407
494
  return platform.charAt(0).toUpperCase() + platform.substring(1);
408
495
  }
409
496
  }
410
- _a = EntraAppAddCommand, _EntraAppAddCommand_instances = new WeakSet(), _EntraAppAddCommand_initTelemetry = function _EntraAppAddCommand_initTelemetry() {
411
- this.telemetry.push((args) => {
412
- Object.assign(this.telemetryProperties, {
413
- apis: typeof args.options.apisDelegated !== 'undefined',
414
- implicitFlow: args.options.implicitFlow,
415
- multitenant: args.options.multitenant,
416
- platform: args.options.platform,
417
- redirectUris: typeof args.options.redirectUris !== 'undefined',
418
- scopeAdminConsentDescription: typeof args.options.scopeAdminConsentDescription !== 'undefined',
419
- scopeAdminConsentDisplayName: typeof args.options.scopeAdminConsentDisplayName !== 'undefined',
420
- scopeConsentBy: args.options.scopeConsentBy,
421
- scopeName: typeof args.options.scopeName !== 'undefined',
422
- uri: typeof args.options.uri !== 'undefined',
423
- withSecret: args.options.withSecret,
424
- certificateFile: typeof args.options.certificateFile !== 'undefined',
425
- certificateBase64Encoded: typeof args.options.certificateBase64Encoded !== 'undefined',
426
- certificateDisplayName: typeof args.options.certificateDisplayName !== 'undefined',
427
- grantAdminConsent: typeof args.options.grantAdminConsent !== 'undefined',
428
- allowPublicClientFlows: typeof args.options.allowPublicClientFlows !== 'undefined',
429
- bundleId: typeof args.options.bundleId !== 'undefined',
430
- signatureHash: typeof args.options.signatureHash !== 'undefined'
431
- });
432
- });
433
- }, _EntraAppAddCommand_initOptions = function _EntraAppAddCommand_initOptions() {
434
- this.options.unshift({
435
- option: '-n, --name [name]'
436
- }, {
437
- option: '--multitenant'
438
- }, {
439
- option: '-r, --redirectUris [redirectUris]'
440
- }, {
441
- option: '-p, --platform [platform]',
442
- autocomplete: _a.entraApplicationPlatform
443
- }, {
444
- option: '--implicitFlow'
445
- }, {
446
- option: '-s, --withSecret'
447
- }, {
448
- option: '--apisDelegated [apisDelegated]'
449
- }, {
450
- option: '--apisApplication [apisApplication]'
451
- }, {
452
- option: '-u, --uri [uri]'
453
- }, {
454
- option: '--scopeName [scopeName]'
455
- }, {
456
- option: '--scopeConsentBy [scopeConsentBy]',
457
- autocomplete: _a.entraAppScopeConsentBy
458
- }, {
459
- option: '--scopeAdminConsentDisplayName [scopeAdminConsentDisplayName]'
460
- }, {
461
- option: '--scopeAdminConsentDescription [scopeAdminConsentDescription]'
462
- }, {
463
- option: '--certificateFile [certificateFile]'
464
- }, {
465
- option: '--certificateBase64Encoded [certificateBase64Encoded]'
466
- }, {
467
- option: '--certificateDisplayName [certificateDisplayName]'
468
- }, {
469
- option: '--manifest [manifest]'
470
- }, {
471
- option: '--bundleId [bundleId]'
472
- }, {
473
- option: '--signatureHash [signatureHash]'
474
- }, {
475
- option: '--save'
476
- }, {
477
- option: '--grantAdminConsent'
478
- }, {
479
- option: '--allowPublicClientFlows'
480
- });
481
- }, _EntraAppAddCommand_initValidators = function _EntraAppAddCommand_initValidators() {
482
- this.validators.push(async (args) => {
483
- if (args.options.platform &&
484
- _a.entraApplicationPlatform.indexOf(args.options.platform) < 0) {
485
- return `${args.options.platform} is not a valid value for platform. Allowed values are ${_a.entraApplicationPlatform.join(', ')}`;
486
- }
487
- if (args.options.redirectUris && !args.options.platform) {
488
- return `When you specify redirectUris you also need to specify platform`;
489
- }
490
- if (args.options.platform && ['spa', 'web', 'publicClient'].indexOf(args.options.platform) > -1 && !args.options.redirectUris) {
491
- return `When you use platform spa, web or publicClient, you'll need to specify redirectUris`;
492
- }
493
- if (args.options.certificateFile && args.options.certificateBase64Encoded) {
494
- return 'Specify either certificateFile or certificateBase64Encoded but not both';
495
- }
496
- if (args.options.certificateDisplayName && !args.options.certificateFile && !args.options.certificateBase64Encoded) {
497
- return 'When you specify certificateDisplayName you also need to specify certificateFile or certificateBase64Encoded';
498
- }
499
- if (args.options.certificateFile && !fs.existsSync(args.options.certificateFile)) {
500
- return 'Certificate file not found';
501
- }
502
- if (args.options.scopeName) {
503
- if (!args.options.uri) {
504
- return `When you specify scopeName you also need to specify uri`;
505
- }
506
- if (!args.options.scopeAdminConsentDescription) {
507
- return `When you specify scopeName you also need to specify scopeAdminConsentDescription`;
508
- }
509
- if (!args.options.scopeAdminConsentDisplayName) {
510
- return `When you specify scopeName you also need to specify scopeAdminConsentDisplayName`;
511
- }
512
- }
513
- if (args.options.scopeConsentBy &&
514
- _a.entraAppScopeConsentBy.indexOf(args.options.scopeConsentBy) < 0) {
515
- return `${args.options.scopeConsentBy} is not a valid value for scopeConsentBy. Allowed values are ${_a.entraAppScopeConsentBy.join(', ')}`;
516
- }
517
- if (args.options.manifest) {
518
- try {
519
- this.manifest = JSON.parse(args.options.manifest);
520
- if (!args.options.name && !this.manifest.name) {
521
- return `Specify the name of the app to create either through the 'name' option or the 'name' property in the manifest`;
522
- }
523
- }
524
- catch (e) {
525
- return `Error while parsing the specified manifest: ${e}`;
526
- }
527
- }
528
- if (args.options.platform === 'apple' && !args.options.bundleId) {
529
- return `When you use platform apple, you'll need to specify bundleId`;
530
- }
531
- if (args.options.platform === 'android' && (!args.options.bundleId || !args.options.signatureHash)) {
532
- return `When you use platform android, you'll need to specify bundleId and signatureHash`;
533
- }
534
- return true;
535
- });
536
- }, _EntraAppAddCommand_initOptionSets = function _EntraAppAddCommand_initOptionSets() {
537
- this.optionSets.push({ options: ['name', 'manifest'] });
538
- };
539
- EntraAppAddCommand.entraApplicationPlatform = ['spa', 'web', 'publicClient', 'apple', 'android'];
540
- EntraAppAddCommand.entraAppScopeConsentBy = ['admins', 'adminsAndUsers'];
541
497
  export default new EntraAppAddCommand();
542
498
  //# sourceMappingURL=app-add.js.map
@@ -1,14 +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 _EntraAppGetCommand_instances, _EntraAppGetCommand_initTelemetry, _EntraAppGetCommand_initOptions, _EntraAppGetCommand_initValidators, _EntraAppGetCommand_initOptionSets;
7
1
  import fs from 'fs';
8
- import { validation } from '../../../../utils/validation.js';
2
+ import { z } from 'zod';
3
+ import { globalOptionsZod } from '../../../../Command.js';
9
4
  import GraphCommand from '../../../base/GraphCommand.js';
10
5
  import commands from '../../commands.js';
11
6
  import { entraApp } from '../../../../utils/entraApp.js';
7
+ export const options = z.strictObject({
8
+ ...globalOptionsZod.shape,
9
+ appId: z.guid().optional(),
10
+ objectId: z.guid().optional(),
11
+ name: z.string().optional(),
12
+ save: z.boolean().optional(),
13
+ properties: z.string().optional().alias('p')
14
+ });
12
15
  class EntraAppGetCommand extends GraphCommand {
13
16
  get name() {
14
17
  return commands.APP_GET;
@@ -16,13 +19,18 @@ class EntraAppGetCommand extends GraphCommand {
16
19
  get description() {
17
20
  return 'Gets an Entra app registration';
18
21
  }
19
- constructor() {
20
- super();
21
- _EntraAppGetCommand_instances.add(this);
22
- __classPrivateFieldGet(this, _EntraAppGetCommand_instances, "m", _EntraAppGetCommand_initTelemetry).call(this);
23
- __classPrivateFieldGet(this, _EntraAppGetCommand_instances, "m", _EntraAppGetCommand_initOptions).call(this);
24
- __classPrivateFieldGet(this, _EntraAppGetCommand_instances, "m", _EntraAppGetCommand_initValidators).call(this);
25
- __classPrivateFieldGet(this, _EntraAppGetCommand_instances, "m", _EntraAppGetCommand_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
+ });
26
34
  }
27
35
  async commandAction(logger, args) {
28
36
  try {
@@ -92,29 +100,5 @@ class EntraAppGetCommand extends GraphCommand {
92
100
  return appInfo;
93
101
  }
94
102
  }
95
- _EntraAppGetCommand_instances = new WeakSet(), _EntraAppGetCommand_initTelemetry = function _EntraAppGetCommand_initTelemetry() {
96
- this.telemetry.push((args) => {
97
- Object.assign(this.telemetryProperties, {
98
- appId: typeof args.options.appId !== 'undefined',
99
- objectId: typeof args.options.objectId !== 'undefined',
100
- name: typeof args.options.name !== 'undefined',
101
- properties: typeof args.options.properties !== 'undefined'
102
- });
103
- });
104
- }, _EntraAppGetCommand_initOptions = function _EntraAppGetCommand_initOptions() {
105
- this.options.unshift({ option: '--appId [appId]' }, { option: '--objectId [objectId]' }, { option: '--name [name]' }, { option: '--save' }, { option: '-p, --properties [properties]' });
106
- }, _EntraAppGetCommand_initValidators = function _EntraAppGetCommand_initValidators() {
107
- this.validators.push(async (args) => {
108
- if (args.options.appId && !validation.isValidGuid(args.options.appId)) {
109
- return `${args.options.appId} is not a valid GUID`;
110
- }
111
- if (args.options.objectId && !validation.isValidGuid(args.options.objectId)) {
112
- return `${args.options.objectId} is not a valid GUID`;
113
- }
114
- return true;
115
- });
116
- }, _EntraAppGetCommand_initOptionSets = function _EntraAppGetCommand_initOptionSets() {
117
- this.optionSets.push({ options: ['appId', 'objectId', 'name'] });
118
- };
119
103
  export default new EntraAppGetCommand();
120
104
  //# sourceMappingURL=app-get.js.map
@@ -1,12 +1,12 @@
1
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
- };
6
- var _EntraAppListCommand_instances, _EntraAppListCommand_initTelemetry, _EntraAppListCommand_initOptions;
7
- import { odata } from "../../../../utils/odata.js";
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
3
+ import { odata } from '../../../../utils/odata.js';
8
4
  import GraphCommand from '../../../base/GraphCommand.js';
9
5
  import commands from '../../commands.js';
6
+ export const options = z.strictObject({
7
+ ...globalOptionsZod.shape,
8
+ properties: z.string().optional().alias('p')
9
+ });
10
10
  class EntraAppListCommand extends GraphCommand {
11
11
  get name() {
12
12
  return commands.APP_LIST;
@@ -14,14 +14,11 @@ class EntraAppListCommand extends GraphCommand {
14
14
  get description() {
15
15
  return 'Retrieves a list of Entra app registrations';
16
16
  }
17
- constructor() {
18
- super();
19
- _EntraAppListCommand_instances.add(this);
20
- __classPrivateFieldGet(this, _EntraAppListCommand_instances, "m", _EntraAppListCommand_initTelemetry).call(this);
21
- __classPrivateFieldGet(this, _EntraAppListCommand_instances, "m", _EntraAppListCommand_initOptions).call(this);
17
+ get schema() {
18
+ return options;
22
19
  }
23
20
  defaultProperties() {
24
- return ['appId', 'id', 'displayName', "signInAudience"];
21
+ return ['appId', 'id', 'displayName', 'signInAudience'];
25
22
  }
26
23
  async commandAction(logger, args) {
27
24
  const queryParameters = [];
@@ -44,14 +41,5 @@ class EntraAppListCommand extends GraphCommand {
44
41
  }
45
42
  }
46
43
  }
47
- _EntraAppListCommand_instances = new WeakSet(), _EntraAppListCommand_initTelemetry = function _EntraAppListCommand_initTelemetry() {
48
- this.telemetry.push((args) => {
49
- Object.assign(this.telemetryProperties, {
50
- properties: typeof args.options.properties !== 'undefined'
51
- });
52
- });
53
- }, _EntraAppListCommand_initOptions = function _EntraAppListCommand_initOptions() {
54
- this.options.unshift({ option: '-p, --properties [properties]' });
55
- };
56
44
  export default new EntraAppListCommand();
57
45
  //# sourceMappingURL=app-list.js.map
@@ -1,16 +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 _EntraAppPermissionAddCommand_instances, _EntraAppPermissionAddCommand_initTelemetry, _EntraAppPermissionAddCommand_initOptions, _EntraAppPermissionAddCommand_initValidators, _EntraAppPermissionAddCommand_initOptionSets;
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 { entraApp } from "../../../../utils/entraApp.js";
13
- import { entraServicePrincipal } from "../../../../utils/entraServicePrincipal.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 { entraApp } from '../../../../utils/entraApp.js';
8
+ import { entraServicePrincipal } from '../../../../utils/entraServicePrincipal.js';
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
+ applicationPermissions: z.string().optional().alias('a'),
15
+ delegatedPermissions: z.string().optional().alias('d'),
16
+ grantAdminConsent: z.boolean().optional()
17
+ });
14
18
  var ScopeType;
15
19
  (function (ScopeType) {
16
20
  ScopeType["Role"] = "Role";
@@ -23,13 +27,25 @@ class EntraAppPermissionAddCommand extends GraphCommand {
23
27
  get description() {
24
28
  return 'Adds the specified application and/or delegated permissions to a specified Microsoft Entra app';
25
29
  }
26
- constructor() {
27
- super();
28
- _EntraAppPermissionAddCommand_instances.add(this);
29
- __classPrivateFieldGet(this, _EntraAppPermissionAddCommand_instances, "m", _EntraAppPermissionAddCommand_initTelemetry).call(this);
30
- __classPrivateFieldGet(this, _EntraAppPermissionAddCommand_instances, "m", _EntraAppPermissionAddCommand_initOptions).call(this);
31
- __classPrivateFieldGet(this, _EntraAppPermissionAddCommand_instances, "m", _EntraAppPermissionAddCommand_initValidators).call(this);
32
- __classPrivateFieldGet(this, _EntraAppPermissionAddCommand_instances, "m", _EntraAppPermissionAddCommand_initOptionSets).call(this);
30
+ get schema() {
31
+ return options;
32
+ }
33
+ getRefinedSchema(schema) {
34
+ return schema
35
+ .refine(options => [options.appId, options.appName, options.appObjectId].filter(o => o !== undefined).length === 1, {
36
+ error: 'Specify either appId, appName, or appObjectId',
37
+ params: {
38
+ customCode: 'optionSet',
39
+ options: ['appId', 'appName', 'appObjectId']
40
+ }
41
+ })
42
+ .refine(options => options.applicationPermissions !== undefined || options.delegatedPermissions !== undefined, {
43
+ error: 'Specify either applicationPermissions or delegatedPermissions',
44
+ params: {
45
+ customCode: 'optionSet',
46
+ options: ['applicationPermissions', 'delegatedPermissions']
47
+ }
48
+ });
33
49
  }
34
50
  async commandAction(logger, args) {
35
51
  try {
@@ -214,35 +230,5 @@ class EntraAppPermissionAddCommand extends GraphCommand {
214
230
  });
215
231
  }
216
232
  }
217
- _EntraAppPermissionAddCommand_instances = new WeakSet(), _EntraAppPermissionAddCommand_initTelemetry = function _EntraAppPermissionAddCommand_initTelemetry() {
218
- this.telemetry.push((args) => {
219
- Object.assign(this.telemetryProperties, {
220
- appId: typeof args.options.appId !== 'undefined',
221
- appName: typeof args.options.appName !== 'undefined',
222
- appObjectId: typeof args.options.appObjectId !== 'undefined',
223
- applicationPermissions: typeof args.options.applicationPermissions !== 'undefined',
224
- delegatedPermissions: typeof args.options.delegatedPermissions !== 'undefined',
225
- grantAdminConsent: !!args.options.grantAdminConsent
226
- });
227
- });
228
- }, _EntraAppPermissionAddCommand_initOptions = function _EntraAppPermissionAddCommand_initOptions() {
229
- this.options.unshift({ option: '-i, --appId [appId]' }, { option: '-n, --appName [appName]' }, { option: '--appObjectId [appObjectId]' }, { option: '-a, --applicationPermissions [applicationPermissions]' }, { option: '-d, --delegatedPermissions [delegatedPermissions]' }, { option: '--grantAdminConsent' });
230
- }, _EntraAppPermissionAddCommand_initValidators = function _EntraAppPermissionAddCommand_initValidators() {
231
- this.validators.push(async (args) => {
232
- if (args.options.appId && !validation.isValidGuid(args.options.appId)) {
233
- return `${args.options.appId} is not a valid GUID`;
234
- }
235
- if (args.options.appObjectId && !validation.isValidGuid(args.options.appObjectId)) {
236
- return `${args.options.appObjectId} is not a valid GUID`;
237
- }
238
- return true;
239
- });
240
- }, _EntraAppPermissionAddCommand_initOptionSets = function _EntraAppPermissionAddCommand_initOptionSets() {
241
- this.optionSets.push({ options: ['appId', 'appName', 'appObjectId'] });
242
- this.optionSets.push({
243
- options: ['applicationPermissions', 'delegatedPermissions'],
244
- runsWhen: (args) => args.options.delegatedPermissions === undefined && args.options.applicationPermissions === undefined
245
- });
246
- };
247
233
  export default new EntraAppPermissionAddCommand();
248
234
  //# sourceMappingURL=app-permission-add.js.map