featurehub-repository
Version:
Core package of API that exposes FeatureHub feature flags, values and configuration to client applications written in Typescript or Javascript.
58 lines (57 loc) • 2.59 kB
TypeScript
import { FeatureHubRepository, Readyness, ReadynessListener } from './client_feature_repository';
import { EdgeService } from './edge_service';
import { ClientContext } from './client_context';
import { InternalFeatureRepository } from './internal_feature_repository';
import { AnalyticsCollector } from './analytics';
import { FeatureStateValueInterceptor } from './interceptors';
export declare type EdgeServiceProvider = (repository: InternalFeatureRepository, config: FeatureHubConfig) => EdgeService;
export declare type EdgeServiceSupplier = () => EdgeService;
export declare type FHLogMethod = (...args: any[]) => void;
export declare class FHLog {
log: FHLogMethod;
error: FHLogMethod;
}
export declare const fhLog: FHLog;
export interface FeatureHubConfig {
readyness: Readyness;
url(): string;
repository(repository?: FeatureHubRepository): FeatureHubRepository;
edgeServiceProvider(edgeService?: EdgeServiceProvider): EdgeServiceProvider;
newContext(repository?: FeatureHubRepository, edgeService?: EdgeServiceProvider): ClientContext;
clientEvaluated(): boolean;
apiKey(apiKey: string): FeatureHubConfig;
getApiKeys(): Array<string>;
getHost(): string;
init(): FeatureHubConfig;
close(): any;
addReadynessListener(listener: ReadynessListener): void;
addAnalyticCollector(collector: AnalyticsCollector): void;
addValueInterceptor(interceptor: FeatureStateValueInterceptor): void;
}
export declare class EdgeFeatureHubConfig implements FeatureHubConfig {
private _host;
private _apiKey;
private _apiKeys;
private _clientEval;
private _url;
private _repository;
private _edgeService;
private _edgeServices;
static defaultEdgeServiceSupplier: EdgeServiceProvider;
constructor(host: string, apiKey: string);
addReadynessListener(listener: ReadynessListener): void;
addAnalyticCollector(collector: AnalyticsCollector): void;
addValueInterceptor(interceptor: FeatureStateValueInterceptor): void;
get readyness(): Readyness;
apiKey(apiKey: string): FeatureHubConfig;
clientEvaluated(): boolean;
getApiKeys(): string[];
getHost(): string;
newContext(repository?: InternalFeatureRepository, edgeService?: EdgeServiceProvider): ClientContext;
_createEdgeService(edgeServSupplier: EdgeServiceProvider): EdgeService;
close(): void;
init(): FeatureHubConfig;
edgeServiceProvider(edgeServ?: EdgeServiceProvider): EdgeServiceProvider;
repository(repository?: InternalFeatureRepository): InternalFeatureRepository;
url(): string;
}