import { IDynamicProperty } from "./abstractions"; import { ConfigurationManager } from "./configurationManager"; import { ConfigurationSourceBuilder } from "./configurationSourceBuilder"; import * as rx from 'rxjs'; /** * * Provides dynamic properties updated when config change. * Accessing a dynamic property is very fast. The last value is cached and updated on the fly * from a ConfigurationSource at fixed interval. * Updates are made using polling requests on a list of sources. *

* Dynamic properties are read only. You can set a value but it will be valid only as a default value. *

* * DynamicConfiguration.init().addRest("http....").startPolling(); * let i:number = DynamicConfiguration.getProperty("prop1"); * let i2:number = DynamicConfiguration.getOrDefaultProperty("prop1", 1); * */ export declare class DynamicConfiguration { /** * For test only - Do not use directly */ private static manager; private static _builder; /** * subscribe for a global property changed */ static readonly propertyChanged: rx.Observable>; /** * Get a property */ static getProperty(name: string, value?: T): IDynamicProperty; static getChainedProperty(name: string, defaultValue: T, ...fallbackPropertyNames: Array): IDynamicProperty; /** * get a chained property for the current service. * Properties chain is: service.version.name->service.name->domain.name->name * @param name property name * @param defaultValue * @returns {IDynamicProperty} */ static getChainedConfigurationProperty(name: string, defaultValue?: T, commandName?: string): IDynamicProperty; /** * Get a property value by name * * @static * @template T * @param {string} name * @returns * * @memberOf DynamicConfiguration */ static getPropertyValue(name: string): T; static init(pollingIntervalInSeconds?: number, sourceTimeoutInMs?: number): ConfigurationSourceBuilder; /** * * @param pollingIntervalInSeconds For test only */ static reset(pollingIntervalInSeconds?: number): ConfigurationManager; }