/** * ToonDB Analytics - Anonymous usage tracking with PostHog * * This module provides anonymous, privacy-respecting analytics to help * improve ToonDB. All tracking can be disabled by setting: * * TOONDB_DISABLE_ANALYTICS=true * * No personally identifiable information (PII) is collected. Only aggregate * usage patterns are tracked to understand: * - Which features are most used * - Performance characteristics * - Error patterns for debugging * * Copyright 2025 Sushanth (https://github.com/sushanthpy) * Licensed under the Apache License, Version 2.0 */ /** * Check if analytics is disabled via environment variable. * * Analytics is disabled when TOONDB_DISABLE_ANALYTICS is set to 'true', '1', 'yes', or 'on'. * * @returns true if analytics is disabled */ export declare function isAnalyticsDisabled(): boolean; export interface EventProperties { [key: string]: string | number | boolean | null | undefined; } /** * Capture an analytics event. * * This function is a no-op if: * - TOONDB_DISABLE_ANALYTICS=true * - posthog-node package is not installed * - Any error occurs (fails silently) * * @param event - Event name (e.g., "database_opened", "vector_search") * @param properties - Optional event properties * @param distinctId - Optional distinct ID (defaults to anonymous machine ID) */ export declare function capture(event: string, properties?: EventProperties, distinctId?: string): Promise; /** * Capture an error event for debugging. * * Only sends static information - no dynamic error messages. * * @param errorType - Static error category (e.g., "connection_error", "query_error", "timeout_error") * @param location - Static code location (e.g., "database.open", "query.execute", "transaction.commit") * @param properties - Optional additional static properties only * * @example * ```typescript * captureError('connection_error', 'database.open'); * captureError('query_error', 'sql.execute', { query_type: 'SELECT' }); * ``` */ export declare function captureError(errorType: string, location: string, properties?: EventProperties): Promise; /** * Flush any pending events and shutdown the client. */ export declare function shutdown(): Promise; /** * Track database open event. */ export declare function trackDatabaseOpen(dbPath: string, mode?: string): Promise; //# sourceMappingURL=analytics.d.ts.map