@pnp/cli-microsoft365 7.7.0-beta.72886a7 → 7.7.0-beta.8a32d54

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 (82) hide show
  1. package/.eslintrc.cjs +1 -0
  2. package/allCommands.json +1 -1
  3. package/allCommandsFull.json +1 -1
  4. package/dist/Command.js +1 -1
  5. package/dist/cli/cli.js +2 -1
  6. package/dist/m365/commands/setup.js +1 -7
  7. package/dist/m365/entra/commands/app/app-add.js +7 -1
  8. package/dist/m365/entra/commands/app/app-set.js +32 -3
  9. package/dist/m365/entra/commands/pim/pim-role-assignment-add.js +233 -0
  10. package/dist/m365/entra/commands/pim/pim-role-assignment-list.js +122 -0
  11. package/dist/m365/entra/commands.js +2 -0
  12. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.0.0.js +3 -1
  13. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.0.1.js +3 -1
  14. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.0.2.js +3 -1
  15. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.1.0.js +3 -1
  16. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.1.1.js +3 -1
  17. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.1.3.js +3 -1
  18. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.10.0.js +3 -1
  19. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.11.0.js +3 -1
  20. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.12.0.js +3 -1
  21. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.12.1.js +3 -1
  22. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.13.0.js +3 -1
  23. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.13.1.js +3 -1
  24. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.14.0.js +3 -1
  25. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.15.0.js +3 -1
  26. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.15.2.js +3 -1
  27. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.16.0.js +3 -1
  28. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.16.1.js +3 -1
  29. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.17.0.js +3 -1
  30. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.17.1.js +3 -1
  31. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.17.2.js +3 -1
  32. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.17.3.js +3 -1
  33. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.17.4.js +3 -1
  34. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.18.0.js +3 -1
  35. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.18.1.js +3 -1
  36. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.18.2.js +3 -1
  37. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.19.0-beta.0.js +25 -0
  38. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.2.0.js +3 -1
  39. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.3.0.js +3 -1
  40. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.3.1.js +3 -1
  41. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.3.2.js +3 -1
  42. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.3.4.js +3 -1
  43. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.4.0.js +3 -1
  44. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.4.1.js +3 -1
  45. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.5.0.js +3 -1
  46. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.5.1.js +3 -1
  47. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.6.0.js +3 -1
  48. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.7.0.js +3 -1
  49. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.7.1.js +3 -1
  50. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.8.0.js +3 -1
  51. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.8.1.js +3 -1
  52. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.8.2.js +3 -1
  53. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.9.1.js +3 -1
  54. package/dist/m365/spfx/commands/project/project-doctor/generic-rules.js +0 -2
  55. package/dist/m365/spfx/commands/project/project-doctor/rules/FN021001_PKG_spfx_deps_versions_match_project_version.js +3 -2
  56. package/dist/m365/spfx/commands/project/project-doctor/rules/FN021013_PKG_spfx_devdeps_match_version.js +58 -0
  57. package/dist/m365/spfx/commands/project/project-doctor/spfx-deps.js +2 -0
  58. package/dist/m365/spfx/commands/project/project-doctor.js +2 -1
  59. package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.19.0-beta.0.js +53 -0
  60. package/dist/m365/spfx/commands/project/project-upgrade.js +16 -13
  61. package/dist/m365/spfx/commands/spfx-doctor.js +15 -0
  62. package/dist/m365/spo/commands/contenttype/contenttype-sync.js +139 -0
  63. package/dist/m365/spo/commands/listitem/listitem-set.js +9 -156
  64. package/dist/m365/spo/commands/page/page-add.js +6 -24
  65. package/dist/m365/spo/commands/page/page-set.js +19 -43
  66. package/dist/m365/spo/commands/site/site-apppermission-remove.js +8 -9
  67. package/dist/m365/spo/commands/site/site-hubsite-connect.js +3 -3
  68. package/dist/m365/spo/commands/site/site-hubsite-disconnect.js +2 -5
  69. package/dist/m365/spo/commands.js +1 -0
  70. package/dist/utils/prompt.js +2 -0
  71. package/dist/utils/spo.js +188 -0
  72. package/dist/utils/validation.js +4 -0
  73. package/docs/docs/cmd/entra/app/app-add.mdx +9 -0
  74. package/docs/docs/cmd/entra/app/app-set.mdx +9 -0
  75. package/docs/docs/cmd/entra/pim/pim-role-assignment-add.mdx +230 -0
  76. package/docs/docs/cmd/entra/pim/pim-role-assignment-list.mdx +224 -0
  77. package/docs/docs/cmd/spfx/project/project-upgrade.mdx +1 -1
  78. package/docs/docs/cmd/spo/contenttype/contenttype-sync.mdx +144 -0
  79. package/docs/docs/cmd/spo/page/page-set.mdx +1 -1
  80. package/docs/docs/cmd/spo/site/site-apppermission-add.mdx +1 -1
  81. package/npm-shrinkwrap.json +138 -214
  82. package/package.json +14 -14
package/dist/Command.js CHANGED
@@ -545,7 +545,7 @@ _Command_instances = new WeakSet(), _Command_initTelemetry = function _Command_i
545
545
  autocomplete: this.allowedOutputs
546
546
  }, { option: '--verbose' }, { option: '--debug' });
547
547
  }, _Command_initValidators = function _Command_initValidators() {
548
- this.validators.push((args, command) => this.validateUnknownOptions(args, command), (args, command) => this.validateRequiredOptions(args, command), args => this.validateOutput(args), (args, command) => this.validateOptionSets(args, command));
548
+ this.validators.push(args => this.validateOutput(args), (args, command) => this.validateUnknownOptions(args, command), (args, command) => this.validateRequiredOptions(args, command), (args, command) => this.validateOptionSets(args, command));
549
549
  };
