import type { OptionsBase } from "./ConfigCatClientOptions"; import type { IConfigFetcher } from "./ConfigFetcher"; import { FetchResult } from "./ConfigFetcher"; import { ProjectConfig } from "./ProjectConfig"; /** Contains the result of an `IConfigCatClient.forceRefreshAsync` operation. */ export declare class RefreshResult { /** Error message in case the operation failed, otherwise `null`. */ errorMessage: string | null; /** The exception object related to the error in case the operation failed (if any). */ errorException?: any; constructor( /** Error message in case the operation failed, otherwise `null`. */ errorMessage: string | null, /** The exception object related to the error in case the operation failed (if any). */ errorException?: any); /** Indicates whether the operation was successful or not. */ get isSuccess(): boolean; static from(fetchResult: FetchResult): RefreshResult; /** Creates an instance of the `RefreshResult` class which indicates that the operation was successful. */ static success(): RefreshResult; /** Creates an instance of the `RefreshResult` class which indicates that the operation failed. */ static failure(errorMessage: string, errorException?: any): RefreshResult; } /** Specifies the possible states of the internal cache. */ export declare enum ClientCacheState { /** No config data is available in the internal cache. */ NoFlagData = 0, /** Only config data provided by local flag override is available in the internal cache. */ HasLocalOverrideFlagDataOnly = 1, /** Only expired config data obtained from the external cache or the ConfigCat CDN is available in the internal cache. */ HasCachedFlagDataOnly = 2, /** Up-to-date config data obtained from the external cache or the ConfigCat CDN is available in the internal cache. */ HasUpToDateFlagData = 3 } export interface IConfigService { readonly readyPromise: Promise; getConfig(): Promise; refreshConfigAsync(): Promise<[RefreshResult, ProjectConfig]>; readonly isOffline: boolean; setOnline(): void; setOffline(): void; getCacheState(cachedConfig: ProjectConfig): ClientCacheState; dispose(): void; } export declare abstract class ConfigServiceBase { protected readonly configFetcher: IConfigFetcher; protected readonly options: TOptions; private status; private pendingCacheSyncUp; private pendingConfigRefresh; protected readonly cacheKey: string; abstract readonly readyPromise: Promise; constructor(configFetcher: IConfigFetcher, options: TOptions); dispose(): void; protected get disposed(): boolean; abstract getConfig(): Promise; refreshConfigAsync(): Promise<[RefreshResult, ProjectConfig]>; protected refreshConfigCoreAsync(latestConfig: ProjectConfig): Promise<[FetchResult, ProjectConfig]>; protected onConfigFetched(newConfig: ProjectConfig): void; protected onConfigChanged(newConfig: ProjectConfig): void; private fetchAsync; private fetchRequestAsync; protected get isOfflineExactly(): boolean; get isOffline(): boolean; protected goOnline(): void; setOnline(): void; setOffline(): void; abstract getCacheState(cachedConfig: ProjectConfig): ClientCacheState; protected syncUpWithCache(): ProjectConfig | Promise; private onCacheSynced; protected getReadyPromise(state: TState, waitForReadyAsync: (state: TState) => Promise): Promise; } //# sourceMappingURL=ConfigServiceBase.d.ts.map