@pnp/cli-microsoft365 11.0.0-beta.1f852eb → 11.0.0-beta.3655c37

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 (86) hide show
  1. package/.devproxy/api-specs/sharepoint.yaml +54 -0
  2. package/.eslintrc.cjs +2 -0
  3. package/allCommands.json +1 -1
  4. package/allCommandsFull.json +1 -1
  5. package/dist/Command.js +4 -0
  6. package/dist/m365/adaptivecard/commands/adaptivecard-send.js +1 -1
  7. package/dist/m365/entra/commands/administrativeunit/administrativeunit-add.js +13 -27
  8. package/dist/m365/entra/commands/administrativeunit/administrativeunit-get.js +18 -43
  9. package/dist/m365/entra/commands/administrativeunit/administrativeunit-list.js +10 -21
  10. package/dist/m365/entra/commands/administrativeunit/administrativeunit-remove.js +25 -49
  11. package/dist/m365/entra/commands/app/app-add.js +14 -2
  12. package/dist/m365/entra/commands/roleassignment/roleassignment-add.js +146 -0
  13. package/dist/m365/entra/commands.js +1 -0
  14. package/dist/m365/flow/commands/environment/environment-get.js +19 -29
  15. package/dist/m365/graph/commands/openextension/openextension-add.js +2 -2
  16. package/dist/m365/graph/commands/openextension/openextension-set.js +2 -6
  17. package/dist/m365/outlook/commands/mail/mail-searchfolder-add.js +85 -0
  18. package/dist/m365/outlook/commands.js +1 -0
  19. package/dist/m365/pa/commands/environment/environment-get.js +18 -23
  20. package/dist/m365/pp/commands/copilot/copilot-get.js +0 -4
  21. package/dist/m365/pp/commands/copilot/copilot-list.js +0 -4
  22. package/dist/m365/pp/commands/copilot/copilot-remove.js +0 -4
  23. package/dist/m365/pp/commands/environment/environment-get.js +19 -26
  24. package/dist/m365/pp/commands.js +0 -7
  25. package/dist/m365/spfx/commands/project/project-upgrade.js +23 -66
  26. package/dist/m365/spo/commands/customaction/customaction-list.js +3 -10
  27. package/dist/m365/spo/commands/file/file-version-keep.js +78 -0
  28. package/dist/m365/spo/commands/homesite/homesite-get.js +28 -14
  29. package/dist/m365/spo/commands/homesite/homesite-list.js +1 -12
  30. package/dist/m365/spo/commands/homesite/homesite-remove.js +6 -34
  31. package/dist/m365/spo/commands/homesite/homesite-set.js +88 -44
  32. package/dist/m365/spo/commands/list/list-view-add.js +1 -1
  33. package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-grant-list.js +17 -25
  34. package/dist/m365/spo/commands.js +1 -2
  35. package/dist/m365/teams/commands/report/report-directroutingcalls.js +5 -12
  36. package/dist/m365/teams/commands/report/report-pstncalls.js +5 -12
  37. package/dist/m365/viva/commands.js +0 -3
  38. package/dist/utils/entraAdministrativeUnit.js +1 -1
  39. package/dist/utils/entraApp.js +15 -0
  40. package/docs/docs/cmd/entra/app/app-add.mdx +7 -1
  41. package/docs/docs/cmd/entra/roleassignment/roleassignment-add.mdx +163 -0
  42. package/docs/docs/cmd/flow/environment/environment-get.mdx +6 -5
  43. package/docs/docs/cmd/outlook/mail/mail-searchfolder-add.mdx +147 -0
  44. package/docs/docs/cmd/pa/environment/environment-get.mdx +5 -2
  45. package/docs/docs/cmd/pp/copilot/copilot-get.mdx +0 -6
  46. package/docs/docs/cmd/pp/copilot/copilot-list.mdx +0 -6
  47. package/docs/docs/cmd/pp/copilot/copilot-remove.mdx +0 -6
  48. package/docs/docs/cmd/pp/environment/environment-get.mdx +5 -2
  49. package/docs/docs/cmd/spfx/project/project-upgrade.mdx +18 -5
  50. package/docs/docs/cmd/spo/file/file-version-keep.mdx +68 -0
  51. package/docs/docs/cmd/spo/homesite/homesite-get.mdx +44 -23
  52. package/docs/docs/cmd/spo/homesite/homesite-list.mdx +0 -6
  53. package/docs/docs/cmd/spo/homesite/homesite-remove.mdx +10 -35
  54. package/docs/docs/cmd/spo/homesite/homesite-set.mdx +85 -45
  55. package/docs/docs/cmd/spo/list/list-view-add.mdx +11 -11
  56. package/docs/docs/cmd/spo/serviceprincipal/serviceprincipal-grant-list.mdx +18 -18
  57. package/docs/docs/cmd/teams/report/report-directroutingcalls.mdx +25 -44
  58. package/docs/docs/cmd/teams/report/report-pstncalls.mdx +25 -48
  59. package/docs/docs/cmd/viva/engage/engage-community-list.mdx +19 -0
  60. package/docs/docs/cmd/viva/engage/engage-community-user-add.mdx +19 -0
  61. package/docs/docs/cmd/viva/engage/engage-community-user-remove.mdx +19 -0
  62. package/npm-shrinkwrap.json +51 -51
  63. package/package.json +12 -12
  64. package/dist/m365/pp/commands/card/card-clone.js +0 -101
  65. package/dist/m365/pp/commands/card/card-get.js +0 -89
  66. package/dist/m365/pp/commands/card/card-list.js +0 -55
  67. package/dist/m365/pp/commands/card/card-remove.js +0 -105
  68. package/dist/m365/skype/commands/report/report-activitycounts.js +0 -15
  69. package/dist/m365/skype/commands/report/report-activityusercounts.js +0 -15
  70. package/dist/m365/skype/commands/report/report-activityuserdetail.js +0 -15
  71. package/dist/m365/skype/commands.js +0 -7
  72. package/dist/m365/spo/commands/mail/mail-send.js +0 -108
  73. package/dist/m365/viva/commands/engage/engage-group-list.js +0 -93
  74. package/dist/m365/viva/commands/engage/engage-group-user-add.js +0 -73
  75. package/dist/m365/viva/commands/engage/engage-group-user-remove.js +0 -88
  76. package/docs/docs/cmd/pp/card/card-clone.mdx +0 -103
  77. package/docs/docs/cmd/pp/card/card-get.mdx +0 -212
  78. package/docs/docs/cmd/pp/card/card-list.mdx +0 -163
  79. package/docs/docs/cmd/pp/card/card-remove.mdx +0 -86
  80. package/docs/docs/cmd/skype/report/report-activitycounts.mdx +0 -96
  81. package/docs/docs/cmd/skype/report/report-activityusercounts.mdx +0 -96
  82. package/docs/docs/cmd/skype/report/report-activityuserdetail.mdx +0 -134
  83. package/docs/docs/cmd/spo/mail/mail-send.mdx +0 -69
  84. package/docs/docs/cmd/viva/engage/engage-group-list.mdx +0 -174
  85. package/docs/docs/cmd/viva/engage/engage-group-user-add.mdx +0 -60
  86. package/docs/docs/cmd/viva/engage/engage-group-user-remove.mdx +0 -58
