@pnp/cli-microsoft365 12.0.0-beta.235caf5 → 12.0.0-beta.445fe0a

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 (117) hide show
  1. package/allCommands.json +1 -1
  2. package/allCommandsFull.json +1 -1
  3. package/dist/Command.js +11 -8
  4. package/dist/cli/cli.js +31 -18
  5. package/dist/config.js +1 -0
  6. package/dist/m365/entra/commands/agent/agent-blueprintprincipal-list.js +56 -0
  7. package/dist/m365/entra/commands.js +1 -0
  8. package/dist/m365/spe/commands/container/container-activate.js +8 -16
  9. package/dist/m365/spe/commands/container/container-list.js +21 -42
  10. package/dist/m365/spe/commands/containertype/containertype-list.js +5 -0
  11. package/dist/m365/spfx/commands/SpfxCompatibilityMatrix.js +15 -0
  12. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.24.1.js +19 -0
  13. package/dist/m365/spfx/commands/project/project-doctor.js +2 -1
  14. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN027004_OVERRIDES_serialize_javascript.js +34 -0
  15. package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.24.1.js +57 -0
  16. package/dist/m365/spfx/commands/project/project-upgrade.js +2 -1
  17. package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-add.js +38 -71
  18. package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-get.js +25 -59
  19. package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-list.js +11 -34
  20. package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-remove.js +25 -54
  21. package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-set.js +52 -83
  22. package/dist/m365/spo/commands/apppage/apppage-add.js +21 -39
  23. package/dist/m365/spo/commands/apppage/apppage-set.js +20 -30
  24. package/dist/m365/spo/commands/eventreceiver/eventreceiver-get.js +39 -65
  25. package/dist/m365/spo/commands/eventreceiver/eventreceiver-list.js +28 -56
  26. package/dist/m365/spo/commands/eventreceiver/eventreceiver-remove.js +40 -68
  27. package/dist/m365/spo/commands/externaluser/externaluser-list.js +24 -66
  28. package/dist/m365/spo/commands/group/group-add.js +19 -60
  29. package/dist/m365/spo/commands/group/group-get.js +32 -45
  30. package/dist/m365/spo/commands/group/group-list.js +13 -27
  31. package/dist/m365/spo/commands/group/group-member-add.js +52 -84
  32. package/dist/m365/spo/commands/group/group-member-list.js +24 -38
  33. package/dist/m365/spo/commands/group/group-member-remove.js +49 -68
  34. package/dist/m365/spo/commands/group/group-remove.js +25 -45
  35. package/dist/m365/spo/commands/group/group-set.js +36 -79
  36. package/dist/m365/spo/commands/orgassetslibrary/orgassetslibrary-add.js +15 -49
  37. package/dist/m365/spo/commands/orgassetslibrary/orgassetslibrary-list.js +5 -0
  38. package/dist/m365/spo/commands/orgassetslibrary/orgassetslibrary-remove.js +9 -17
  39. package/dist/m365/spo/commands/orgnewssite/orgnewssite-list.js +5 -0
  40. package/dist/m365/spo/commands/orgnewssite/orgnewssite-remove.js +11 -27
  41. package/dist/m365/spo/commands/orgnewssite/orgnewssite-set.js +10 -18
  42. package/dist/m365/spo/commands/propertybag/propertybag-get.js +14 -29
  43. package/dist/m365/spo/commands/propertybag/propertybag-list.js +13 -27
  44. package/dist/m365/spo/commands/propertybag/propertybag-remove.js +15 -32
  45. package/dist/m365/spo/commands/propertybag/propertybag-set.js +15 -31
  46. package/dist/m365/spo/commands/roledefinition/roledefinition-add.js +45 -44
  47. package/dist/m365/spo/commands/roledefinition/roledefinition-get.js +14 -25
  48. package/dist/m365/spo/commands/roledefinition/roledefinition-list.js +12 -18
  49. package/dist/m365/spo/commands/roledefinition/roledefinition-remove.js +15 -35
  50. package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-grant-add.js +9 -17
  51. package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-grant-list.js +5 -0
  52. package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-grant-revoke.js +9 -17
  53. package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-permissionrequest-approve.js +29 -39
  54. package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-permissionrequest-deny.js +10 -23
  55. package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-permissionrequest-list.js +5 -0
  56. package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-set.js +19 -28
  57. package/dist/m365/spo/commands/sitedesign/sitedesign-add.js +24 -59
  58. package/dist/m365/spo/commands/sitedesign/sitedesign-apply.js +10 -34
  59. package/dist/m365/spo/commands/sitedesign/sitedesign-get.js +19 -36
  60. package/dist/m365/spo/commands/sitedesign/sitedesign-list.js +8 -0
  61. package/dist/m365/spo/commands/sitedesign/sitedesign-remove.js +9 -32
  62. package/dist/m365/spo/commands/sitedesign/sitedesign-rights-grant.js +10 -31
  63. package/dist/m365/spo/commands/sitedesign/sitedesign-rights-list.js +8 -23
  64. package/dist/m365/spo/commands/sitedesign/sitedesign-rights-revoke.js +10 -34
  65. package/dist/m365/spo/commands/sitedesign/sitedesign-run-list.js +9 -38
  66. package/dist/m365/spo/commands/sitedesign/sitedesign-run-status-get.js +9 -29
  67. package/dist/m365/spo/commands/sitedesign/sitedesign-set.js +27 -80
  68. package/dist/m365/spo/commands/sitedesign/sitedesign-task-get.js +8 -23
  69. package/dist/m365/spo/commands/sitedesign/sitedesign-task-list.js +8 -18
  70. package/dist/m365/spo/commands/sitedesign/sitedesign-task-remove.js +9 -32
  71. package/dist/m365/spo/commands/tenant/tenant-appcatalog-add.js +15 -46
  72. package/dist/m365/spo/commands/tenant/tenant-appcatalogurl-get.js +5 -0
  73. package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-add.js +12 -56
  74. package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-get.js +25 -49
  75. package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-list.js +5 -1
  76. package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-remove.js +25 -49
  77. package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-set.js +47 -79
  78. package/dist/m365/spo/commands/tenant/tenant-commandset-add.js +15 -53
  79. package/dist/m365/spo/commands/tenant/tenant-commandset-get.js +25 -50
  80. package/dist/m365/spo/commands/tenant/tenant-commandset-list.js +5 -1
  81. package/dist/m365/spo/commands/tenant/tenant-commandset-remove.js +25 -49
  82. package/dist/m365/spo/commands/tenant/tenant-commandset-set.js +41 -65
  83. package/dist/m365/spo/commands/tenant/tenant-recyclebinitem-list.js +5 -0
  84. package/dist/m365/spo/commands/tenant/tenant-recyclebinitem-remove.js +10 -30
  85. package/dist/m365/spo/commands/tenant/tenant-recyclebinitem-restore.js +8 -21
  86. package/dist/m365/spo/commands/tenant/tenant-settings-list.js +5 -0
  87. package/dist/m365/spo/commands/tenant/tenant-settings-set.js +104 -386
  88. package/dist/m365/spo/commands/term/term-add.js +95 -110
  89. package/dist/m365/spo/commands/term/term-get.js +63 -75
  90. package/dist/m365/spo/commands/term/term-group-add.js +11 -41
  91. package/dist/m365/spo/commands/term/term-group-get.js +16 -47
  92. package/dist/m365/spo/commands/term/term-group-list.js +9 -34
  93. package/dist/m365/spo/commands/term/term-list.js +42 -57
  94. package/dist/m365/spo/commands/term/term-set-add.js +50 -71
  95. package/dist/m365/spo/commands/term/term-set-get.js +41 -58
  96. package/dist/m365/spo/commands/term/term-set-list.js +16 -47
  97. package/dist/m365/spo/commands/theme/theme-apply.js +27 -43
  98. package/dist/m365/spo/commands/theme/theme-get.js +8 -15
  99. package/dist/m365/spo/commands/theme/theme-list.js +5 -0
  100. package/dist/m365/spo/commands/theme/theme-remove.js +9 -24
  101. package/dist/m365/spo/commands/theme/theme-set.js +12 -34
  102. package/dist/m365/tenant/commands/id/id-get.js +8 -22
  103. package/dist/m365/tenant/commands/info/info-get.js +23 -36
  104. package/dist/m365/tenant/commands/people/people-profilecardproperty-add.js +67 -55
  105. package/dist/m365/tenant/commands/people/people-profilecardproperty-get.js +11 -24
  106. package/dist/m365/tenant/commands/people/people-profilecardproperty-list.js +5 -0
  107. package/dist/m365/tenant/commands/people/people-profilecardproperty-remove.js +12 -33
  108. package/dist/m365/tenant/commands/people/people-profilecardproperty-set.js +31 -51
  109. package/dist/m365/tenant/commands/people/people-pronouns-get.js +5 -0
  110. package/dist/m365/tenant/commands/people/profileCardProperties.js +10 -7
  111. package/dist/m365/tenant/commands/security/security-alerts-list.js +8 -20
  112. package/dist/utils/validation.js +12 -0
  113. package/dist/utils/zod.js +1 -0
  114. package/docs/docs/cmd/entra/agent/agent-blueprintprincipal-list.mdx +156 -0
  115. package/docs/docs/cmd/spfx/project/project-upgrade.mdx +1 -1
  116. package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-set.mdx +1 -1
  117. package/package.json +1 -1
