@optimizely/js-sdk-event-processor
Version:
Optimizely Full Stack Event Processor
35 lines (34 loc) • 1.74 kB
TypeScript
/**
* Copyright 2019-2020, 2023 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
*
* http://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 { Managed } from './managed';
import { ConversionEvent, ImpressionEvent } from './events';
import { EventV1Request } from './eventDispatcher';
import { EventQueue, EventQueueSink } from './eventQueue';
import { NotificationCenter } from '@optimizely/js-sdk-utils';
export declare const DEFAULT_FLUSH_INTERVAL = 30000;
export declare const DEFAULT_BATCH_SIZE = 10;
export declare type ProcessableEvent = ConversionEvent | ImpressionEvent;
export declare type EventDispatchResult = {
result: boolean;
event: ProcessableEvent;
};
export interface EventProcessor extends Managed {
process(event: ProcessableEvent): void;
}
export declare function validateAndGetFlushInterval(flushInterval: number): number;
export declare function validateAndGetBatchSize(batchSize: number): number;
export declare function getQueue(batchSize: number, flushInterval: number, batchComparator: any, sink: EventQueueSink<ProcessableEvent>, closingSink?: EventQueueSink<ProcessableEvent>): EventQueue<ProcessableEvent>;
export declare function sendEventNotification(notificationCenter: NotificationCenter | undefined, event: EventV1Request): void;