-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy path_sfUserDetails.js
More file actions
32 lines (28 loc) · 1.06 KB
/
_sfUserDetails.js
File metadata and controls
32 lines (28 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
'use strict';
// Initialize required modules
const sfdx = require('sfdx-node/parallel');
/**
* @function _sfUserDisplay
* @description Attempts to retrieve the details for a given scratchOrg user
*
* @param {Object} environmentDef Represents the already-validated environment details to use when performing the actions
* @returns {Promise} Returns the userDetails obtained from the Salesforce environment
*/
module.exports = environmentDef => {
const displayArguments = {
_rejectOnError: true
};
// Set the username to deploy to if it's defined
if (Object.prototype.hasOwnProperty.call(environmentDef, 'sfScratchOrgUsername')) {
displayArguments.targetusername = environmentDef.sfScratchOrgUsername;
}
// Attempt to get the details for the scratchOrg
return sfdx.force.user.display(displayArguments)
.then(result => {
return {
outputDisplay: Object.keys(result)
.map(resultKey => [resultKey, result[resultKey]]),
result: result
};
});
};