import type { ItemEvent, StreamEvent } from "@contfu/connect"; import type { FileStore } from "./domain/files.js"; import type { ClientI18nConfig } from "./domain/i18n.js"; import type { MediaMasterConfig, MediaOptimizer, MediaVariants, TransformMediaRule } from "./domain/media.js"; import type { QueryLocale, TypedContfuClient } from "./domain/query-types.js"; import { withDatabase } from "./infra/db/db.js"; export type ContfuOptions = { /** Read local content without opening a sync connection, even when a key is configured. */ offline?: boolean; fileStore?: FileStore; mediaOptimizer?: MediaOptimizer; /** Sync-time media conversion rules (format constraints, include/exclude filters). */ transformMedia?: TransformMediaRule[]; /** Named variant presets for on-demand serving and optional sync-time pre-generation. */ mediaVariants?: MediaVariants; /** Canonical local masters for reprocessing without redownloading. Default: enabled. */ mediaMaster?: false | MediaMasterConfig; /** Authentication key. Falls back to process.env.CONTFU_KEY. */ key?: string; /** Cache optimized file variants in the database. Default: true */ cacheOptimizedFiles?: boolean; /** Localize remote files into Contfu storage. Default: true */ localFiles?: boolean; /** Base path used when resolving internal file metadata URLs. Default: /files */ filesBasePath?: string; /** Number of concurrent media download/processing jobs. Default: 2 */ mediaQueueConcurrency?: number; /** Optional app-level i18n overrides. DB config remains the source of truth. */ i18n?: ClientI18nConfig>; /** Database used by this instance's background sync worker. */ database?: Parameters[0]; }; export type SyncEvent = ItemEvent | StreamEvent; export type ContfuInstance = { query: TypedContfuClient; fileStore: FileStore; events: AsyncIterable; handleFileRequest(request: Request, filePath: string): Promise; }; export declare function contfu(options?: ContfuOptions): ContfuInstance;