import { Context, EventName, internal, LDContext, LDHeaders, LDLogger, Platform, ProcessStreamResponse, subsystem } from '@launchdarkly/js-sdk-common'; import type FDv2ConnectionMode from './api/datasource/FDv2ConnectionMode'; import { LDIdentifyOptions } from './api/LDIdentifyOptions'; import { Configuration } from './configuration/Configuration'; import { DataSourceStatusManager } from './datasource/DataSourceStatusManager'; import { Requestor } from './datasource/Requestor'; import { FlagManager } from './flag-manager/FlagManager'; import LDEmitter from './LDEmitter'; import { DataSourcePaths } from './streaming'; export interface DataManager { /** * This function handles the data management aspects of the identification process. * * Implementation Note: The identifyResolve and identifyReject function resolve or reject the * identify function at LDClient level. It is likely in individual implementations that these * functions will be passed to other components, such as a datasource, do indicate when the * identify process has been completed. The data manager identify function should return once * everything has been set in motion to complete the identification process. * * @param identifyResolve Called to reject the identify operation. * @param identifyReject Called to complete the identify operation. * @param context The context being identified. * @param identifyOptions Options for identification. */ identify(identifyResolve: () => void, identifyReject: (err: Error) => void, context: Context, identifyOptions?: LDIdentifyOptions): Promise; /** * Closes the data manager. Any active connections are closed. */ close(): void; /** * Force streaming on or off. When `true`, the data manager should * maintain a streaming connection. When `false`, streaming is disabled. * When `undefined`, the forced state is cleared and automatic behavior * takes over. * * Optional — only browser data managers implement this. */ setForcedStreaming?(streaming?: boolean): void; /** * Update the automatic streaming state based on whether change listeners * are registered. When `true` and forced streaming is not set, the data * manager should activate streaming. * * Optional — only browser data managers implement this. */ setAutomaticStreamingState?(streaming: boolean): void; /** * Set an explicit connection mode override. When set, only this mode is * used, bypassing all automatic behavior. Pass undefined to clear the * override. * * Optional — only FDv2 data managers implement this. */ setConnectionMode?(mode?: FDv2ConnectionMode): void; /** * Set a callback to flush pending analytics events. Called immediately * (not debounced) when the lifecycle transitions to background. * * Optional — only FDv2 data managers implement this. */ setFlushCallback?(callback: () => void): void; } /** * Factory interface for constructing data managers. */ export interface DataManagerFactory { (flagManager: FlagManager, configuration: Configuration, baseHeaders: LDHeaders, emitter: LDEmitter, diagnosticsManager?: internal.DiagnosticsManager): DataManager; } export interface ConnectionParams { queryParameters?: { key: string; value: string; }[]; } export declare abstract class BaseDataManager implements DataManager { protected readonly platform: Platform; protected readonly flagManager: FlagManager; protected readonly credential: string; protected readonly config: Configuration; protected readonly getPollingPaths: () => DataSourcePaths; protected readonly getStreamingPaths: () => DataSourcePaths; protected readonly baseHeaders: LDHeaders; protected readonly emitter: LDEmitter; protected readonly diagnosticsManager?: internal.DiagnosticsManager | undefined; protected updateProcessor?: subsystem.LDStreamProcessor; protected readonly logger: LDLogger; protected context?: Context; private _connectionParams?; protected readonly dataSourceStatusManager: DataSourceStatusManager; private readonly _dataSourceEventHandler; protected closed: boolean; constructor(platform: Platform, flagManager: FlagManager, credential: string, config: Configuration, getPollingPaths: () => DataSourcePaths, getStreamingPaths: () => DataSourcePaths, baseHeaders: LDHeaders, emitter: LDEmitter, diagnosticsManager?: internal.DiagnosticsManager | undefined); /** * Set additional connection parameters for requests polling/streaming. */ protected setConnectionParams(connectionParams?: ConnectionParams): void; abstract identify(identifyResolve: () => void, identifyReject: (err: Error) => void, context: Context, identifyOptions?: LDIdentifyOptions): Promise; protected createPollingProcessor(context: LDContext, checkedContext: Context, requestor: Requestor, identifyResolve?: () => void, identifyReject?: (err: Error) => void): void; protected createStreamingProcessor(context: LDContext, checkedContext: Context, pollingRequestor: Requestor, identifyResolve?: () => void, identifyReject?: (err: Error) => void): void; protected createStreamListeners(context: Context, identifyResolve?: () => void): Map; private _decorateProcessorWithStatusReporting; close(): void; } //# sourceMappingURL=DataManager.d.ts.map