Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const defaultDevHubUsernameorAlias = await this.getDefaultDevHubUsernameorAlias();
if (defaultDevHubUsernameorAlias) {
const defaultDevHubUsername =
(await OrgAuthInfo.getUsername(defaultDevHubUsernameorAlias)) ||
defaultDevHubUsernameorAlias;
authInfoObjects = authInfoObjects.filter(
fileData =>
isNullOrUndefined(fileData.devHubUsername) ||
(!isNullOrUndefined(fileData.devHubUsername) &&
fileData.devHubUsername === defaultDevHubUsername)
);
}
const authUsernames = authInfoObjects.map(file => file.username);
const aliases = await Aliases.create(Aliases.getDefaultOptions());
const authList = [];
for (const username of authUsernames) {
const alias = await aliases.getKeysByValue(username);
if (alias.length > 0) {
authList.push(alias + ' - ' + username);
} else {
authList.push(username);
}
}
return authList;
}