@optimizely/optimizely-sdk
Version:
JavaScript SDK for Optimizely Feature Experimentation, Optimizely Full Stack (legacy), and Optimizely Rollouts
64 lines (63 loc) • 2.36 kB
TypeScript
/**
* Copyright 2022-2024, Optimizely
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { OdpEvent } from './odp_event';
import { OdpIntegrationConfig } from '../odp_config';
import { OdpEventApiManager } from './odp_event_api_manager';
import { BaseService, Service, StartupLog } from '../../service';
import { BackoffController, Repeater } from '../../utils/repeater/repeater';
import { Producer } from '../../utils/type';
import { LoggerFacade } from '../../logging/logger';
import { Platform } from '../../platform_support';
export interface OdpEventManager extends Service {
updateConfig(odpIntegrationConfig: OdpIntegrationConfig): void;
sendEvent(event: OdpEvent): void;
setLogger(logger: LoggerFacade): void;
flushImmediately(): Promise<unknown>;
}
export type RetryConfig = {
maxRetries: number;
backoffProvider: Producer<BackoffController>;
};
export type OdpEventManagerConfig = {
repeater: Repeater;
apiManager: OdpEventApiManager;
batchSize: number;
startUpLogs?: StartupLog[];
retryConfig: RetryConfig;
};
export declare const LOGGER_NAME = "OdpEventManager";
export declare class DefaultOdpEventManager extends BaseService implements OdpEventManager {
private queue;
private repeater;
private odpIntegrationConfig?;
private apiManager;
private batchSize;
private retryConfig;
constructor(config: OdpEventManagerConfig);
setLogger(logger: LoggerFacade): void;
private executeDispatch;
private flush;
start(): void;
makeDisposable(): void;
updateConfig(odpIntegrationConfig: OdpIntegrationConfig): void;
private goToRunningState;
flushImmediately(): Promise<unknown>;
stop(): void;
sendEvent(event: OdpEvent): void;
private isDataValid;
private processEvent;
}
export declare const __platforms: Platform[];