@pnp/cli-microsoft365 11.1.0-beta.d3fc85d → 11.1.0-beta.dce6352

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 (101) hide show
  1. package/.devproxy/api-specs/sharepoint.yaml +23 -0
  2. package/allCommands.json +1 -1
  3. package/allCommandsFull.json +1 -1
  4. package/dist/Auth.js +10 -7
  5. package/dist/Command.js +2 -2
  6. package/dist/auth/msalCachePlugin.js +6 -2
  7. package/dist/autocomplete.js +6 -2
  8. package/dist/chili/chili.js +2 -1
  9. package/dist/cli/cli.js +4 -2
  10. package/dist/config.js +0 -1
  11. package/dist/m365/adaptivecard/commands/adaptivecard-send.js +2 -2
  12. package/dist/m365/app/commands/permission/permission-list.js +4 -2
  13. package/dist/m365/booking/commands/business/business-list.js +5 -0
  14. package/dist/m365/commands/setup.js +6 -3
  15. package/dist/m365/connection/commands/connection-list.js +5 -1
  16. package/dist/m365/entra/commands/app/app-role-add.js +1 -1
  17. package/dist/m365/entra/commands/group/group-add.js +1 -1
  18. package/dist/m365/entra/commands/group/group-set.js +1 -1
  19. package/dist/m365/entra/commands/m365group/m365group-add.js +0 -1
  20. package/dist/m365/file/commands/convert/convert-pdf.js +1 -6
  21. package/dist/m365/flow/commands/flow-export.js +8 -5
  22. package/dist/m365/flow/commands/run/run-get.js +3 -3
  23. package/dist/m365/graph/commands/schemaextension/schemaextension-set.js +1 -1
  24. package/dist/m365/onedrive/commands/onedrive-list.js +5 -0
  25. package/dist/m365/outlook/commands/roomlist/roomlist-list.js +5 -0
  26. package/dist/m365/pa/commands/app/app-export.js +1 -1
  27. package/dist/m365/pa/commands/app/app-get.js +1 -1
  28. package/dist/m365/pa/commands/environment/environment-list.js +5 -0
  29. package/dist/m365/planner/commands/tenant/tenant-settings-list.js +5 -0
  30. package/dist/m365/pp/commands/solution/solution-publisher-get.js +1 -1
  31. package/dist/m365/purview/commands/retentionevent/retentionevent-list.js +5 -0
  32. package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-list.js +5 -0
  33. package/dist/m365/purview/commands/retentionlabel/retentionlabel-list.js +5 -0
  34. package/dist/m365/spfx/commands/package/package-generate.js +3 -1
  35. package/dist/m365/spfx/commands/project/base-project-command.js +13 -5
  36. package/dist/m365/spfx/commands/project/project-doctor/rules/FN021007_PKG_only_one_rush_stack_compiler_installed.js +1 -1
  37. package/dist/m365/spfx/commands/project/project-externalize/rules/PnPJsRule.js +6 -4
  38. package/dist/m365/spfx/commands/project/project-model/ScssFile.js +3 -1
  39. package/dist/m365/spfx/commands/project/project-model/TsFile.js +6 -2
  40. package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.15.2.js +1 -1
  41. package/dist/m365/spfx/commands/spfx-doctor.js +5 -5
  42. package/dist/m365/spo/commands/file/file-add.js +4 -2
  43. package/dist/m365/spo/commands/file/file-rename.js +3 -4
  44. package/dist/m365/spo/commands/hubsite/hubsite-list.js +1 -1
  45. package/dist/m365/spo/commands/listitem/listitem-attachment-add.js +1 -1
  46. package/dist/m365/spo/commands/listitem/listitem-batch-set.js +9 -5
  47. package/dist/m365/spo/commands/page/clientsidepages.js +12 -12
  48. package/dist/m365/spo/commands/page/page-add.js +4 -2
  49. package/dist/m365/spo/commands/page/page-clientsidewebpart-add.js +1 -0
  50. package/dist/m365/spo/commands/page/page-set.js +4 -2
  51. package/dist/m365/spo/commands/page/page-text-add.js +1 -0
  52. package/dist/m365/spo/commands/propertybag/propertybag-base.js +34 -54
  53. package/dist/m365/spo/commands/site/site-alert-list.js +107 -0
  54. package/dist/m365/spo/commands/theme/theme-apply.js +1 -1
  55. package/dist/m365/spo/commands/web/web-reindex.js +17 -27
  56. package/dist/m365/spo/commands.js +1 -0
  57. package/dist/m365/teams/commands/tab/tab-add.js +9 -3
  58. package/dist/m365/viva/commands/connections/connections-app-create.js +1 -1
  59. package/dist/m365/viva/commands/engage/engage-community-user-add.js +1 -1
  60. package/dist/m365/viva/commands/engage/engage-community-user-remove.js +1 -1
  61. package/dist/telemetry.js +3 -1
  62. package/dist/utils/accessToken.js +4 -0
  63. package/dist/utils/cache.js +3 -2
  64. package/dist/utils/customAppScope.js +1 -1
  65. package/dist/utils/directoryExtension.js +1 -1
  66. package/dist/utils/entraAdministrativeUnit.js +1 -1
  67. package/dist/utils/entraApp.js +2 -2
  68. package/dist/utils/entraDevice.js +1 -1
  69. package/dist/utils/entraServicePrincipal.js +2 -2
  70. package/dist/utils/formatting.js +1 -1
  71. package/dist/utils/md.js +2 -2
  72. package/dist/utils/odata.js +2 -0
  73. package/dist/utils/planner.js +1 -1
  74. package/dist/utils/powerPlatform.js +2 -2
  75. package/dist/utils/roleDefinition.js +2 -2
  76. package/dist/utils/spo.js +10 -11
  77. package/dist/utils/urlUtil.js +1 -1
  78. package/dist/utils/validation.js +1 -1
  79. package/dist/utils/vivaEngage.js +3 -3
  80. package/docs/docs/cmd/entra/enterpriseapp/enterpriseapp-add.mdx +14 -0
  81. package/docs/docs/cmd/entra/enterpriseapp/enterpriseapp-get.mdx +15 -0
  82. package/docs/docs/cmd/entra/enterpriseapp/enterpriseapp-list.mdx +14 -0
  83. package/docs/docs/cmd/entra/enterpriseapp/enterpriseapp-remove.mdx +14 -0
  84. package/docs/docs/cmd/entra/groupsetting/groupsetting-add.mdx +19 -0
  85. package/docs/docs/cmd/entra/groupsetting/groupsetting-get.mdx +19 -0
  86. package/docs/docs/cmd/entra/groupsetting/groupsetting-list.mdx +19 -0
  87. package/docs/docs/cmd/entra/groupsetting/groupsetting-remove.mdx +21 -0
  88. package/docs/docs/cmd/entra/groupsetting/groupsetting-set.mdx +21 -0
  89. package/docs/docs/cmd/entra/m365group/m365group-add.mdx +19 -0
  90. package/docs/docs/cmd/entra/m365group/m365group-get.mdx +19 -0
  91. package/docs/docs/cmd/entra/m365group/m365group-list.mdx +19 -0
  92. package/docs/docs/cmd/entra/m365group/m365group-remove.mdx +21 -0
  93. package/docs/docs/cmd/entra/m365group/m365group-renew.mdx +21 -0
  94. package/docs/docs/cmd/entra/m365group/m365group-set.mdx +21 -0
  95. package/docs/docs/cmd/entra/m365group/m365group-teamify.mdx +19 -0
  96. package/docs/docs/cmd/spo/site/site-alert-list.mdx +187 -0
  97. package/eslint-rules/lib/rules/correct-command-class-name.js +18 -2
  98. package/eslint.config.mjs +270 -0
  99. package/npm-shrinkwrap.json +1117 -2277
  100. package/package.json +22 -21
  101. package/.eslintrc.cjs +0 -289
