import { SourceConfigResolver as Resolver } from "../SourceConfigResolver.js"; import type { StorageRepository } from "./StorageRepository.js"; /** * FetchRepository: A browser-compatible StorageRepository implementation. * * This implementation uses `fetch()` to load files under a public directory. * * ⚠ Write, delete, and full file listing are not supported in browser environments. */ export declare class FetchRepository implements StorageRepository { baseUrl: string; resolver?: Resolver; private preferGzip; /** * @param baseUrl - Base URL for fetching files. * @param options.preferGzip - If true, tries fetching .gz version first and decompresses. Defaults to false. */ constructor(baseUrl?: string, options?: { preferGzip?: boolean; }); setResolver(resolver: Resolver): void; /** * Reads a file from the public directory using fetch. * * @param path - Relative path from base URL. * @returns The file contents as text. * @throws If fetch fails or response is not OK. */ readFile(path: string): Promise; /** * Checks if a file exists by sending a HEAD request. * * @param path - Relative path from base URL. * @returns True if the file is accessible; false otherwise. */ exists(path: string): Promise; /** * Retrieves a list of file paths matching a pattern. * * This works by: * - Inferring the source name from the pattern. * - Using the resolved source config to locate the slug index file. * - Converting slugs to full paths using the resolver. * * @param pattern - A glob-style pattern like "herbs/*.md" or "states.yaml". * @returns List of matching file paths (relative to base). */ listFiles(pattern: string): Promise; /** * Not supported in browser. */ writeFile(path: string, data: Uint8Array | string): Promise; /** * Not supported in browser. */ removeFile(path: string): Promise; /** * Not supported in browser. */ removeDir(path: string): Promise; /** * Internal helper to fetch a JSON index file (typically a list of slugs). * * @param indexPath - Relative or absolute path to index file. * @returns Parsed slug list or empty array on failure. */ private fetchIndexFile; /** * Opens a file as a ReadableStream. * * @param path - Relative path to the file (from the repository base directory) * @returns Promise that resolves to a ReadableStream for the file contents */ openFileStream(path: string): Promise; /** * Remote (fetch-based) version of recursive prefix index traversal. */ private readAllIndexesRemote; private flatPrefixIndexLine; }