@pnp/cli-microsoft365 11.10.0 → 11.11.0-beta.1cb40cb

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 (55) hide show
  1. package/allCommands.json +1 -1
  2. package/allCommandsFull.json +1 -1
  3. package/dist/config.js +1 -0
  4. package/dist/m365/entra/commands/agent/agent-list.js +48 -0
  5. package/dist/m365/entra/commands.js +1 -0
  6. package/dist/m365/pp/commands/aibuildermodel/aibuildermodel-get.js +23 -41
  7. package/dist/m365/pp/commands/aibuildermodel/aibuildermodel-list.js +9 -24
  8. package/dist/m365/pp/commands/aibuildermodel/aibuildermodel-remove.js +24 -44
  9. package/dist/m365/pp/commands/copilot/copilot-get.js +23 -41
  10. package/dist/m365/pp/commands/copilot/copilot-list.js +9 -24
  11. package/dist/m365/pp/commands/copilot/copilot-remove.js +24 -44
  12. package/dist/m365/pp/commands/dataverse/dataverse-table-get.js +10 -26
  13. package/dist/m365/pp/commands/dataverse/dataverse-table-list.js +9 -24
  14. package/dist/m365/pp/commands/dataverse/dataverse-table-remove.js +11 -29
  15. package/dist/m365/pp/commands/dataverse/dataverse-table-row-list.js +21 -33
  16. package/dist/m365/pp/commands/dataverse/dataverse-table-row-remove.js +25 -46
  17. package/dist/m365/pp/commands/gateway/gateway-get.js +10 -23
  18. package/dist/m365/pp/commands/managementapp/managementapp-add.js +24 -36
  19. package/dist/m365/pp/commands/managementapp/managementapp-list.js +5 -0
  20. package/dist/m365/pp/commands/solution/solution-get.js +23 -41
  21. package/dist/m365/pp/commands/solution/solution-list.js +9 -24
  22. package/dist/m365/pp/commands/solution/solution-publish.js +25 -45
  23. package/dist/m365/pp/commands/solution/solution-publisher-add.js +26 -49
  24. package/dist/m365/pp/commands/solution/solution-publisher-get.js +23 -41
  25. package/dist/m365/pp/commands/solution/solution-publisher-list.js +10 -27
  26. package/dist/m365/pp/commands/solution/solution-publisher-remove.js +24 -44
  27. package/dist/m365/pp/commands/solution/solution-remove.js +24 -44
  28. package/dist/m365/pp/commands/tenant/tenant-settings-set.js +81 -170
  29. package/dist/m365/spo/commands/folder/folder-add.js +1 -1
  30. package/docs/docs/cmd/entra/agent/agent-list.mdx +209 -0
  31. package/docs/docs/cmd/spo/file/file-version-clear.mdx +21 -0
  32. package/docs/docs/cmd/spo/file/file-version-get.mdx +19 -0
  33. package/docs/docs/cmd/spo/file/file-version-list.mdx +19 -0
  34. package/docs/docs/cmd/spo/file/file-version-remove.mdx +21 -0
  35. package/docs/docs/cmd/spo/file/file-version-restore.mdx +21 -0
  36. package/docs/docs/cmd/spo/folder/folder-add.mdx +20 -1
  37. package/docs/docs/cmd/spo/folder/folder-archive.mdx +2 -3
  38. package/docs/docs/cmd/spo/folder/folder-copy.mdx +19 -0
  39. package/docs/docs/cmd/spo/folder/folder-get.mdx +19 -0
  40. package/docs/docs/cmd/spo/folder/folder-list.mdx +19 -0
  41. package/docs/docs/cmd/spo/folder/folder-move.mdx +19 -0
  42. package/docs/docs/cmd/spo/folder/folder-remove.mdx +21 -0
  43. package/docs/docs/cmd/spo/folder/folder-set.mdx +21 -0
  44. package/docs/docs/cmd/todo/list/list-add.mdx +19 -0
  45. package/docs/docs/cmd/todo/list/list-get.mdx +19 -0
  46. package/docs/docs/cmd/todo/list/list-list.mdx +19 -0
  47. package/docs/docs/cmd/todo/list/list-remove.mdx +21 -0
  48. package/docs/docs/cmd/todo/list/list-set.mdx +21 -0
  49. package/docs/docs/cmd/todo/task/task-add.mdx +19 -0
  50. package/docs/docs/cmd/todo/task/task-get.mdx +19 -0
  51. package/docs/docs/cmd/todo/task/task-list.mdx +19 -0
  52. package/docs/docs/cmd/todo/task/task-remove.mdx +21 -0
  53. package/docs/docs/cmd/todo/task/task-set.mdx +19 -0
  54. package/npm-shrinkwrap.json +356 -190
  55. package/package.json +14 -14