550
550
  export default Command;
551
551
  //# sourceMappingURL=Command.js.map
package/dist/cli/cli.js CHANGED
@@ -875,7 +875,8 @@ export const cli = {
875
875
  const spinnerOptions = {
876
876
  text: 'Running command...',
877
877
  /* c8 ignore next 1 */
878
- stream: cli.getSettingWithDefaultValue('errorOutput', 'stderr') === 'stderr' ? process.stderr : process.stdout
878
+ stream: cli.getSettingWithDefaultValue('errorOutput', 'stderr') === 'stderr' ? process.stderr : process.stdout,
879
+ discardStdin: false
879
880
  };
880
881
  cli.spinner = ora(spinnerOptions);
881
882
  //# sourceMappingURL=cli.js.map
@@ -73,13 +73,7 @@ class SetupCommand extends AnonymousCommand {
73
73
  };
74
74
  preferences.experience = await cli.promptForSelection(experienceConfig);
75
75
  const summaryConfig = {
76
- // invoked by inquirer
77
- /* c8 ignore next 6 */
78
- message: async () => {
79
- settings = this.getSettings(preferences);
80
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
81
- return this.getSummaryMessage(settings);
82
- }
76
+ message: this.getSummaryMessage(this.getSettings(preferences))
83
77
  };
84
78
  preferences.summary = await cli.promptForConfirmation(summaryConfig);
85
79
  if (preferences.summary) {
@@ -98,6 +98,9 @@ class EntraAppAddCommand extends GraphCommand {
98
98
  };
99
99
  applicationInfo.keyCredentials = [newKeyCredential];
100
100
  }
101
+ if (args.options.allowPublicClientFlows) {
102
+ applicationInfo.isFallbackPublicClient = true;
103
+ }
101
104
  if (this.verbose) {
102
105
  await logger.logToStderr(`Creating Microsoft Entra app registration...`);
103
106
  }
@@ -657,7 +660,8 @@ _a = EntraAppAddCommand, _EntraAppAddCommand_instances = new WeakSet(), _EntraAp
657
660
  certificateFile: typeof args.options.certificateFile !== 'undefined',
658
661
  certificateBase64Encoded: typeof args.options.certificateBase64Encoded !== 'undefined',
659
662
  certificateDisplayName: typeof args.options.certificateDisplayName !== 'undefined',
660
- grantAdminConsent: typeof args.options.grantAdminConsent !== 'undefined'
663
+ grantAdminConsent: typeof args.options.grantAdminConsent !== 'undefined',
664
+ allowPublicClientFlows: typeof args.options.allowPublicClientFlows !== 'undefined'
661
665
  });
662
666
  });
663
667
  }, _EntraAppAddCommand_initOptions = function _EntraAppAddCommand_initOptions() {
@@ -701,6 +705,8 @@ _a = EntraAppAddCommand, _EntraAppAddCommand_instances = new WeakSet(), _EntraAp
701
705
  option: '--save'
702
706
  }, {
703
707
  option: '--grantAdminConsent'
708
+ }, {
709
+ option: '--allowPublicClientFlows'
704
710
  });
