import type { DB } from '../db/client.js'; export interface UsageCounterOptions { db: DB; } export declare class UsageCounter { readonly db: DB; constructor({ db }: UsageCounterOptions); /** * Record a usage event. `key` is an optional content identifier (e.g. the * verse you generated an image for) — useful for analytics and dedup. */ record(whatsapp: string, feature: string, key?: string | null): Promise; getDailyCount(whatsapp: string, feature: string): Promise; getLifetimeCount(whatsapp: string, feature: string): Promise; /** * Atomic check-and-record: if the user is under `dailyMax` for this feature, * record a usage event and return true. Otherwise return false. * * This is best-effort (D1 doesn't support row-level locks); two concurrent * calls could race past the cap by 1. For most chat apps that's acceptable. */ tryRecordWithCap(whatsapp: string, feature: string, dailyMax: number, key?: string | null): Promise; /** * @returns count of distinct users who used `feature` since `sinceHoursAgo` ago (default 24h). */ distinctUsersSince(feature: string, { sinceHoursAgo }?: { sinceHoursAgo?: number; }): Promise; } //# sourceMappingURL=usage_counter.d.ts.map