import type { EvaluationContext, FlagValue, Hook, Logger, Provider, ResolutionDetails, TrackingEventDetails } from '@openfeature/web-sdk'; import { OpenFeatureEventEmitter } from '@openfeature/web-sdk'; import type { GoFeatureFlagWebProviderOptions } from './model'; export declare class GoFeatureFlagWebProvider implements Provider { metadata: { name: string; }; events: OpenFeatureEventEmitter; hooks?: Hook[]; private readonly _websocketPath; private _logger?; private readonly _endpoint; private readonly _apiTimeout; private readonly _apiKey; private readonly _retryInitialDelay; private readonly _retryDelayMultiplier; private readonly _maxRetries; private _websocket?; private _flags; private _keepAliveInterval?; private readonly _keepAliveIntervalMs; private readonly _collectorManager; private readonly _dataCollectorHook; private readonly _disableDataCollection; constructor(options: GoFeatureFlagWebProviderOptions, logger?: Logger); initialize(context: EvaluationContext): Promise; /** * connectWebsocket is starting the websocket and associate some handler * to react if the state of the websocket change. */ connectWebsocket(): Promise; /** * waitWebsocketFinalStatus is waiting synchronously for the websocket to be in a stable * state (CLOSED or OPEN). * @param socket - the websocket you are waiting for */ waitWebsocketFinalStatus(socket: WebSocket): Promise; onClose(): Promise; onContextChange(_: EvaluationContext, newContext: EvaluationContext): Promise; resolveNumberEvaluation(flagKey: string): ResolutionDetails; resolveObjectEvaluation(flagKey: string): ResolutionDetails; resolveStringEvaluation(flagKey: string): ResolutionDetails; resolveBooleanEvaluation(flagKey: string): ResolutionDetails; /** * Track allows to send tracking events to a tracking exporter. * * Warning: Note that you need to have a relay proxy with version 1.45.0 or upper to use this feature. * If you are using a version lower than 1.45.0, the events may look weird in your exporter. * * @param trackingEventName * @param context * @param trackingEventDetails */ track(trackingEventName: string, context: EvaluationContext, trackingEventDetails: TrackingEventDetails): void; /** * extract flag names from the websocket answer */ private extractFlagNamesFromWebsocket; /** * reconnectWebsocket is using an exponential backoff pattern to try to restart the connection * to the websocket. */ private reconnectWebsocket; private evaluate; private retryFetchAll; /** * fetchAll is a function that is calling GO Feature Flag to bulk evaluate flags. * It emits an event to notify when it is ready or on error. * * @param context - The static evaluation context * @param flagsChanged - The list of flags update - default: [] * @private */ private fetchAll; /** * handleFetchErrors is a function that take care of the errors that can be thrown * inside the FetchAll method. * * @param error - The error thrown * @private */ private handleFetchErrors; /** * Start keep-alive mechanism to prevent websocket timeouts * Sends periodic ping messages to keep the connection alive */ private startKeepAlive; /** * Stop keep-alive mechanism */ private stopKeepAlive; }