@salesforce/core
Version:
Core libraries to interact with SFDX projects, orgs, and APIs.
96 lines (95 loc) • 2.99 kB
TypeScript
import { AsyncOptionalCreatable } from '@salesforce/kit';
import { SfOrg, SfOrgs } from '../config/globalInfoConfig';
/**
* Handles the removing of authorizations, which includes deleting the auth file
* in the global .sfdx folder, deleting any configs that are associated with the username/alias,
* and deleting any aliases associated with the username
*
* ```
* const remover = await AuthRemover.create();
* await remover.removeAuth('example@mycompany.com');
* ```
*
* ```
* const remover = await AuthRemover.create();
* await remover.removeAllAuths();
* ```
*
* ```
* const remover = await AuthRemover.create();
* const auth = await remover.findAuth(
* example@mycompany.com
* );
* await remover.removeAuth(auth.username);
* ```
*/
export declare class AuthRemover extends AsyncOptionalCreatable {
private globalConfig;
private localConfig;
private globalInfo;
private logger;
private aliases;
/**
* Removes the authentication and any configs or aliases associated with it
*
* @param usernameOrAlias the username or alias that you want to remove
*/
removeAuth(usernameOrAlias: string): Promise<void>;
/**
* Removes all authentication files and any configs or aliases associated with them
*/
removeAllAuths(): Promise<void>;
/**
* Finds authorization files for username/alias in the global .sfdx folder
* **Throws** *{@link SfdxError}{ name: 'DefaultUsernameNotSetError' }* if no defaultusername
* **Throws** *{@link SfdxError}{ name: 'NamedOrgNotFoundError' }* if specified user is not found
*
* @param usernameOrAlias username or alias of the auth you want to find, defaults to the configured defaultusername
* @returns {Promise<SfOrg>}
*/
findAuth(usernameOrAlias?: string): Promise<SfOrg>;
/**
* Finds all authorization files in the global .sfdx folder
*
* @returns {SfOrgs}
*/
findAllAuths(): SfOrgs;
protected init(): Promise<void>;
/**
* Returns the username for a given alias if the alias exists.
*
* @param usernameOrAlias username or alias
* @returns {Promise<string>}
*/
private resolveUsername;
/**
* Instantiates config class
*
* @param isGlobal
* @returns {Promise<Nullable<Config>>}
*/
private getConfig;
/**
* @returns {Promise<string>}
*/
private getDefaultUsername;
/**
* Returns aliases for provided username
*
* @param username username that's been aliased
* @returns {Promise<string[]>}
*/
private getAliases;
/**
* Unsets any configured values (both global and local) for provided username
*
* @param username username that you want to remove from config files
*/
private unsetConfigValues;
/**
* Unsets any aliases for provided username
*
* @param username username that you want to remove from aliases
*/
private unsetAliases;
}