@pnp/cli-microsoft365 11.9.0-beta.93bd508 → 11.9.0-beta.9bd71dd

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/.devcontainer/Dockerfile +2 -2
  2. package/.devproxy/api-specs/sharepoint.yaml +84 -0
  3. package/allCommands.json +1 -1
  4. package/allCommandsFull.json +1 -1
  5. package/dist/m365/entra/commands/approleassignment/approleassignment-add.js +23 -48
  6. package/dist/m365/entra/commands/approleassignment/approleassignment-list.js +20 -43
  7. package/dist/m365/entra/commands/approleassignment/approleassignment-remove.js +24 -51
  8. package/dist/m365/entra/commands/enterpriseapp/enterpriseapp-add.js +20 -43
  9. package/dist/m365/entra/commands/enterpriseapp/enterpriseapp-get.js +20 -43
  10. package/dist/m365/entra/commands/enterpriseapp/enterpriseapp-list.js +9 -25
  11. package/dist/m365/entra/commands/enterpriseapp/enterpriseapp-remove.js +21 -50
  12. package/dist/m365/entra/commands/groupsetting/groupsetting-add.js +9 -25
  13. package/dist/m365/entra/commands/groupsetting/groupsetting-get.js +8 -24
  14. package/dist/m365/entra/commands/groupsetting/groupsetting-list.js +6 -0
  15. package/dist/m365/entra/commands/groupsetting/groupsetting-remove.js +9 -33
  16. package/dist/m365/entra/commands/groupsetting/groupsetting-set.js +8 -24
  17. package/dist/m365/entra/commands/groupsettingtemplate/groupsettingtemplate-get.js +19 -38
  18. package/dist/m365/entra/commands/groupsettingtemplate/groupsettingtemplate-list.js +6 -0
  19. package/dist/m365/entra/commands/pim/pim-role-assignment-add.js +68 -114
  20. package/dist/m365/entra/commands/pim/pim-role-assignment-eligibility-list.js +28 -55
  21. package/dist/m365/entra/commands/pim/pim-role-assignment-list.js +30 -57
  22. package/dist/m365/entra/commands/pim/pim-role-assignment-remove.js +50 -90
  23. package/dist/m365/entra/commands/pim/pim-role-request-list.js +36 -69
  24. package/dist/m365/entra/commands/policy/policy-list.js +13 -56
  25. package/dist/m365/entra/commands/user/user-add.js +39 -118
  26. package/dist/m365/entra/commands/user/user-get.js +24 -49
  27. package/dist/m365/entra/commands/user/user-groupmembership-list.js +25 -48
  28. package/dist/m365/entra/commands/user/user-guest-add.js +14 -39
  29. package/dist/m365/entra/commands/user/user-hibp.js +12 -34
  30. package/dist/m365/entra/commands/user/user-license-add.js +23 -42
  31. package/dist/m365/entra/commands/user/user-license-list.js +21 -42
  32. package/dist/m365/entra/commands/user/user-license-remove.js +25 -47
  33. package/dist/m365/entra/commands/user/user-list.js +12 -39
  34. package/dist/m365/entra/commands/user/user-password-validate.js +8 -15
  35. package/dist/m365/entra/commands/user/user-recyclebinitem-clear.js +8 -22
  36. package/dist/m365/entra/commands/user/user-recyclebinitem-remove.js +9 -33
  37. package/dist/m365/entra/commands/user/user-recyclebinitem-restore.js +8 -24
  38. package/dist/m365/entra/commands/user/user-registrationdetails-list.js +43 -113
  39. package/dist/m365/entra/commands/user/user-remove.js +22 -42
  40. package/dist/m365/entra/commands/user/user-set.js +69 -149
  41. package/dist/m365/entra/commands/user/user-signin-list.js +22 -51
  42. package/dist/m365/external/commands/connection/connection-add.js +40 -65
  43. package/dist/m365/external/commands/connection/connection-doctor.js +14 -30
  44. package/dist/m365/external/commands/connection/connection-get.js +19 -28
  45. package/dist/m365/external/commands/connection/connection-remove.js +20 -25
  46. package/dist/m365/external/commands/connection/connection-schema-add.js +53 -42
  47. package/dist/m365/external/commands/connection/connection-urltoitemresolver-add.js +12 -23
  48. package/dist/m365/external/commands/item/item-add.js +37 -60
  49. package/dist/m365/file/commands/convert/convert-pdf.js +18 -33
  50. package/dist/m365/file/commands/file-add.js +28 -34
  51. package/dist/m365/file/commands/file-copy.js +18 -34
  52. package/dist/m365/file/commands/file-list.js +18 -24
  53. package/dist/m365/file/commands/file-move.js +22 -35
  54. package/dist/m365/flow/commands/flow-disable.js +10 -26
  55. package/dist/m365/flow/commands/flow-enable.js +10 -26
  56. package/dist/m365/flow/commands/flow-export.js +45 -71
  57. package/dist/m365/flow/commands/flow-get.js +10 -26
  58. package/dist/m365/flow/commands/flow-list.js +17 -48
  59. package/dist/m365/flow/commands/flow-remove.js +11 -38
  60. package/dist/m365/flow/commands/owner/owner-ensure.js +30 -65
  61. package/dist/m365/flow/commands/owner/owner-list.js +10 -35
  62. package/dist/m365/flow/commands/owner/owner-remove.js +30 -61
  63. package/dist/m365/flow/commands/run/run-cancel.js +11 -37
  64. package/dist/m365/flow/commands/run/run-get.js +12 -43
  65. package/dist/m365/flow/commands/run/run-list.js +29 -61
  66. package/dist/m365/flow/commands/run/run-resubmit.js +11 -37
  67. package/dist/m365/graph/commands/changelog/changelog-list.js +68 -67
  68. package/dist/m365/graph/commands/schemaextension/schemaextension-add.js +25 -31
  69. package/dist/m365/graph/commands/schemaextension/schemaextension-get.js +8 -15
  70. package/dist/m365/graph/commands/schemaextension/schemaextension-list.js +26 -50
  71. package/dist/m365/graph/commands/schemaextension/schemaextension-remove.js +9 -24
  72. package/dist/m365/graph/commands/schemaextension/schemaextension-set.js +32 -53
  73. package/dist/m365/graph/commands/subscription/subscription-add.js +63 -89
  74. package/dist/m365/outlook/commands/calendar/calendar-list.js +64 -0
  75. package/dist/m365/outlook/commands/mail/mail-send.js +55 -84
  76. package/dist/m365/outlook/commands/message/message-get.js +27 -27
  77. package/dist/m365/outlook/commands/message/message-list.js +53 -80
  78. package/dist/m365/outlook/commands/message/message-move.js +43 -40
  79. package/dist/m365/outlook/commands/message/message-remove.js +17 -45
  80. package/dist/m365/outlook/commands.js +1 -0
  81. package/dist/m365/spo/commands/list/list-sensitivitylabel-remove.js +83 -0
  82. package/dist/m365/spo/commands.js +1 -0
  83. package/docs/docs/cmd/outlook/calendar/calendar-list.mdx +155 -0
  84. package/docs/docs/cmd/spo/list/list-sensitivitylabel-remove.mdx +77 -0
  85. package/npm-shrinkwrap.json +7 -0
  86. package/package.json +1 -1
