@pnp/cli-microsoft365 11.8.0-beta.ae98113 → 11.9.0-beta.0365d84

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 (69) hide show
  1. package/allCommandsFull.json +1 -1
  2. package/dist/cli/cli.js +49 -13
  3. package/dist/index.js +9 -1
  4. package/dist/m365/adaptivecard/commands/adaptivecard-send.js +4 -1
  5. package/dist/m365/app/commands/permission/permission-add.js +4 -1
  6. package/dist/m365/booking/commands/business/business-get.js +5 -1
  7. package/dist/m365/commands/login.js +26 -6
  8. package/dist/m365/entra/commands/administrativeunit/administrativeunit-get.js +5 -1
  9. package/dist/m365/entra/commands/administrativeunit/administrativeunit-remove.js +10 -2
  10. package/dist/m365/entra/commands/organization/organization-set.js +14 -3
  11. package/dist/m365/entra/commands/roleassignment/roleassignment-add.js +10 -2
  12. package/dist/m365/entra/commands/roledefinition/roledefinition-get.js +10 -2
  13. package/dist/m365/entra/commands/roledefinition/roledefinition-remove.js +10 -2
  14. package/dist/m365/entra/commands/roledefinition/roledefinition-set.js +14 -3
  15. package/dist/m365/entra/commands/user/user-session-revoke.js +5 -1
  16. package/dist/m365/exo/commands/approleassignment/approleassignment-add.js +60 -12
  17. package/dist/m365/flow/commands/environment/environment-get.js +5 -1
  18. package/dist/m365/graph/commands/directoryextension/directoryextension-add.js +5 -1
  19. package/dist/m365/graph/commands/directoryextension/directoryextension-get.js +15 -3
  20. package/dist/m365/graph/commands/directoryextension/directoryextension-list.js +5 -1
  21. package/dist/m365/graph/commands/directoryextension/directoryextension-remove.js +15 -3
  22. package/dist/m365/outlook/commands/mail/mail-searchfolder-add.js +5 -1
  23. package/dist/m365/outlook/commands/mailbox/mailbox-settings-get.js +5 -1
  24. package/dist/m365/outlook/commands/mailbox/mailbox-settings-set.js +9 -2
  25. package/dist/m365/pa/commands/environment/environment-get.js +5 -1
  26. package/dist/m365/pp/commands/environment/environment-get.js +5 -1
  27. package/dist/m365/pp/commands/website/website-get.js +5 -1
  28. package/dist/m365/spe/commands/container/container-add.js +5 -1
  29. package/dist/m365/spe/commands/container/container-recyclebinitem-list.js +5 -1
  30. package/dist/m365/spe/commands/container/container-recyclebinitem-remove.js +10 -2
  31. package/dist/m365/spe/commands/container/container-recyclebinitem-restore.js +10 -2
  32. package/dist/m365/spe/commands/container/container-remove.js +10 -2
  33. package/dist/m365/spe/commands/containertype/containertype-get.js +5 -1
  34. package/dist/m365/spe/commands/containertype/containertype-remove.js +5 -1
  35. package/dist/m365/spfx/commands/SpfxCompatibilityMatrix.js +1 -1
  36. package/dist/m365/spfx/commands/project/project-doctor/{doctor-1.23.0-rc.0.js → doctor-1.23.0.js} +1 -1
  37. package/dist/m365/spfx/commands/project/project-doctor.js +7 -1
  38. package/dist/m365/spfx/commands/project/project-upgrade/rules/DependencyRule.js +11 -5
  39. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002035_DEVDEP_types_heft_jest.js +2 -2
  40. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002036_DEVDEP_types_jest.js +10 -0
  41. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN027001_OVERRIDES_rushstack_heft.js +33 -0
  42. package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.22.0.js +2 -2
  43. package/dist/m365/spfx/commands/project/project-upgrade/{upgrade-1.23.0-rc.0.js → upgrade-1.23.0.js} +39 -31
  44. package/dist/m365/spfx/commands/project/project-upgrade.js +36 -19
  45. package/dist/m365/spo/commands/file/file-version-keep.js +5 -1
  46. package/dist/m365/spo/commands/homesite/homesite-add.js +5 -1
  47. package/dist/m365/spo/commands/homesite/homesite-set.js +9 -2
  48. package/dist/m365/spo/commands/list/list-defaultvalue-clear.js +10 -2
  49. package/dist/m365/spo/commands/list/list-defaultvalue-get.js +5 -1
  50. package/dist/m365/spo/commands/list/list-defaultvalue-list.js +5 -1
  51. package/dist/m365/spo/commands/list/list-defaultvalue-remove.js +5 -1
  52. package/dist/m365/spo/commands/list/list-defaultvalue-set.js +5 -1
  53. package/dist/m365/spo/commands/list/list-view-add.js +17 -4
  54. package/dist/m365/spo/commands/page/page-get.js +5 -1
  55. package/dist/m365/spo/commands/web/web-alert-list.js +10 -2
  56. package/dist/m365/spp/commands/autofillcolumn/autofillcolumn-set.js +10 -2
  57. package/dist/m365/spp/commands/model/model-apply.js +10 -2
  58. package/dist/m365/teams/commands/callrecord/callrecord-list.js +5 -1
  59. package/dist/m365/viva/commands/engage/engage-community-user-add.js +20 -4
  60. package/dist/m365/viva/commands/engage/engage-community-user-list.js +10 -2
  61. package/dist/m365/viva/commands/engage/engage-community-user-remove.js +16 -7
  62. package/dist/m365/viva/commands/engage/engage-role-member-list.js +5 -1
  63. package/dist/request.js +1 -1
  64. package/dist/utils/packageManager.js +38 -7
  65. package/dist/utils/prompt.js +1 -7
  66. package/docs/docs/cmd/spfx/project/project-upgrade.mdx +2 -2
  67. package/npm-shrinkwrap.json +1579 -503
  68. package/package.json +37 -19
  69. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021009_PKG_overrides_rushstack_heft.js +0 -45
