UNPKG

bear-tracker

Version:

Lightweight bot detection middleware for tracking AI crawler visits (OpenAI, ChatGPT, etc.) with API support and analytics

13 lines 806 B
import { BotInfo, BotTrackerOptions, MiddlewareFunction, NextRequestLike } from './types'; export declare class BotTracker { private logger; private options; constructor(options?: BotTrackerOptions); middleware(): MiddlewareFunction; static createQuickTracker(logLevel?: 'info' | 'warn' | 'error'): MiddlewareFunction; static createCustomTracker(customLogger: (botInfo: BotInfo) => void): MiddlewareFunction; static createApiTracker(apiUrl: string, apiKey: string, logLevel?: 'info' | 'warn' | 'error'): (request: any, response?: any, next?: any) => Promise<any>; static createNextMiddleware(apiUrl: string, apiKey: string): (request: NextRequestLike) => Promise<any>; static detectBotFromUserAgent(userAgent: string): BotInfo; } //# sourceMappingURL=middleware.d.ts.map