package/dist/Auth.js CHANGED
@@ -122,6 +122,7 @@ export class Auth {
122
122
  this._connection = Object.assign(this._connection, connection);
123
123
  }
124
124
  catch {
125
+ // Do nothing
125
126
  }
126
127
  }
127
128
  async ensureAccessToken(resource, logger, debug = false, fetchNew = false) {
@@ -296,15 +297,17 @@ export class Auth {
296
297
  return new ConfidentialClientApplication(await this.getAuthClientConfiguration(logger, debug, certificateThumbprint, certificatePrivateKey, clientSecret));
297
298
  }
298
299
  retrieveAuthCodeWithBrowser(resource, logger, debug) {
299
- return new Promise(async (resolve, reject) => {
300
+ return new Promise((resolve, reject) => {
300
301
  // _authServer is never set before hitting this line, but this check
301
302
  // is implemented so that we can support lazy loading
302
303
  // but also stub it for testing
303
- /* c8 ignore next 3 */
304
- if (!this._authServer) {
305
- this._authServer = (await import('./AuthServer.js')).default;
306
- }
307
- this._authServer.initializeServer(this.connection, resource, resolve, reject, logger, debug);
304
+ (async () => {
305
+ /* c8 ignore next 3 */
306
+ if (!this._authServer) {
307
+ this._authServer = (await import('./AuthServer.js')).default;
308
+ }
309
+ this._authServer.initializeServer(this.connection, resource, resolve, reject, logger, debug);
310
+ })().catch(reject);
308
311
  });
309
312
  }
310
313
  async ensureAccessTokenWithBrowser(resource, logger, debug) {
@@ -404,7 +407,7 @@ export class Auth {
404
407
  this.connection.thumbprint = await this.calculateThumbprint(pemCert);
405
408
  }
406
409
  }
407
- catch (e) {
410
+ catch {
408
411
  this.connection.certificateType = CertificateType.Binary;
409
412
  }
410
413
  }
package/dist/Command.js CHANGED
@@ -243,7 +243,7 @@ class Command {
243
243
  /* c8 ignore next 4 */
244
244
  if (this.debug && typeof global.it === 'undefined') {
245
245
  const error = new Error();
246
- cli.error(error.stack).then(() => { }).catch(() => { });
246
+ cli.error(error.stack).catch(() => undefined);
247
247
  }
248
248
  if (res.error) {
249
249
  try {
@@ -284,7 +284,7 @@ class Command {
284
284
  /* c8 ignore next 4 */
285
285
  if (this.debug && typeof global.it === 'undefined') {
286
286
  const error = new Error();
287
- cli.error(error.stack).then(() => { }).catch(() => { });
287
+ cli.error(error.stack).catch(() => undefined);
288
288
  }
289
289
  if (response.error &&
290
290
  response.error['odata.error'] &&
@@ -8,7 +8,9 @@ class MsalCachePlugin {
8
8
  const data = await this.fileTokenStorage.get();
9
9
  tokenCacheContext.tokenCache.deserialize(data);
10
10
  }
11
- catch { }
11
+ catch {
12
+ // Do nothing
13
+ }
12
14
  }
13
15
  async afterCacheAccess(tokenCacheContext) {
14
16
  if (!tokenCacheContext.cacheHasChanged) {
@@ -17,7 +19,9 @@ class MsalCachePlugin {
17
19
  try {
18
20
  await this.fileTokenStorage.set(tokenCacheContext.tokenCache.serialize());
19
21
  }
20
- catch { }
22
+ catch {
23
+ // Do nothing
24
+ }
21
25
  }
22
26
  }
23
27
  const msalCachePlugin = new MsalCachePlugin();
@@ -17,7 +17,9 @@ class Autocomplete {
17
17
  const data = fs.readFileSync(Autocomplete.autocompleteFilePath, 'utf-8');
18
18
  this.commands = JSON.parse(data);
19
19
  }
20
- catch { }
20
+ catch {
21
+ // Do nothing
22
+ }
21
23
  }
22
24
  this.omelette = omelette('m365_comp|m365|microsoft365');
23
25
  this.omelette.on('complete', this.handleAutocomplete.bind(this));
@@ -58,7 +60,9 @@ class Autocomplete {
58
60
  replies = Object.keys(replies);
59
61
  }
60
62
  }
61
- catch { }
63
+ catch {
64
+ // Do nothing
65
+ }
62
66
  }
63
67
  if (!replies) {
64
68
  replies = [];
@@ -97,10 +97,11 @@ async function runConversationTurn(conversationId, question) {
97
97
  ];
98
98
  const result = await prompt.forSelection({ message: 'What would you like to do next?', choices });
99
99
  switch (result) {
100
- case 'ask':
100
+ case 'ask': {
101
101
  const prompt = await promptForPrompt();
102
102
  await runConversationTurn(conversationId, prompt);
103
103
  break;
104
+ }
104
105
  case 'end':
105
106
  await endConversation(conversationId);
106
107
  console.log('');
package/dist/cli/cli.js CHANGED
@@ -360,7 +360,7 @@ async function loadOptionsFromContext(commandOptions, debug) {
360
360
  m365rc = JSON.parse(fileContents);
361
361
  }
362
362
  }
363
- catch (e) {
363
+ catch {
364
364
  await cli.closeWithError(`Error parsing ${filePath}`, { options: {} });
365
365
  /* c8 ignore next */
366
366
  }
@@ -403,7 +403,9 @@ async function loadCommandFromFile(commandFileUrl) {
403
403
  cli.commandToExecute = cli.getCommandInfo(command.default, commandFileUrl, commandInfo?.help);
404
404
  }
405
405
  }
406
- catch { }
406
+ catch {
407
+ // Do nothing
408
+ }
407
409
  }
408
410
  function getCommandInfo(command, filePath = '', helpFilePath = '') {
409
411
  const options = command.schema ? zod.schemaToOptionInfo(command.schema) : getCommandOptions(command);
package/dist/config.js CHANGED
@@ -64,7 +64,6 @@ export default {
64
64
  'https://microsoft.sharepoint-df.com/User.ReadWrite.All'
65
65
  ],
66
66
  applicationName: `CLI for Microsoft 365 v${app.packageJson().version}`,
67
- delimiter: 'm365\$',
68
67
  configstoreName: 'cli-m365-config',
69
68
  minimalScopes: [
70
69
  'https://graph.microsoft.com/User.Read'
@@ -38,7 +38,7 @@ class AdaptiveCardSendCommand extends AnonymousCommand {
38
38
  JSON.parse(options.card);
39
39
  return true;
40
40
  }
41
- catch (e) {
41
+ catch {
42
42
  return false;
43
43
  }
44
44
  }
@@ -53,7 +53,7 @@ class AdaptiveCardSendCommand extends AnonymousCommand {
53
53
  JSON.parse(options.cardData);
54
54
  return true;
55
55
  }
56
- catch (e) {
56
+ catch {
57
57
  return false;
58
58
  }
59
59
  }
@@ -60,7 +60,7 @@ class AppPermissionListCommand extends AppCommand {
60
60
  }
61
61
  const permissionsPromises = [];
62
62
  switch (mode) {
63
- case GetServicePrincipal.withPermissions:
63
+ case GetServicePrincipal.withPermissions: {
64
64
  const appRoleAssignmentsRequestOptions = {
65
65
  url: `${this.resource}/v1.0/servicePrincipals/${servicePrincipal.id}/appRoleAssignments`,
66
66
  headers: {
@@ -80,7 +80,8 @@ class AppPermissionListCommand extends AppCommand {
80
80
  request.get(oauth2PermissionGrantsRequestOptions)
81
81
  ]);
82
82
  break;
83
- case GetServicePrincipal.withPermissionDefinitions:
83
+ }
84
+ case GetServicePrincipal.withPermissionDefinitions: {
84
85
  const oauth2PermissionScopesRequestOptions = {
85
86
  url: `${this.resource}/v1.0/servicePrincipals/${servicePrincipal.id}/oauth2PermissionScopes`,
86
87
  headers: {
@@ -100,6 +101,7 @@ class AppPermissionListCommand extends AppCommand {
100
101
  request.get(appRolesRequestOptions)
101
102
  ]);
102
103
  break;
104
+ }
103
105
  }
104
106
  const permissions = await Promise.all(permissionsPromises);
105
107
  switch (mode) {
@@ -1,6 +1,8 @@
1
+ import { globalOptionsZod } from '../../../../Command.js';
1
2
  import { odata } from '../../../../utils/odata.js';
2
3
  import GraphCommand from '../../../base/GraphCommand.js';
3
4
  import commands from '../../commands.js';
5
+ const options = globalOptionsZod.strict();
4
6
  class BookingBusinessListCommand extends GraphCommand {
5
7
  get name() {
6
8
  return commands.BUSINESS_LIST;
@@ -8,6 +10,9 @@ class BookingBusinessListCommand extends GraphCommand {
8
10
  get description() {
9
11
  return 'Lists all Microsoft Bookings businesses that are created for the tenant.';
10
12
  }
13
+ get schema() {
14
+ return options;
15
+ }
11
16
  defaultProperties() {
12
17
  return ['id', 'displayName'];
13
18
  }
@@ -90,7 +90,7 @@ class SetupCommand extends AnonymousCommand {
90
90
  };
91
91
  preferences.entraApp = await cli.promptForSelection(entraAppConfig);
92
92
  switch (preferences.entraApp) {
93
- case EntraAppConfig.Create:
93
+ case EntraAppConfig.Create: {
94
94
  const newEntraAppScopesConfig = {
95
95
  message: 'What scopes should the new app registration have?',
96
96
  choices: [
@@ -100,10 +100,12 @@ class SetupCommand extends AnonymousCommand {
100
100
  };
101
101
  preferences.newEntraAppScopes = await cli.promptForSelection(newEntraAppScopesConfig);
102
102
  break;
103
- case EntraAppConfig.UseExisting:
103
+ }
104
+ case EntraAppConfig.UseExisting: {
104
105
  const existingApp = await this.configureExistingEntraApp(logger);
105
106
  Object.assign(preferences, existingApp);
106
107
  break;
108
+ }
107
109
  }
108
110
  }
109
111
  else {
@@ -318,7 +320,7 @@ class SetupCommand extends AnonymousCommand {
318
320
  }
319
321
  async configureSettings({ preferences, settings, silent, logger }) {
320
322
  switch (preferences.entraApp) {
321
- case EntraAppConfig.Create:
323
+ case EntraAppConfig.Create: {
322
324
  if (this.verbose) {
323
325
  await logger.logToStderr('Creating a new Entra app...');
324
326
  }
@@ -332,6 +334,7 @@ class SetupCommand extends AnonymousCommand {
332
334
  cli.getConfig().delete(settingsNames.clientCertificateBase64Encoded);
333
335
  cli.getConfig().delete(settingsNames.clientCertificatePassword);
334
336
  break;
337
+ }
335
338
  case EntraAppConfig.UseExisting:
336
339
  Object.assign(settings, {
337
340
  clientId: preferences.clientId,
@@ -1,7 +1,8 @@
1
1
  import assert from 'assert';
2
2
  import auth from '../../../Auth.js';
3
- import Command, { CommandError } from '../../../Command.js';
3
+ import Command, { CommandError, globalOptionsZod } from '../../../Command.js';
4
4
  import commands from '../commands.js';
5
+ const options = globalOptionsZod.strict();
5
6
  class ConnectionListCommand extends Command {
6
7
  get name() {
7
8
  return commands.LIST;
@@ -9,6 +10,9 @@ class ConnectionListCommand extends Command {
9
10
  get description() {
10
11
  return 'Show the list of available connections';
11
12
  }
13
+ get schema() {
14
+ return options;
15
+ }
12
16
  defaultProperties() {
13
17
  return ['name', 'connectedAs', 'authType', 'active'];
14
18
  }
@@ -104,7 +104,7 @@ _a = EntraAppRoleAddCommand, _EntraAppRoleAddCommand_instances = new WeakSet(),
104
104
  if (claim.startsWith('.')) {
105
105
  return 'Claim must not begin with .';
106
106
  }
107
- if (!/^[\w:!#$%&'()*+,-.\/:;<=>?@\[\]^+_`{|}~]+$/.test(claim)) {
107
+ if (!/^[\w:!#$%&'()*+,-./:;<=>?@[\]^+_`{|}~]+$/.test(claim)) {
108
108
  return `Claim can contain only the following characters a-z, A-Z, 0-9, :!#$%&'()*+,-./:;<=>?@[]^+_\`{|}~]+`;
109
109
  }
110
110
  return true;
@@ -158,7 +158,7 @@ _EntraGroupAddCommand_instances = new WeakSet(), _EntraGroupAddCommand_initOptio
158
158
  }
159
159
  if (args.options.mailNickname) {
160
160
  if (!validation.isValidMailNickname(args.options.mailNickname)) {
161
- return `Value for option 'mailNickname' must contain only characters in the ASCII character set 0-127 except the following: @ () \ [] " ; : <> , SPACE.`;
161
+ return `Value for option 'mailNickname' must contain only characters in the ASCII character set 0-127 except the following: @ () \\ [] " ; : <> , SPACE.`;
162
162
  }
163
163
  if (args.options.mailNickname.length > 64) {
164
164
  return `The maximum amount of characters for 'mailNickname' is 64.`;
@@ -207,7 +207,7 @@ _EntraGroupSetCommand_instances = new WeakSet(), _EntraGroupSetCommand_initTelem
207
207
  }
208
208
  if (args.options.mailNickname) {
209
209
  if (!validation.isValidMailNickname(args.options.mailNickname)) {
210
- return `Value '${args.options.mailNickname}' for option 'mailNickname' must contain only characters in the ASCII character set 0-127 except the following: @ () \ [] " ; : <> , SPACE.`;
210
+ return `Value '${args.options.mailNickname}' for option 'mailNickname' must contain only characters in the ASCII character set 0-127 except the following: @ () \\ [] " ; : <> , SPACE.`;
211
211
  }
212
212
  if (args.options.mailNickname.length > 64) {
213
213
  return `The maximum amount of characters for 'mailNickname' is 64.`;
@@ -134,7 +134,6 @@ class EntraM365GroupAddCommand extends GraphCommand {
134
134
  const userArr = users.split(',').map(o => o.trim());
135
135
  let promises = [];
136
136
  let userIds = [];
137
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
138
137
  promises = userArr.map(user => {
139
138
  const requestOptions = {
140
139
  url: `${this.resource}/v1.0/users?$filter=userPrincipalName eq '${formatting.encodeQueryParameter(user)}'&$select=id,userPrincipalName`,
@@ -69,12 +69,7 @@ class FileConvertPdfCommand extends GraphCommand {
69
69
  if (this.verbose) {
70
70
  await logger.logToStderr(`Deleting the temporary PDF file at ${localTargetFilePath}...`);
71
71
  }
72
- try {
73
- fs.unlinkSync(localTargetFilePath);
74
- }
75
- catch (e) {
76
- throw e;
77
- }
72
+ fs.unlinkSync(localTargetFilePath);
78
73
  }
79
74
  else {
80
75
  if (this.debug) {
@@ -73,9 +73,12 @@ class FlowExportCommand extends PowerPlatformCommand {
73
73
  // adds suggestedCreationType property to all resources
74
74
  // see https://github.com/pnp/cli-microsoft365/issues/1845
75
75
  Object.keys(res.resources).forEach((key) => {
76
- res.resources[key].type === 'Microsoft.Flow/flows'
77
- ? res.resources[key].suggestedCreationType = 'Update'
78
- : res.resources[key].suggestedCreationType = 'Existing';
76
+ if (res.resources[key].type === 'Microsoft.Flow/flows') {
77
+ res.resources[key].suggestedCreationType = 'Update';
78
+ }
79
+ else {
80
+ res.resources[key].suggestedCreationType = 'Existing';
81
+ }
79
82
  });
80
83
  requestOptions.data = {
81
84
  includedResourceIds: [
@@ -95,10 +98,10 @@ class FlowExportCommand extends PowerPlatformCommand {
95
98
  await logger.logToStderr(`Getting file for Microsoft Flow ${args.options.name}...`);
96
99
  }
97
100
  const downloadFileUrl = formatArgument === 'json' ? '' : res.packageLink.value;
98
- const filenameRegEx = /([^\/]+\.zip)/i;
101
+ const filenameRegEx = /([^/]+\.zip)/i;
99
102
  filenameFromApi = formatArgument === 'json' ? `${res.properties.displayName}.json` : (filenameRegEx.exec(downloadFileUrl) || ['output.zip'])[0];
100
103
  // Replace all illegal characters from the file name
101
- const illegalCharsRegEx = /[\\\/:*?"<>|]/g;
104
+ const illegalCharsRegEx = /[\\/:*?"<>|]/g;
102
105
  filenameFromApi = filenameFromApi.replace(illegalCharsRegEx, '_');
103
106
  if (this.verbose) {
104
107
  await logger.logToStderr(`Filename from PowerApps API: ${filenameFromApi}.`);
@@ -44,7 +44,7 @@ class FlowRunGetCommand extends PowerAutomateCommand {
44
44
  if (args.options.withTrigger && res.properties.trigger.outputsLink) {
45
45
  res.triggerInformation = await this.getTriggerInformation(res);
46
46
  }
47
- if (!!args.options.withActions) {
47
+ if (args.options.withActions) {
48
48
  res.actions = await this.getActionsInformation(res, args.options.withActions);
49
49
  }
50
50
  await logger.log(res);
@@ -64,10 +64,10 @@ class FlowRunGetCommand extends PowerAutomateCommand {
64
64
  continue;
65
65
  }
66
66
  actionsResult[action] = res.properties.actions[action];
67
- if (!!res.properties.actions[action].inputsLink?.uri) {
67
+ if (res.properties.actions[action].inputsLink?.uri) {
68
68
  actionsResult[action].input = await this.requestAdditionalInformation(res.properties.actions[action].inputsLink?.uri);
69
69
  }
70
- if (!!res.properties.actions[action].outputsLink?.uri) {
70
+ if (res.properties.actions[action].outputsLink?.uri) {
71
71
  actionsResult[action].output = await this.requestAdditionalInformation(res.properties.actions[action].outputsLink?.uri);
72
72
  }
73
73
  }
@@ -88,7 +88,7 @@ class GraphSchemaExtensionSetCommand extends GraphCommand {
88
88
  try {
89
89
  properties = JSON.parse(propertiesString);
90
90
  }
91
- catch (e) {
91
+ catch {
92
92
  return 'The specified properties is not a valid JSON string';
93
93
  }
94
94
  // If the properties object is not an array
@@ -1,8 +1,10 @@
1
+ import { globalOptionsZod } from '../../../Command.js';
1
2
  import config from "../../../config.js";
2
3
  import request from "../../../request.js";
3
4
  import { spo } from "../../../utils/spo.js";
4
5
  import SpoCommand from "../../base/SpoCommand.js";
5
6
  import commands from "../commands.js";
7
+ const options = globalOptionsZod.strict();
6
8
  class OneDriveListCommand extends SpoCommand {
7
9
  get name() {
8
10
  return commands.LIST;
@@ -10,6 +12,9 @@ class OneDriveListCommand extends SpoCommand {
10
12
  get description() {
11
13
  return "Retrieves a list of OneDrive sites";
12
14
  }
15
+ get schema() {
16
+ return options;
17
+ }
13
18
  defaultProperties() {
14
19
  return ['Title', 'Url'];
15
20
  }
@@ -1,6 +1,8 @@
1
+ import { globalOptionsZod } from '../../../../Command.js';
1
2
  import { odata } from '../../../../utils/odata.js';
2
3
  import GraphCommand from '../../../base/GraphCommand.js';
3
4
  import commands from '../../commands.js';
5
+ const options = globalOptionsZod.strict();
4
6
  class OutlookRoomListListCommand extends GraphCommand {
5
7
  get name() {
6
8
  return commands.ROOMLIST_LIST;
@@ -8,6 +10,9 @@ class OutlookRoomListListCommand extends GraphCommand {
8
10
  get description() {
9
11
  return 'Get a collection of available roomlists';
10
12
  }
13
+ get schema() {
14
+ return options;
15
+ }
11
16
  defaultProperties() {
12
17
  return ['id', 'displayName', 'phone', 'emailAddress'];
13
18
  }
@@ -35,7 +35,7 @@ class PaAppExportCommand extends PowerPlatformCommand {
35
35
  let filename = args.options.name;
36
36
  if (args.options.packageDisplayName) {
37
37
  //Replace all illegal characters from the file name
38
- const illegalCharsRegEx = /[\\\/:*?"<>|]/g;
38
+ const illegalCharsRegEx = /[\\/:*?"<>|]/g;
39
39
  filename = args.options.packageDisplayName.replace(illegalCharsRegEx, '_');
40
40
  }
41
41
  const requestOptions = {
@@ -57,7 +57,7 @@ class PaAppGetCommand extends PowerAppsCommand {
57
57
  const app = allApps.find((a) => {
58
58
  return a.properties.displayName.toLowerCase() === `${args.options.displayName}`.toLowerCase();
59
59
  });
60
- if (!!app) {
60
+ if (app) {
61
61
  await logger.log(this.setProperties(app));
62
62
  }
63
63
  else {
@@ -1,6 +1,8 @@
1
1
  import request from '../../../../request.js';
2
2
  import PowerAppsCommand from '../../../base/PowerAppsCommand.js';
3
3
  import commands from '../../commands.js';
4
+ import { globalOptionsZod } from '../../../../Command.js';
5
+ const options = globalOptionsZod.strict();
4
6
  class PaEnvironmentListCommand extends PowerAppsCommand {
5
7
  get name() {
6
8
  return commands.ENVIRONMENT_LIST;
@@ -8,6 +10,9 @@ class PaEnvironmentListCommand extends PowerAppsCommand {
8
10
  get description() {
9
11
  return 'Lists Microsoft Power Apps environments in the current tenant';
10
12
  }
13
+ get schema() {
14
+ return options;
15
+ }
11
16
  defaultProperties() {
12
17
  return ['name', 'displayName'];
13
18
  }
@@ -1,6 +1,8 @@
1
+ import { globalOptionsZod } from '../../../../Command.js';
1
2
  import request from '../../../../request.js';
2
3
  import PlannerCommand from '../../../base/PlannerCommand.js';
3
4
  import commands from '../../commands.js';
5
+ const options = globalOptionsZod.strict();
4
6
  class PlannerTenantSettingsListCommand extends PlannerCommand {
5
7
  get name() {
6
8
  return commands.TENANT_SETTINGS_LIST;
@@ -8,6 +10,9 @@ class PlannerTenantSettingsListCommand extends PlannerCommand {
8
10
  get description() {
9
11
  return 'Lists the Microsoft Planner configuration of the tenant';
10
12
  }
13
+ get schema() {
14
+ return options;
15
+ }
11
16
  async commandAction(logger) {
12
17
  const requestOptions = {
13
18
  url: `${this.resource}/taskAPI/tenantAdminSettings/Settings`,
@@ -45,7 +45,7 @@ class PpSolutionPublisherGetCommand extends PowerPlatformCommand {
45
45
  const result = await request.get(requestOptions);
46
46
  return result;
47
47
  }
48
- requestOptions.url = `${dynamicsApiUrl}/api/data/v9.0/publishers?$filter=friendlyname eq \'${args.options.name}\'&$select=publisherid,uniquename,friendlyname,versionnumber,isreadonly,description,customizationprefix,customizationoptionvalueprefix&api-version=9.1`;
48
+ requestOptions.url = `${dynamicsApiUrl}/api/data/v9.0/publishers?$filter=friendlyname eq '${args.options.name}'&$select=publisherid,uniquename,friendlyname,versionnumber,isreadonly,description,customizationprefix,customizationoptionvalueprefix&api-version=9.1`;
49
49
  const result = await request.get(requestOptions);
50
50
  if (result.value.length === 0) {
51
51
  throw `The specified publisher '${args.options.name}' does not exist.`;
@@ -1,6 +1,8 @@
1
+ import { globalOptionsZod } from '../../../../Command.js';
1
2
  import { odata } from '../../../../utils/odata.js';
2
3
  import GraphCommand from '../../../base/GraphCommand.js';
3
4
  import commands from '../../commands.js';
5
+ const options = globalOptionsZod.strict();
4
6
  class PurviewRetentionEventListCommand extends GraphCommand {
5
7
  get name() {
6
8
  return commands.RETENTIONEVENT_LIST;
@@ -8,6 +10,9 @@ class PurviewRetentionEventListCommand extends GraphCommand {
8
10
  get description() {
9
11
  return 'Get a list of retention events';
10
12
  }
13
+ get schema() {
14
+ return options;
15
+ }
11
16
  defaultProperties() {
12
17
  return ['id', 'displayName', 'eventTriggerDateTime'];
13
18
  }
@@ -1,6 +1,8 @@
1
+ import { globalOptionsZod } from '../../../../Command.js';
1
2
  import { odata } from '../../../../utils/odata.js';
2
3
  import GraphCommand from '../../../base/GraphCommand.js';
3
4
  import commands from '../../commands.js';
5
+ const options = globalOptionsZod.strict();
4
6
  class PurviewRetentionEventTypeListCommand extends GraphCommand {
5
7
  get name() {
6
8
  return commands.RETENTIONEVENTTYPE_LIST;
@@ -8,6 +10,9 @@ class PurviewRetentionEventTypeListCommand extends GraphCommand {
8
10
  get description() {
9
11
  return 'Get a list of retention event types';
10
12
  }
13
+ get schema() {
14
+ return options;
15
+ }
11
16
  defaultProperties() {
12
17
  return ['id', 'displayName', 'createdDateTime'];
13
18
  }
@@ -1,6 +1,8 @@
1
+ import { globalOptionsZod } from '../../../../Command.js';
1
2
  import { odata } from '../../../../utils/odata.js';
2
3
  import GraphCommand from '../../../base/GraphCommand.js';
3
4
  import commands from '../../commands.js';
5
+ const options = globalOptionsZod.strict();
4
6
  class PurviewRetentionLabelListCommand extends GraphCommand {
5
7
  get name() {
6
8
  return commands.RETENTIONLABEL_LIST;
@@ -8,6 +10,9 @@ class PurviewRetentionLabelListCommand extends GraphCommand {
8
10
  get description() {
9
11
  return 'Get a list of retention labels';
10
12
  }
13
+ get schema() {
14
+ return options;
15
+ }
11
16
  defaultProperties() {
12
17
  return ['id', 'displayName', 'isInUse'];
13
18
  }
@@ -128,6 +128,7 @@ class SpfxPackageGenerateCommand extends AnonymousCommand {
128
128
  error = err.message;
129
129
  }
130
130
  finally {
131
+ /* eslint-disable no-unsafe-finally */
131
132
  try {
132
133
  if (tmpDir) {
133
134
  if (this.verbose) {
@@ -145,10 +146,11 @@ class SpfxPackageGenerateCommand extends AnonymousCommand {
145
146
  }
146
147
  throw `An error has occurred while removing the temp folder at ${tmpDir}. Please remove it manually.`;
147
148
  }
149
+ /* eslint-enable no-unsafe-finally */
148
150
  }
149
151
  }
150
152
  static replaceTokens(s, tokens) {
151
- return s.replace(/\$([^\$]+)\$/g, (substring, token) => {
153
+ return s.replace(/\$([^$]+)\$/g, (substring, token) => {
152
154
  if (tokens[token]) {
153
155
  return tokens[token];
154
156
  }
@@ -21,7 +21,9 @@ export class BaseProjectCommand extends AnonymousCommand {
21
21
  source: fs.readFileSync(gitignorePath, 'utf-8')
22
22
  };
23
23
  }
24
- catch { }
24
+ catch {
25
+ // Do nothing
26
+ }
25
27
  }
26
28
  const npmignorePath = path.join(projectRootPath, '.npmignore');
27
29
  if (fs.existsSync(npmignorePath)) {
@@ -30,7 +32,9 @@ export class BaseProjectCommand extends AnonymousCommand {
30
32
  source: fs.readFileSync(npmignorePath, 'utf-8')
31
33
  };
32
34
  }
33
- catch { }
35
+ catch {
36
+ // Do nothing
37
+ }
34
38
  }
35
39
  this.readAndParseJsonFile(path.join(projectRootPath, 'config', 'config.json'), project, 'configJson');
36
40
  this.readAndParseJsonFile(path.join(projectRootPath, 'config', 'copy-assets.json'), project, 'copyAssetsJson');
@@ -108,7 +112,9 @@ export class BaseProjectCommand extends AnonymousCommand {
108
112
  }
109
113
  }
110
114
  }
111
- catch { }
115
+ catch {
116
+ // Do nothing
117
+ }
112
118
  }
113
119
  const packageJsonPath = path.resolve(this.projectRootPath, 'package.json');
114
120
  try {
@@ -117,10 +123,12 @@ export class BaseProjectCommand extends AnonymousCommand {
117
123
  packageJson.dependencies &&
118
124
  packageJson.dependencies['@microsoft/sp-core-library']) {
119
125
  const coreLibVersion = packageJson.dependencies['@microsoft/sp-core-library'];
120
- return coreLibVersion.replace(/[^0-9\.]/g, '');
126
+ return coreLibVersion.replace(/[^0-9.]/g, '');
121
127
  }
122
128
  }
123
- catch { }
129
+ catch {
130
+ // Do nothing
131
+ }
124
132
  return undefined;
125
133
  }
126
134
  readAndParseJsonFile(filePath, project, keyPath) {
@@ -54,7 +54,7 @@ export class FN021007_PKG_only_one_rush_stack_compiler_installed extends JsonRul
54
54
  if (!tsConfigExtends) {
55
55
  return;
56
56
  }
57
- const match = /@microsoft\/rush-stack-compiler[^\/]+/.exec(tsConfigExtends);
57
+ const match = /@microsoft\/rush-stack-compiler[^/]+/.exec(tsConfigExtends);
58
58
  if (!match) {
59
59
  return;
60
60
  }