/** * Media Variants Repository * * Data access layer for media_variants table. * Provides normalized storage for file variants (thumbnail, mobile, desktop, 4k). * * Use this repository when you need to: * - Query variants by name (e.g., "find all thumbnails") * - Query variants by dimensions * - Aggregate variant storage usage * - Clean up orphaned variants * * For simple variant access, use FilesDatabaseRow.variants JSONB column instead. */ import { BaseRepository } from '@plyaz/db'; import type { DatabaseResult, PaginatedResult, QueryOptions, DatabaseServiceInterface, OperationConfig } from '@plyaz/types/db'; import type { MediaVariantsDatabaseRow } from '@plyaz/types/core'; /** Standard variant names */ export declare const VARIANT_NAMES: { readonly THUMBNAIL: "thumbnail"; readonly MOBILE: "mobile"; readonly DESKTOP: "desktop"; readonly HD_4K: "4k"; }; export type VariantName = (typeof VARIANT_NAMES)[keyof typeof VARIANT_NAMES]; /** * Media Variants Repository * * Extends BaseRepository for normalized variant storage and querying. * * Inherited from BaseRepository (used directly): * - findById(id) - Get variant by ID * - delete(id) - Delete variant * - exists(id) - Check if variant exists * - query() - Fluent QueryBuilder * - count(filter) - Count variants * - findOne(filter) - Find single variant * * Domain-specific methods: * - findByMediaId(mediaId) - Get all variants for a media file * - findByVariantName(name) - Get all variants of a specific type * - findByMediaIdAndName(mediaId, name) - Get specific variant for a media file * - deleteByMediaId(mediaId) - Delete all variants for a media file * - getTotalSizeByMediaId(mediaId) - Get total storage size for a file's variants */ export declare class MediaVariantsRepository extends BaseRepository { constructor(db: DatabaseServiceInterface); /** * Create repository instance. * Uses DbService if initialized. */ static create(): MediaVariantsRepository; /** * Find multiple variants with default sorting */ findMany(options?: QueryOptions, config?: OperationConfig): Promise>>; /** * Create new variant record with auto-generated ID */ create(data: Partial, config?: OperationConfig): Promise>; /** * Find all variants for a media file */ findByMediaId(mediaId: string, options?: { limit?: number; offset?: number; }): Promise>>; /** * Find all variants of a specific type (e.g., all thumbnails) */ findByVariantName(variantName: VariantName | string, options?: { limit?: number; offset?: number; }): Promise>>; /** * Find a specific variant for a media file */ findByMediaIdAndName(mediaId: string, variantName: VariantName | string): Promise>; /** * Delete all variants for a media file */ deleteByMediaId(mediaId: string): Promise>; /** * Count variants for a media file */ countByMediaId(mediaId: string): Promise>; /** * Count all variants of a specific type */ countByVariantName(variantName: VariantName | string): Promise>; /** * Find variants by dimensions (useful for responsive queries) */ findByMinWidth(minWidth: number, options?: { limit?: number; offset?: number; }): Promise>>; /** * Upsert variant - create or update if exists */ upsert(mediaId: string, variantName: VariantName | string, data: Partial): Promise>; } //# sourceMappingURL=MediaVariantsRepository.d.ts.map