import { LogDestination } from './debugLog.js'; import { MetadataTask, Logger } from './types.js'; declare const QueueType: { readonly AUTODETECT: "AUTODETECT"; readonly IN_MEMORY: "IN_MEMORY"; readonly PERSISTENT: "PERSISTENT"; }; /** * Executes and compiles metadata tasks into a single metadata object. * * When initializing `lo_event`, clients can set which metadata items * they wish to include. */ declare function compileMetadata(metadataTasks: MetadataTask[]): Promise[]>; /** * Set specific key/value pairs using the `lock_fields` * event. We use this to set specific fields that we want * included overall for subsequent events to prevent * sending the same information in each event. * * This is useful for items such as `source` and `version` * which should be the same for every event. * * This function works even after we are initialized and * processing items from the queue (INIT_STATES.READY). * * Each individual logger should keep track of state and * handle their respecitive reconnects properly. */ declare function lockFields(data: Record[]): void; /** * Total enqueued-but-unacked events across all ack-aware loggers (currently * websocketLogger). Zero means every event has been durably acknowledged by * the server — the precise "is anything unsaved?" signal for a beforeunload * warning, replacing the blob-based heuristic. Loggers without ack support * (which confirm on send) contribute zero. */ declare function unackedCount(): Promise; declare function init(source: string, version: string, loggers: Logger[], { debugLevel, debugDest, useDisabler, queueType, sendBrowserInfo, verboseEvents, metadata, }?: { debugLevel?: string | undefined; debugDest?: LogDestination[] | undefined; useDisabler?: boolean | undefined; queueType?: string | undefined; sendBrowserInfo?: boolean | undefined; verboseEvents?: boolean | undefined; metadata?: MetadataTask[] | undefined; }): void; /** * Begin dequeuing and streaming events. * * This should be called after init() and any preauth lockFields() * calls. Source/version and metadata are sent here so that preauth * fields (set between init() and go()) are transmitted first. * * Typical usage: * lo_event.init(source, version, loggers, options); * lo_event.lockFields([{ preauth_type: 'test' }]); // sent first * lo_event.lockFields([{ postauth: 'data' }]); // sent second * lo_event.go(); // source/version sent here, then streaming begins */ declare function go(): void; declare function logEvent(eventType: string, event: Record): void; /** * We would like to be able to log events roughly following the xAPI * conventions (and possibly Caliper conventions). This allows us to * explicitly structure events with the same fields as xAPI, and * might have validation logic in the future. However, we have not * figured out the best way to do this, so please treath this as * stub / in-progress code. * * In the long term, we'd like to be as close to standards as possible. */ declare function logXAPILite({ verb, object, result, context, attachments }: { verb: string; object?: unknown; result?: unknown; context?: unknown; attachments?: unknown; }): void; export { QueueType, compileMetadata, go, init, lockFields, logEvent, logXAPILite, unackedCount };