@@ -1,15 +1,24 @@
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 _FileCopyCommand_instances, _FileCopyCommand_initTelemetry, _FileCopyCommand_initOptions, _FileCopyCommand_initValidators;
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../Command.js';
7
3
  import request from '../../../request.js';
8
4
  import { urlUtil } from '../../../utils/urlUtil.js';
9
5
  import { spo } from '../../../utils/spo.js';
10
6
  import { validation } from '../../../utils/validation.js';
11
7
  import GraphCommand from '../../base/GraphCommand.js';
12
8
  import commands from '../commands.js';
9
+ const nameConflictBehaviorOptions = ['fail', 'replace', 'rename'];
10
+ export const options = z.strictObject({
11
+ ...globalOptionsZod.shape,
12
+ webUrl: z.string()
13
+ .refine(url => validation.isValidSharePointUrl(url) === true, {
14
+ error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
15
+ })
16
+ .alias('u'),
17
+ sourceUrl: z.string().alias('s'),
18
+ targetUrl: z.string().alias('t'),
19
+ newName: z.string().optional(),
20
+ nameConflictBehavior: z.enum(nameConflictBehaviorOptions).optional()
21
+ });
13
22
  class FileCopyCommand extends GraphCommand {
14
23
  get name() {
15
24
  return commands.COPY;
@@ -17,13 +26,8 @@ class FileCopyCommand extends GraphCommand {
17
26
  get description() {
18
27
  return 'Copies a file to another location using the Microsoft Graph';
19
28
  }
20
- constructor() {
21
- super();
22
- _FileCopyCommand_instances.add(this);
23
- this.nameConflictBehaviorOptions = ['fail', 'replace', 'rename'];
24
- __classPrivateFieldGet(this, _FileCopyCommand_instances, "m", _FileCopyCommand_initTelemetry).call(this);
25
- __classPrivateFieldGet(this, _FileCopyCommand_instances, "m", _FileCopyCommand_initOptions).call(this);
26
- __classPrivateFieldGet(this, _FileCopyCommand_instances, "m", _FileCopyCommand_initValidators).call(this);
29
+ get schema() {
30
+ return options;
27
31
  }
28
32
  async commandAction(logger, args) {
29
33
  try {
@@ -52,7 +56,7 @@ class FileCopyCommand extends GraphCommand {
52
56
  const sourceFileName = sourcePath.substring(sourcePath.lastIndexOf('/') + 1);
53
57
  const sourceFileExtension = sourceFileName.includes('.') ? sourceFileName.substring(sourceFileName.lastIndexOf('.')) : '';
54
58
  const newNameExtension = newName.includes('.') ? newName.substring(newName.lastIndexOf('.')) : '';
55
- requestOptions.data.name = newNameExtension ? `${newName.replace(newNameExtension, "")}${sourceFileExtension}` : `${newName}${sourceFileExtension}`;
59
+ requestOptions.data.name = newNameExtension ? `${newName.replace(newNameExtension, '')}${sourceFileExtension}` : `${newName}${sourceFileExtension}`;
56
60
  }
57
61
  await request.post(requestOptions);
58
62
  }
@@ -127,25 +131,5 @@ class FileCopyCommand extends GraphCommand {
127
131
  return url.startsWith('https://') ? url : urlUtil.getAbsoluteUrl(webUrl, url);
128
132
  }
129
133
  }
130
- _FileCopyCommand_instances = new WeakSet(), _FileCopyCommand_initTelemetry = function _FileCopyCommand_initTelemetry() {
131
- this.telemetry.push((args) => {
132
- Object.assign(this.telemetryProperties, {
133
- webUrl: typeof args.options.webUrl !== 'undefined',
134
- sourceUrl: typeof args.options.sourceUrl !== 'undefined',
135
- targetUrl: typeof args.options.targetUrl !== 'undefined',
136
- newName: typeof args.options.newName !== 'undefined',
137
- nameConflictBehavior: typeof args.options.nameConflictBehavior !== 'undefined'
138
- });
139
- });
140
- }, _FileCopyCommand_initOptions = function _FileCopyCommand_initOptions() {
141
- this.options.unshift({ option: '-u, --webUrl <webUrl>' }, { option: '-s, --sourceUrl <sourceUrl>' }, { option: '-t, --targetUrl <targetUrl>' }, { option: '--newName [newName]' }, { option: '--nameConflictBehavior [nameConflictBehavior]', autocomplete: this.nameConflictBehaviorOptions });
142
- }, _FileCopyCommand_initValidators = function _FileCopyCommand_initValidators() {
143
- this.validators.push(async (args) => {
144
- if (args.options.nameConflictBehavior && this.nameConflictBehaviorOptions.indexOf(args.options.nameConflictBehavior) === -1) {
145
- return `${args.options.nameConflictBehavior} is not a valid nameConflictBehavior value. Allowed values: ${this.nameConflictBehaviorOptions.join(', ')}.`;
146
- }
147
- return validation.isValidSharePointUrl(args.options.webUrl);
148
- });
149
- };
150
134
  export default new FileCopyCommand();
151
135
  //# sourceMappingURL=file-copy.js.map
@@ -1,16 +1,26 @@
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 _FileListCommand_instances, _FileListCommand_initTelemetry, _FileListCommand_initOptions, _FileListCommand_initValidators;
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';
9
5
  import { odata } from '../../../utils/odata.js';
10
6
  import { validation } from '../../../utils/validation.js';
11
7
  import GraphCommand from '../../base/GraphCommand.js';
12
8
  import commands from '../commands.js';
9
+ export const options = z.strictObject({
10
+ ...globalOptionsZod.shape,
11
+ webUrl: z.string()
12
+ .refine(url => validation.isValidSharePointUrl(url) === true, {
13
+ error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
14
+ })
15
+ .alias('u'),
16
+ folderUrl: z.string(),
17
+ recursive: z.boolean().optional()
18
+ });
13
19
  class FileListCommand extends GraphCommand {
20
+ constructor() {
21
+ super(...arguments);
22
+ this.foldersToGetFilesFrom = [];
23
+ }
14
24
  get name() {
15
25
  return commands.LIST;
16
26
  }
@@ -20,13 +30,8 @@ class FileListCommand extends GraphCommand {
20
30
  defaultProperties() {
21
31
  return ['name', 'lastModifiedByUser'];
22
32
  }
23
- constructor() {
24
- super();
25
- _FileListCommand_instances.add(this);
26
- this.foldersToGetFilesFrom = [];
27
- __classPrivateFieldGet(this, _FileListCommand_instances, "m", _FileListCommand_initTelemetry).call(this);
28
- __classPrivateFieldGet(this, _FileListCommand_instances, "m", _FileListCommand_initOptions).call(this);
29
- __classPrivateFieldGet(this, _FileListCommand_instances, "m", _FileListCommand_initValidators).call(this);
33
+ get schema() {
34
+ return options;
30
35
  }
31
36
  async commandAction(logger, args) {
32
37
  let webUrl = args.options.webUrl;
@@ -161,16 +166,5 @@ class FileListCommand extends GraphCommand {
161
166
  return files;
162
167
  }
163
168
  }
164
- _FileListCommand_instances = new WeakSet(), _FileListCommand_initTelemetry = function _FileListCommand_initTelemetry() {
165
- this.telemetry.push((args) => {
166
- Object.assign(this.telemetryProperties, {
167
- recursive: !!args.options.recursive
168
- });
169
- });
170
- }, _FileListCommand_initOptions = function _FileListCommand_initOptions() {
171
- this.options.unshift({ option: '-u, --webUrl <webUrl>' }, { option: '--folderUrl <folderUrl>' }, { option: '--recursive' });
172
- }, _FileListCommand_initValidators = function _FileListCommand_initValidators() {
173
- this.validators.push(async (args) => validation.isValidSharePointUrl(args.options.webUrl));
174
- };
175
169
  export default new FileListCommand();
176
170
  //# sourceMappingURL=file-list.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 _FileMoveCommand_instances, _FileMoveCommand_initTelemetry, _FileMoveCommand_initOptions, _FileMoveCommand_initValidators;
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../Command.js';
7
3
  import GraphCommand from '../../base/GraphCommand.js';
8
4
  import { setTimeout } from 'timers/promises';
9
5
  import commands from '../commands.js';
@@ -12,21 +8,32 @@ import { spo } from '../../../utils/spo.js';
12
8
  import { urlUtil } from '../../../utils/urlUtil.js';
13
9
  import { drive } from '../../../utils/drive.js';
14
10
  import { validation } from '../../../utils/validation.js';
11
+ const nameConflictBehaviorOptions = ['fail', 'replace', 'rename'];
12
+ export const options = z.strictObject({
13
+ ...globalOptionsZod.shape,
14
+ webUrl: z.string()
15
+ .refine(url => validation.isValidSharePointUrl(url) === true, {
16
+ error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
17
+ })
18
+ .alias('u'),
19
+ sourceUrl: z.string().alias('s'),
20
+ targetUrl: z.string().alias('t'),
21
+ newName: z.string().optional(),
22
+ nameConflictBehavior: z.enum(nameConflictBehaviorOptions).optional()
23
+ });
15
24
  class FileMoveCommand extends GraphCommand {
25
+ constructor() {
26
+ super(...arguments);
27
+ this.pollingInterval = 10000;
28
+ }
16
29
  get name() {
17
30
  return commands.MOVE;
18
31
  }
19
32
  get description() {
20
33
  return 'Moves a file to another location using the Microsoft Graph';
21
34
  }
22
- constructor() {
23
- super();
24
- _FileMoveCommand_instances.add(this);
25
- this.pollingInterval = 10000;
26
- this.nameConflictBehaviorOptions = ['fail', 'replace', 'rename'];
27
- __classPrivateFieldGet(this, _FileMoveCommand_instances, "m", _FileMoveCommand_initTelemetry).call(this);
28
- __classPrivateFieldGet(this, _FileMoveCommand_instances, "m", _FileMoveCommand_initOptions).call(this);
29
- __classPrivateFieldGet(this, _FileMoveCommand_instances, "m", _FileMoveCommand_initValidators).call(this);
35
+ get schema() {
36
+ return options;
30
37
  }
31
38
  async commandAction(logger, args) {
32
39
  try {
@@ -83,7 +90,7 @@ class FileMoveCommand extends GraphCommand {
83
90
  const sourceFileName = sourcePath.substring(sourcePath.lastIndexOf('/') + 1);
84
91
  const sourceFileExtension = sourceFileName.includes('.') ? sourceFileName.substring(sourceFileName.lastIndexOf('.')) : '';
85
92
  const newNameExtension = newName.includes('.') ? newName.substring(newName.lastIndexOf('.')) : '';
86
- requestOptions.data.name = newNameExtension ? `${newName.replace(newNameExtension, "")}${sourceFileExtension}` : `${newName}${sourceFileExtension}`;
93
+ requestOptions.data.name = newNameExtension ? `${newName.replace(newNameExtension, '')}${sourceFileExtension}` : `${newName}${sourceFileExtension}`;
87
94
  }
88
95
  return requestOptions;
89
96
  }
@@ -111,25 +118,5 @@ class FileMoveCommand extends GraphCommand {
111
118
  }
112
119
  }
113
120
  }
114
- _FileMoveCommand_instances = new WeakSet(), _FileMoveCommand_initTelemetry = function _FileMoveCommand_initTelemetry() {
115
- this.telemetry.push((args) => {
116
- Object.assign(this.telemetryProperties, {
117
- webUrl: typeof args.options.webUrl !== 'undefined',
118
- sourceUrl: typeof args.options.sourceUrl !== 'undefined',
119
- targetUrl: typeof args.options.targetUrl !== 'undefined',
120
- newName: typeof args.options.newName !== 'undefined',
121
- nameConflictBehavior: typeof args.options.nameConflictBehavior !== 'undefined'
122
- });
123
- });
124
- }, _FileMoveCommand_initOptions = function _FileMoveCommand_initOptions() {
125
- this.options.unshift({ option: '-u, --webUrl <webUrl>' }, { option: '-s, --sourceUrl <sourceUrl>' }, { option: '-t, --targetUrl <targetUrl>' }, { option: '--newName [newName]' }, { option: '--nameConflictBehavior [nameConflictBehavior]', autocomplete: this.nameConflictBehaviorOptions });
126
- }, _FileMoveCommand_initValidators = function _FileMoveCommand_initValidators() {
127
- this.validators.push(async (args) => {
128
- if (args.options.nameConflictBehavior && this.nameConflictBehaviorOptions.indexOf(args.options.nameConflictBehavior) === -1) {
129
- return `${args.options.nameConflictBehavior} is not a valid nameConflictBehavior value. Allowed values: ${this.nameConflictBehaviorOptions.join(', ')}.`;
130
- }
131
- return validation.isValidSharePointUrl(args.options.webUrl);
132
- });
133
- };
134
121
  export default new FileMoveCommand();
135
122
  //# sourceMappingURL=file-move.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 _FlowDisableCommand_instances, _FlowDisableCommand_initTelemetry, _FlowDisableCommand_initOptions;
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';
9
5
  import PowerAutomateCommand from '../../base/PowerAutomateCommand.js';
10
6
  import commands from '../commands.js';
7
+ export const options = z.strictObject({
8
+ ...globalOptionsZod.shape,
9
+ name: z.string().alias('n'),
10
+ environmentName: z.string().alias('e'),
11
+ asAdmin: z.boolean().optional()
12
+ });
11
13
  class FlowDisableCommand extends PowerAutomateCommand {
12
14
  get name() {
13
15
  return commands.DISABLE;
@@ -15,11 +17,8 @@ class FlowDisableCommand extends PowerAutomateCommand {
15
17
  get description() {
16
18
  return 'Disables specified Microsoft Flow';
17
19
  }
18
- constructor() {
19
- super();
20
- _FlowDisableCommand_instances.add(this);
21
- __classPrivateFieldGet(this, _FlowDisableCommand_instances, "m", _FlowDisableCommand_initTelemetry).call(this);
22
- __classPrivateFieldGet(this, _FlowDisableCommand_instances, "m", _FlowDisableCommand_initOptions).call(this);
20
+ get schema() {
21
+ return options;
23
22
  }
24
23
  async commandAction(logger, args) {
25
24
  if (this.verbose) {
@@ -40,20 +39,5 @@ class FlowDisableCommand extends PowerAutomateCommand {
40
39
  }
41
40
  }
42
41
  }
43
- _FlowDisableCommand_instances = new WeakSet(), _FlowDisableCommand_initTelemetry = function _FlowDisableCommand_initTelemetry() {
44
- this.telemetry.push((args) => {
45
- Object.assign(this.telemetryProperties, {
46
- asAdmin: !!args.options.asAdmin
47
- });
48
- });
49
- }, _FlowDisableCommand_initOptions = function _FlowDisableCommand_initOptions() {
50
- this.options.unshift({
51
- option: '-n, --name <name>'
52
- }, {
53
- option: '-e, --environmentName <environmentName>'
54
- }, {
55
- option: '--asAdmin'
56
- });
57
- };
58
42
  export default new FlowDisableCommand();
59
43
  //# sourceMappingURL=flow-disable.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 _FlowEnableCommand_instances, _FlowEnableCommand_initTelemetry, _FlowEnableCommand_initOptions;
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';
9
5
  import PowerAutomateCommand from '../../base/PowerAutomateCommand.js';
10
6
  import commands from '../commands.js';
7
+ export const options = z.strictObject({
8
+ ...globalOptionsZod.shape,
9
+ name: z.string().alias('n'),
10
+ environmentName: z.string().alias('e'),
11
+ asAdmin: z.boolean().optional()
12
+ });
11
13
  class FlowEnableCommand extends PowerAutomateCommand {
12
14
  get name() {
13
15
  return commands.ENABLE;
@@ -15,11 +17,8 @@ class FlowEnableCommand extends PowerAutomateCommand {
15
17
  get description() {
16
18
  return 'Enables specified Microsoft Flow';
17
19
  }
18
- constructor() {
19
- super();
20
- _FlowEnableCommand_instances.add(this);
21
- __classPrivateFieldGet(this, _FlowEnableCommand_instances, "m", _FlowEnableCommand_initTelemetry).call(this);
22
- __classPrivateFieldGet(this, _FlowEnableCommand_instances, "m", _FlowEnableCommand_initOptions).call(this);
20
+ get schema() {
21
+ return options;
23
22
  }
24
23
  async commandAction(logger, args) {
25
24
  if (this.verbose) {
@@ -40,20 +39,5 @@ class FlowEnableCommand extends PowerAutomateCommand {
40
39
  }
41
40
  }
42
41
  }
43
- _FlowEnableCommand_instances = new WeakSet(), _FlowEnableCommand_initTelemetry = function _FlowEnableCommand_initTelemetry() {
44
- this.telemetry.push((args) => {
45
- Object.assign(this.telemetryProperties, {
46
- asAdmin: !!args.options.asAdmin
47
- });
48
- });
49
- }, _FlowEnableCommand_initOptions = function _FlowEnableCommand_initOptions() {
50
- this.options.unshift({
51
- option: '-n, --name <name>'
52
- }, {
53
- option: '-e, --environmentName <environmentName>'
54
- }, {
55
- option: '--asAdmin'
56
- });
57
- };
58
42
  export default new FlowEnableCommand();
59
43
  //# sourceMappingURL=flow-enable.js.map
@@ -1,17 +1,25 @@
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 _FlowExportCommand_instances, _FlowExportCommand_initTelemetry, _FlowExportCommand_initOptions, _FlowExportCommand_initValidators;
7
1
  import fs from 'fs';
8
2
  import path from 'path';
3
+ import { z } from 'zod';
4
+ import { globalOptionsZod } from '../../../Command.js';
9
5
  import request from '../../../request.js';
10
6
  import { formatting } from '../../../utils/formatting.js';
11
- import { validation } from '../../../utils/validation.js';
12
7
  import PowerPlatformCommand from '../../base/PowerPlatformCommand.js';
13
8
  import commands from '../commands.js';
14
9
  import PowerAutomateCommand from '../../base/PowerAutomateCommand.js';
10
+ export const options = z.strictObject({
11
+ ...globalOptionsZod.shape,
12
+ environmentName: z.string().alias('e'),
13
+ name: z.uuid().alias('n'),
14
+ packageDisplayName: z.string().optional().alias('d'),
15
+ packageDescription: z.string().optional(),
16
+ packageCreatedBy: z.string().optional().alias('c'),
17
+ packageSourceEnvironment: z.string().optional().alias('s'),
18
+ format: z.string().transform(v => v.toLowerCase()).pipe(z.enum(['json', 'zip'], {
19
+ error: 'Option format must be json or zip. Default is zip'
20
+ })).optional().alias('f'),
21
+ path: z.string().optional().alias('p')
22
+ });
15
23
  class FlowExportCommand extends PowerPlatformCommand {
16
24
  get name() {
17
25
  return commands.EXPORT;
@@ -19,12 +27,36 @@ class FlowExportCommand extends PowerPlatformCommand {
19
27
  get description() {
20
28
  return 'Exports the specified Microsoft Flow as a file';
21
29
  }
22
- constructor() {
23
- super();
24
- _FlowExportCommand_instances.add(this);
25
- __classPrivateFieldGet(this, _FlowExportCommand_instances, "m", _FlowExportCommand_initTelemetry).call(this);
26
- __classPrivateFieldGet(this, _FlowExportCommand_instances, "m", _FlowExportCommand_initOptions).call(this);
27
- __classPrivateFieldGet(this, _FlowExportCommand_instances, "m", _FlowExportCommand_initValidators).call(this);
30
+ get schema() {
31
+ return options;
32
+ }
33
+ getRefinedSchema(schema) {
34
+ return schema
35
+ .refine(options => options.format !== 'json' || !options.packageCreatedBy, {
36
+ error: 'packageCreatedBy cannot be specified with output of json',
37
+ path: ['packageCreatedBy']
38
+ })
39
+ .refine(options => options.format !== 'json' || !options.packageDescription, {
40
+ error: 'packageDescription cannot be specified with output of json',
41
+ path: ['packageDescription']
42
+ })
43
+ .refine(options => options.format !== 'json' || !options.packageDisplayName, {
44
+ error: 'packageDisplayName cannot be specified with output of json',
45
+ path: ['packageDisplayName']
46
+ })
47
+ .refine(options => options.format !== 'json' || !options.packageSourceEnvironment, {
48
+ error: 'packageSourceEnvironment cannot be specified with output of json',
49
+ path: ['packageSourceEnvironment']
50
+ })
51
+ .refine(options => {
52
+ if (options.path) {
53
+ return fs.existsSync(path.dirname(options.path));
54
+ }
55
+ return true;
56
+ }, {
57
+ error: 'Specified path where to save the file does not exist',
58
+ path: ['path']
59
+ });
28
60
  }
29
61
  async commandAction(logger, args) {
30
62
  const formatArgument = args.options.format?.toLowerCase() || '';
@@ -139,63 +171,5 @@ class FlowExportCommand extends PowerPlatformCommand {
139
171
  }
140
172
  }
141
173
  }
142
- _FlowExportCommand_instances = new WeakSet(), _FlowExportCommand_initTelemetry = function _FlowExportCommand_initTelemetry() {
143
- this.telemetry.push((args) => {
144
- Object.assign(this.telemetryProperties, {
145
- packageDisplayName: typeof args.options.packageDisplayName !== 'undefined',
146
- packageDescription: typeof args.options.packageDescription !== 'undefined',
147
- packageCreatedBy: typeof args.options.packageCreatedBy !== 'undefined',
148
- packageSourceEnvironment: typeof args.options.packageSourceEnvironment !== 'undefined',
149
- format: args.options.format,
150
- path: typeof args.options.path !== 'undefined'
151
- });
152
- });
153
- }, _FlowExportCommand_initOptions = function _FlowExportCommand_initOptions() {
154
- this.options.unshift({
155
- option: '-n, --name <name>'
156
- }, {
157
- option: '-e, --environmentName <environmentName>'
158
- }, {
159
- option: '-d, --packageDisplayName [packageDisplayName]'
160
- }, {
161
- option: '--packageDescription [packageDescription]'
162
- }, {
163
- option: '-c, --packageCreatedBy [packageCreatedBy]'
164
- }, {
165
- option: '-s, --packageSourceEnvironment [packageSourceEnvironment]'
166
- }, {
167
- option: '-f, --format [format]'
168
- }, {
169
- option: '-p, --path [path]'
170
- });
171
- }, _FlowExportCommand_initValidators = function _FlowExportCommand_initValidators() {
172
- this.validators.push(async (args) => {
173
- const lowerCaseFormat = args.options.format ? args.options.format.toLowerCase() : '';
174
- if (!validation.isValidGuid(args.options.name)) {
175
- return `${args.options.name} is not a valid GUID`;
176
- }
177
- if (args.options.format && (lowerCaseFormat !== 'json' && lowerCaseFormat !== 'zip')) {
178
- return 'Option format must be json or zip. Default is zip';
179
- }
180
- if (lowerCaseFormat === 'json') {
181
- if (args.options.packageCreatedBy) {
182
- return 'packageCreatedBy cannot be specified with output of json';
183
- }
184
- if (args.options.packageDescription) {
185
- return 'packageDescription cannot be specified with output of json';
186
- }
187
- if (args.options.packageDisplayName) {
188
- return 'packageDisplayName cannot be specified with output of json';
189
- }
190
- if (args.options.packageSourceEnvironment) {
191
- return 'packageSourceEnvironment cannot be specified with output of json';
192
- }
193
- }
194
- if (args.options.path && !fs.existsSync(path.dirname(args.options.path))) {
195
- return 'Specified path where to save the file does not exist';
196
- }
197
- return true;
198
- });
199
- };
200
174
  export default new FlowExportCommand();
201
175
  //# sourceMappingURL=flow-export.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 _FlowGetCommand_instances, _FlowGetCommand_initTelemetry, _FlowGetCommand_initOptions;
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';
9
5
  import PowerAutomateCommand from '../../base/PowerAutomateCommand.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().alias('n'),
11
+ asAdmin: z.boolean().optional()
12
+ });
11
13
  class FlowGetCommand extends PowerAutomateCommand {
12
14
  get name() {
13
15
  return commands.GET;
@@ -15,11 +17,8 @@ class FlowGetCommand extends PowerAutomateCommand {
15
17
  get description() {
16
18
  return 'Gets information about the specified Microsoft Flow';
17
19
  }
18
- constructor() {
19
- super();
20
- _FlowGetCommand_instances.add(this);
21
- __classPrivateFieldGet(this, _FlowGetCommand_instances, "m", _FlowGetCommand_initTelemetry).call(this);
22
- __classPrivateFieldGet(this, _FlowGetCommand_instances, "m", _FlowGetCommand_initOptions).call(this);
20
+ get schema() {
21
+ return options;
23
22
  }
24
23
  async commandAction(logger, args) {
25
24
  if (this.verbose) {
@@ -45,20 +44,5 @@ class FlowGetCommand extends PowerAutomateCommand {
45
44
  }
46
45
  }
47
46
  }
48
- _FlowGetCommand_instances = new WeakSet(), _FlowGetCommand_initTelemetry = function _FlowGetCommand_initTelemetry() {
49
- this.telemetry.push((args) => {
50
- Object.assign(this.telemetryProperties, {
51
- asAdmin: !!args.options.asAdmin
52
- });
53
- });
54
- }, _FlowGetCommand_initOptions = function _FlowGetCommand_initOptions() {
55
- this.options.unshift({
56
- option: '-n, --name <name>'
57
- }, {
58
- option: '-e, --environmentName <environmentName>'
59
- }, {
60
- option: '--asAdmin'
61
- });
62
- };
63
47
  export default new FlowGetCommand();
64
48
  //# sourceMappingURL=flow-get.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 _FlowListCommand_instances, _FlowListCommand_initTelemetry, _FlowListCommand_initOptions, _FlowListCommand_initValidators, _FlowListCommand_initTypes;
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../Command.js';
7
3
  import { formatting } from '../../../utils/formatting.js';
8
4
  import { odata } from '../../../utils/odata.js';
9
5
  import PowerAutomateCommand from '../../base/PowerAutomateCommand.js';
10
6
  import commands from '../commands.js';
7
+ export const options = z.strictObject({
8
+ ...globalOptionsZod.shape,
9
+ environmentName: z.string().alias('e'),
10
+ sharingStatus: z.enum(['all', 'personal', 'ownedByMe', 'sharedWithMe']).optional(),
11
+ withSolutions: z.boolean().optional(),
12
+ asAdmin: z.boolean().optional()
13
+ });
11
14
  class FlowListCommand extends PowerAutomateCommand {
12
15
  get name() {
13
16
  return commands.LIST;
@@ -15,18 +18,17 @@ class FlowListCommand extends PowerAutomateCommand {
15
18
  get description() {
16
19
  return 'Lists Power Automate flows in the given environment';
17
20
  }
21
+ get schema() {
22
+ return options;
23
+ }
24
+ getRefinedSchema(schema) {
25
+ return schema.refine(options => !(options.asAdmin && options.sharingStatus), {
26
+ error: 'The options asAdmin and sharingStatus cannot be specified together.'
27
+ });
28
+ }
18
29
  defaultProperties() {
19
30
  return ['name', 'displayName'];
20
31
  }
21
- constructor() {
22
- super();
23
- _FlowListCommand_instances.add(this);
24
- this.allowedSharingStatuses = ['all', 'personal', 'ownedByMe', 'sharedWithMe'];
25
- __classPrivateFieldGet(this, _FlowListCommand_instances, "m", _FlowListCommand_initTelemetry).call(this);
26
- __classPrivateFieldGet(this, _FlowListCommand_instances, "m", _FlowListCommand_initOptions).call(this);
27
- __classPrivateFieldGet(this, _FlowListCommand_instances, "m", _FlowListCommand_initValidators).call(this);
28
- __classPrivateFieldGet(this, _FlowListCommand_instances, "m", _FlowListCommand_initTypes).call(this);
29
- }
30
32
  async commandAction(logger, args) {
31
33
  if (this.verbose) {
32
34
  await logger.logToStderr(`Getting Power Automate flows${args.options.asAdmin ? ' as admin' : ''} in environment '${args.options.environmentName}'...`);
@@ -76,38 +78,5 @@ class FlowListCommand extends PowerAutomateCommand {
76
78
  return `${baseEndpoint}${asAdmin ? adminSegment : environmentSegment}${flowsEndpoint}${filterQuery}${includeQuery}`;
77
79
  }
78
80
  }
79
- _FlowListCommand_instances = new WeakSet(), _FlowListCommand_initTelemetry = function _FlowListCommand_initTelemetry() {
80
- this.telemetry.push((args) => {
81
- Object.assign(this.telemetryProperties, {
82
- sharingStatus: typeof args.options.sharingStatus !== 'undefined',
83
- withSolutions: !!args.options.withSolutions,
84
- asAdmin: !!args.options.asAdmin
85
- });
86
- });
87
- }, _FlowListCommand_initOptions = function _FlowListCommand_initOptions() {
88
- this.options.unshift({
89
- option: '-e, --environmentName <environmentName>'
90
- }, {
91
- option: '--sharingStatus [sharingStatus]',
92
- autocomplete: this.allowedSharingStatuses
93
- }, {
94
- option: '--withSolutions'
95
- }, {
96
- option: '--asAdmin'
97
- });
98
- }, _FlowListCommand_initValidators = function _FlowListCommand_initValidators() {
99
- this.validators.push(async (args) => {
100
- if (args.options.asAdmin && args.options.sharingStatus) {
101
- return `The options asAdmin and sharingStatus cannot be specified together.`;
102
- }
103
- if (args.options.sharingStatus && !this.allowedSharingStatuses.some(status => status === args.options.sharingStatus)) {
104
- return `${args.options.sharingStatus} is not a valid sharing status. Allowed values are: ${this.allowedSharingStatuses.join(', ')}`;
105
- }
106
- return true;
107
- });
108
- }, _FlowListCommand_initTypes = function _FlowListCommand_initTypes() {
109
- this.types.string.push('environmentName', 'sharingStatus');
110
- this.types.boolean.push('withSolutions', 'asAdmin');
111
- };
112
81
  export default new FlowListCommand();
113
82
  //# sourceMappingURL=flow-list.js.map