@@ -1,14 +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 _SpoThemeRemoveCommand_instances, _SpoThemeRemoveCommand_initTelemetry, _SpoThemeRemoveCommand_initOptions;
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
7
3
  import { cli } from '../../../../cli/cli.js';
8
4
  import request from '../../../../request.js';
9
5
  import { spo } from '../../../../utils/spo.js';
10
6
  import SpoCommand from '../../../base/SpoCommand.js';
11
7
  import commands from '../../commands.js';
8
+ export const options = z.strictObject({
9
+ ...globalOptionsZod.shape,
10
+ name: z.string().alias('n'),
11
+ force: z.boolean().optional().alias('f')
12
+ });
12
13
  class SpoThemeRemoveCommand extends SpoCommand {
13
14
  get name() {
14
15
  return commands.THEME_REMOVE;
@@ -16,11 +17,8 @@ class SpoThemeRemoveCommand extends SpoCommand {
16
17
  get description() {
17
18
  return 'Removes existing theme';
18
19
  }
19
- constructor() {
20
- super();
21
- _SpoThemeRemoveCommand_instances.add(this);
22
- __classPrivateFieldGet(this, _SpoThemeRemoveCommand_instances, "m", _SpoThemeRemoveCommand_initTelemetry).call(this);
23
- __classPrivateFieldGet(this, _SpoThemeRemoveCommand_instances, "m", _SpoThemeRemoveCommand_initOptions).call(this);
20
+ get schema() {
21
+ return options;
24
22
  }
25
23
  async commandAction(logger, args) {
26
24
  if (args.options.force) {
@@ -56,18 +54,5 @@ class SpoThemeRemoveCommand extends SpoCommand {
56
54
  }
57
55
  }
58
56
  }
59
- _SpoThemeRemoveCommand_instances = new WeakSet(), _SpoThemeRemoveCommand_initTelemetry = function _SpoThemeRemoveCommand_initTelemetry() {
60
- this.telemetry.push((args) => {
61
- Object.assign(this.telemetryProperties, {
62
- force: (!(!args.options.force)).toString()
63
- });
64
- });
65
- }, _SpoThemeRemoveCommand_initOptions = function _SpoThemeRemoveCommand_initOptions() {
66
- this.options.unshift({
67
- option: '-n, --name <name>'
68
- }, {
69
- option: '-f, --force'
70
- });
71
- };
72
57
  export default new SpoThemeRemoveCommand();
73
58
  //# sourceMappingURL=theme-remove.js.map
@@ -1,9 +1,5 @@
1
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
- };
6
- var _SpoThemeSetCommand_instances, _SpoThemeSetCommand_initTelemetry, _SpoThemeSetCommand_initOptions, _SpoThemeSetCommand_initValidators;
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
7
3
  import config from '../../../../config.js';
8
4
  import request from '../../../../request.js';
9
5
  import { formatting } from '../../../../utils/formatting.js';
@@ -11,6 +7,14 @@ import { spo } from '../../../../utils/spo.js';
11
7
  import { validation } from '../../../../utils/validation.js';
12
8
  import SpoCommand from '../../../base/SpoCommand.js';
13
9
  import commands from '../../commands.js';
10
+ export const options = z.strictObject({
11
+ ...globalOptionsZod.shape,
12
+ name: z.string().alias('n'),
13
+ theme: z.string().refine(val => validation.isValidTheme(val), {
14
+ message: 'The specified theme is not valid'
15
+ }).alias('t'),
16
+ isInverted: z.boolean().optional()
17
+ });
14
18
  class SpoThemeSetCommand extends SpoCommand {
15
19
  get name() {
16
20
  return commands.THEME_SET;
@@ -18,12 +22,8 @@ class SpoThemeSetCommand extends SpoCommand {
18
22
  get description() {
19
23
  return 'Adds or updates a theme';
20
24
  }
21
- constructor() {
22
- super();
23
- _SpoThemeSetCommand_instances.add(this);
24
- __classPrivateFieldGet(this, _SpoThemeSetCommand_instances, "m", _SpoThemeSetCommand_initTelemetry).call(this);
25
- __classPrivateFieldGet(this, _SpoThemeSetCommand_instances, "m", _SpoThemeSetCommand_initOptions).call(this);
26
- __classPrivateFieldGet(this, _SpoThemeSetCommand_instances, "m", _SpoThemeSetCommand_initValidators).call(this);
25
+ get schema() {
26
+ return options;
27
27
  }
28
28
  async commandAction(logger, args) {
29
29
  try {
@@ -55,27 +55,5 @@ class SpoThemeSetCommand extends SpoCommand {
55
55
  }
56
56
  }
57
57
  }
58
- _SpoThemeSetCommand_instances = new WeakSet(), _SpoThemeSetCommand_initTelemetry = function _SpoThemeSetCommand_initTelemetry() {
59
- this.telemetry.push((args) => {
60
- Object.assign(this.telemetryProperties, {
61
- inverted: (!(!args.options.isInverted)).toString()
62
- });
63
- });
64
- }, _SpoThemeSetCommand_initOptions = function _SpoThemeSetCommand_initOptions() {
65
- this.options.unshift({
66
- option: '-n, --name <name>'
67
- }, {
68
- option: '-t, --theme <theme>'
69
- }, {
70
- option: '--isInverted'
71
- });
72
- }, _SpoThemeSetCommand_initValidators = function _SpoThemeSetCommand_initValidators() {
73
- this.validators.push(async (args) => {
74
- if (!validation.isValidTheme(args.options.theme)) {
75
- return 'The specified theme is not valid';
76
- }
77
- return true;
78
- });
79
- };
80
58
  export default new SpoThemeSetCommand();
81
59
  //# sourceMappingURL=theme-set.js.map
@@ -1,14 +1,14 @@
1
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
- };
6
- var _TenantIdGetCommand_instances, _TenantIdGetCommand_initTelemetry, _TenantIdGetCommand_initOptions;
1
+ import { z } from 'zod';
7
2
  import auth from '../../../../Auth.js';
3
+ import { globalOptionsZod } from '../../../../Command.js';
8
4
  import Command from '../../../../Command.js';
9
5
  import request from '../../../../request.js';
10
6
  import { accessToken } from '../../../../utils/accessToken.js';
11
7
  import commands from '../../commands.js';
8
+ export const options = z.strictObject({
9
+ ...globalOptionsZod.shape,
10
+ domainName: z.string().optional().alias('d')
11
+ });
12
12
  class TenantIdGetCommand extends Command {
13
13
  get name() {
14
14
  return commands.ID_GET;
@@ -16,11 +16,8 @@ class TenantIdGetCommand extends Command {
16
16
  get description() {
17
17
  return 'Gets Microsoft 365 tenant ID for the specified domain';
18
18
  }
19
- constructor() {
20
- super();
21
- _TenantIdGetCommand_instances.add(this);
22
- __classPrivateFieldGet(this, _TenantIdGetCommand_instances, "m", _TenantIdGetCommand_initTelemetry).call(this);
23
- __classPrivateFieldGet(this, _TenantIdGetCommand_instances, "m", _TenantIdGetCommand_initOptions).call(this);
19
+ get schema() {
20
+ return options;
24
21
  }
25
22
  async commandAction(logger, args) {
26
23
  let domainName = args.options.domainName;
@@ -51,16 +48,5 @@ class TenantIdGetCommand extends Command {
51
48
  }
52
49
  }
53
50
  }
54
- _TenantIdGetCommand_instances = new WeakSet(), _TenantIdGetCommand_initTelemetry = function _TenantIdGetCommand_initTelemetry() {
55
- this.telemetry.push((args) => {
56
- Object.assign(this.telemetryProperties, {
57
- domainName: typeof args.options.domainName !== 'undefined'
58
- });
59
- });
60
- }, _TenantIdGetCommand_initOptions = function _TenantIdGetCommand_initOptions() {
61
- this.options.unshift({
62
- option: '-d, --domainName [domainName]'
63
- });
64
- };
65
51
  export default new TenantIdGetCommand();
66
52
  //# sourceMappingURL=id-get.js.map
@@ -1,9 +1,5 @@
1
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
- };
6
- var _TenantInfoGetCommand_instances, _TenantInfoGetCommand_initTelemetry, _TenantInfoGetCommand_initOptions, _TenantInfoGetCommand_initValidators;
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
7
3
  import auth from '../../../../Auth.js';
8
4
  import GraphCommand from '../../../base/GraphCommand.js';
9
5
  import request from '../../../../request.js';
@@ -11,6 +7,11 @@ import { accessToken } from '../../../../utils/accessToken.js';
11
7
  import { formatting } from '../../../../utils/formatting.js';
12
8
  import { validation } from '../../../../utils/validation.js';
13
9
  import commands from '../../commands.js';
10
+ export const options = z.strictObject({
11
+ ...globalOptionsZod.shape,
12
+ domainName: z.string().optional().alias('d'),
13
+ tenantId: z.string().optional().alias('i')
14
+ });
14
15
  class TenantInfoGetCommand extends GraphCommand {
15
16
  get name() {
16
17
  return commands.INFO_GET;
@@ -18,12 +19,22 @@ class TenantInfoGetCommand extends GraphCommand {
18
19
  get description() {
19
20
  return 'Gets information about any tenant';
20
21
  }
21
- constructor() {
22
- super();
23
- _TenantInfoGetCommand_instances.add(this);
24
- __classPrivateFieldGet(this, _TenantInfoGetCommand_instances, "m", _TenantInfoGetCommand_initTelemetry).call(this);
25
- __classPrivateFieldGet(this, _TenantInfoGetCommand_instances, "m", _TenantInfoGetCommand_initOptions).call(this);
26
- __classPrivateFieldGet(this, _TenantInfoGetCommand_instances, "m", _TenantInfoGetCommand_initValidators).call(this);
22
+ get schema() {
23
+ return options;
24
+ }
25
+ getRefinedSchema(schema) {
26
+ return schema
27
+ .superRefine((opts, ctx) => {
28
+ if (opts.tenantId && !validation.isValidGuid(opts.tenantId)) {
29
+ ctx.addIssue({
30
+ code: 'custom',
31
+ message: `${opts.tenantId} is not a valid GUID`
32
+ });
33
+ }
34
+ })
35
+ .refine(opts => !(opts.tenantId && opts.domainName), {
36
+ message: 'Specify either domainName or tenantId but not both'
37
+ });
27
38
  }
28
39
  async commandAction(logger, args) {
29
40
  let domainName = args.options.domainName;
@@ -55,29 +66,5 @@ class TenantInfoGetCommand extends GraphCommand {
55
66
  }
56
67
  }
57
68
  }
58
- _TenantInfoGetCommand_instances = new WeakSet(), _TenantInfoGetCommand_initTelemetry = function _TenantInfoGetCommand_initTelemetry() {
59
- this.telemetry.push((args) => {
60
- Object.assign(this.telemetryProperties, {
61
- domainName: typeof args.options.domainName !== 'undefined',
62
- tenantId: typeof args.options.tenantId !== 'undefined'
63
- });
64
- });
65
- }, _TenantInfoGetCommand_initOptions = function _TenantInfoGetCommand_initOptions() {
66
- this.options.unshift({
67
- option: '-d, --domainName [domainName]'
68
- }, {
69
- option: '-i, --tenantId [tenantId]'
70
- });
71
- }, _TenantInfoGetCommand_initValidators = function _TenantInfoGetCommand_initValidators() {
72
- this.validators.push(async (args) => {
73
- if (args.options.tenantId && !validation.isValidGuid(args.options.tenantId)) {
74
- return `${args.options.tenantId} is not a valid GUID`;
75
- }
76
- if (args.options.tenantId && args.options.domainName) {
77
- return `Specify either domainName or tenantId but not both`;
78
- }
79
- return true;
80
- });
81
- };
82
69
  export default new TenantInfoGetCommand();
83
70
  //# sourceMappingURL=info-get.js.map
@@ -1,14 +1,19 @@
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 _TenantPeopleProfileCardPropertyAddCommand_instances, _TenantPeopleProfileCardPropertyAddCommand_initTelemetry, _TenantPeopleProfileCardPropertyAddCommand_initOptions, _TenantPeopleProfileCardPropertyAddCommand_initValidators;
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
7
3
  import request from '../../../../request.js';
8
4
  import { optionsUtils } from '../../../../utils/optionsUtils.js';
5
+ import { zod } from '../../../../utils/zod.js';
9
6
  import GraphCommand from '../../../base/GraphCommand.js';
10
7
  import commands from '../../commands.js';
11
8
  import { profileCardPropertyNames } from './profileCardProperties.js';
9
+ export const options = z.looseObject({
10
+ ...globalOptionsZod.shape,
11
+ name: z.string()
12
+ .transform(value => profileCardPropertyNames.find(p => p.toLowerCase() === value.toLowerCase()) ?? value)
13
+ .pipe(z.enum(profileCardPropertyNames))
14
+ .alias('n'),
15
+ displayName: z.string().optional().alias('d')
16
+ });
12
17
  class TenantPeopleProfileCardPropertyAddCommand extends GraphCommand {
13
18
  get name() {
14
19
  return commands.PEOPLE_PROFILECARDPROPERTY_ADD;
@@ -16,12 +21,61 @@ class TenantPeopleProfileCardPropertyAddCommand extends GraphCommand {
16
21
  get description() {
17
22
  return 'Adds an additional attribute to the profile card properties';
18
23
  }
19
- constructor() {
20
- super();
21
- _TenantPeopleProfileCardPropertyAddCommand_instances.add(this);
22
- __classPrivateFieldGet(this, _TenantPeopleProfileCardPropertyAddCommand_instances, "m", _TenantPeopleProfileCardPropertyAddCommand_initTelemetry).call(this);
23
- __classPrivateFieldGet(this, _TenantPeopleProfileCardPropertyAddCommand_instances, "m", _TenantPeopleProfileCardPropertyAddCommand_initOptions).call(this);
24
- __classPrivateFieldGet(this, _TenantPeopleProfileCardPropertyAddCommand_instances, "m", _TenantPeopleProfileCardPropertyAddCommand_initValidators).call(this);
24
+ get schema() {
25
+ return options;
26
+ }
27
+ getRefinedSchema(schema) {
28
+ return schema
29
+ .refine(opts => {
30
+ const propertyName = (opts.name).toLowerCase();
31
+ if (propertyName.startsWith('customattribute') && opts.displayName === undefined) {
32
+ return false;
33
+ }
34
+ return true;
35
+ }, {
36
+ message: `The option 'displayName' is required when adding customAttributes as profile card properties`,
37
+ path: ['displayName'],
38
+ params: {
39
+ customCode: 'required'
40
+ }
41
+ })
42
+ .refine(opts => {
43
+ const propertyName = (opts.name).toLowerCase();
44
+ if (!propertyName.startsWith('customattribute') && opts.displayName !== undefined) {
45
+ return false;
46
+ }
47
+ return true;
48
+ }, {
49
+ message: `The option 'displayName' can only be used when adding customAttributes as profile card properties`
50
+ })
51
+ .superRefine((opts, ctx) => {
52
+ const propertyName = (opts.name).toLowerCase();
53
+ if (!propertyName.startsWith('customattribute')) {
54
+ // For non-custom attributes, check that no unknown options are passed
55
+ const knownKeys = new Set([...Object.keys(globalOptionsZod.shape), 'name', 'displayName']);
56
+ const unknownKeys = Object.keys(opts).filter(k => !knownKeys.has(k));
57
+ if (unknownKeys.length > 0) {
58
+ ctx.addIssue({
59
+ code: 'custom',
60
+ message: `Unknown options like ${unknownKeys.join(', ')} are only supported with customAttributes`
61
+ });
62
+ }
63
+ }
64
+ })
65
+ .superRefine((opts, ctx) => {
66
+ const propertyName = (opts.name).toLowerCase();
67
+ if (propertyName.startsWith('customattribute')) {
68
+ const knownKeys = new Set([...Object.keys(globalOptionsZod.shape), 'name', 'displayName']);
69
+ const unknownKeys = Object.keys(opts).filter(k => !knownKeys.has(k));
70
+ const wronglyFormattedOptions = unknownKeys.filter(key => !key.toLowerCase().startsWith('displayname-'));
71
+ if (wronglyFormattedOptions.length > 0) {
72
+ ctx.addIssue({
73
+ code: 'custom',
74
+ message: `Wrong option format detected for the following option(s): ${wronglyFormattedOptions.join(', ')}'. When adding localizations for customAttributes, use the format displayName-<languageTag>.`
75
+ });
76
+ }
77
+ }
78
+ });
25
79
  }
26
80
  allowUnknownOptions() {
27
81
  return true;
@@ -72,7 +126,7 @@ class TenantPeopleProfileCardPropertyAddCommand extends GraphCommand {
72
126
  ];
73
127
  }
74
128
  getLocalizations(options) {
75
- const unknownOptions = Object.keys(optionsUtils.getUnknownOptions(options, this.options));
129
+ const unknownOptions = Object.keys(optionsUtils.getUnknownOptions(options, zod.schemaToOptions(this.schema)));
76
130
  if (unknownOptions.length === 0) {
77
131
  return [];
78
132
  }
@@ -86,47 +140,5 @@ class TenantPeopleProfileCardPropertyAddCommand extends GraphCommand {
86
140
  return localizations;
87
141
  }
88
142
  }
89
- _TenantPeopleProfileCardPropertyAddCommand_instances = new WeakSet(), _TenantPeopleProfileCardPropertyAddCommand_initTelemetry = function _TenantPeopleProfileCardPropertyAddCommand_initTelemetry() {
90
- this.telemetry.push((args) => {
91
- // Add unknown options to telemetry
92
- const unknownOptions = Object.keys(optionsUtils.getUnknownOptions(args.options, this.options));
93
- const unknownOptionsObj = unknownOptions.reduce((obj, key) => ({ ...obj, [key]: true }), {});
94
- Object.assign(this.telemetryProperties, {
95
- displayName: typeof args.options.displayName !== 'undefined',
96
- ...unknownOptionsObj
97
- });
98
- });
99
- }, _TenantPeopleProfileCardPropertyAddCommand_initOptions = function _TenantPeopleProfileCardPropertyAddCommand_initOptions() {
100
- this.options.unshift({
101
- option: '-n, --name <name>',
102
- autocomplete: profileCardPropertyNames
103
- }, {
104
- option: '-d, --displayName [displayName]'
105
- });
106
- }, _TenantPeopleProfileCardPropertyAddCommand_initValidators = function _TenantPeopleProfileCardPropertyAddCommand_initValidators() {
107
- this.validators.push(async (args) => {
108
- const propertyName = args.options.name.toLowerCase();
109
- if (profileCardPropertyNames.every(n => n.toLowerCase() !== propertyName)) {
110
- return `${args.options.name} is not a valid value for name. Allowed values are ${profileCardPropertyNames.join(', ')}`;
111
- }
112
- if (propertyName.startsWith('customattribute') && args.options.displayName === undefined) {
113
- return `The option 'displayName' is required when adding customAttributes as profile card properties`;
114
- }
115
- if (!propertyName.startsWith('customattribute') && args.options.displayName !== undefined) {
116
- return `The option 'displayName' can only be used when adding customAttributes as profile card properties`;
117
- }
118
- const unknownOptions = Object.keys(optionsUtils.getUnknownOptions(args.options, this.options));
119
- if (!propertyName.startsWith('customattribute') && unknownOptions.length > 0) {
120
- return `Unknown options like ${unknownOptions.join(', ')} are only supported with customAttributes`;
121
- }
122
- if (propertyName.startsWith('customattribute')) {
123
- const wronglyFormattedOptions = unknownOptions.filter(key => !key.toLowerCase().startsWith('displayname-'));
124
- if (wronglyFormattedOptions.length > 0) {
125
- return `Wrong option format detected for the following option(s): ${wronglyFormattedOptions.join(', ')}'. When adding localizations for customAttributes, use the format displayName-<languageTag>.`;
126
- }
127
- }
128
- return true;
129
- });
130
- };
131
143
  export default new TenantPeopleProfileCardPropertyAddCommand();
132
144
  //# sourceMappingURL=people-profilecardproperty-add.js.map
@@ -1,13 +1,16 @@
1
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
- };
6
- var _TenantPeopleProfileCardPropertyGetCommand_instances, _TenantPeopleProfileCardPropertyGetCommand_initOptions, _TenantPeopleProfileCardPropertyGetCommand_initValidators;
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
7
3
  import GraphCommand from '../../../base/GraphCommand.js';
8
4
  import request from '../../../../request.js';
9
5
  import { profileCardPropertyNames } from './profileCardProperties.js';
10
6
  import commands from '../../commands.js';
7
+ export const options = z.strictObject({
8
+ ...globalOptionsZod.shape,
9
+ name: z.string()
10
+ .transform(value => profileCardPropertyNames.find(p => p.toLowerCase() === value.toLowerCase()) ?? value)
11
+ .pipe(z.enum(profileCardPropertyNames))
12
+ .alias('n')
13
+ });
11
14
  class TenantPeopleProfileCardPropertyGetCommand extends GraphCommand {
12
15
  get name() {
13
16
  return commands.PEOPLE_PROFILECARDPROPERTY_GET;
@@ -15,11 +18,8 @@ class TenantPeopleProfileCardPropertyGetCommand extends GraphCommand {
15
18
  get description() {
16
19
  return 'Retrieves information about a specific profile card property';
17
20
  }
18
- constructor() {
19
- super();
20
- _TenantPeopleProfileCardPropertyGetCommand_instances.add(this);
21
- __classPrivateFieldGet(this, _TenantPeopleProfileCardPropertyGetCommand_instances, "m", _TenantPeopleProfileCardPropertyGetCommand_initOptions).call(this);
22
- __classPrivateFieldGet(this, _TenantPeopleProfileCardPropertyGetCommand_instances, "m", _TenantPeopleProfileCardPropertyGetCommand_initValidators).call(this);
21
+ get schema() {
22
+ return options;
23
23
  }
24
24
  async commandAction(logger, args) {
25
25
  try {
@@ -58,18 +58,5 @@ class TenantPeopleProfileCardPropertyGetCommand extends GraphCommand {
58
58
  }
59
59
  }
60
60
  }
61
- _TenantPeopleProfileCardPropertyGetCommand_instances = new WeakSet(), _TenantPeopleProfileCardPropertyGetCommand_initOptions = function _TenantPeopleProfileCardPropertyGetCommand_initOptions() {
62
- this.options.unshift({
63
- option: '-n, --name <name>',
64
- autocomplete: profileCardPropertyNames
65
- });
66
- }, _TenantPeopleProfileCardPropertyGetCommand_initValidators = function _TenantPeopleProfileCardPropertyGetCommand_initValidators() {
67
- this.validators.push(async (args) => {
68
- if (!profileCardPropertyNames.some(p => p.toLowerCase() === args.options.name.toLowerCase())) {
69
- return `'${args.options.name}' is not a valid value for option name. Allowed values are: ${profileCardPropertyNames.join(', ')}.`;
70
- }
71
- return true;
72
- });
73
- };
74
61
  export default new TenantPeopleProfileCardPropertyGetCommand();
75
62
  //# sourceMappingURL=people-profilecardproperty-get.js.map
@@ -1,6 +1,8 @@
1
+ import { globalOptionsZod } from '../../../../Command.js';
1
2
  import GraphCommand from '../../../base/GraphCommand.js';
2
3
  import commands from '../../commands.js';
3
4
  import { odata } from '../../../../utils/odata.js';
5
+ export const options = globalOptionsZod.strict();
4
6
  class TenantPeopleProfileCardPropertyListCommand extends GraphCommand {
5
7
  get name() {
6
8
  return commands.PEOPLE_PROFILECARDPROPERTY_LIST;
@@ -8,6 +10,9 @@ class TenantPeopleProfileCardPropertyListCommand extends GraphCommand {
8
10
  get description() {
9
11
  return 'Lists all profile card properties';
10
12
  }
13
+ get schema() {
14
+ return options;
15
+ }
11
16
  async commandAction(logger, args) {
12
17
  try {
13
18
  if (this.verbose) {
@@ -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 _TenantPeopleProfileCardPropertyRemoveCommand_instances, _TenantPeopleProfileCardPropertyRemoveCommand_initTelemetry, _TenantPeopleProfileCardPropertyRemoveCommand_initOptions, _TenantPeopleProfileCardPropertyRemoveCommand_initValidators;
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
7
3
  import { cli } from '../../../../cli/cli.js';
8
4
  import request from '../../../../request.js';
9
5
  import GraphCommand from '../../../base/GraphCommand.js';
10
6
  import commands from '../../commands.js';
11
7
  import { profileCardPropertyNames } from './profileCardProperties.js';
8
+ export const options = z.strictObject({
9
+ ...globalOptionsZod.shape,
10
+ name: z.string()
11
+ .transform(value => profileCardPropertyNames.find(p => p.toLowerCase() === value.toLowerCase()) ?? value)
12
+ .pipe(z.enum(profileCardPropertyNames))
13
+ .alias('n'),
14
+ force: z.boolean().optional().alias('f')
15
+ });
12
16
  class TenantPeopleProfileCardPropertyRemoveCommand extends GraphCommand {
13
17
  get name() {
14
18
  return commands.PEOPLE_PROFILECARDPROPERTY_REMOVE;
@@ -16,12 +20,8 @@ class TenantPeopleProfileCardPropertyRemoveCommand extends GraphCommand {
16
20
  get description() {
17
21
  return 'Removes an additional attribute from the profile card properties';
18
22
  }
19
- constructor() {
20
- super();
21
- _TenantPeopleProfileCardPropertyRemoveCommand_instances.add(this);
22
- __classPrivateFieldGet(this, _TenantPeopleProfileCardPropertyRemoveCommand_instances, "m", _TenantPeopleProfileCardPropertyRemoveCommand_initTelemetry).call(this);
23
- __classPrivateFieldGet(this, _TenantPeopleProfileCardPropertyRemoveCommand_instances, "m", _TenantPeopleProfileCardPropertyRemoveCommand_initOptions).call(this);
24
- __classPrivateFieldGet(this, _TenantPeopleProfileCardPropertyRemoveCommand_instances, "m", _TenantPeopleProfileCardPropertyRemoveCommand_initValidators).call(this);
23
+ get schema() {
24
+ return options;
25
25
  }
26
26
  async commandAction(logger, args) {
27
27
  const directoryPropertyName = profileCardPropertyNames.find(n => n.toLowerCase() === args.options.name.toLowerCase());
@@ -54,26 +54,5 @@ class TenantPeopleProfileCardPropertyRemoveCommand extends GraphCommand {
54
54
  }
55
55
  }
56
56
  }
57
- _TenantPeopleProfileCardPropertyRemoveCommand_instances = new WeakSet(), _TenantPeopleProfileCardPropertyRemoveCommand_initTelemetry = function _TenantPeopleProfileCardPropertyRemoveCommand_initTelemetry() {
58
- this.telemetry.push((args) => {
59
- Object.assign(this.telemetryProperties, {
60
- force: !!args.options.force
61
- });
62
- });
63
- }, _TenantPeopleProfileCardPropertyRemoveCommand_initOptions = function _TenantPeopleProfileCardPropertyRemoveCommand_initOptions() {
64
- this.options.unshift({
65
- option: '-n, --name <name>',
66
- autocomplete: profileCardPropertyNames
67
- }, {
68
- option: '-f, --force'
69
- });
70
- }, _TenantPeopleProfileCardPropertyRemoveCommand_initValidators = function _TenantPeopleProfileCardPropertyRemoveCommand_initValidators() {
71
- this.validators.push(async (args) => {
72
- if (profileCardPropertyNames.every(n => n.toLowerCase() !== args.options.name.toLowerCase())) {
73
- return `${args.options.name} is not a valid value for name. Allowed values are ${profileCardPropertyNames.join(', ')}`;
74
- }
75
- return true;
76
- });
77
- };
78
57
  export default new TenantPeopleProfileCardPropertyRemoveCommand();
79
58
  //# sourceMappingURL=people-profilecardproperty-remove.js.map