import FMCStore from "./store.js"; declare const origFetch: typeof fetch; /** * A runtime interface with the required subset of built-in runtime functions * needed for fech-mock-cache, e.g. `env`, `sha256`, `fs`, `path`, `cwd`. */ export interface Runtime { name: string; env: Record; sha256(input: string, length?: number): Promise; fs: { readFile(path: string): Promise; writeFile(path: string, content: string): Promise; mkdir(path: string, options: { recursive?: boolean; }): Promise; }; path: { join(...paths: string[]): string; }; cwd: () => string; } /** * Options to control the behaviour of the `fetch()` calls. * Can be passed with experimental fetch._once(options). */ export interface FetchCacheOptions { id?: string; } /** * Function signature for the created `fetch` / `fetchCache` function. * Used to make sure the runtime implementation is compliant. */ export interface FetchCache { (urlOrRequest: string | Request | URL | undefined, options: RequestInit | undefined): Promise; runtime: Runtime; _options?: FetchCacheOptions | FetchCacheOptions[]; _store?: FMCStore; _once: (options: FetchCacheOptions) => void; } /** * Options for `createFetchCache`. `Store` is required. `runtime` is * generally passed automatically by each runtime entry point. `fetch` * is optional and defaults to the built-in `fetch` as available at * module load time. */ export interface CreateFetchCacheOptions { runtime: Runtime; Store?: typeof FMCStore | [typeof FMCStore, Record]; fetch?: typeof origFetch; } /** * Creates a new caching fetch implementation. Generally not used directly, * instead use the same named function provided by the various run-time entry * points. */ export default function createCachingMock({ Store, fetch, runtime, }: CreateFetchCacheOptions): FetchCache; export {};