import Ajv from 'ajv'; import { IConfigOptions } from '../interfaces/IConfigOptions'; import { IConfiguration } from '../interfaces/IConfiguration'; import { IRequiredConfigOptions } from '../interfaces/IRequiredConfigOptions'; import { IUpdateOptions } from '../interfaces/IUpdateOptions'; import { IConfig } from '../interfaces/IConfig'; import { IConfigHierarchy } from '../interfaces/IConfigHierarchy'; import { IExportOptions } from 'src/interfaces/IExportOptions'; export declare const defaultOptions: IRequiredConfigOptions; /** * JSON-Schema validated Configuration Wrapper with dot notation support. * * @export * @class Configuration * @implements {IConfiguration} */ export declare class Configuration implements IConfiguration { private static instance; private options; private dot; private data; private schema; /** * keeps the current configuration as object */ private config; private schemaValidator; private validate?; private updateErrors; private readyState; private NODE_ENV; private configurationHierarchy; private secretCleaner; /** * Creates a new instance of Configuration class. * To retrieve a global singleton instance, use default export instead. * @param {IConfigOptions} [options] * @memberof Configuration * @deprecated use singleton getInstance() instead, this will be private in future versions */ constructor(options?: IConfigOptions); has: (key: string) => boolean; get: (key: string) => any; private getSchemaFilePath; /** * set final, probably dotted config object * * @readonly * @private * @type {*} * @memberof Configuration */ private updateConfig; /** * publishes the current configuration, eventually converted in dot notation * * @returns {*} * @memberof Configuration */ toObject(options?: IExportOptions): IConfig; getConfigurationHierarchy(): IConfigHierarchy[]; printHierarchy(loggerTarget?: string): void; /** * returns a singleton configuration instance, override defaults using a sc-config.json file based on IConfigOptions in the projects root. * * @returns {Configuration} * @memberof Configuration */ static get Instance(): Configuration; /** * Updates the given values in current configuration. * @param {IConfig} params params to override in current configuration * @param {IUpdateOptions} options * @param {boolean} options.reset set true, to only keep values given in params and remove the current values */ update(params: IConfig, options?: IUpdateOptions): boolean; /** * Replaces the current Configuration with given params. * This removes all current values. * @param params */ reset(params: IConfig): boolean; /** * update a single configuration value * * @param {string} key * @param {*} value * @returns {boolean} * @memberof Configuration */ set(key: string, value: any): boolean; remove(...keys: string[]): boolean; /** * updates the current schema if it can be compiled * * @param {*} schema * @memberof Configuration */ private setSchema; private parse; /** * returns an array of error objects or error strings which will be created due to validation or schema errors after setting schema or value(s). * * @memberof Configuration */ getErrors: () => [Ajv.ErrorObject | string] | null; /** * depending on options.throwOnError returns null by default or throws an error for undefined config values * * @private * @param {string} key * @returns {*} * @memberof Configuration */ private notFound; private loadJSONFromFileName; /** * throws an error when initialization has not finished * * @private * @returns {boolean} * @memberof Configuration */ private ensureInitialized; /** * restrict access to configuration modifying functions if NODE_ENV in option restrictRuntimeChanges. Defaults to 'production'. */ private restrictRuntimeChanges; private runtimeChangesAllowed; } declare const _default: Configuration; export default _default; //# sourceMappingURL=index.d.ts.map