import { IAssignmentLogger } from '../assignment-logger'; import { IBanditLogger } from '../bandit-logger'; import { AssignmentCache } from '../cache/abstract-assignment-cache'; import { IConfigurationStore, ISyncStore } from '../configuration-store/configuration-store'; import { IObfuscatedPrecomputedBandit, PrecomputedFlag, Variation } from '../interfaces'; import { Attributes, ContextAttributes, FlagKey } from '../types'; import { IAssignmentDetails } from './eppo-client'; export interface Subject { subjectKey: string; subjectAttributes: Attributes | ContextAttributes; } export type PrecomputedFlagsRequestParameters = { apiKey: string; sdkVersion: string; sdkName: string; baseUrl?: string; requestTimeoutMs?: number; pollingIntervalMs?: number; numInitialRequestRetries?: number; numPollRequestRetries?: number; pollAfterSuccessfulInitialization?: boolean; pollAfterFailedInitialization?: boolean; throwOnFailedInitialization?: boolean; skipInitialPoll?: boolean; }; interface EppoPrecomputedClientOptions { precomputedFlagStore: IConfigurationStore; precomputedBanditStore?: IConfigurationStore; overrideStore?: ISyncStore; subject: Subject; banditActions?: Record>; requestParameters?: PrecomputedFlagsRequestParameters; } export default class EppoPrecomputedClient { private readonly queuedAssignmentEvents; private readonly banditEventsQueue; private assignmentLogger?; private banditLogger?; private banditAssignmentCache?; private assignmentCache?; private requestPoller?; private requestParameters?; private subject; private banditActions?; private precomputedFlagStore; private precomputedBanditStore?; private overrideStore?; constructor(options: EppoPrecomputedClientOptions); fetchPrecomputedFlags(): Promise; stopPolling(): void; private getPrecomputedAssignment; /** * Maps a subject to a string variation for a given experiment. * * @param flagKey feature flag identifier * @param defaultValue default value to return if the subject is not part of the experiment sample * @returns a variation value if a flag was precomputed for the subject, otherwise the default value * @public */ getStringAssignment(flagKey: string, defaultValue: string): string; /** * Maps a subject to a boolean variation for a given experiment. * * @param flagKey feature flag identifier * @param defaultValue default value to return if the subject is not part of the experiment sample * @returns a variation value if a flag was precomputed for the subject, otherwise the default value * @public */ getBooleanAssignment(flagKey: string, defaultValue: boolean): boolean; /** * Maps a subject to an integer variation for a given experiment. * * @param flagKey feature flag identifier * @param defaultValue default value to return if the subject is not part of the experiment sample * @returns a variation value if a flag was precomputed for the subject, otherwise the default value * @public */ getIntegerAssignment(flagKey: string, defaultValue: number): number; /** * Maps a subject to a numeric (floating point) variation for a given experiment. * * @param flagKey feature flag identifier * @param defaultValue default value to return if the subject is not part of the experiment sample * @returns a variation value if a flag was precomputed for the subject, otherwise the default value * @public */ getNumericAssignment(flagKey: string, defaultValue: number): number; /** * Maps a subject to a JSON object variation for a given experiment. * * @param flagKey feature flag identifier * @param defaultValue default value to return if the subject is not part of the experiment sample * @returns a parsed JSON object if a flag was precomputed for the subject, otherwise the default value * @public */ getJSONAssignment(flagKey: string, defaultValue: object): object; getBanditAction(flagKey: string, defaultValue: string): Omit, 'evaluationDetails'>; private getPrecomputedFlag; private getObfuscatedFlag; private getPrecomputedBandit; private getObfuscatedPrecomputedBandit; isInitialized(): boolean; setAssignmentLogger(logger: IAssignmentLogger): void; setBanditLogger(logger: IBanditLogger): void; /** * Assignment cache methods. */ disableAssignmentCache(): void; useNonExpiringInMemoryAssignmentCache(): void; useLRUInMemoryAssignmentCache(maxSize: number): void; useCustomAssignmentCache(cache: AssignmentCache): void; private flushQueuedEvents; private logAssignment; private logBanditAction; private buildLoggerMetadata; setOverrideStore(store: ISyncStore): void; unsetOverrideStore(): void; } export {}; //# sourceMappingURL=eppo-precomputed-client.d.ts.map