import type { GoFeatureFlagProviderOptions } from '../go-feature-flag-provider-options'; import type { GoFeatureFlagApi } from './api'; import type { Logger } from '@openfeature/server-sdk'; import { type ExportEvent } from '../model'; /** * EventPublisher is used to collect events and publish them in batch before they are published. */ export declare class EventPublisher { /** The API used to communicate with the GO Feature Flag relay proxy. */ private readonly api; /** The options for the event publisher. */ private readonly options; /** The events to publish. */ private readonly events; /** The interval ID for the periodic runner. */ private intervalId?; /** Whether the event publisher is running. */ private isRunning; /** The logger to use for logging. */ private readonly logger?; /** * Initialize the event publisher with a specified publication interval. * @param {GoFeatureFlagApi} api - The API used to communicate with the GO Feature Flag relay proxy. * @param {GoFeatureFlagProviderOptions} options - The options to initialise the provider. * @throws {InvalidOptionsException} If api or options are null. */ constructor(api: GoFeatureFlagApi, options: GoFeatureFlagProviderOptions, logger?: Logger); /** * Starts the periodic runner that publishes events. * @returns {Promise} A promise that resolves when the periodic runner has started. */ start(): Promise; /** * Runs the publisher and sets up a periodic runner. * @returns {Promise} A promise that resolves when the publisher has run. */ private runPublisher; /** * Stops the periodic runner that publishes events and flushes any remaining events. * @returns {Promise} A promise that resolves when the periodic runner has stopped and all events are published. */ stop(): Promise; /** * Add event for aggregation before publishing. If the max pending events is reached, events are published immediately. * @param {ExportEvent} eventToAdd - The event to add to the collection. * @returns {void} */ addEvent(eventToAdd: ExportEvent): void; /** * @private * Publishes the collected events to the GO Feature Flag relay proxy. * @returns {Promise} A promise that resolves when the events have been published. */ private publishEvents; }