705
711
  }, _EntraAppAddCommand_initValidators = function _EntraAppAddCommand_initValidators() {
706
712
  this.validators.push(async (args) => {
@@ -3,7 +3,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
3
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
4
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
5
  };
6
- var _EntraAppSetCommand_instances, _a, _EntraAppSetCommand_initTelemetry, _EntraAppSetCommand_initOptions, _EntraAppSetCommand_initValidators, _EntraAppSetCommand_initOptionSets;
6
+ var _EntraAppSetCommand_instances, _a, _EntraAppSetCommand_initTelemetry, _EntraAppSetCommand_initOptions, _EntraAppSetCommand_initValidators, _EntraAppSetCommand_initOptionSets, _EntraAppSetCommand_initTypes;
7
7
  import fs from 'fs';
8
8
  import request from '../../../../request.js';
9
9
  import { formatting } from '../../../../utils/formatting.js';
@@ -28,6 +28,7 @@ class EntraAppSetCommand extends GraphCommand {
28
28
  __classPrivateFieldGet(this, _EntraAppSetCommand_instances, "m", _EntraAppSetCommand_initOptions).call(this);
29
29
  __classPrivateFieldGet(this, _EntraAppSetCommand_instances, "m", _EntraAppSetCommand_initValidators).call(this);
30
30
  __classPrivateFieldGet(this, _EntraAppSetCommand_instances, "m", _EntraAppSetCommand_initOptionSets).call(this);
31
+ __classPrivateFieldGet(this, _EntraAppSetCommand_instances, "m", _EntraAppSetCommand_initTypes).call(this);
31
32
  }
32
33
  async commandAction(logger, args) {
33
34
  await this.showDeprecationWarning(logger, aadCommands.APP_SET, commands.APP_SET);
@@ -35,6 +36,7 @@ class EntraAppSetCommand extends GraphCommand {
35
36
  let objectId = await this.getAppObjectId(args, logger);
36
37
  objectId = await this.configureUri(args, objectId, logger);
37
38
  objectId = await this.configureRedirectUris(args, objectId, logger);
39
+ objectId = await this.updateAllowPublicClientFlows(args, objectId, logger);
38
40
  await this.configureCertificate(args, objectId, logger);
39
41
  }
40
42
  catch (err) {
@@ -71,6 +73,27 @@ class EntraAppSetCommand extends GraphCommand {
71
73
  const result = await cli.handleMultipleResultsFound(`Multiple Microsoft Entra application registration with name '${name}' found.`, resultAsKeyValuePair);
72
74
  return result.id;
73
75
  }
76
+ async updateAllowPublicClientFlows(args, objectId, logger) {
77
+ if (args.options.allowPublicClientFlows === undefined) {
78
+ return objectId;
79
+ }
80
+ if (this.verbose) {
81
+ await logger.logToStderr(`Configuring Entra application AllowPublicClientFlows option...`);
82
+ }
83
+ const applicationInfo = {
84
+ isFallbackPublicClient: args.options.allowPublicClientFlows
85
+ };
86
+ const requestOptions = {
87
+ url: `${this.resource}/v1.0/myorganization/applications/${objectId}`,
88
+ headers: {
89
+ 'content-type': 'application/json;odata.metadata=none'
90
+ },
91
+ responseType: 'json',
92
+ data: applicationInfo
93
+ };
94
+ await request.patch(requestOptions);
95
+ return objectId;
96
+ }
74
97
  async configureUri(args, objectId, logger) {
75
98
  if (!args.options.uris) {
76
99
  return objectId;
@@ -249,14 +272,18 @@ _a = EntraAppSetCommand, _EntraAppSetCommand_instances = new WeakSet(), _EntraAp
249
272
  uris: typeof args.options.uris !== 'undefined',
250
273
  certificateFile: typeof args.options.certificateFile !== 'undefined',
251
274
  certificateBase64Encoded: typeof args.options.certificateBase64Encoded !== 'undefined',
252
- certificateDisplayName: typeof args.options.certificateDisplayName !== 'undefined'
275
+ certificateDisplayName: typeof args.options.certificateDisplayName !== 'undefined',
276
+ allowPublicClientFlows: typeof args.options.allowPublicClientFlows !== 'undefined'
253
277
  });
254
278
  });
255
279
  }, _EntraAppSetCommand_initOptions = function _EntraAppSetCommand_initOptions() {
256
280
  this.options.unshift({ option: '--appId [appId]' }, { option: '--objectId [objectId]' }, { option: '-n, --name [name]' }, { option: '-u, --uris [uris]' }, { option: '-r, --redirectUris [redirectUris]' }, { option: '--certificateFile [certificateFile]' }, { option: '--certificateBase64Encoded [certificateBase64Encoded]' }, { option: '--certificateDisplayName [certificateDisplayName]' }, {
257
281
  option: '--platform [platform]',
258
282
  autocomplete: _a.aadApplicationPlatform
259
- }, { option: '--redirectUrisToRemove [redirectUrisToRemove]' });
283
+ }, { option: '--redirectUrisToRemove [redirectUrisToRemove]' }, {
284
+ option: '--allowPublicClientFlows [allowPublicClientFlows]',
285
+ autocomplete: ['true', 'false']
286
+ });
260
287
  }, _EntraAppSetCommand_initValidators = function _EntraAppSetCommand_initValidators() {
261
288
  this.validators.push(async (args) => {
262
289
  if (args.options.certificateFile && args.options.certificateBase64Encoded) {
@@ -279,6 +306,8 @@ _a = EntraAppSetCommand, _EntraAppSetCommand_instances = new WeakSet(), _EntraAp
279
306
  });
280
307
  }, _EntraAppSetCommand_initOptionSets = function _EntraAppSetCommand_initOptionSets() {
281
308
  this.optionSets.push({ options: ['appId', 'objectId', 'name'] });
309
+ }, _EntraAppSetCommand_initTypes = function _EntraAppSetCommand_initTypes() {
310
+ this.types.boolean.push('allowPublicClientFlows');
282
311
  };
283
312
  EntraAppSetCommand.aadApplicationPlatform = ['spa', 'web', 'publicClient'];
284
313
  export default new EntraAppSetCommand();
@@ -0,0 +1,233 @@
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 _EntraPimRoleAssignmentAddCommand_instances, _EntraPimRoleAssignmentAddCommand_initTelemetry, _EntraPimRoleAssignmentAddCommand_initOptions, _EntraPimRoleAssignmentAddCommand_initValidators, _EntraPimRoleAssignmentAddCommand_initOptionSets;
7
+ import request from '../../../../request.js';
8
+ import GraphCommand from '../../../base/GraphCommand.js';
9
+ import commands from '../../commands.js';
10
+ import { roleDefinition } from '../../../../utils/roleDefinition.js';
11
+ import { validation } from '../../../../utils/validation.js';
12
+ import { entraUser } from '../../../../utils/entraUser.js';
13
+ import { entraGroup } from '../../../../utils/entraGroup.js';
14
+ import { accessToken } from '../../../../utils/accessToken.js';
15
+ import auth from '../../../../Auth.js';
16
+ class EntraPimRoleAssignmentAddCommand extends GraphCommand {
17
+ get name() {
18
+ return commands.PIM_ROLE_ASSIGNMENT_ADD;
19
+ }
20
+ get description() {
21
+ return 'Request activation of an Entra role assignment for a user or group';
22
+ }
23
+ constructor() {
24
+ super();
25
+ _EntraPimRoleAssignmentAddCommand_instances.add(this);
26
+ __classPrivateFieldGet(this, _EntraPimRoleAssignmentAddCommand_instances, "m", _EntraPimRoleAssignmentAddCommand_initTelemetry).call(this);
27
+ __classPrivateFieldGet(this, _EntraPimRoleAssignmentAddCommand_instances, "m", _EntraPimRoleAssignmentAddCommand_initOptions).call(this);
28
+ __classPrivateFieldGet(this, _EntraPimRoleAssignmentAddCommand_instances, "m", _EntraPimRoleAssignmentAddCommand_initValidators).call(this);
29
+ __classPrivateFieldGet(this, _EntraPimRoleAssignmentAddCommand_instances, "m", _EntraPimRoleAssignmentAddCommand_initOptionSets).call(this);
30
+ }
31
+ async commandAction(logger, args) {
32
+ const { userId, userName, groupId, groupName, startDateTime, endDateTime, ticketNumber, ticketSystem } = args.options;
33
+ try {
34
+ const token = auth.connection.accessTokens[auth.defaultResource].accessToken;
35
+ const isAppOnlyAccessToken = accessToken.isAppOnlyAccessToken(token);
36
+ if (isAppOnlyAccessToken) {
37
+ throw 'When running with application permissions either userId, userName, groupId or groupName is required';
38
+ }
39
+ const roleDefinitionId = await this.getRoleDefinitionId(args.options, logger);
40
+ const principalId = await this.getPrincipalId(args.options, logger);
41
+ const requestOptions = {
42
+ url: `${this.resource}/v1.0/roleManagement/directory/roleAssignmentScheduleRequests`,
43
+ headers: {
44
+ 'accept': 'application/json;odata.metadata=none'
45
+ },
46
+ responseType: 'json',
47
+ data: {
48
+ principalId: principalId,
49
+ roleDefinitionId: roleDefinitionId,
50
+ directoryScopeId: this.getDirectoryScope(args.options),
51
+ action: !userId && !userName && !groupId && !groupName ? 'selfActivate' : 'adminAssign',
52
+ justification: args.options.justification,
53
+ scheduleInfo: {
54
+ startDateTime: startDateTime,
55
+ expiration: {
56
+ duration: this.getDuration(args.options),
57
+ endDateTime: endDateTime,
58
+ type: this.getExpirationType(args.options)
59
+ }
60
+ },
61
+ ticketInfo: {
62
+ ticketNumber: ticketNumber,
63
+ ticketSystem: ticketSystem
64
+ }
65
+ }
66
+ };
67
+ const response = await request.post(requestOptions);
68
+ await logger.log(response);
69
+ }
70
+ catch (err) {
71
+ this.handleRejectedODataJsonPromise(err);
72
+ }
73
+ }
74
+ async getRoleDefinitionId(options, logger) {
75
+ if (options.roleDefinitionId) {
76
+ return options.roleDefinitionId;
77
+ }
78
+ if (this.verbose) {
79
+ await logger.logToStderr(`Retrieving role definition by its name '${options.roleDefinitionName}'`);
80
+ }
81
+ const role = await roleDefinition.getRoleDefinitionByDisplayName(options.roleDefinitionName);
82
+ return role.id;
83
+ }
84
+ async getPrincipalId(options, logger) {
85
+ if (options.userId || options.groupId) {
86
+ return options.userId || options.groupId;
87
+ }
88
+ if (options.userName) {
89
+ if (this.verbose) {
90
+ await logger.logToStderr(`Retrieving user by its name '${options.userName}'`);
91
+ }
92
+ return await entraUser.getUserIdByUpn(options.userName);
93
+ }
94
+ else if (options.groupName) {
95
+ if (this.verbose) {
96
+ await logger.logToStderr(`Retrieving group by its name '${options.groupName}'`);
97
+ }
98
+ return await entraGroup.getGroupIdByDisplayName(options.groupName);
99
+ }
100
+ if (this.verbose) {
101
+ await logger.logToStderr(`Retrieving id of the current user`);
102
+ }
103
+ const token = auth.connection.accessTokens[auth.defaultResource].accessToken;
104
+ return accessToken.getUserIdFromAccessToken(token);
105
+ }
106
+ getExpirationType(options) {
107
+ if (options.endDateTime) {
108
+ return 'afterDateTime';
109
+ }
110
+ if (options.noExpiration) {
111
+ return 'noExpiration';
112
+ }
113
+ return 'afterDuration';
114
+ }
115
+ getDuration(options) {
116
+ if (!options.duration && !options.endDateTime && !options.noExpiration) {
117
+ return 'PT8H';
118
+ }
119
+ return options.duration;
120
+ }
121
+ getDirectoryScope(options) {
122
+ if (options.administrativeUnitId) {
123
+ return `/administrativeUnits/${options.administrativeUnitId}`;
124
+ }
125
+ if (options.applicationId) {
126
+ return `/${options.applicationId}`;
127
+ }
128
+ return '/';
129
+ }
130
+ }
131
+ _EntraPimRoleAssignmentAddCommand_instances = new WeakSet(), _EntraPimRoleAssignmentAddCommand_initTelemetry = function _EntraPimRoleAssignmentAddCommand_initTelemetry() {
132
+ this.telemetry.push((args) => {
133
+ Object.assign(this.telemetryProperties, {
134
+ roleDefinitionName: typeof args.options.roleDefinitionName !== 'undefined',
135
+ roleDefinitionId: typeof args.options.roleDefinitionId !== 'undefined',
136
+ userId: typeof args.options.userId !== 'undefined',
137
+ userName: typeof args.options.userName !== 'undefined',
138
+ groupId: typeof args.options.groupId !== 'undefined',
139
+ groupName: typeof args.options.groupName !== 'undefined',
140
+ administrativeUnitId: typeof args.options.administrativeUnitId !== 'undefined',
141
+ applicationId: typeof args.options.applicationId !== 'undefined',
142
+ justification: typeof args.options.justification !== 'undefined',
143
+ startDateTime: typeof args.options.startDateTime !== 'undefined',
144
+ endDateTime: typeof args.options.endDateTime !== 'undefined',
145
+ duration: typeof args.options.duration !== 'undefined',
146
+ ticketNumber: typeof args.options.ticketNumber !== 'undefined',
147
+ ticketSystem: typeof args.options.ticketSystem !== 'undefined',
148
+ noExpiration: !!args.options.noExpiration
149
+ });
150
+ });
151
+ }, _EntraPimRoleAssignmentAddCommand_initOptions = function _EntraPimRoleAssignmentAddCommand_initOptions() {
152
+ this.options.unshift({
153
+ option: '-n, --roleDefinitionName [roleDefinitionName]'
154
+ }, {
155
+ option: '-i, --roleDefinitionId [roleDefinitionId]'
156
+ }, {
157
+ option: "--userId [userId]"
158
+ }, {
159
+ option: "--userName [userName]"
160
+ }, {
161
+ option: "--groupId [groupId]"
162
+ }, {
163
+ option: "--groupName [groupName]"
164
+ }, {
165
+ option: "--administrativeUnitId [administrativeUnitId]"
166
+ }, {
167
+ option: "--applicationId [applicationId]"
168
+ }, {
169
+ option: "-j, --justification [justification]"
170
+ }, {
171
+ option: "-s, --startDateTime [startDateTime]"
172
+ }, {
173
+ option: "-e, --endDateTime [endDateTime]"
174
+ }, {
175
+ option: "-d, --duration [duration]"
176
+ }, {
177
+ option: "--ticketNumber [ticketNumber]"
178
+ }, {
179
+ option: "--ticketSystem [ticketSystem]"
180
+ }, {
181
+ option: "--no-expiration"
182
+ });
183
+ }, _EntraPimRoleAssignmentAddCommand_initValidators = function _EntraPimRoleAssignmentAddCommand_initValidators() {
184
+ this.validators.push(async (args) => {
185
+ if (args.options.roleDefinitionId && !validation.isValidGuid(args.options.roleDefinitionId)) {
186
+ return `${args.options.roleDefinitionId} is not a valid GUID`;
187
+ }
188
+ if (args.options.userId && !validation.isValidGuid(args.options.userId)) {
189
+ return `${args.options.userId} is not a valid GUID`;
190
+ }
191
+ if (args.options.groupId && !validation.isValidGuid(args.options.groupId)) {
192
+ return `${args.options.groupId} is not a valid GUID`;
193
+ }
194
+ if (args.options.startDateTime && !validation.isValidISODateTime(args.options.startDateTime)) {
195
+ return `${args.options.startDateTime} is not a valid ISO 8601 date time string`;
196
+ }
197
+ if (args.options.endDateTime && !validation.isValidISODateTime(args.options.endDateTime)) {
198
+ return `${args.options.endDateTime} is not a valid ISO 8601 date time string`;
199
+ }
200
+ if (args.options.duration && !validation.isValidISODuration(args.options.duration)) {
201
+ return `${args.options.duration} is not a valid ISO 8601 duration`;
202
+ }
203
+ if (args.options.administrativeUnitId && !validation.isValidGuid(args.options.administrativeUnitId)) {
204
+ return `${args.options.administrativeUnitId} is not a valid GUID`;
205
+ }
206
+ if (args.options.applicationId && !validation.isValidGuid(args.options.applicationId)) {
207
+ return `${args.options.applicationId} is not a valid GUID`;
208
+ }
209
+ return true;
210
+ });
211
+ }, _EntraPimRoleAssignmentAddCommand_initOptionSets = function _EntraPimRoleAssignmentAddCommand_initOptionSets() {
212
+ this.optionSets.push({ options: ['roleDefinitionName', 'roleDefinitionId'] });
213
+ this.optionSets.push({
214
+ options: ['noExpiration', 'endDateTime', 'duration'],
215
+ runsWhen: (args) => {
216
+ return !!args.options.noExpiration || args.options.endDateTime !== undefined || args.options.duration !== undefined;
217
+ }
218
+ });
219
+ this.optionSets.push({
220
+ options: ['userId', 'userName', 'groupId', 'groupName'],
221
+ runsWhen: (args) => {
222
+ return args.options.userId !== undefined || args.options.userName !== undefined || args.options.groupId !== undefined || args.options.groupName !== undefined;
223
+ }
224
+ });
225
+ this.optionSets.push({
226
+ options: ['administrativeUnitId', 'applicationId'],
227
+ runsWhen: (args) => {
228
+ return args.options.administrativeUnitId !== undefined || args.options.applicationId !== undefined;
229
+ }
230
+ });
231
+ };
232
+ export default new EntraPimRoleAssignmentAddCommand();
233
+ //# sourceMappingURL=pim-role-assignment-add.js.map
@@ -0,0 +1,122 @@
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 _EntraPimRoleAssignmentListCommand_instances, _EntraPimRoleAssignmentListCommand_initTelemetry, _EntraPimRoleAssignmentListCommand_initOptions, _EntraPimRoleAssignmentListCommand_initValidators, _EntraPimRoleAssignmentListCommand_initOptionSets;
7
+ import GraphCommand from '../../../base/GraphCommand.js';
8
+ import commands from '../../commands.js';
9
+ import { validation } from '../../../../utils/validation.js';
10
+ import { entraUser } from '../../../../utils/entraUser.js';
11
+ import { entraGroup } from '../../../../utils/entraGroup.js';
12
+ import { odata } from '../../../../utils/odata.js';
13
+ class EntraPimRoleAssignmentListCommand extends GraphCommand {
14
+ get name() {
15
+ return commands.PIM_ROLE_ASSIGNMENT_LIST;
16
+ }
17
+ get description() {
18
+ return 'Retrieves a list of Entra role assignments for a user or group';
19
+ }
20
+ constructor() {
21
+ super();
22
+ _EntraPimRoleAssignmentListCommand_instances.add(this);
23
+ __classPrivateFieldGet(this, _EntraPimRoleAssignmentListCommand_instances, "m", _EntraPimRoleAssignmentListCommand_initTelemetry).call(this);
24
+ __classPrivateFieldGet(this, _EntraPimRoleAssignmentListCommand_instances, "m", _EntraPimRoleAssignmentListCommand_initOptions).call(this);
25
+ __classPrivateFieldGet(this, _EntraPimRoleAssignmentListCommand_instances, "m", _EntraPimRoleAssignmentListCommand_initValidators).call(this);
26
+ __classPrivateFieldGet(this, _EntraPimRoleAssignmentListCommand_instances, "m", _EntraPimRoleAssignmentListCommand_initOptionSets).call(this);
27
+ }
28
+ async commandAction(logger, args) {
29
+ const queryParameters = [];
30
+ const filters = [];
31
+ const expands = [];
32
+ try {
33
+ const principalId = await this.getPrincipalId(logger, args.options);
34
+ if (principalId) {
35
+ filters.push(`principalId eq '${principalId}'`);
36
+ }
37
+ if (args.options.startDateTime) {
38
+ filters.push(`startDateTime ge ${args.options.startDateTime}`);
39
+ }
40
+ if (filters.length > 0) {
41
+ queryParameters.push(`$filter=${filters.join(' and ')}`);
42
+ }
43
+ expands.push('roleDefinition($select=displayName)');
44
+ if (args.options.includePrincipalDetails) {
45
+ expands.push('principal');
46
+ }
47
+ queryParameters.push(`$expand=${expands.join(',')}`);
48
+ const queryString = `?${queryParameters.join('&')}`;
49
+ const url = `${this.resource}/v1.0/roleManagement/directory/roleAssignmentScheduleInstances${queryString}`;
50
+ const results = await odata.getAllItems(url);
51
+ await logger.log(results);
52
+ }
53
+ catch (err) {
54
+ this.handleRejectedODataJsonPromise(err);
55
+ }
56
+ }
57
+ async getPrincipalId(logger, options) {
58
+ let principalId = options.userId;
59
+ if (options.userName) {
60
+ if (this.verbose) {
61
+ await logger.logToStderr(`Retrieving user by its name '${options.userName}'`);
62
+ }
63
+ principalId = await entraUser.getUserIdByUpn(options.userName);
64
+ }
65
+ else if (options.groupId) {
66
+ principalId = options.groupId;
67
+ }
68
+ else if (options.groupName) {
69
+ if (this.verbose) {
70
+ await logger.logToStderr(`Retrieving group by its name '${options.groupName}'`);
71
+ }
72
+ principalId = await entraGroup.getGroupIdByDisplayName(options.groupName);
73
+ }
74
+ return principalId;
75
+ }
76
+ }
77
+ _EntraPimRoleAssignmentListCommand_instances = new WeakSet(), _EntraPimRoleAssignmentListCommand_initTelemetry = function _EntraPimRoleAssignmentListCommand_initTelemetry() {
78
+ this.telemetry.push((args) => {
79
+ Object.assign(this.telemetryProperties, {
80
+ userId: typeof args.options.userId !== 'undefined',
81
+ userName: typeof args.options.userName !== 'undefined',
82
+ groupId: typeof args.options.groupId !== 'undefined',
83
+ groupName: typeof args.options.groupName !== 'undefined',
84
+ startDateTime: typeof args.options.startDateTime !== 'undefined',
85
+ includePrincipalDetails: !!args.options.includePrincipalDetails
86
+ });
87
+ });
88
+ }, _EntraPimRoleAssignmentListCommand_initOptions = function _EntraPimRoleAssignmentListCommand_initOptions() {
89
+ this.options.unshift({
90
+ option: "--userId [userId]"
91
+ }, {
92
+ option: "--userName [userName]"
93
+ }, {
94
+ option: "--groupId [groupId]"
95
+ }, {
96
+ option: "--groupName [groupName]"
97
+ }, {
98
+ option: "-s, --startDateTime [startDateTime]"
99
+ }, {
100
+ option: "--includePrincipalDetails [includePrincipalDetails]"
101
+ });
102
+ }, _EntraPimRoleAssignmentListCommand_initValidators = function _EntraPimRoleAssignmentListCommand_initValidators() {
103
+ this.validators.push(async (args) => {
104
+ if (args.options.userId && !validation.isValidGuid(args.options.userId)) {
105
+ return `${args.options.userId} is not a valid GUID`;
106
+ }
107
+ if (args.options.groupId && !validation.isValidGuid(args.options.groupId)) {
108
+ return `${args.options.groupId} is not a valid GUID`;
109
+ }
110
+ if (args.options.startDateTime && !validation.isValidISODateTime(args.options.startDateTime)) {
111
+ return `${args.options.startDateTime} is not a valid ISO 8601 date time string`;
112
+ }
113
+ return true;
114
+ });
115
+ }, _EntraPimRoleAssignmentListCommand_initOptionSets = function _EntraPimRoleAssignmentListCommand_initOptionSets() {
116
+ this.optionSets.push({
117
+ options: ['userId', 'userName', 'groupId', 'groupName'],
118
+ runsWhen: (args) => args.options.userId || args.options.userName || args.options.groupId || args.options.groupName
119
+ });
120
+ };
121
+ export default new EntraPimRoleAssignmentListCommand();
122
+ //# sourceMappingURL=pim-role-assignment-list.js.map
@@ -74,6 +74,8 @@ export default {
74
74
  OAUTH2GRANT_LIST: `${prefix} oauth2grant list`,
75
75
  OAUTH2GRANT_REMOVE: `${prefix} oauth2grant remove`,
76
76
  OAUTH2GRANT_SET: `${prefix} oauth2grant set`,
77
+ PIM_ROLE_ASSIGNMENT_ADD: `${prefix} pim role assignment add`,
78
+ PIM_ROLE_ASSIGNMENT_LIST: `${prefix} pim role assignment list`,
77
79
  POLICY_LIST: `${prefix} policy list`,
78
80
  SITECLASSIFICATION_DISABLE: `${prefix} siteclassification disable`,
79
81
  SITECLASSIFICATION_ENABLE: `${prefix} siteclassification enable`,
@@ -1,7 +1,9 @@
1
1
  import { FN002004_DEVDEP_gulp } from './rules/FN002004_DEVDEP_gulp.js';
2
2
  import { FN002013_DEVDEP_types_webpack_env } from './rules/FN002013_DEVDEP_types_webpack_env.js';
3
+ import { FN021001_PKG_spfx_deps_versions_match_project_version } from './rules/FN021001_PKG_spfx_deps_versions_match_project_version.js';
3
4
  export default [
4
5
  new FN002004_DEVDEP_gulp('~3.9.1'),
5
- new FN002013_DEVDEP_types_webpack_env('>=1.12.1 <1.14.0')
6
+ new FN002013_DEVDEP_types_webpack_env('>=1.12.1 <1.14.0'),
7
+ new FN021001_PKG_spfx_deps_versions_match_project_version()
6
8
  ];
7
9
  //# sourceMappingURL=doctor-1.0.0.js.map
@@ -1,7 +1,9 @@
1
1
  import { FN002004_DEVDEP_gulp } from './rules/FN002004_DEVDEP_gulp.js';
2
2
  import { FN002013_DEVDEP_types_webpack_env } from './rules/FN002013_DEVDEP_types_webpack_env.js';
3
+ import { FN021001_PKG_spfx_deps_versions_match_project_version } from './rules/FN021001_PKG_spfx_deps_versions_match_project_version.js';
3
4
  export default [
4
5
  new FN002004_DEVDEP_gulp('~3.9.1'),
5
- new FN002013_DEVDEP_types_webpack_env('>=1.12.1 <1.14.0')
6
+ new FN002013_DEVDEP_types_webpack_env('>=1.12.1 <1.14.0'),
7
+ new FN021001_PKG_spfx_deps_versions_match_project_version()
6
8
  ];
7
9
  //# sourceMappingURL=doctor-1.0.1.js.map
@@ -1,7 +1,9 @@
1
1
  import { FN002004_DEVDEP_gulp } from './rules/FN002004_DEVDEP_gulp.js';
2
2
  import { FN002013_DEVDEP_types_webpack_env } from './rules/FN002013_DEVDEP_types_webpack_env.js';
3
+ import { FN021001_PKG_spfx_deps_versions_match_project_version } from './rules/FN021001_PKG_spfx_deps_versions_match_project_version.js';
3
4
  export default [
4
5
  new FN002004_DEVDEP_gulp('~3.9.1'),
5
- new FN002013_DEVDEP_types_webpack_env('>=1.12.1 <1.14.0')
6
+ new FN002013_DEVDEP_types_webpack_env('>=1.12.1 <1.14.0'),
7
+ new FN021001_PKG_spfx_deps_versions_match_project_version()
6
8
  ];
7
9
  //# sourceMappingURL=doctor-1.0.2.js.map
@@ -4,12 +4,14 @@ import { FN002004_DEVDEP_gulp } from './rules/FN002004_DEVDEP_gulp.js';
4
4
  import { FN002013_DEVDEP_types_webpack_env } from './rules/FN002013_DEVDEP_types_webpack_env.js';
5
5
  import { FN002015_DEVDEP_types_react } from './rules/FN002015_DEVDEP_types_react.js';
6
6
  import { FN002016_DEVDEP_types_react_dom } from './rules/FN002016_DEVDEP_types_react_dom.js';
7
+ import { FN021001_PKG_spfx_deps_versions_match_project_version } from './rules/FN021001_PKG_spfx_deps_versions_match_project_version.js';
7
8
  export default [
8
9
  new FN001008_DEP_react('15'),
9
10
  new FN001009_DEP_react_dom('15'),
10
11
  new FN002004_DEVDEP_gulp('~3.9.1'),
11
12
  new FN002013_DEVDEP_types_webpack_env('>=1.12.1 <1.14.0'),
12
13
  new FN002015_DEVDEP_types_react('0.14'),
13
- new FN002016_DEVDEP_types_react_dom('0.14')
14
+ new FN002016_DEVDEP_types_react_dom('0.14'),
15
+ new FN021001_PKG_spfx_deps_versions_match_project_version()
14
16
  ];
15
17
  //# sourceMappingURL=doctor-1.1.0.js.map
@@ -4,12 +4,14 @@ import { FN002004_DEVDEP_gulp } from './rules/FN002004_DEVDEP_gulp.js';
4
4
  import { FN002013_DEVDEP_types_webpack_env } from './rules/FN002013_DEVDEP_types_webpack_env.js';
5
5
  import { FN002015_DEVDEP_types_react } from './rules/FN002015_DEVDEP_types_react.js';
6
6
  import { FN002016_DEVDEP_types_react_dom } from './rules/FN002016_DEVDEP_types_react_dom.js';
7
+ import { FN021001_PKG_spfx_deps_versions_match_project_version } from './rules/FN021001_PKG_spfx_deps_versions_match_project_version.js';
7
8
  export default [
8
9
  new FN001008_DEP_react('15'),
9
10
  new FN001009_DEP_react_dom('15'),
10
11
  new FN002004_DEVDEP_gulp('~3.9.1'),
11
12
  new FN002013_DEVDEP_types_webpack_env('>=1.12.1 <1.14.0'),
12
13
  new FN002015_DEVDEP_types_react('0.14'),
13
- new FN002016_DEVDEP_types_react_dom('0.14')
14
+ new FN002016_DEVDEP_types_react_dom('0.14'),
15
+ new FN021001_PKG_spfx_deps_versions_match_project_version()
14
16
  ];
15
17
  //# sourceMappingURL=doctor-1.1.1.js.map
@@ -4,12 +4,14 @@ import { FN002004_DEVDEP_gulp } from './rules/FN002004_DEVDEP_gulp.js';
4
4
  import { FN002013_DEVDEP_types_webpack_env } from './rules/FN002013_DEVDEP_types_webpack_env.js';
5
5
  import { FN002015_DEVDEP_types_react } from './rules/FN002015_DEVDEP_types_react.js';
6
6
  import { FN002016_DEVDEP_types_react_dom } from './rules/FN002016_DEVDEP_types_react_dom.js';
7
+ import { FN021001_PKG_spfx_deps_versions_match_project_version } from './rules/FN021001_PKG_spfx_deps_versions_match_project_version.js';
7
8
  export default [
8
9
  new FN001008_DEP_react('15'),
9
10
  new FN001009_DEP_react_dom('15'),
10
11
  new FN002004_DEVDEP_gulp('~3.9.1'),
11
12
  new FN002013_DEVDEP_types_webpack_env('>=1.12.1 <1.14.0'),
12
13
  new FN002015_DEVDEP_types_react('0.14'),
13
- new FN002016_DEVDEP_types_react_dom('0.14')
14
+ new FN002016_DEVDEP_types_react_dom('0.14'),
15
+ new FN021001_PKG_spfx_deps_versions_match_project_version()
14
16
  ];
15
17
  //# sourceMappingURL=doctor-1.1.3.js.map
@@ -7,6 +7,7 @@ import { FN002013_DEVDEP_types_webpack_env } from './rules/FN002013_DEVDEP_types
7
7
  import { FN002015_DEVDEP_types_react } from './rules/FN002015_DEVDEP_types_react.js';
8
8
  import { FN002016_DEVDEP_types_react_dom } from './rules/FN002016_DEVDEP_types_react_dom.js';
9
9
  import { FN002019_DEVDEP_microsoft_rush_stack_compiler } from './rules/FN002019_DEVDEP_microsoft_rush_stack_compiler.js';
10
+ import { FN021001_PKG_spfx_deps_versions_match_project_version } from './rules/FN021001_PKG_spfx_deps_versions_match_project_version.js';
10
11
  export default [
11
12
  new FN001008_DEP_react('16'),
12
13
  new FN001009_DEP_react_dom('16'),
@@ -16,6 +17,7 @@ export default [
16
17
  new FN002013_DEVDEP_types_webpack_env('1.13.1'),
17
18
  new FN002015_DEVDEP_types_react('16'),
18
19
  new FN002016_DEVDEP_types_react_dom('16'),
19
- new FN002019_DEVDEP_microsoft_rush_stack_compiler(['3.3'])
20
+ new FN002019_DEVDEP_microsoft_rush_stack_compiler(['3.3']),
21
+ new FN021001_PKG_spfx_deps_versions_match_project_version()
20
22
  ];
21
23
  //# sourceMappingURL=doctor-1.10.0.js.map
@@ -7,6 +7,7 @@ import { FN002013_DEVDEP_types_webpack_env } from './rules/FN002013_DEVDEP_types
7
7
  import { FN002015_DEVDEP_types_react } from './rules/FN002015_DEVDEP_types_react.js';
8
8
  import { FN002016_DEVDEP_types_react_dom } from './rules/FN002016_DEVDEP_types_react_dom.js';
9
9
  import { FN002019_DEVDEP_microsoft_rush_stack_compiler } from './rules/FN002019_DEVDEP_microsoft_rush_stack_compiler.js';
10
+ import { FN021001_PKG_spfx_deps_versions_match_project_version } from './rules/FN021001_PKG_spfx_deps_versions_match_project_version.js';
10
11
  export default [
11
12
  new FN001008_DEP_react('16'),
12
13
  new FN001009_DEP_react_dom('16'),
@@ -16,6 +17,7 @@ export default [
16
17
  new FN002013_DEVDEP_types_webpack_env('1.13.1'),
17
18
  new FN002015_DEVDEP_types_react('16'),
18
19
  new FN002016_DEVDEP_types_react_dom('16'),
19
- new FN002019_DEVDEP_microsoft_rush_stack_compiler(['3.3'])
20
+ new FN002019_DEVDEP_microsoft_rush_stack_compiler(['3.3']),
21
+ new FN021001_PKG_spfx_deps_versions_match_project_version()
20
22
  ];
21
23
  //# sourceMappingURL=doctor-1.11.0.js.map