package/dist/Command.js CHANGED
@@ -359,6 +359,10 @@ class Command {
359
359
  const unknownOptions = optionsUtils.getUnknownOptions(options, this.options);
360
360
  optionsUtils.addUnknownOptionsToPayload(payload, unknownOptions);
361
361
  }
362
+ addUnknownOptionsToPayloadZod(payload, options) {
363
+ const unknownOptions = optionsUtils.getUnknownOptions(options, zod.schemaToOptions(this.schema));
364
+ optionsUtils.addUnknownOptionsToPayload(payload, unknownOptions);
365
+ }
362
366
  loadValuesFromAccessToken(args) {
363
367
  if (!auth.connection.accessTokens[auth.defaultResource]) {
364
368
  return;
@@ -15,7 +15,7 @@ export const options = globalOptionsZod
15
15
  card: z.string().optional(),
16
16
  cardData: z.string().optional()
17
17
  })
18
- .and(z.any());
18
+ .passthrough();
19
19
  class AdaptiveCardSendCommand extends AnonymousCommand {
20
20
  get name() {
21
21
  return commands.SEND;
@@ -1,12 +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 _EntraAdministrativeUnitAddCommand_instances, _EntraAdministrativeUnitAddCommand_initTelemetry, _EntraAdministrativeUnitAddCommand_initOptions;
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
7
3
  import request from "../../../../request.js";
4
+ import { zod } from '../../../../utils/zod.js';
8
5
  import GraphCommand from "../../../base/GraphCommand.js";
9
6
  import commands from "../../commands.js";
7
+ const options = globalOptionsZod
8
+ .extend({
9
+ displayName: zod.alias('n', z.string()),
10
+ description: zod.alias('d', z.string().optional()),
11
+ hiddenMembership: z.boolean().optional()
12
+ })
13
+ .passthrough();
10
14
  class EntraAdministrativeUnitAddCommand extends GraphCommand {
11
15
  get name() {
12
16
  return commands.ADMINISTRATIVEUNIT_ADD;
@@ -17,11 +21,8 @@ class EntraAdministrativeUnitAddCommand extends GraphCommand {
17
21
  allowUnknownOptions() {
18
22
  return true;
19
23
  }
20
- constructor() {
21
- super();
22
- _EntraAdministrativeUnitAddCommand_instances.add(this);
23
- __classPrivateFieldGet(this, _EntraAdministrativeUnitAddCommand_instances, "m", _EntraAdministrativeUnitAddCommand_initTelemetry).call(this);
24
- __classPrivateFieldGet(this, _EntraAdministrativeUnitAddCommand_instances, "m", _EntraAdministrativeUnitAddCommand_initOptions).call(this);
24
+ get schema() {
25
+ return options;
25
26
  }
26
27
  async commandAction(logger, args) {
27
28
  const requestBody = {
@@ -29,7 +30,7 @@ class EntraAdministrativeUnitAddCommand extends GraphCommand {
29
30
  displayName: args.options.displayName,
30
31
  visibility: args.options.hiddenMembership ? 'HiddenMembership' : null
31
32
  };
32
- this.addUnknownOptionsToPayload(requestBody, args.options);
33
+ this.addUnknownOptionsToPayloadZod(requestBody, args.options);
33
34
  const requestOptions = {
34
35
  url: `${this.resource}/v1.0/directory/administrativeUnits`,
35
36
  headers: {
@@ -47,20 +48,5 @@ class EntraAdministrativeUnitAddCommand extends GraphCommand {
47
48
  }
48
49
  }
49
50
  }
50
- _EntraAdministrativeUnitAddCommand_instances = new WeakSet(), _EntraAdministrativeUnitAddCommand_initTelemetry = function _EntraAdministrativeUnitAddCommand_initTelemetry() {
51
- this.telemetry.push((args) => {
52
- Object.assign(this.telemetryProperties, {
53
- hiddenMembership: !!args.options.hiddenMembership
54
- });
55
- });
56
- }, _EntraAdministrativeUnitAddCommand_initOptions = function _EntraAdministrativeUnitAddCommand_initOptions() {
57
- this.options.unshift({
58
- option: '-n, --displayName <displayName>'
59
- }, {
60
- option: '-d, --description [description]'
61
- }, {
62
- option: '--hiddenMembership'
63
- });
64
- };
65
51
  export default new EntraAdministrativeUnitAddCommand();
66
52
  //# sourceMappingURL=administrativeunit-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 _EntraAdministrativeUnitGetCommand_instances, _EntraAdministrativeUnitGetCommand_initTelemetry, _EntraAdministrativeUnitGetCommand_initOptions, _EntraAdministrativeUnitGetCommand_initValidators, _EntraAdministrativeUnitGetCommand_initOptionSets, _EntraAdministrativeUnitGetCommand_initTypes;
7
- import { validation } from "../../../../utils/validation.js";
1
+ import { z } from 'zod';
8
2
  import request from "../../../../request.js";
9
3
  import GraphCommand from "../../../base/GraphCommand.js";
10
4
  import commands from "../../commands.js";
11
5
  import { entraAdministrativeUnit } from "../../../../utils/entraAdministrativeUnit.js";
6
+ import { globalOptionsZod } from "../../../../Command.js";
7
+ import { zod } from "../../../../utils/zod.js";
8
+ const options = globalOptionsZod
9
+ .extend({
10
+ id: zod.alias('i', z.string().uuid().optional()),
11
+ displayName: zod.alias('n', z.string().optional()),
12
+ properties: zod.alias('p', z.string().optional())
13
+ })
14
+ .strict();
12
15
  class EntraAdministrativeUnitGetCommand extends GraphCommand {
13
16
  get name() {
14
17
  return commands.ADMINISTRATIVEUNIT_GET;
@@ -16,14 +19,14 @@ class EntraAdministrativeUnitGetCommand extends GraphCommand {
16
19
  get description() {
17
20
  return 'Gets information about a specific administrative unit';
18
21
  }
19
- constructor() {
20
- super();
21
- _EntraAdministrativeUnitGetCommand_instances.add(this);
22
- __classPrivateFieldGet(this, _EntraAdministrativeUnitGetCommand_instances, "m", _EntraAdministrativeUnitGetCommand_initTelemetry).call(this);
23
- __classPrivateFieldGet(this, _EntraAdministrativeUnitGetCommand_instances, "m", _EntraAdministrativeUnitGetCommand_initOptions).call(this);
24
- __classPrivateFieldGet(this, _EntraAdministrativeUnitGetCommand_instances, "m", _EntraAdministrativeUnitGetCommand_initValidators).call(this);
25
- __classPrivateFieldGet(this, _EntraAdministrativeUnitGetCommand_instances, "m", _EntraAdministrativeUnitGetCommand_initOptionSets).call(this);
26
- __classPrivateFieldGet(this, _EntraAdministrativeUnitGetCommand_instances, "m", _EntraAdministrativeUnitGetCommand_initTypes).call(this);
22
+ get schema() {
23
+ return options;
24
+ }
25
+ getRefinedSchema(schema) {
26
+ return schema
27
+ .refine(options => [options.id, options.displayName].filter(Boolean).length === 1, {
28
+ message: 'Specify either id or displayName'
29
+ });
27
30
  }
28
31
  async commandAction(logger, args) {
29
32
  let administrativeUnit;
@@ -62,33 +65,5 @@ class EntraAdministrativeUnitGetCommand extends GraphCommand {
62
65
  return await request.get(requestOptions);
63
66
  }
64
67
  }
65
- _EntraAdministrativeUnitGetCommand_instances = new WeakSet(), _EntraAdministrativeUnitGetCommand_initTelemetry = function _EntraAdministrativeUnitGetCommand_initTelemetry() {
66
- this.telemetry.push((args) => {
67
- Object.assign(this.telemetryProperties, {
68
- id: typeof args.options.id !== 'undefined',
69
- displayName: typeof args.options.displayName !== 'undefined',
70
- properties: typeof args.options.properties !== 'undefined'
71
- });
72
- });
73
- }, _EntraAdministrativeUnitGetCommand_initOptions = function _EntraAdministrativeUnitGetCommand_initOptions() {
74
- this.options.unshift({
75
- option: '-i, --id [id]'
76
- }, {
77
- option: '-n, --displayName [displayName]'
78
- }, {
79
- option: '-p, --properties [properties]'
80
- });
81
- }, _EntraAdministrativeUnitGetCommand_initValidators = function _EntraAdministrativeUnitGetCommand_initValidators() {
82
- this.validators.push(async (args) => {
83
- if (args.options.id && !validation.isValidGuid(args.options.id)) {
84
- return `${args.options.id} is not a valid GUID`;
85
- }
86
- return true;
87
- });
88
- }, _EntraAdministrativeUnitGetCommand_initOptionSets = function _EntraAdministrativeUnitGetCommand_initOptionSets() {
89
- this.optionSets.push({ options: ['id', 'displayName'] });
90
- }, _EntraAdministrativeUnitGetCommand_initTypes = function _EntraAdministrativeUnitGetCommand_initTypes() {
91
- this.types.string.push('displayName');
92
- };
93
68
  export default new EntraAdministrativeUnitGetCommand();
94
69
  //# sourceMappingURL=administrativeunit-get.js.map
@@ -1,12 +1,13 @@
1
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
- };
6
- var _EntraAdministrativeUnitListCommand_instances, _EntraAdministrativeUnitListCommand_initTelemetry, _EntraAdministrativeUnitListCommand_initOptions;
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
7
3
  import { odata } from '../../../../utils/odata.js';
4
+ import { zod } from '../../../../utils/zod.js';
8
5
  import GraphCommand from '../../../base/GraphCommand.js';
9
6
  import commands from '../../commands.js';
7
+ const options = globalOptionsZod
8
+ .extend({
9
+ properties: zod.alias('p', z.string().optional())
10
+ }).strict();
10
11
  class EntraAdministrativeUnitListCommand extends GraphCommand {
11
12
  get name() {
12
13
  return commands.ADMINISTRATIVEUNIT_LIST;
@@ -14,15 +15,12 @@ class EntraAdministrativeUnitListCommand extends GraphCommand {
14
15
  get description() {
15
16
  return 'Retrieves a list of administrative units';
16
17
  }
18
+ get schema() {
19
+ return options;
20
+ }
17
21
  defaultProperties() {
18
22
  return ['id', 'displayName', 'visibility'];
19
23
  }
20
- constructor() {
21
- super();
22
- _EntraAdministrativeUnitListCommand_instances.add(this);
23
- __classPrivateFieldGet(this, _EntraAdministrativeUnitListCommand_instances, "m", _EntraAdministrativeUnitListCommand_initTelemetry).call(this);
24
- __classPrivateFieldGet(this, _EntraAdministrativeUnitListCommand_instances, "m", _EntraAdministrativeUnitListCommand_initOptions).call(this);
25
- }
26
24
  async commandAction(logger, args) {
27
25
  const queryParameters = [];
28
26
  if (args.options.properties) {
@@ -44,14 +42,5 @@ class EntraAdministrativeUnitListCommand extends GraphCommand {
44
42
  }
45
43
  }
46
44
  }
47
- _EntraAdministrativeUnitListCommand_instances = new WeakSet(), _EntraAdministrativeUnitListCommand_initTelemetry = function _EntraAdministrativeUnitListCommand_initTelemetry() {
48
- this.telemetry.push((args) => {
49
- Object.assign(this.telemetryProperties, {
50
- properties: typeof args.options.properties !== 'undefined'
51
- });
52
- });
53
- }, _EntraAdministrativeUnitListCommand_initOptions = function _EntraAdministrativeUnitListCommand_initOptions() {
54
- this.options.unshift({ option: '-p, --properties [properties]' });
55
- };
56
45
  export default new EntraAdministrativeUnitListCommand();
57
46
  //# sourceMappingURL=administrativeunit-list.js.map
@@ -1,15 +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 _EntraAdministrativeUnitRemoveCommand_instances, _EntraAdministrativeUnitRemoveCommand_initTelemetry, _EntraAdministrativeUnitRemoveCommand_initOptions, _EntraAdministrativeUnitRemoveCommand_initOptionSets, _EntraAdministrativeUnitRemoveCommand_initValidators, _EntraAdministrativeUnitRemoveCommand_initTypes;
1
+ import { z } from 'zod';
2
+ import { cli } from '../../../../cli/cli.js';
3
+ import { globalOptionsZod } from '../../../../Command.js';
4
+ import request from '../../../../request.js';
7
5
  import { entraAdministrativeUnit } from '../../../../utils/entraAdministrativeUnit.js';
8
- import { validation } from "../../../../utils/validation.js";
9
- import request from "../../../../request.js";
10
- import GraphCommand from "../../../base/GraphCommand.js";
11
- import commands from "../../commands.js";
12
- import { cli } from "../../../../cli/cli.js";
6
+ import { zod } from '../../../../utils/zod.js';
7
+ import GraphCommand from '../../../base/GraphCommand.js';
8
+ import commands from '../../commands.js';
9
+ const options = globalOptionsZod
10
+ .extend({
11
+ id: zod.alias('i', z.string().uuid().optional()),
12
+ displayName: zod.alias('n', z.string().optional()),
13
+ force: zod.alias('f', z.boolean().optional())
14
+ })
15
+ .strict();
13
16
  class EntraAdministrativeUnitRemoveCommand extends GraphCommand {
14
17
  get name() {
15
18
  return commands.ADMINISTRATIVEUNIT_REMOVE;
@@ -17,14 +20,17 @@ class EntraAdministrativeUnitRemoveCommand extends GraphCommand {
17
20
  get description() {
18
21
  return 'Removes an administrative unit';
19
22
  }
20
- constructor() {
21
- super();
22
- _EntraAdministrativeUnitRemoveCommand_instances.add(this);
23
- __classPrivateFieldGet(this, _EntraAdministrativeUnitRemoveCommand_instances, "m", _EntraAdministrativeUnitRemoveCommand_initOptions).call(this);
24
- __classPrivateFieldGet(this, _EntraAdministrativeUnitRemoveCommand_instances, "m", _EntraAdministrativeUnitRemoveCommand_initValidators).call(this);
25
- __classPrivateFieldGet(this, _EntraAdministrativeUnitRemoveCommand_instances, "m", _EntraAdministrativeUnitRemoveCommand_initOptionSets).call(this);
26
- __classPrivateFieldGet(this, _EntraAdministrativeUnitRemoveCommand_instances, "m", _EntraAdministrativeUnitRemoveCommand_initTelemetry).call(this);
27
- __classPrivateFieldGet(this, _EntraAdministrativeUnitRemoveCommand_instances, "m", _EntraAdministrativeUnitRemoveCommand_initTypes).call(this);
23
+ get schema() {
24
+ return options;
25
+ }
26
+ getRefinedSchema(schema) {
27
+ return schema
28
+ .refine(options => options.id || options.displayName, {
29
+ message: 'Specify either id or displayName'
30
+ })
31
+ .refine(options => !(options.id && options.displayName), {
32
+ message: 'Specify either id or displayName but not both'
33
+ });
28
34
  }
29
35
  async commandAction(logger, args) {
30
36
  const removeAdministrativeUnit = async () => {
@@ -57,35 +63,5 @@ class EntraAdministrativeUnitRemoveCommand extends GraphCommand {
57
63
  }
58
64
  }
59
65
  }
60
- _EntraAdministrativeUnitRemoveCommand_instances = new WeakSet(), _EntraAdministrativeUnitRemoveCommand_initTelemetry = function _EntraAdministrativeUnitRemoveCommand_initTelemetry() {
61
- this.telemetry.push((args) => {
62
- Object.assign(this.telemetryProperties, {
63
- id: args.options.id !== 'undefined',
64
- displayName: args.options.displayName !== 'undefined',
65
- force: !!args.options.force
66
- });
67
- });
68
- }, _EntraAdministrativeUnitRemoveCommand_initOptions = function _EntraAdministrativeUnitRemoveCommand_initOptions() {
69
- this.options.unshift({
70
- option: '-i, --id [id]'
71
- }, {
72
- option: '-n, --displayName [displayName]'
73
- }, {
74
- option: '-f, --force'
75
- });
76
- }, _EntraAdministrativeUnitRemoveCommand_initOptionSets = function _EntraAdministrativeUnitRemoveCommand_initOptionSets() {
77
- this.optionSets.push({
78
- options: ['id', 'displayName']
79
- });
80
- }, _EntraAdministrativeUnitRemoveCommand_initValidators = function _EntraAdministrativeUnitRemoveCommand_initValidators() {
81
- this.validators.push(async (args) => {
82
- if (args.options.id && !validation.isValidGuid(args.options.id)) {
83
- return `${args.options.id} is not a valid GUID for option id.`;
84
- }
85
- return true;
86
- });
87
- }, _EntraAdministrativeUnitRemoveCommand_initTypes = function _EntraAdministrativeUnitRemoveCommand_initTypes() {
88
- this.types.string.push('id', 'displayName');
89
- };
90
66
  export default new EntraAdministrativeUnitRemoveCommand();
91
67
  //# sourceMappingURL=administrativeunit-remove.js.map
@@ -425,7 +425,9 @@ _a = EntraAppAddCommand, _EntraAppAddCommand_instances = new WeakSet(), _EntraAp
425
425
  certificateBase64Encoded: typeof args.options.certificateBase64Encoded !== 'undefined',
426
426
  certificateDisplayName: typeof args.options.certificateDisplayName !== 'undefined',
427
427
  grantAdminConsent: typeof args.options.grantAdminConsent !== 'undefined',
428
- allowPublicClientFlows: typeof args.options.allowPublicClientFlows !== 'undefined'
428
+ allowPublicClientFlows: typeof args.options.allowPublicClientFlows !== 'undefined',
429
+ bundleId: typeof args.options.bundleId !== 'undefined',
430
+ signatureHash: typeof args.options.signatureHash !== 'undefined'
429
431
  });
430
432
  });
431
433
  }, _EntraAppAddCommand_initOptions = function _EntraAppAddCommand_initOptions() {
@@ -465,6 +467,10 @@ _a = EntraAppAddCommand, _EntraAppAddCommand_instances = new WeakSet(), _EntraAp
465
467
  option: '--certificateDisplayName [certificateDisplayName]'
466
468
  }, {
467
469
  option: '--manifest [manifest]'
470
+ }, {
471
+ option: '--bundleId [bundleId]'
472
+ }, {
473
+ option: '--signatureHash [signatureHash]'
468
474
  }, {
469
475
  option: '--save'
470
476
  }, {
@@ -519,12 +525,18 @@ _a = EntraAppAddCommand, _EntraAppAddCommand_instances = new WeakSet(), _EntraAp
519
525
  return `Error while parsing the specified manifest: ${e}`;
520
526
  }
521
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
+ }
522
534
  return true;
523
535
  });
524
536
  }, _EntraAppAddCommand_initOptionSets = function _EntraAppAddCommand_initOptionSets() {
525
537
  this.optionSets.push({ options: ['name', 'manifest'] });
526
538
  };
527
- EntraAppAddCommand.entraApplicationPlatform = ['spa', 'web', 'publicClient'];
539
+ EntraAppAddCommand.entraApplicationPlatform = ['spa', 'web', 'publicClient', 'apple', 'android'];
528
540
  EntraAppAddCommand.entraAppScopeConsentBy = ['admins', 'adminsAndUsers'];
529
541
  export default new EntraAppAddCommand();
530
542
  //# sourceMappingURL=app-add.js.map
@@ -0,0 +1,146 @@
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 { validation } from '../../../../utils/validation.js';
7
+ import { entraAdministrativeUnit } from '../../../../utils/entraAdministrativeUnit.js';
8
+ import { entraApp } from '../../../../utils/entraApp.js';
9
+ import { entraServicePrincipal } from '../../../../utils/entraServicePrincipal.js';
10
+ import { entraGroup } from '../../../../utils/entraGroup.js';
11
+ import { roleDefinition } from '../../../../utils/roleDefinition.js';
12
+ import { entraUser } from '../../../../utils/entraUser.js';
13
+ const options = globalOptionsZod
14
+ .extend({
15
+ roleDefinitionId: z.string().refine(id => validation.isValidGuid(id), id => ({
16
+ message: `'${id}' is not a valid GUID.`
17
+ })).optional(),
18
+ roleDefinitionName: z.string().optional(),
19
+ principal: z.string().refine(principal => validation.isValidGuid(principal) || validation.isValidUserPrincipalName(principal) || validation.isValidMailNickname(principal), principal => ({
20
+ message: `'${principal}' is not a valid GUID, UPN or group mail nickname.`
21
+ })),
22
+ userId: z.string().refine(id => validation.isValidGuid(id), id => ({
23
+ message: `'${id}' is not a valid GUID.`
24
+ })).optional(),
25
+ userName: z.string().refine(upn => validation.isValidUserPrincipalName(upn), upn => ({
26
+ message: `'${upn}' is not a valid UPN.`
27
+ })).optional(),
28
+ administrativeUnitId: z.string().refine(id => validation.isValidGuid(id), id => ({
29
+ message: `'${id}' is not a valid GUID.`
30
+ })).optional(),
31
+ administrativeUnitName: z.string().optional(),
32
+ applicationId: z.string().refine(id => validation.isValidGuid(id), id => ({
33
+ message: `'${id}' is not a valid GUID.`
34
+ })).optional(),
35
+ applicationObjectId: z.string().refine(id => validation.isValidGuid(id), id => ({
36
+ message: `'${id}' is not a valid GUID.`
37
+ })).optional(),
38
+ applicationName: z.string().optional(),
39
+ servicePrincipalId: z.string().refine(id => validation.isValidGuid(id), id => ({
40
+ message: `'${id}' is not a valid GUID.`
41
+ })).optional(),
42
+ servicePrincipalName: z.string().optional(),
43
+ groupId: z.string().refine(id => validation.isValidGuid(id), id => ({
44
+ message: `'${id}' is not a valid GUID.`
45
+ })).optional(),
46
+ groupName: z.string().optional()
47
+ })
48
+ .strict();
49
+ class EntraRoleAssignmentAddCommand extends GraphCommand {
50
+ get name() {
51
+ return commands.ROLEASSIGNMENT_ADD;
52
+ }
53
+ get description() {
54
+ return 'Assign a Entra ID role to a user and specify the scope for which the user has been granted access';
55
+ }
56
+ get schema() {
57
+ return options;
58
+ }
59
+ getRefinedSchema(schema) {
60
+ return schema
61
+ .refine(options => [options.roleDefinitionId, options.roleDefinitionName].filter(o => o !== undefined).length === 1, {
62
+ message: 'Specify either roleDefinitionId or roleDefinitionName'
63
+ })
64
+ .refine(options => Object.values([options.userId, options.userName, options.administrativeUnitId, options.administrativeUnitName, options.applicationId, options.applicationObjectId, options.applicationName,
65
+ options.servicePrincipalId, options.servicePrincipalName, options.groupId, options.groupName]).filter(v => typeof v !== 'undefined').length < 2, {
66
+ message: 'Provide value for only one of the following parameters: userId, userName, administrativeUnitId, administrativeUnitName, applicationId, applicationObjectId, applicationName, servicePrincipalId, servicePrincipalName, groupId or groupName'
67
+ });
68
+ }
69
+ async commandAction(logger, args) {
70
+ try {
71
+ const roleDefinitionId = await this.getRoleDefinitionId(args.options, logger);
72
+ const data = {
73
+ roleDefinitionId: roleDefinitionId,
74
+ principalId: await this.getPrincipalId(args.options, logger),
75
+ directoryScopeId: await this.getDirectoryScopeId(args.options)
76
+ };
77
+ const requestOptions = {
78
+ url: `${this.resource}/v1.0/roleManagement/directory/roleAssignments`,
79
+ headers: {
80
+ accept: 'application/json;odata.metadata=none'
81
+ },
82
+ responseType: 'json',
83
+ data: data
84
+ };
85
+ const response = await request.post(requestOptions);
86
+ await logger.log(response);
87
+ }
88
+ catch (err) {
89
+ this.handleRejectedODataJsonPromise(err);
90
+ }
91
+ }
92
+ async getRoleDefinitionId(options, logger) {
93
+ if (options.roleDefinitionId) {
94
+ return options.roleDefinitionId;
95
+ }
96
+ if (this.verbose) {
97
+ await logger.logToStderr(`Retrieving role definition by its name '${options.roleDefinitionName}'`);
98
+ }
99
+ const role = await roleDefinition.getRoleDefinitionByDisplayName(options.roleDefinitionName);
100
+ return role.id;
101
+ }
102
+ async getPrincipalId(options, logger) {
103
+ if (validation.isValidGuid(options.principal)) {
104
+ return options.principal;
105
+ }
106
+ if (validation.isValidUserPrincipalName(options.principal)) {
107
+ if (this.verbose) {
108
+ await logger.logToStderr(`Retrieving user id by UPN '${options.principal}'`);
109
+ }
110
+ return await entraUser.getUserIdByUpn(options.principal);
111
+ }
112
+ if (this.verbose) {
113
+ await logger.logToStderr(`Retrieving group id by mail nickname '${options.principal}'`);
114
+ }
115
+ return await entraGroup.getGroupIdByMailNickname(options.principal);
116
+ }
117
+ async getDirectoryScopeId(options) {
118
+ let prefix = '/';
119
+ let resourceId = '';
120
+ if (options.userId || options.userName) {
121
+ resourceId = options.userId || await entraUser.getUserIdByUpn(options.userName);
122
+ }
123
+ else if (options.administrativeUnitId || options.administrativeUnitName) {
124
+ prefix = '/administrativeUnits/';
125
+ resourceId = options.administrativeUnitId || (await entraAdministrativeUnit.getAdministrativeUnitByDisplayName(options.administrativeUnitName, "id")).id;
126
+ }
127
+ else if (options.applicationId || options.applicationObjectId || options.applicationName) {
128
+ resourceId = options.applicationObjectId;
129
+ if (options.applicationId) {
130
+ resourceId = (await entraApp.getAppRegistrationByAppId(options.applicationId, ["id"])).id;
131
+ }
132
+ else if (options.applicationName) {
133
+ resourceId = (await entraApp.getAppRegistrationByAppName(options.applicationName, ["id"])).id;
134
+ }
135
+ }
136
+ else if (options.servicePrincipalId || options.servicePrincipalName) {
137
+ resourceId = options.servicePrincipalId || (await entraServicePrincipal.getServicePrincipalByAppName(options.servicePrincipalName, "id")).id;
138
+ }
139
+ else if (options.groupId || options.groupName) {
140
+ resourceId = options.groupId || (await entraGroup.getGroupIdByDisplayName(options.groupName));
141
+ }
142
+ return `${prefix}${resourceId}`;
143
+ }
144
+ }
145
+ export default new EntraRoleAssignmentAddCommand();
146
+ //# sourceMappingURL=roleassignment-add.js.map
@@ -92,6 +92,7 @@ export default {
92
92
  PIM_ROLE_REQUEST_LIST: `${prefix} pim role request list`,
93
93
  POLICY_LIST: `${prefix} policy list`,
94
94
  RESOURCENAMESPACE_LIST: `${prefix} resourcenamespace list`,
95
+ ROLEASSIGNMENT_ADD: `${prefix} roleassignment add`,
95
96
  ROLEDEFINITION_ADD: `${prefix} roledefinition add`,
96
97
  ROLEDEFINITION_LIST: `${prefix} roledefinition list`,
97
98
  ROLEDEFINITION_GET: `${prefix} roledefinition get`,
@@ -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 _FlowEnvironmentGetCommand_instances, _FlowEnvironmentGetCommand_initOptions, _FlowEnvironmentGetCommand_initTelemetry;
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
7
3
  import request from '../../../../request.js';
8
4
  import { formatting } from '../../../../utils/formatting.js';
5
+ import { zod } from '../../../../utils/zod.js';
9
6
  import PowerAutomateCommand from '../../../base/PowerAutomateCommand.js';
10
7
  import commands from '../../commands.js';
8
+ const options = globalOptionsZod
9
+ .extend({
10
+ name: zod.alias('n', z.string().optional()),
11
+ default: z.boolean().optional()
12
+ })
13
+ .strict();
11
14
  class FlowEnvironmentGetCommand extends PowerAutomateCommand {
12
15
  get name() {
13
16
  return commands.ENVIRONMENT_GET;
@@ -15,23 +18,21 @@ class FlowEnvironmentGetCommand extends PowerAutomateCommand {
15
18
  get description() {
16
19
  return 'Gets information about the specified Microsoft Flow environment';
17
20
  }
18
- constructor() {
19
- super();
20
- _FlowEnvironmentGetCommand_instances.add(this);
21
- __classPrivateFieldGet(this, _FlowEnvironmentGetCommand_instances, "m", _FlowEnvironmentGetCommand_initOptions).call(this);
22
- __classPrivateFieldGet(this, _FlowEnvironmentGetCommand_instances, "m", _FlowEnvironmentGetCommand_initTelemetry).call(this);
21
+ get schema() {
22
+ return options;
23
+ }
24
+ getRefinedSchema(schema) {
25
+ return schema
26
+ .refine(options => !!options.name !== !!options.default, {
27
+ message: `Specify either name or default, but not both.`
28
+ });
23
29
  }
24
30
  async commandAction(logger, args) {
25
31
  if (this.verbose) {
26
- await logger.logToStderr(`Retrieving information about Microsoft Flow environment ${args.options.name ?? ''}...`);
32
+ await logger.logToStderr(`Retrieving information about Microsoft Flow environment ${args.options.name ?? 'default'}...`);
27
33
  }
28
34
  let requestUrl = `${PowerAutomateCommand.resource}/providers/Microsoft.ProcessSimple/environments/`;
29
- if (args.options.name) {
30
- requestUrl += `${formatting.encodeQueryParameter(args.options.name)}`;
31
- }
32
- else {
33
- requestUrl += `~default`;
34
- }
35
+ requestUrl += args.options.default ? '~default' : formatting.encodeQueryParameter(args.options.name);
35
36
  const requestOptions = {
36
37
  url: `${requestUrl}?api-version=2016-11-01`,
37
38
  headers: {
@@ -55,16 +56,5 @@ class FlowEnvironmentGetCommand extends PowerAutomateCommand {
55
56
  }
56
57
  }
57
58
  }
58
- _FlowEnvironmentGetCommand_instances = new WeakSet(), _FlowEnvironmentGetCommand_initOptions = function _FlowEnvironmentGetCommand_initOptions() {
59
- this.options.unshift({
60
- option: '-n, --name [name]'
61
- });
62
- }, _FlowEnvironmentGetCommand_initTelemetry = function _FlowEnvironmentGetCommand_initTelemetry() {
63
- this.telemetry.push((args) => {
64
- Object.assign(this.telemetryProperties, {
65
- name: typeof args.options.name !== 'undefined'
66
- });
67
- });
68
- };
69
59
  export default new FlowEnvironmentGetCommand();
70
60
  //# sourceMappingURL=environment-get.js.map
@@ -12,7 +12,7 @@ const options = globalOptionsZod
12
12
  resourceId: zod.alias('i', z.string()),
13
13
  resourceType: zod.alias('t', z.enum(['user', 'group', 'device', 'organization']))
14
14
  })
15
- .and(z.any());
15
+ .passthrough();
16
16
  class GraphOpenExtensionAddCommand extends GraphCommand {
17
17
  get name() {
18
18
  return commands.OPENEXTENSION_ADD;
@@ -38,7 +38,7 @@ class GraphOpenExtensionAddCommand extends GraphCommand {
38
38
  try {
39
39
  const requestBody = {};
40
40
  requestBody["extensionName"] = args.options.name;
41
- const unknownOptions = optionsUtils.getUnknownOptions(args.options, this.options);
41
+ const unknownOptions = optionsUtils.getUnknownOptions(args.options, zod.schemaToOptions(this.schema));
42
42
  const unknownOptionsNames = Object.getOwnPropertyNames(unknownOptions);
43
43
  unknownOptionsNames.forEach(async (o) => {
44
44
  try {
@@ -13,11 +13,10 @@ const options = globalOptionsZod
13
13
  resourceType: zod.alias('t', z.enum(['user', 'group', 'device', 'organization'])),
14
14
  keepUnchangedProperties: zod.alias('k', z.boolean().optional())
15
15
  })
16
- .and(z.any());
16
+ .passthrough();
17
17
  class GraphOpenExtensionSetCommand extends GraphCommand {
18
18
  constructor() {
19
19
  super(...arguments);
20
- this.commandOptions = ['keepUnchangedProperties', 'resourceType', 'resourceId', 'name'];
21
20
  this.defaultOpenExtensionProperties = ['id', 'extensionName'];
22
21
  }
23
22
  get name() {
@@ -46,12 +45,9 @@ class GraphOpenExtensionSetCommand extends GraphCommand {
46
45
  const currentExtensionNames = Object.getOwnPropertyNames(currentExtension);
47
46
  const requestBody = {};
48
47
  requestBody["@odata.type"] = '#microsoft.graph.openTypeExtension';
49
- const unknownOptions = optionsUtils.getUnknownOptions(args.options, this.options);
48
+ const unknownOptions = optionsUtils.getUnknownOptions(args.options, zod.schemaToOptions(this.schema));
50
49
  const unknownOptionsNames = Object.getOwnPropertyNames(unknownOptions);
51
50
  unknownOptionsNames.forEach(async (option) => {
52
- if (this.commandOptions.includes(option)) {
53
- return;
54
- }
55
51
  const value = unknownOptions[option];
56
52
  if (value === "") {
57
53
  requestBody[option] = null;