Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
if (args.instanceUrl || args.i) {
config.auth.instanceUrl = args.instanceUrl || args.i;
}
if (args.outputFile || args.o) {
config.outPath = args.outputFile || args.o;
}
if (args.sObjects || args.s) {
config.sObjects = (args.sObjects || args.s).split(',');
}
if (config.auth.accessToken === undefined) {
// if just username is set, load from sfdx
if (config.auth.username !== undefined && config.auth.password === undefined) {
let username = await Aliases.fetch(config.auth.username);
if (username) {
config.auth.username = username;
}
console.log(config.auth.username);
let connection: Connection = await Connection.create({
authInfo: await AuthInfo.create({ username: config.auth.username }
)
});
let org = await Org.create({ connection });
await org.refreshAuth();
connection = org.getConnection();
config.auth.accessToken = connection.accessToken;
config.auth.instanceUrl = connection.instanceUrl;
} else if (config.auth.username !== undefined && config.auth.password !== undefined) {
public static async getUsername(
usernameOrAlias: string
): Promise {
const username = await Aliases.fetch(usernameOrAlias);
return Promise.resolve(username);
}