/** * Short URL Repository * * Data access layer for URL shortening. * Extends BaseRepository from @plyaz/db for consistent CRUD operations. * * @example * ```typescript * // Use with StorageBackedUrlShortener * const shortener = new StorageBackedUrlShortener({ * baseUrl: 'https://s.example.com', * storage: ShortUrlRepository.createStorage(), * }); * * // Or use repository directly for queries * const repo = ShortUrlRepository.create(); * const topUrls = await repo.findTopClicked(10); * ``` */ import { BaseRepository } from '@plyaz/db'; import type { DatabaseResult, PaginatedResult, QueryOptions, DatabaseServiceInterface, OperationConfig } from '@plyaz/types/db'; import type { UrlShortenerStorage, UrlAnalytics } from '@plyaz/types/notifications'; export interface ShortUrlDatabaseRow extends Record { short_code: string; original_url: string; created_at: string; expires_at: string | null; click_count: number; last_clicked_at: string | null; metadata: Record | null; } export declare class ShortUrlRepository extends BaseRepository { constructor(db: DatabaseServiceInterface); static create(): ShortUrlRepository; /** * Create UrlShortenerStorage-compatible interface for StorageBackedUrlShortener */ static createStorage(): UrlShortenerStorage; findMany(options?: QueryOptions, config?: OperationConfig): Promise>>; create(data: Partial, config?: OperationConfig): Promise>; store(shortCode: string, originalUrl: string, options?: { expiresAt?: number; metadata?: Record; }): Promise; retrieve(shortCode: string): Promise; incrementClicks(shortCode: string): Promise; getAnalytics(shortCode: string): Promise; cleanup(): Promise; findByOriginalUrl(originalUrl: string): Promise>; findTopClicked(limit?: number): Promise>>; } //# sourceMappingURL=ShortUrlRepository.d.ts.map