type ConfigKey = string; type Duration$1 = { seconds: number; ms: number; }; type ConfigValue = number | string | boolean | object | Duration$1 | undefined; type RawConfigWithoutTypes = { [key: string]: any; }; type ConfigEvaluationMetadata = { configRowIndex: number; conditionalValueIndex: number; type: string; configId: string; }; type APIKeyMetadata = { id: string | number; }; type Duration = { definition: string; millis: number; }; type Value = { [key: string]: number | string | string[] | boolean | Duration; }; type Evaluation = { value: Value; configEvaluationMetadata: { configRowIndex: string | number; conditionalValueIndex: string | number; weightedValueIndex?: string | number; type: string; valueType: string; id: string; }; }; type EvaluationPayload = { evaluations: { [key: string]: Evaluation; }; apikeyMetadata: APIKeyMetadata; }; declare class Config { key: ConfigKey; value: ConfigValue; rawValue: Value | undefined; type: string; configEvaluationMetadata: ConfigEvaluationMetadata | undefined; constructor(key: ConfigKey, value: ConfigValue, type: string, rawValue?: Value, metadata?: ConfigEvaluationMetadata); static digest(payload: EvaluationPayload | RawConfigWithoutTypes): { [key: string]: Config; }; } type ContextValue = number | string | boolean; type Contexts = { [key: Key]: Record; }; declare class Context { contexts: Contexts; constructor(contexts: Contexts); equals(other: Context): boolean; encode(): string; } type CollectContextModeType = "NONE" | "SHAPE_ONLY" | "PERIODIC_EXAMPLE"; type LoaderParams = { apiKey: string; context: Context; endpoints?: string[] | undefined; timeout?: number; collectContextMode?: CollectContextModeType; clientVersion?: string; }; type Headers = { [key: string]: string; }; type FetchOptions = { headers: Headers; }; declare class Loader { apiKey: string; context: Context; endpoints: string[]; timeout: number; abortTimeoutId: ReturnType | undefined; collectContextMode: CollectContextModeType; clientVersion: string; abortController: AbortController | undefined; isAborted: boolean; constructor({ apiKey, context, endpoints, timeout, collectContextMode, clientVersion, }: LoaderParams); url(root: string): string; loadFromEndpoint(index: number, options: FetchOptions, resolve: (value: any) => void, reject: (value: any) => void): void; load(): Promise; clearAbortTimeout(): void; } declare const shouldLog: ({ loggerName, desiredLevel, defaultLevel, get, }: { loggerName: string; desiredLevel: string; defaultLevel: string; get: (key: string) => ConfigValue; }) => boolean; type TelemetryUploaderParams = { apiKey: string; apiEndpoint?: string | undefined; timeout?: number; clientVersion: string; }; declare class TelemetryUploader { apiKey: string; apiEndpoint: string; timeout: number; clientVersion: string; abortTimeoutId: ReturnType | undefined; constructor({ apiKey, apiEndpoint, timeout, clientVersion, }: TelemetryUploaderParams); clearAbortTimeout(): void; static postUrl(root: string): string; postToEndpoint(options: object, resolve: (value: any) => void, reject: (value: any) => void): void; post(data: any): Promise; } type EvaluationCallback = (key: string, value: ConfigValue, context: Context | undefined) => void; interface PrefabBootstrap { evaluations: EvaluationPayload; context: Contexts; } type InitParams = { apiKey: string; context: Context; endpoints?: string[] | undefined; apiEndpoint?: string; timeout?: number; afterEvaluationCallback?: EvaluationCallback; collectEvaluationSummaries?: boolean; collectLoggerNames?: boolean; collectContextMode?: CollectContextModeType; clientNameString?: string; clientVersionString?: string; }; type PollStatus = { status: "not-started"; } | { status: "pending"; } | { status: "stopped"; } | { status: "running"; frequencyInMs: number; }; declare class Prefab { private _configs; private _telemetryUploader; private _pollCount; private _pollStatus; private _pollTimeoutId; private _instanceHash; private collectEvaluationSummaries; private collectLoggerNames; private evalutionSummaryAggregator; private loggerAggregator; clientNameString: string; loaded: boolean; loader: Loader | undefined; afterEvaluationCallback: EvaluationCallback; private _context; init({ apiKey, context: providedContext, endpoints, apiEndpoint, timeout, afterEvaluationCallback, collectEvaluationSummaries, collectLoggerNames, collectContextMode, clientNameString, clientVersionString, }: InitParams): Promise; extract(): Record; hydrate(rawValues: RawConfigWithoutTypes | EvaluationPayload): void; get configs(): Record; get context(): Context; get instanceHash(): string; get pollTimeoutId(): NodeJS.Timeout | undefined; get pollCount(): number; get pollStatus(): PollStatus; get telemetryUploader(): TelemetryUploader | undefined; private load; updateContext(context: Context, skipLoad?: boolean): Promise; poll({ frequencyInMs }: { frequencyInMs: number; }): Promise; private doPolling; stopPolling(): void; stopTelemetry(): void; setConfig(rawValues: RawConfigWithoutTypes | EvaluationPayload): void; private setConfigPrivate; isEnabled(key: string): boolean; get(key: string): ConfigValue; getDuration(key: string): Duration$1 | undefined; shouldLog(args: Omit[0], "get">, async?: boolean): boolean; isCollectingEvaluationSummaries(): boolean; isCollectingLoggerNames(): boolean; } declare const prefab: Prefab; declare const _default: "0.4.7"; export { type CollectContextModeType, Config, type ConfigValue, Context, type ContextValue, type Duration$1 as Duration, Prefab, type PrefabBootstrap, prefab, _default as version };