@zowe/imperative
Version:
framework for building configurable CLIs
95 lines • 4.16 kB
TypeScript
import { ICommandArguments } from "../../cmd";
import { ImperativeError } from "../../error";
export declare class ConfigUtils {
/**
* Retrieves the Zowe CLI home directory. In the situation Imperative has
* not initialized it we use a default value.
* @returns {string} - Returns the Zowe home directory
*/
static getZoweDir(): string;
/**
* Coerces string property value to a boolean or number type.
* @param value String value
* @param type Property type defined in the schema
* @returns Boolean, number, or string
*/
static coercePropValue(value: any, type?: string): any;
/**
* Retrieves the name of the active profile for the given type. If no such
* profile exists, returns the default name which can be used to create a new profile.
* @param profileType The type of CLI profile
* @param cmdArguments CLI arguments which may specify a profile
* @param defaultProfileName Name to fall back to if profile doesn't exist. If
* not specified, the profile type will be used.
* @returns The profile name
*/
static getActiveProfileName(profileType: string, cmdArguments?: ICommandArguments, defaultProfileName?: string): string;
/**
* Checks if partial path is equal to or nested inside full path
* @param fullPath JSON path to profile 1
* @param partialPath JSON path to profile 2
*/
static jsonPathMatches(fullPath: string, partialPath: string): boolean;
/**
* Returns an indicator that the user has no team configuration, but we
* detected the existence of old-school V1 profiles. We will not work with the
* V1 profiles. This function can let you tell a user that they are incorrectly
* trying to use V1 profiles.
*
* @returns True - Means there is *NO* team config *AND* we detected that a V1 profile exists.
* False otherwise.
*/
static get onlyV1ProfilesExist(): boolean;
/**
* Form an error message for failures to securely save a value.
* @param solution Text that our caller can supply for a solution.
* @returns ImperativeError to be thrown
*/
static secureSaveError(solution?: string): ImperativeError;
/**
* Form a profile name of a given profile type to be used as a default
* profile name. The name can vary based on whether the configuration to
* contain the profile is a global config or a project config.
*
* Currently, we only form a different global/project profile name for
* a base profile. The profile name for any other profile type is currently
* set to the profile type string.
*
* @param profileType
* The profile type for which we will form a name.
*
* @param globalConfig
* Indicator that the caller knows that the profile name will be
* for a globalConfig (true) or project config (false).
* If globalConfig is not supplied, we interrogate any existing
* Config object to determine whether to form a global or project
* profile name.
*
* @returns
* A string to be used as the profile name for the specified profile type.
*/
static formGlobOrProjProfileNm(profileType: string, globalConfig?: boolean): string;
/**
* Find the specified profile type in the specified (or nested) profiles.
*
* @param profileType
* The profile type to search for.
*
* @param profilesObj
* The profile object in which we should search.
*
* @returns
* True if we find the profile type. False otherwise.
*/
private static findProfTypeInNestedProfiles;
/**
* Checks if the given token has expired. Supports JSON web tokens only.
*
* @param {string} token - The JSON web token to check
* @returns {boolean}
* Whether the token has expired. Returns `false` if the token cannot
* be decoded or an expire time is not specified in the payload.
*/
static hasTokenExpired(token: string): boolean;
}
//# sourceMappingURL=ConfigUtils.d.ts.map