@@ -1,13 +1,30 @@
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 _PpSolutionPublisherAddCommand_instances, _PpSolutionPublisherAddCommand_initTelemetry, _PpSolutionPublisherAddCommand_initOptions, _PpSolutionPublisherAddCommand_initValidators;
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
7
3
  import request from '../../../../request.js';
8
4
  import { powerPlatform } from '../../../../utils/powerPlatform.js';
9
5
  import PowerPlatformCommand from '../../../base/PowerPlatformCommand.js';
10
6
  import commands from '../../commands.js';
7
+ export const options = z.strictObject({
8
+ ...globalOptionsZod.shape,
9
+ environmentName: z.string().alias('e'),
10
+ name: z.string()
11
+ .refine(val => /^[a-zA-Z_][A-Za-z0-9_]+$/.test(val), {
12
+ error: 'Option name may only consist of alphanumeric characters and underscores. The first character cannot be a number.'
13
+ }).alias('n'),
14
+ displayName: z.string(),
15
+ prefix: z.string()
16
+ .refine(val => /^(?!mscrm.*$)[a-zA-Z][A-Za-z0-9]{1,7}$/.test(val), {
17
+ error: `Option prefix may only consist of alphanumeric characters. The first character cannot be a number and may not start with 'mscrm'. It must be between 2 and 8 characters long.`
18
+ }),
19
+ choiceValuePrefix: z.string()
20
+ .refine(val => {
21
+ const num = Number(val);
22
+ return Number.isInteger(num) && num >= 10000 && num <= 99999;
23
+ }, {
24
+ error: 'Option choiceValuePrefix should be an integer between 10000 and 99999.'
25
+ }),
26
+ asAdmin: z.boolean().optional()
27
+ });
11
28
  class PpSolutionPublisherAddCommand extends PowerPlatformCommand {
12
29
  get name() {
13
30
  return commands.SOLUTION_PUBLISHER_ADD;
@@ -15,12 +32,8 @@ class PpSolutionPublisherAddCommand extends PowerPlatformCommand {
15
32
  get description() {
16
33
  return 'Adds a specified publisher in a given environment';
17
34
  }
18
- constructor() {
19
- super();
20
- _PpSolutionPublisherAddCommand_instances.add(this);
21
- __classPrivateFieldGet(this, _PpSolutionPublisherAddCommand_instances, "m", _PpSolutionPublisherAddCommand_initTelemetry).call(this);
22
- __classPrivateFieldGet(this, _PpSolutionPublisherAddCommand_instances, "m", _PpSolutionPublisherAddCommand_initOptions).call(this);
23
- __classPrivateFieldGet(this, _PpSolutionPublisherAddCommand_instances, "m", _PpSolutionPublisherAddCommand_initValidators).call(this);
35
+ get schema() {
36
+ return options;
24
37
  }
25
38
  async commandAction(logger, args) {
26
39
  if (this.verbose) {
@@ -38,7 +51,7 @@ class PpSolutionPublisherAddCommand extends PowerPlatformCommand {
38
51
  uniquename: args.options.name,
39
52
  friendlyname: args.options.displayName,
40
53
  customizationprefix: args.options.prefix,
41
- customizationoptionvalueprefix: args.options.choiceValuePrefix
54
+ customizationoptionvalueprefix: Number(args.options.choiceValuePrefix)
42
55
  }
43
56
  };
44
57
  await request.post(requestOptions);
@@ -48,41 +61,5 @@ class PpSolutionPublisherAddCommand extends PowerPlatformCommand {
48
61
  }
49
62
  }
50
63
  }
51
- _PpSolutionPublisherAddCommand_instances = new WeakSet(), _PpSolutionPublisherAddCommand_initTelemetry = function _PpSolutionPublisherAddCommand_initTelemetry() {
52
- this.telemetry.push((args) => {
53
- Object.assign(this.telemetryProperties, {
54
- asAdmin: !!args.options.asAdmin
55
- });
56
- });
57
- }, _PpSolutionPublisherAddCommand_initOptions = function _PpSolutionPublisherAddCommand_initOptions() {
58
- this.options.unshift({
59
- option: '-e, --environmentName <environmentName>'
60
- }, {
61
- option: '-n, --name <name>'
62
- }, {
63
- option: '--displayName <displayName>'
64
- }, {
65
- option: '--prefix <prefix>'
66
- }, {
67
- option: '--choiceValuePrefix <choiceValuePrefix>'
68
- }, {
69
- option: '--asAdmin'
70
- });
71
- }, _PpSolutionPublisherAddCommand_initValidators = function _PpSolutionPublisherAddCommand_initValidators() {
72
- this.validators.push(async (args) => {
73
- if (isNaN(args.options.choiceValuePrefix) || args.options.choiceValuePrefix < 10000 || args.options.choiceValuePrefix > 99999 || !Number.isInteger(args.options.choiceValuePrefix)) {
74
- return 'Option choiceValuePrefix should be an integer between 10000 and 99999.';
75
- }
76
- const nameRegEx = new RegExp(/^[a-zA-Z_][A-Za-z0-9_]+$/);
77
- if (!nameRegEx.test(args.options.name)) {
78
- return 'Option name may only consist of alphanumeric characters and underscores. The first character cannot be a number.';
79
- }
80
- const prefixRegEx = new RegExp(/^(?!mscrm.*$)[a-zA-Z][A-Za-z0-9]{1,7}$/);
81
- if (!prefixRegEx.test(args.options.prefix)) {
82
- return `Option prefix may only consist of alphanumeric characters. The first character cannot be a number and may not start with 'mscrm'. It must be between 2 and 8 characters long.`;
83
- }
84
- return true;
85
- });
86
- };
87
64
  export default new PpSolutionPublisherAddCommand();
88
65
  //# sourceMappingURL=solution-publisher-add.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 _PpSolutionPublisherGetCommand_instances, _PpSolutionPublisherGetCommand_initTelemetry, _PpSolutionPublisherGetCommand_initOptions, _PpSolutionPublisherGetCommand_initOptionSets, _PpSolutionPublisherGetCommand_initValidators;
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
7
3
  import request from '../../../../request.js';
8
4
  import { powerPlatform } from '../../../../utils/powerPlatform.js';
9
5
  import { validation } from '../../../../utils/validation.js';
10
6
  import PowerPlatformCommand from '../../../base/PowerPlatformCommand.js';
11
7
  import commands from '../../commands.js';
8
+ export const options = z.strictObject({
9
+ ...globalOptionsZod.shape,
10
+ environmentName: z.string().alias('e'),
11
+ id: z.string().refine(val => validation.isValidGuid(val), {
12
+ error: 'The value must be a valid GUID.'
13
+ }).optional().alias('i'),
14
+ name: z.string().optional().alias('n'),
15
+ asAdmin: z.boolean().optional()
16
+ });
12
17
  class PpSolutionPublisherGetCommand extends PowerPlatformCommand {
13
18
  get name() {
14
19
  return commands.SOLUTION_PUBLISHER_GET;
@@ -16,13 +21,18 @@ class PpSolutionPublisherGetCommand extends PowerPlatformCommand {
16
21
  get description() {
17
22
  return 'Gets information about the specified publisher in a given environment.';
18
23
  }
19
- constructor() {
20
- super();
21
- _PpSolutionPublisherGetCommand_instances.add(this);
22
- __classPrivateFieldGet(this, _PpSolutionPublisherGetCommand_instances, "m", _PpSolutionPublisherGetCommand_initTelemetry).call(this);
23
- __classPrivateFieldGet(this, _PpSolutionPublisherGetCommand_instances, "m", _PpSolutionPublisherGetCommand_initOptions).call(this);
24
- __classPrivateFieldGet(this, _PpSolutionPublisherGetCommand_instances, "m", _PpSolutionPublisherGetCommand_initValidators).call(this);
25
- __classPrivateFieldGet(this, _PpSolutionPublisherGetCommand_instances, "m", _PpSolutionPublisherGetCommand_initOptionSets).call(this);
24
+ get schema() {
25
+ return options;
26
+ }
27
+ getRefinedSchema(schema) {
28
+ return schema
29
+ .refine(opts => [opts.id, opts.name].filter(x => x !== undefined).length === 1, {
30
+ error: `Specify either 'id' or 'name', but not both.`,
31
+ params: {
32
+ customCode: 'optionSet',
33
+ options: ['id', 'name']
34
+ }
35
+ });
26
36
  }
27
37
  async commandAction(logger, args) {
28
38
  if (this.verbose) {
@@ -57,33 +67,5 @@ class PpSolutionPublisherGetCommand extends PowerPlatformCommand {
57
67
  }
58
68
  }
59
69
  }
60
- _PpSolutionPublisherGetCommand_instances = new WeakSet(), _PpSolutionPublisherGetCommand_initTelemetry = function _PpSolutionPublisherGetCommand_initTelemetry() {
61
- this.telemetry.push((args) => {
62
- Object.assign(this.telemetryProperties, {
63
- id: typeof args.options.id !== 'undefined',
64
- name: typeof args.options.name !== 'undefined',
65
- asAdmin: !!args.options.asAdmin
66
- });
67
- });
68
- }, _PpSolutionPublisherGetCommand_initOptions = function _PpSolutionPublisherGetCommand_initOptions() {
69
- this.options.unshift({
70
- option: '-e, --environmentName <environmentName>'
71
- }, {
72
- option: '-i, --id [id]'
73
- }, {
74
- option: '-n, --name [name]'
75
- }, {
76
- option: '--asAdmin'
77
- });
78
- }, _PpSolutionPublisherGetCommand_initOptionSets = function _PpSolutionPublisherGetCommand_initOptionSets() {
79
- this.optionSets.push({ options: ['id', 'name'] });
80
- }, _PpSolutionPublisherGetCommand_initValidators = function _PpSolutionPublisherGetCommand_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`;
84
- }
85
- return true;
86
- });
87
- };
88
70
  export default new PpSolutionPublisherGetCommand();
89
71
  //# sourceMappingURL=solution-publisher-get.js.map
@@ -1,13 +1,15 @@
1
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
- };
6
- var _PpSolutionPublisherListCommand_instances, _PpSolutionPublisherListCommand_initTelemetry, _PpSolutionPublisherListCommand_initOptions;
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
7
3
  import request from '../../../../request.js';
8
4
  import { powerPlatform } from '../../../../utils/powerPlatform.js';
9
5
  import PowerPlatformCommand from '../../../base/PowerPlatformCommand.js';
10
6
  import commands from '../../commands.js';
7
+ export const options = z.strictObject({
8
+ ...globalOptionsZod.shape,
9
+ environmentName: z.string().alias('e'),
10
+ withMicrosoftPublishers: z.boolean().optional(),
11
+ asAdmin: z.boolean().optional()
12
+ });
11
13
  class PpSolutionPublisherListCommand extends PowerPlatformCommand {
12
14
  get name() {
13
15
  return commands.SOLUTION_PUBLISHER_LIST;
@@ -18,11 +20,8 @@ class PpSolutionPublisherListCommand extends PowerPlatformCommand {
18
20
  defaultProperties() {
19
21
  return ['publisherid', 'uniquename', 'friendlyname'];
20
22
  }
21
- constructor() {
22
- super();
23
- _PpSolutionPublisherListCommand_instances.add(this);
24
- __classPrivateFieldGet(this, _PpSolutionPublisherListCommand_instances, "m", _PpSolutionPublisherListCommand_initTelemetry).call(this);
25
- __classPrivateFieldGet(this, _PpSolutionPublisherListCommand_instances, "m", _PpSolutionPublisherListCommand_initOptions).call(this);
23
+ get schema() {
24
+ return options;
26
25
  }
27
26
  async commandAction(logger, args) {
28
27
  if (this.verbose) {
@@ -45,21 +44,5 @@ class PpSolutionPublisherListCommand extends PowerPlatformCommand {
45
44
  }
46
45
  }
47
46
  }
48
- _PpSolutionPublisherListCommand_instances = new WeakSet(), _PpSolutionPublisherListCommand_initTelemetry = function _PpSolutionPublisherListCommand_initTelemetry() {
49
- this.telemetry.push((args) => {
50
- Object.assign(this.telemetryProperties, {
51
- withMicrosoftPublishers: typeof args.options.withMicrosoftPublishers !== 'undefined',
52
- asAdmin: !!args.options.asAdmin
53
- });
54
- });
55
- }, _PpSolutionPublisherListCommand_initOptions = function _PpSolutionPublisherListCommand_initOptions() {
56
- this.options.unshift({
57
- option: '-e, --environmentName <environmentName>'
58
- }, {
59
- option: '--withMicrosoftPublishers'
60
- }, {
61
- option: '--asAdmin'
62
- });
63
- };
64
47
  export default new PpSolutionPublisherListCommand();
65
48
  //# sourceMappingURL=solution-publisher-list.js.map
@@ -1,16 +1,22 @@
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 _PpSolutionPublisherRemoveCommand_instances, _PpSolutionPublisherRemoveCommand_initTelemetry, _PpSolutionPublisherRemoveCommand_initOptions, _PpSolutionPublisherRemoveCommand_initOptionSets, _PpSolutionPublisherRemoveCommand_initValidators;
1
+ import { z } from 'zod';
7
2
  import { cli } from '../../../../cli/cli.js';
3
+ import { globalOptionsZod } from '../../../../Command.js';
8
4
  import request from '../../../../request.js';
9
5
  import { powerPlatform } from '../../../../utils/powerPlatform.js';
10
6
  import { validation } from '../../../../utils/validation.js';
11
7
  import PowerPlatformCommand from '../../../base/PowerPlatformCommand.js';
12
8
  import commands from '../../commands.js';
13
9
  import ppSolutionPublisherGetCommand from './solution-publisher-get.js';
10
+ export const options = z.strictObject({
11
+ ...globalOptionsZod.shape,
12
+ environmentName: z.string().alias('e'),
13
+ id: z.string().refine(val => validation.isValidGuid(val), {
14
+ error: 'The value must be a valid GUID.'
15
+ }).optional().alias('i'),
16
+ name: z.string().optional().alias('n'),
17
+ asAdmin: z.boolean().optional(),
18
+ force: z.boolean().optional().alias('f')
19
+ });
14
20
  class PpSolutionPublisherRemoveCommand extends PowerPlatformCommand {
15
21
  get name() {
16
22
  return commands.SOLUTION_PUBLISHER_REMOVE;
@@ -18,13 +24,18 @@ class PpSolutionPublisherRemoveCommand extends PowerPlatformCommand {
18
24
  get description() {
19
25
  return 'Removes a specific publisher in the specified Power Platform environment.';
20
26
  }
21
- constructor() {
22
- super();
23
- _PpSolutionPublisherRemoveCommand_instances.add(this);
24
- __classPrivateFieldGet(this, _PpSolutionPublisherRemoveCommand_instances, "m", _PpSolutionPublisherRemoveCommand_initTelemetry).call(this);
25
- __classPrivateFieldGet(this, _PpSolutionPublisherRemoveCommand_instances, "m", _PpSolutionPublisherRemoveCommand_initOptions).call(this);
26
- __classPrivateFieldGet(this, _PpSolutionPublisherRemoveCommand_instances, "m", _PpSolutionPublisherRemoveCommand_initValidators).call(this);
27
- __classPrivateFieldGet(this, _PpSolutionPublisherRemoveCommand_instances, "m", _PpSolutionPublisherRemoveCommand_initOptionSets).call(this);
27
+ get schema() {
28
+ return options;
29
+ }
30
+ getRefinedSchema(schema) {
31
+ return schema
32
+ .refine(opts => [opts.id, opts.name].filter(x => x !== undefined).length === 1, {
33
+ error: `Specify either 'id' or 'name', but not both.`,
34
+ params: {
35
+ customCode: 'optionSet',
36
+ options: ['id', 'name']
37
+ }
38
+ });
28
39
  }
29
40
  async commandAction(logger, args) {
30
41
  if (this.verbose) {
@@ -73,36 +84,5 @@ class PpSolutionPublisherRemoveCommand extends PowerPlatformCommand {
73
84
  }
74
85
  }
75
86
  }
76
- _PpSolutionPublisherRemoveCommand_instances = new WeakSet(), _PpSolutionPublisherRemoveCommand_initTelemetry = function _PpSolutionPublisherRemoveCommand_initTelemetry() {
77
- this.telemetry.push((args) => {
78
- Object.assign(this.telemetryProperties, {
79
- id: typeof args.options.id !== 'undefined',
80
- name: typeof args.options.name !== 'undefined',
81
- asAdmin: !!args.options.asAdmin,
82
- force: !!args.options.force
83
- });
84
- });
85
- }, _PpSolutionPublisherRemoveCommand_initOptions = function _PpSolutionPublisherRemoveCommand_initOptions() {
86
- this.options.unshift({
87
- option: '-e, --environmentName <environmentName>'
88
- }, {
89
- option: '-i, --id [id]'
90
- }, {
91
- option: '-n, --name [name]'
92
- }, {
93
- option: '--asAdmin'
94
- }, {
95
- option: '-f, --force'
96
- });
97
- }, _PpSolutionPublisherRemoveCommand_initOptionSets = function _PpSolutionPublisherRemoveCommand_initOptionSets() {
98
- this.optionSets.push({ options: ['id', 'name'] });
99
- }, _PpSolutionPublisherRemoveCommand_initValidators = function _PpSolutionPublisherRemoveCommand_initValidators() {
100
- this.validators.push(async (args) => {
101
- if (args.options.id && !validation.isValidGuid(args.options.id)) {
102
- return `${args.options.id} is not a valid GUID`;
103
- }
104
- return true;
105
- });
106
- };
107
87
  export default new PpSolutionPublisherRemoveCommand();
108
88
  //# sourceMappingURL=solution-publisher-remove.js.map
@@ -1,15 +1,21 @@
1
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
- };
6
- var _PpSolutionRemoveCommand_instances, _PpSolutionRemoveCommand_initTelemetry, _PpSolutionRemoveCommand_initOptions, _PpSolutionRemoveCommand_initOptionSets, _PpSolutionRemoveCommand_initValidators;
1
+ import { z } from 'zod';
7
2
  import { cli } from '../../../../cli/cli.js';
3
+ import { globalOptionsZod } from '../../../../Command.js';
8
4
  import request from '../../../../request.js';
9
5
  import { powerPlatform } from '../../../../utils/powerPlatform.js';
10
6
  import { validation } from '../../../../utils/validation.js';
11
7
  import PowerPlatformCommand from '../../../base/PowerPlatformCommand.js';
12
8
  import commands from '../../commands.js';
9
+ export const options = z.strictObject({
10
+ ...globalOptionsZod.shape,
11
+ environmentName: z.string().alias('e'),
12
+ id: z.string().refine(val => validation.isValidGuid(val), {
13
+ error: 'The value must be a valid GUID.'
14
+ }).optional().alias('i'),
15
+ name: z.string().optional().alias('n'),
16
+ asAdmin: z.boolean().optional(),
17
+ force: z.boolean().optional().alias('f')
18
+ });
13
19
  class PpSolutionRemoveCommand extends PowerPlatformCommand {
14
20
  get name() {
15
21
  return commands.SOLUTION_REMOVE;
@@ -17,13 +23,18 @@ class PpSolutionRemoveCommand extends PowerPlatformCommand {
17
23
  get description() {
18
24
  return 'Removes a specific solution in the specified Power Platform environment.';
19
25
  }
20
- constructor() {
21
- super();
22
- _PpSolutionRemoveCommand_instances.add(this);
23
- __classPrivateFieldGet(this, _PpSolutionRemoveCommand_instances, "m", _PpSolutionRemoveCommand_initTelemetry).call(this);
24
- __classPrivateFieldGet(this, _PpSolutionRemoveCommand_instances, "m", _PpSolutionRemoveCommand_initOptions).call(this);
25
- __classPrivateFieldGet(this, _PpSolutionRemoveCommand_instances, "m", _PpSolutionRemoveCommand_initValidators).call(this);
26
- __classPrivateFieldGet(this, _PpSolutionRemoveCommand_instances, "m", _PpSolutionRemoveCommand_initOptionSets).call(this);
26
+ get schema() {
27
+ return options;
28
+ }
29
+ getRefinedSchema(schema) {
30
+ return schema
31
+ .refine(opts => [opts.id, opts.name].filter(x => x !== undefined).length === 1, {
32
+ error: `Specify either 'id' or 'name', but not both.`,
33
+ params: {
34
+ customCode: 'optionSet',
35
+ options: ['id', 'name']
36
+ }
37
+ });
27
38
  }
28
39
  async commandAction(logger, args) {
29
40
  if (this.verbose) {
@@ -64,36 +75,5 @@ class PpSolutionRemoveCommand extends PowerPlatformCommand {
64
75
  }
65
76
  }
66
77
  }
67
- _PpSolutionRemoveCommand_instances = new WeakSet(), _PpSolutionRemoveCommand_initTelemetry = function _PpSolutionRemoveCommand_initTelemetry() {
68
- this.telemetry.push((args) => {
69
- Object.assign(this.telemetryProperties, {
70
- id: typeof args.options.id !== 'undefined',
71
- name: typeof args.options.name !== 'undefined',
72
- asAdmin: !!args.options.asAdmin,
73
- force: !!args.options.force
74
- });
75
- });
76
- }, _PpSolutionRemoveCommand_initOptions = function _PpSolutionRemoveCommand_initOptions() {
77
- this.options.unshift({
78
- option: '-e, --environmentName <environmentName>'
79
- }, {
80
- option: '-i, --id [id]'
81
- }, {
82
- option: '-n, --name [name]'
83
- }, {
84
- option: '--asAdmin'
85
- }, {
86
- option: '-f, --force'
87
- });
88
- }, _PpSolutionRemoveCommand_initOptionSets = function _PpSolutionRemoveCommand_initOptionSets() {
89
- this.optionSets.push({ options: ['id', 'name'] });
90
- }, _PpSolutionRemoveCommand_initValidators = function _PpSolutionRemoveCommand_initValidators() {
91
- this.validators.push(async (args) => {
92
- if (args.options.id && !validation.isValidGuid(args.options.id)) {
93
- return `${args.options.id} is not a valid GUID`;
94
- }
95
- return true;
96
- });
97
- };
98
78
  export default new PpSolutionRemoveCommand();
99
79
  //# sourceMappingURL=solution-remove.js.map