package/dist/cli/cli.js CHANGED
@@ -156,13 +156,30 @@ async function execute(rawArgs) {
156
156
  break;
157
157
  }
158
158
  else {
159
- const hasNonRequiredErrors = result.error.issues.some(i => i.code !== 'invalid_type');
160
159
  const shouldPrompt = cli.getSettingWithDefaultValue(settingsNames.prompt, true);
161
- if (hasNonRequiredErrors === false &&
162
- shouldPrompt) {
160
+ if (!shouldPrompt) {
161
+ result.error.issues.forEach(e => {
162
+ if (e.code === 'invalid_type' &&
163
+ e.input === undefined) {
164
+ e.message = `Required option not specified`;
165
+ }
166
+ });
167
+ return cli.closeWithError(result.error, cli.optionsFromArgs, true);
168
+ }
169
+ const missingRequiredValuesErrors = result.error.issues
170
+ .filter(e => (e.code === 'invalid_type' && e.input === undefined) ||
171
+ (e.code === 'custom' && e.params?.customCode === 'required'));
172
+ const optionSetErrors = result.error.issues
173
+ .filter(e => e.code === 'custom' && e.params?.customCode === 'optionSet');
174
+ const otherErrors = result.error.issues
175
+ .filter(e => !missingRequiredValuesErrors.includes(e) && !optionSetErrors.includes(e));
176
+ if (otherErrors.length > 0) {
177
+ return cli.closeWithError(result.error, cli.optionsFromArgs, true);
178
+ }
179
+ if (missingRequiredValuesErrors.length > 0) {
163
180
  await cli.error('🌶️ Provide values for the following parameters:');
164
- for (const issue of result.error.issues) {
165
- const optionName = issue.path.join('.');
181
+ for (const error of missingRequiredValuesErrors) {
182
+ const optionName = error.path.join('.');
166
183
  const optionInfo = cli.commandToExecute.options.find(o => o.name === optionName);
167
184
  const answer = await cli.promptForValue(optionInfo);
168
185
  // coerce the answer to the correct type
@@ -174,15 +191,13 @@ async function execute(rawArgs) {
174
191
  return cli.closeWithError(e.message, cli.optionsFromArgs, true);
175
192
  }
176
193
  }
194
+ continue;
177
195
  }
178
- else {
179
- result.error.issues.forEach(i => {
180
- if (i.code === 'invalid_type' &&
181
- i.input === undefined) {
182
- i.message = `Required option not specified`;
183
- }
184
- });
185
- return cli.closeWithError(result.error, cli.optionsFromArgs, true);
196
+ if (optionSetErrors.length > 0) {
197
+ for (const error of optionSetErrors) {
198
+ await promptForOptionSetNameAndValue(cli.optionsFromArgs, error.params?.options);
199
+ }
200
+ continue;
186
201
  }
187
202
  }
188
203
  }
@@ -891,6 +906,27 @@ function loadOptionValuesFromFiles(args) {
891
906
  function shouldTrimOutput(output) {
892
907
  return output === 'text';
893
908
  }
909
+ async function promptForOptionSetNameAndValue(args, options) {
910
+ await cli.error(`🌶️ Please specify one of the following options:`);
911
+ const selectedOptionName = await prompt.forSelection({ message: `Option to use:`, choices: options.map((choice) => { return { name: choice, value: choice }; }) });
912
+ const optionValue = await prompt.forInput({ message: `${selectedOptionName}:` });
913
+ let coercedValue = optionValue;
914
+ // Basic type coercion to align with how CLI arguments are typically parsed
915
+ if (typeof optionValue === 'string') {
916
+ const trimmed = optionValue.trim();
917
+ if (trimmed === 'true') {
918
+ coercedValue = true;
919
+ }
920
+ else if (trimmed === 'false') {
921
+ coercedValue = false;
922
+ }
923
+ else if (trimmed !== '' && !isNaN(Number(trimmed))) {
924
+ coercedValue = Number(trimmed);
925
+ }
926
+ }
927
+ args.options[selectedOptionName] = coercedValue;
928
+ await cli.error('');
929
+ }
894
930
  export const cli = {
895
931
  closeWithError,
896
932
  commands,
package/dist/index.js CHANGED
@@ -13,6 +13,14 @@ await (async () => {
13
13
  const updateNotifier = await import('update-notifier');
14
14
  updateNotifier.default({ pkg: app.packageJson() }).notify({ defer: false });
15
15
  }
16
- await cli.execute(process.argv.slice(2));
16
+ try {
17
+ await cli.execute(process.argv.slice(2));
18
+ }
19
+ catch (err) {
20
+ if (err instanceof Error && err.name === 'ExitPromptError') {
21
+ process.exit(1);
22
+ }
23
+ await cli.closeWithError(err, cli.optionsFromArgs || { options: {} });
24
+ }
17
25
  })();
18
26
  //# sourceMappingURL=index.js.map
@@ -29,7 +29,10 @@ class AdaptiveCardSendCommand extends AnonymousCommand {
29
29
  return schema
30
30
  .refine(options => !options.cardData || options.card, {
31
31
  error: 'When you specify cardData, you must also specify card.',
32
- path: ['cardData']
32
+ path: ['cardData'],
33
+ params: {
34
+ customCode: 'required'
35
+ }
33
36
  })
34
37
  .refine(options => {
35
38
  if (options.card) {
@@ -30,7 +30,10 @@ class AppPermissionAddCommand extends AppCommand {
30
30
  return schema
31
31
  .refine(options => options.applicationPermissions || options.delegatedPermissions, {
32
32
  error: 'Specify at least one of applicationPermissions or delegatedPermissions, or both.',
33
- path: ['delegatedPermissions']
33
+ path: ['delegatedPermissions'],
34
+ params: {
35
+ customCode: 'required'
36
+ }
34
37
  });
35
38
  }
36
39
  async commandAction(logger, args) {
@@ -23,7 +23,11 @@ class BookingBusinessGetCommand extends GraphCommand {
23
23
  getRefinedSchema(schema) {
24
24
  return schema
25
25
  .refine(options => options.id || options.name, {
26
- error: 'Specify either id or name'
26
+ error: 'Specify either id or name',
27
+ params: {
28
+ customCode: 'optionSet',
29
+ options: ['id', 'name']
30
+ }
27
31
  });
28
32
  }
29
33
  async commandAction(logger, args) {
@@ -42,19 +42,32 @@ class LoginCommand extends Command {
42
42
  return schema
43
43
  .refine(options => typeof options.appId !== 'undefined' || cli.getClientId() || options.authType === 'identity' || options.authType === 'federatedIdentity', {
44
44
  error: `appId is required. TIP: use the "m365 setup" command to configure the default appId.`,
45
- path: ['appId']
45
+ path: ['appId'],
46
+ params: {
47
+ customCode: 'required'
48
+ }
46
49
  })
47
50
  .refine(options => options.authType !== 'password' || options.userName, {
48
51
  error: 'Username is required when using password authentication.',
49
- path: ['userName']
52
+ path: ['userName'],
53
+ params: {
54
+ customCode: 'required'
55
+ }
50
56
  })
51
57
  .refine(options => options.authType !== 'password' || options.password, {
52
58
  error: 'Password is required when using password authentication.',
53
- path: ['password']
59
+ path: ['password'],
60
+ params: {
61
+ customCode: 'required'
62
+ }
54
63
  })
55
64
  .refine(options => options.authType !== 'certificate' || !(options.certificateFile && options.certificateBase64Encoded), {
56
65
  error: 'Specify either certificateFile or certificateBase64Encoded, but not both.',
57
- path: ['certificateBase64Encoded']
66
+ path: ['certificateBase64Encoded'],
67
+ params: {
68
+ customCode: 'optionSet',
69
+ options: ['certificateFile', 'certificateBase64Encoded']
70
+ }
58
71
  })
59
72
  .refine(options => options.authType !== 'certificate' ||
60
73
  options.certificateFile ||
@@ -62,13 +75,20 @@ class LoginCommand extends Command {
62
75
  cli.getConfig().get(settingsNames.clientCertificateFile) ||
63
76
  cli.getConfig().get(settingsNames.clientCertificateBase64Encoded), {
64
77
  error: 'Specify either certificateFile or certificateBase64Encoded.',
65
- path: ['certificateFile']
78
+ path: ['certificateFile'],
79
+ params: {
80
+ customCode: 'optionSet',
81
+ options: ['certificateFile', 'certificateBase64Encoded']
82
+ }
66
83
  })
67
84
  .refine(options => options.authType !== 'secret' ||
68
85
  options.secret ||
69
86
  cli.getConfig().get(settingsNames.clientSecret), {
70
87
  error: 'Secret is required when using secret authentication.',
71
- path: ['secret']
88
+ path: ['secret'],
89
+ params: {
90
+ customCode: 'required'
91
+ }
72
92
  });
73
93
  }
74
94
  async commandAction(logger, args) {
@@ -23,7 +23,11 @@ class EntraAdministrativeUnitGetCommand extends GraphCommand {
23
23
  getRefinedSchema(schema) {
24
24
  return schema
25
25
  .refine(options => [options.id, options.displayName].filter(Boolean).length === 1, {
26
- error: 'Specify either id or displayName'
26
+ error: 'Specify either id or displayName',
27
+ params: {
28
+ customCode: 'optionSet',
29
+ options: ['id', 'displayName']
30
+ }
27
31
  });
28
32
  }
29
33
  async commandAction(logger, args) {
@@ -24,10 +24,18 @@ class EntraAdministrativeUnitRemoveCommand extends GraphCommand {
24
24
  getRefinedSchema(schema) {
25
25
  return schema
26
26
  .refine(options => options.id || options.displayName, {
27
- error: 'Specify either id or displayName'
27
+ error: 'Specify either id or displayName',
28
+ params: {
29
+ customCode: 'optionSet',
30
+ options: ['id', 'displayName']
31
+ }
28
32
  })
29
33
  .refine(options => !(options.id && options.displayName), {
30
- error: 'Specify either id or displayName but not both'
34
+ error: 'Specify either id or displayName but not both',
35
+ params: {
36
+ customCode: 'optionSet',
37
+ options: ['id', 'displayName']
38
+ }
31
39
  });
32
40
  }
33
41
  async commandAction(logger, args) {
@@ -37,16 +37,27 @@ class EntraOrganizationSetCommand extends GraphCommand {
37
37
  getRefinedSchema(schema) {
38
38
  return schema
39
39
  .refine(options => !(options.id && options.displayName), {
40
- error: 'Specify either id or displayName, but not both'
40
+ error: 'Specify either id or displayName, but not both',
41
+ params: {
42
+ customCode: 'optionSet',
43
+ options: ['id', 'displayName']
44
+ }
41
45
  })
42
46
  .refine(options => options.id || options.displayName, {
43
- error: 'Specify either id or displayName'
47
+ error: 'Specify either id or displayName',
48
+ params: {
49
+ customCode: 'optionSet',
50
+ options: ['id', 'displayName']
51
+ }
44
52
  })
45
53
  .refine(options => [
46
54
  options.contactEmail, options.marketingNotificationEmails, options.securityComplianceNotificationMails, options.securityComplianceNotificationPhones,
47
55
  options.statementUrl, options.technicalNotificationMails
48
56
  ].filter(o => o !== undefined).length > 0, {
49
- error: 'Specify at least one of the following options: contactEmail, marketingNotificationEmails, securityComplianceNotificationMails, securityComplianceNotificationPhones, statementUrl, or technicalNotificationMails'
57
+ error: 'Specify at least one of the following options: contactEmail, marketingNotificationEmails, securityComplianceNotificationMails, securityComplianceNotificationPhones, statementUrl, or technicalNotificationMails',
58
+ params: {
59
+ customCode: 'required'
60
+ }
50
61
  });
51
62
  }
52
63
  async commandAction(logger, args) {
@@ -44,13 +44,21 @@ class EntraRoleAssignmentAddCommand extends GraphCommand {
44
44
  getRefinedSchema(schema) {
45
45
  return schema
46
46
  .refine(options => [options.roleDefinitionId, options.roleDefinitionName].filter(o => o !== undefined).length === 1, {
47
- error: 'Specify either roleDefinitionId or roleDefinitionName'
47
+ error: 'Specify either roleDefinitionId or roleDefinitionName',
48
+ params: {
49
+ customCode: 'optionSet',
50
+ options: ['roleDefinitionId', 'roleDefinitionName']
51
+ }
48
52
  })
49
53
  .refine(options => Object.values([
50
54
  options.userId, options.userName, options.administrativeUnitId, options.administrativeUnitName, options.applicationId, options.applicationObjectId, options.applicationName,
51
55
  options.servicePrincipalId, options.servicePrincipalName, options.groupId, options.groupName
52
56
  ]).filter(v => typeof v !== 'undefined').length < 2, {
53
- message: 'Provide value for only one of the following parameters: userId, userName, administrativeUnitId, administrativeUnitName, applicationId, applicationObjectId, applicationName, servicePrincipalId, servicePrincipalName, groupId or groupName'
57
+ message: 'Provide value for only one of the following parameters: userId, userName, administrativeUnitId, administrativeUnitName, applicationId, applicationObjectId, applicationName, servicePrincipalId, servicePrincipalName, groupId or groupName',
58
+ params: {
59
+ customCode: 'optionSet',
60
+ options: ['userId', 'userName', 'administrativeUnitId', 'administrativeUnitName', 'applicationId', 'applicationObjectId', 'applicationName', 'servicePrincipalId', 'servicePrincipalName', 'groupId', 'groupName']
61
+ }
54
62
  });
55
63
  }
56
64
  async commandAction(logger, args) {
@@ -23,10 +23,18 @@ class EntraRoleDefinitionGetCommand extends GraphCommand {
23
23
  getRefinedSchema(schema) {
24
24
  return schema
25
25
  .refine(options => !options.id !== !options.displayName, {
26
- error: 'Specify either id or displayName, but not both'
26
+ error: 'Specify either id or displayName, but not both',
27
+ params: {
28
+ customCode: 'optionSet',
29
+ options: ['id', 'displayName']
30
+ }
27
31
  })
28
32
  .refine(options => options.id || options.displayName, {
29
- error: 'Specify either id or displayName'
33
+ error: 'Specify either id or displayName',
34
+ params: {
35
+ customCode: 'optionSet',
36
+ options: ['id', 'displayName']
37
+ }
30
38
  })
31
39
  .refine(options => (!options.id && !options.displayName) || options.displayName || (options.id && validation.isValidGuid(options.id)), {
32
40
  error: e => `The '${e.input}' must be a valid GUID`,
@@ -25,10 +25,18 @@ class EntraRoleDefinitionRemoveCommand extends GraphCommand {
25
25
  getRefinedSchema(schema) {
26
26
  return schema
27
27
  .refine(options => !options.id !== !options.displayName, {
28
- error: 'Specify either id or displayName, but not both'
28
+ error: 'Specify either id or displayName, but not both',
29
+ params: {
30
+ customCode: 'optionSet',
31
+ options: ['id', 'displayName']
32
+ }
29
33
  })
30
34
  .refine(options => options.id || options.displayName, {
31
- error: 'Specify either id or displayName'
35
+ error: 'Specify either id or displayName',
36
+ params: {
37
+ customCode: 'optionSet',
38
+ options: ['id', 'displayName']
39
+ }
32
40
  })
33
41
  .refine(options => (!options.id && !options.displayName) || options.displayName || (options.id && validation.isValidGuid(options.id)), {
34
42
  error: e => `The '${e.input}' must be a valid GUID`,
@@ -28,17 +28,28 @@ class EntraRoleDefinitionSetCommand extends GraphCommand {
28
28
  getRefinedSchema(schema) {
29
29
  return schema
30
30
  .refine(options => !options.id !== !options.displayName, {
31
- error: 'Specify either id or displayName, but not both'
31
+ error: 'Specify either id or displayName, but not both',
32
+ params: {
33
+ customCode: 'optionSet',
34
+ options: ['id', 'displayName']
35
+ }
32
36
  })
33
37
  .refine(options => options.id || options.displayName, {
34
- error: 'Specify either id or displayName'
38
+ error: 'Specify either id or displayName',
39
+ params: {
40
+ customCode: 'optionSet',
41
+ options: ['id', 'displayName']
42
+ }
35
43
  })
36
44
  .refine(options => (!options.id && !options.displayName) || options.displayName || (options.id && validation.isValidGuid(options.id)), {
37
45
  error: e => `The '${e.input}' must be a valid GUID`,
38
46
  path: ['id']
39
47
  })
40
48
  .refine(options => Object.values([options.newDisplayName, options.description, options.allowedResourceActions, options.enabled, options.version]).filter(v => typeof v !== 'undefined').length > 0, {
41
- error: 'Provide value for at least one of the following parameters: newDisplayName, description, allowedResourceActions, enabled or version'
49
+ error: 'Provide value for at least one of the following parameters: newDisplayName, description, allowedResourceActions, enabled or version',
50
+ params: {
51
+ customCode: 'required'
52
+ }
42
53
  });
43
54
  }
44
55
  async commandAction(logger, args) {
@@ -27,7 +27,11 @@ class EntraUserSessionRevokeCommand extends GraphCommand {
27
27
  getRefinedSchema(schema) {
28
28
  return schema
29
29
  .refine(options => [options.userId, options.userName].filter(o => o !== undefined).length === 1, {
30
- error: `Specify either 'userId' or 'userName'.`
30
+ error: `Specify either 'userId' or 'userName'.`,
31
+ params: {
32
+ customCode: 'optionSet',
33
+ options: ['userId', 'userName']
34
+ }
31
35
  });
32
36
  }
33
37
  async commandAction(logger, args) {
@@ -39,20 +39,36 @@ class ExoAppRoleAssignmentAddCommand extends GraphCommand {
39
39
  getRefinedSchema(schema) {
40
40
  return schema
41
41
  .refine(options => !options.roleDefinitionId !== !options.roleDefinitionName, {
42
- error: 'Specify either roleDefinitionId or roleDefinitionName, but not both'
42
+ error: 'Specify either roleDefinitionId or roleDefinitionName, but not both',
43
+ params: {
44
+ customCode: 'optionSet',
45
+ options: ['roleDefinitionId', 'roleDefinitionName']
46
+ }
43
47
  })
44
48
  .refine(options => options.roleDefinitionId || options.roleDefinitionName, {
45
- error: 'Specify either roleDefinitionId or roleDefinitionName'
49
+ error: 'Specify either roleDefinitionId or roleDefinitionName',
50
+ params: {
51
+ customCode: 'optionSet',
52
+ options: ['roleDefinitionId', 'roleDefinitionName']
53
+ }
46
54
  })
47
55
  .refine(options => (!options.roleDefinitionId && !options.roleDefinitionName) || options.roleDefinitionName || (options.roleDefinitionId && validation.isValidGuid(options.roleDefinitionId)), {
48
56
  error: e => `The '${e.input}' must be a valid GUID`,
49
57
  path: ['roleDefinitionId']
50
58
  })
51
59
  .refine(options => !options.principalId !== !options.principalName, {
52
- error: 'Specify either principalId or principalName, but not both'
60
+ error: 'Specify either principalId or principalName, but not both',
61
+ params: {
62
+ customCode: 'optionSet',
63
+ options: ['principalId', 'principalName']
64
+ }
53
65
  })
54
66
  .refine(options => options.principalId || options.principalName, {
55
- error: 'Specify either principalId or principalName'
67
+ error: 'Specify either principalId or principalName',
68
+ params: {
69
+ customCode: 'optionSet',
70
+ options: ['principalId', 'principalName']
71
+ }
56
72
  })
57
73
  .refine(options => (!options.principalId && !options.principalName) || options.principalName || (options.principalId && validation.isValidGuid(options.principalId)), {
58
74
  error: e => `The '${e.input}' must be a valid GUID`,
@@ -68,11 +84,19 @@ class ExoAppRoleAssignmentAddCommand extends GraphCommand {
68
84
  })
69
85
  .refine(options => options.scope !== 'user' || (!options.userId !== !options.userName), {
70
86
  message: "When the scope is set to 'user' specify either userId or userName, but not both",
71
- path: ['scope']
87
+ path: ['scope'],
88
+ params: {
89
+ customCode: 'optionSet',
90
+ options: ['userId', 'userName']
91
+ }
72
92
  })
73
93
  .refine(options => options.scope !== 'user' || (options.userId || options.userName), {
74
94
  message: "When the scope is set to 'user' specify either userId or userName",
75
- path: ['scope']
95
+ path: ['scope'],
96
+ params: {
97
+ customCode: 'optionSet',
98
+ options: ['userId', 'userName']
99
+ }
76
100
  })
77
101
  .refine(options => options.scope !== 'user' || (!options.userId && !options.userName) || options.userName || (options.userId && validation.isValidGuid(options.userId)), {
78
102
  error: e => `The '${e.input}' must be a valid GUID`,
@@ -88,11 +112,19 @@ class ExoAppRoleAssignmentAddCommand extends GraphCommand {
88
112
  })
89
113
  .refine(options => options.scope !== 'group' || (!options.groupId !== !options.groupName), {
90
114
  message: "When the scope is set to 'group' specify either groupId or groupName, but not both",
91
- path: ['scope']
115
+ path: ['scope'],
116
+ params: {
117
+ customCode: 'optionSet',
118
+ options: ['groupId', 'groupName']
119
+ }
92
120
  })
93
121
  .refine(options => options.scope !== 'group' || (options.groupId || options.groupName), {
94
122
  message: "When the scope is set to 'group' specify either groupId or groupName",
95
- path: ['scope']
123
+ path: ['scope'],
124
+ params: {
125
+ customCode: 'optionSet',
126
+ options: ['groupId', 'groupName']
127
+ }
96
128
  })
97
129
  .refine(options => options.scope !== 'group' || (!options.groupId && !options.groupName) || options.groupName || (options.groupId && validation.isValidGuid(options.groupId)), {
98
130
  error: e => `The '${e.input}' must be a valid GUID`,
@@ -104,11 +136,19 @@ class ExoAppRoleAssignmentAddCommand extends GraphCommand {
104
136
  })
105
137
  .refine(options => options.scope !== 'administrativeUnit' || (!options.administrativeUnitId !== !options.administrativeUnitName), {
106
138
  message: "When the scope is set to 'administrativeUnit' specify either administrativeUnitId or administrativeUnitName, but not both",
107
- path: ['scope']
139
+ path: ['scope'],
140
+ params: {
141
+ customCode: 'optionSet',
142
+ options: ['administrativeUnitId', 'administrativeUnitName']
143
+ }
108
144
  })
109
145
  .refine(options => options.scope !== 'administrativeUnit' || (options.administrativeUnitId || options.administrativeUnitName), {
110
146
  message: "When the scope is set to 'administrativeUnit' specify either administrativeUnitId or administrativeUnitName",
111
- path: ['scope']
147
+ path: ['scope'],
148
+ params: {
149
+ customCode: 'optionSet',
150
+ options: ['administrativeUnitId', 'administrativeUnitName']
151
+ }
112
152
  })
113
153
  .refine(options => options.scope !== 'administrativeUnit' || (!options.administrativeUnitId && !options.administrativeUnitName) || options.administrativeUnitName || (options.administrativeUnitId && validation.isValidGuid(options.administrativeUnitId)), {
114
154
  error: e => `The '${e.input}' must be a valid GUID`,
@@ -120,11 +160,19 @@ class ExoAppRoleAssignmentAddCommand extends GraphCommand {
120
160
  })
121
161
  .refine(options => options.scope !== 'custom' || (!options.customAppScopeId !== !options.customAppScopeName), {
122
162
  message: "When the scope is set to 'custom' specify either customAppScopeId or customAppScopeName, but not both",
123
- path: ['scope']
163
+ path: ['scope'],
164
+ params: {
165
+ customCode: 'optionSet',
166
+ options: ['customAppScopeId', 'customAppScopeName']
167
+ }
124
168
  })
125
169
  .refine(options => options.scope !== 'custom' || (options.customAppScopeId || options.customAppScopeName), {
126
170
  message: "When the scope is set to 'custom' specify either customAppScopeId or customAppScopeName",
127
- path: ['scope']
171
+ path: ['scope'],
172
+ params: {
173
+ customCode: 'optionSet',
174
+ options: ['customAppScopeId', 'customAppScopeName']
175
+ }
128
176
  })
129
177
  .refine(options => options.scope !== 'custom' || (!options.customAppScopeId && !options.customAppScopeName) || options.customAppScopeName || (options.customAppScopeId && validation.isValidGuid(options.customAppScopeId)), {
130
178
  error: e => `The '${e.input}' must be a valid GUID`,
@@ -22,7 +22,11 @@ class FlowEnvironmentGetCommand extends PowerAutomateCommand {
22
22
  getRefinedSchema(schema) {
23
23
  return schema
24
24
  .refine(options => !!options.name !== !!options.default, {
25
- error: `Specify either name or default, but not both.`
25
+ error: `Specify either name or default, but not both.`,
26
+ params: {
27
+ customCode: 'optionSet',
28
+ options: ['name', 'default']
29
+ }
26
30
  });
27
31
  }
28
32
  async commandAction(logger, args) {
@@ -29,7 +29,11 @@ class GraphDirectoryExtensionAddCommand extends GraphCommand {
29
29
  getRefinedSchema(schema) {
30
30
  return schema
31
31
  .refine(options => Object.values([options.appId, options.appObjectId, options.appName]).filter(v => typeof v !== 'undefined').length === 1, {
32
- error: 'Specify either appId, appObjectId or appName, but not multiple'
32
+ error: 'Specify either appId, appObjectId or appName, but not multiple',
33
+ params: {
34
+ customCode: 'optionSet',
35
+ options: ['appId', 'appObjectId', 'appName']
36
+ }
33
37
  })
34
38
  .refine(options => (!options.appId && !options.appObjectId && !options.appName) || options.appObjectId || options.appName ||
35
39
  (options.appId && validation.isValidGuid(options.appId)), {
@@ -26,13 +26,25 @@ class GraphDirectoryExtensionGetCommand extends GraphCommand {
26
26
  getRefinedSchema(schema) {
27
27
  return schema
28
28
  .refine(options => !options.id !== !options.name, {
29
- error: 'Specify either id or name, but not both'
29
+ error: 'Specify either id or name, but not both',
30
+ params: {
31
+ customCode: 'optionSet',
32
+ options: ['id', 'name']
33
+ }
30
34
  })
31
35
  .refine(options => options.id || options.name, {
32
- error: 'Specify either id or name'
36
+ error: 'Specify either id or name',
37
+ params: {
38
+ customCode: 'optionSet',
39
+ options: ['id', 'name']
40
+ }
33
41
  })
34
42
  .refine(options => Object.values([options.appId, options.appObjectId, options.appName]).filter(v => typeof v !== 'undefined').length === 1, {
35
- error: 'Specify either appId, appObjectId or appName, but not multiple'
43
+ error: 'Specify either appId, appObjectId or appName, but not multiple',
44
+ params: {
45
+ customCode: 'optionSet',
46
+ options: ['appId', 'appObjectId', 'appName']
47
+ }
36
48
  });
37
49
  }
38
50
  async commandAction(logger, args) {
@@ -27,7 +27,11 @@ class GraphDirectoryExtensionListCommand extends GraphCommand {
27
27
  getRefinedSchema(schema) {
28
28
  return schema
29
29
  .refine(options => ([options.appId, options.appObjectId, options.appName].filter(x => x !== undefined).length <= 1), {
30
- error: 'Specify either appId, appObjectId, or appName, but not multiple.'
30
+ error: 'Specify either appId, appObjectId, or appName, but not multiple.',
31
+ params: {
32
+ customCode: 'optionSet',
33
+ options: ['appId', 'appObjectId', 'appName']
34
+ }
31
35
  });
32
36
  }
33
37
  async commandAction(logger, args) {
@@ -28,13 +28,25 @@ class GraphDirectoryExtensionRemoveCommand extends GraphCommand {
28
28
  getRefinedSchema(schema) {
29
29
  return schema
30
30
  .refine(options => !options.id !== !options.name, {
31
- error: 'Specify either id or name, but not both'
31
+ error: 'Specify either id or name, but not both',
32
+ params: {
33
+ customCode: 'optionSet',
34
+ options: ['id', 'name']
35
+ }
32
36
  })
33
37
  .refine(options => options.id || options.name, {
34
- error: 'Specify either id or name'
38
+ error: 'Specify either id or name',
39
+ params: {
40
+ customCode: 'optionSet',
41
+ options: ['id', 'name']
42
+ }
35
43
  })
36
44
  .refine(options => Object.values([options.appId, options.appObjectId, options.appName]).filter(v => typeof v !== 'undefined').length === 1, {
37
- error: 'Specify either appId, appObjectId or appName, but not multiple'
45
+ error: 'Specify either appId, appObjectId or appName, but not multiple',
46
+ params: {
47
+ customCode: 'optionSet',
48
+ options: ['appId', 'appObjectId', 'appName']
49
+ }
38
50
  });
39
51
  }
40
52
  async commandAction(logger, args) {
@@ -31,7 +31,11 @@ class OutlookMailSearchFolderAddCommand extends GraphCommand {
31
31
  getRefinedSchema(schema) {
32
32
  return schema
33
33
  .refine(options => !(options.userId && options.userName), {
34
- error: 'Specify either userId or userName, but not both'
34
+ error: 'Specify either userId or userName, but not both',
35
+ params: {
36
+ customCode: 'optionSet',
37
+ options: ['userId', 'userName']
38
+ }
35
39
  });
36
40
  }
37
41
  async commandAction(logger, args) {