/** * @athenna/config * * (c) Victor Tesoura JĂșnior * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ import { Macroable, ObjectBuilder } from '@athenna/common'; export declare class Config extends Macroable { /** * Object to save all the configurations. */ static configs: ObjectBuilder; /** * Object to save all the paths of the configuration files. */ static paths: ObjectBuilder; static fatherConfigPath: string; /** * Clear all the configurations of config object. */ static clear(): typeof Config; /** * Verify if configuration key has the same value. */ static is(key: string, ...values: any[]): boolean; /** * Verify if configuration key does not have the same value. */ static isNot(key: string, ...values: any[]): boolean; /** * Verify if a configuration key exists. */ static exists(key: string): boolean; /** * Verify if a configuration key does not exist. */ static notExists(key: string): boolean; /** * Verify if configuration keys exist. */ static existsAll(...keys: any[]): boolean; /** * Verify if configuration keys not exist. */ static notExistsAll(...keys: any[]): boolean; /** * Set a value in the configuration key. */ static set(key: string, value: any | any[]): typeof Config; /** * Set a value in the configuration key if the value is not defined. */ static safeSet(key: string, value: any | any[]): typeof Config; /** * Push a value to a configuration key that is a valid array. * If the configuration is not an array, an exception will be thrown. */ static push(key: string, value: any | any[]): typeof Config; /** * Delete the configuration key. */ static delete(key: string): typeof Config; /** * Get the value from Config file by key. If not * found, defaultValue will be used. */ static get(key?: string, defaultValue?: any): T; /** * Rewrite the configuration file. All values * set in the configuration using the Config * class will be saved in the file. * * @example * ```ts * Config.set('app.foo', 'bar') * * await Config.rewrite('app') * ``` */ static rewrite(key: string): Promise; /** * Load all configuration files in path. */ static loadAll(path?: string, safe?: boolean): Promise; /** * Load the configuration file only if it has * not been loaded yet. */ static safeLoad(path: string, callNumber?: number): Promise; /** * Load the configuration file. */ static load(path: string, callNumber?: number): Promise; }