import { ConfigChangeEvent } from './interfaces/config-change-event.interface'; import { NoInferType, Path, PathValue } from './types'; /** * `ValidatedResult * * If `WasValidated` is `true`, return `T`. * Otherwise, constructs the type `T` with `undefined`. */ type ValidatedResult = WasValidated extends true ? T : T | undefined; /** * @publicApi */ export interface ConfigGetOptions { /** * If present, "get" method will try to automatically * infer a type of property based on the type argument * specified at the "ConfigService" class-level (example: ConfigService). */ infer: true; } type KeyOf = keyof T extends never ? string : keyof T; /** * @publicApi */ export declare class ConfigService, WasValidated extends boolean = false> { private readonly internalConfig; private set isCacheEnabled(value); private get isCacheEnabled(); private readonly cache; private readonly _changes$; private _isCacheEnabled; private envFilePaths; constructor(internalConfig?: Record); /** * Returns a stream of configuration changes. * Each event contains the attribute path, the old value and the new value. */ get changes$(): import("rxjs").Observable>; /** * Get a configuration value (either custom configuration or process environment variable) * based on property path (you can use dot notation to traverse nested object, e.g. "database.host"). * @param propertyPath */ get(propertyPath: KeyOf): ValidatedResult; /** * Get a configuration value (either custom configuration or process environment variable) * based on property path (you can use dot notation to traverse nested object, e.g. "database.host"). * @param propertyPath * @param options */ get = any, R = PathValue>(propertyPath: P, options: ConfigGetOptions): ValidatedResult; /** * Get a configuration value (either custom configuration or process environment variable) * based on property path (you can use dot notation to traverse nested object, e.g. "database.host"). * It returns a default value if the key does not exist. * @param propertyPath * @param defaultValue */ get(propertyPath: KeyOf, defaultValue: NoInferType): T; /** * Get a configuration value (either custom configuration or process environment variable) * based on property path (you can use dot notation to traverse nested object, e.g. "database.host"). * It returns a default value if the key does not exist. * @param propertyPath * @param defaultValue * @param options */ get = any, R = PathValue>(propertyPath: P, defaultValue: NoInferType, options: ConfigGetOptions): Exclude; /** * Get a configuration value (either custom configuration or process environment variable) * based on property path (you can use dot notation to traverse nested object, e.g. "database.host"). * @param propertyPath */ getOrThrow(propertyPath: KeyOf): Exclude; /** * Get a configuration value (either custom configuration or process environment variable) * based on property path (you can use dot notation to traverse nested object, e.g. "database.host"). * @param propertyPath * @param options */ getOrThrow = any, R = PathValue>(propertyPath: P, options: ConfigGetOptions): Exclude; /** * Get a configuration value (either custom configuration or process environment variable) * based on property path (you can use dot notation to traverse nested object, e.g. "database.host"). * It returns a default value if the key does not exist. * If the default value is undefined an exception will be thrown. * @param propertyPath * @param defaultValue */ getOrThrow(propertyPath: KeyOf, defaultValue: NoInferType): Exclude; /** * Get a configuration value (either custom configuration or process environment variable) * based on property path (you can use dot notation to traverse nested object, e.g. "database.host"). * It returns a default value if the key does not exist. * If the default value is undefined an exception will be thrown. * @param propertyPath * @param defaultValue * @param options */ getOrThrow = any, R = PathValue>(propertyPath: P, defaultValue: NoInferType, options: ConfigGetOptions): Exclude; /** * Sets a configuration value based on property path. * @param propertyPath * @param value */ set(propertyPath: KeyOf, value: T): void; /** * Sets env file paths from `config.module.ts` to parse. * @param paths */ setEnvFilePaths(paths: string[]): void; private getFromCache; private getFromValidatedEnv; private getFromProcessEnv; private getFromInternalConfig; private setInCacheIfDefined; private isGetOptionsObject; private updateInterpolatedEnv; } export {};