@onboardbase/cli
Version:
[](https://www.npmjs.com/package/@onboardbase/cli) [](https://www.npmjs.com/package/@onboardbase/cli) [ • 6.02 kB
TypeScript
/// <reference types="node" />
import { ChildProcess } from "child_process";
import { AxiosInstance } from "axios";
import { AllConfig } from "./types";
import { IConfig } from "@oclif/config";
declare class ConfigManager {
private store;
private runningProcess;
private defaultApiHostBaseUrl;
private defaultDashboardBaseUrl;
private configFile;
onboardbaseDirectory: string;
private onboardbaseFallbackDirectory;
onboardbaseConfigFile: string;
onboardbaseVersioningDirectory: string;
onboardbaseDatabaseDirectory: string;
private rsaKeys;
private authApiHost;
private authSessionDetails;
shouldCreateProjectLog: boolean;
private projectFallbackConfigFile;
private projectNewConfigFile;
/**
* check for .yml extension first before falling back to .yaml.
*/
private projectConfigPath;
/**
* Add a fallback for .yml extension incase a user chooses to use that in replace of .yaml
*
* Also check to see if the user has the old config file, that is `onboardbase.yaml`,
* if user does, just fallback to that instead of assuming the user doesn't have any
* local onboardbase config file.
*
* @todo
*
* Fallback should no longer be supported in the next couple of releases so as to enforce
* using the new `.onboardbase.yaml` file instead.
*/
projectConfigFile: string;
private syncSocketClient;
configManager: ConfigManager;
private encryptionSecretKey;
/**
*
* @param apiHost string
* This should only be called when authenticating.
* How does it work? let's assume a user has two organizations, they have authenticated for one already and are trying
* to authenticate for another organization, we need to map the 1st organization api-host to the scope of the organization
* they're trying to auth with (that is, the 2nd organization).
* Why? Because deviceTokens are scoped to api's. So the api that handled the authentication for the 2nd org
* is also the api that has the organization's deviceToken.
*
* I hope you get it.
*/
setAuthApiHost(apiHost: string): void;
getAuthApiHost(): string;
setSyncSocketClient(socketClient: any): void;
getSynSocketClient(): any;
storeEncrytionSecretKey(secretKey: string): void;
getEncryptionSecretKey(): string;
/**
*
* @param payload
*
* this is basically a decoded information of the user's authToken
* & the ID of the current project the user is running for the current
* CLI & Login Session
*/
setAuthSessionDetails(payload: {
email: string;
team: {
id: string;
name: string;
};
teamRole: {
id: string;
name: string;
};
project: {
id: string;
};
}): void;
getAuthSessionDetails(): {
email: string;
team: {
id: string;
name: string;
};
teamRole: {
id: string;
name: string;
};
project: {
id: string;
};
};
throwAuthenticationError(): void;
checkAndCreateOnboardbaseDirectories(): void;
createOnboardbaseConfigFile(): void;
/**
*
* @param command string optional. It's used to exclude the
* login command from throwing authentication error when ConfigManager
* is called without being authenticated.
* @returns void
*/
init(command?: string, iconfig?: IConfig): Promise<void>;
isUserLoggedIn(): boolean;
registerProcess(identifier: "socket" | "main", process: ChildProcess): void;
closeRunningProcess(): void;
getConfigs(): any;
getScopedConfig(directory?: string): any;
getProjectConfig(): any;
getLocalConfig(): {
[key: string]: string;
};
/**
* This returns an encrypted version of the user's token
* @returns
*/
getRawToken(): string;
/**
* This returns a decrypted version of the user's token
* @returns
*/
getToken(): Promise<string>;
isNewServiceToken(): Promise<boolean>;
getRsaKeys(): {
publicKey: string | undefined;
privateKey: string | undefined;
backendPublicKey: string | undefined;
};
storeRsaKeys(publicKey: string, privateKey: string): void;
storeBackendPublicKey(publicKey: string): void;
deleteToken({ scope }: {
scope: any;
}): Promise<void>;
getDirectoriesThatRequiresPassword(): any[];
updateLocalProjectSecrets(updatedSecrets: {
[key: string]: any;
}): Promise<void>;
updateDirectorySessionConfig({ scope, requirePasswordForCurrentSession, }: {
scope: string;
requirePasswordForCurrentSession: boolean;
}): Promise<void>;
updateGlobalConfig({ scope, token, encryptToken, apiHost, dashboardHost, authToken, requirePassword, password, requirePasswordForCurrentSession, }: {
scope?: string;
token?: string | undefined;
authToken?: string | undefined;
encryptToken?: boolean;
apiHost?: string;
dashboardHost?: string;
requirePassword?: boolean;
password?: string;
requirePasswordForCurrentSession?: boolean;
}): Promise<void>;
deleteOnboardbaseConfigs(): Promise<void>;
getHttpInstance(url?: any): AxiosInstance;
private _handleRequestTimeout;
private _getTimeThresholdForTerminationInMs;
private _getDefaultTimeoutAndWarn;
updateProjectAndEnvironmentVersion(project: string, environment: string, version: number): void;
getCurrentProjectAndEnvironmentVersion(project: string, environment: string): any;
getApiHostBaseUrl(allConfigs: AllConfig): string;
getDashboardBaseUrl(allConfigs: AllConfig): string;
private _getFromConfig;
getDefaultDashboardBaseUrl(): string;
getDefaultApiHostBaseUrl(): string;
}
declare const _default: ConfigManager;
export default _default;