-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy path_sfOrgDetails.js
More file actions
31 lines (27 loc) · 1.03 KB
/
_sfOrgDetails.js
File metadata and controls
31 lines (27 loc) · 1.03 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
'use strict';
// Initialize required modules
const sfdx = require('sfdx-node/parallel');
/**
* @function _sfScratchOrgDetails
* @description Attempts to retrieve the details for a given scratchOrg
*
* @param {Object} environmentDef Represents the already-validated environment details to use when performing the actions
* @returns {Promise} Returns the results of the scratchOrg detail request
*/
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.org.display(displayArguments)
.then(result => {
return {
outputDisplay: Object.keys(result).map(resultKey => [resultKey, result[resultKey]]),
result: result
};
});
};