import { F as File, u as MetaStorageOptions, M as MetaStorage, i as BaseStorageOptions, d as FileInit, O as OperationOptions, e as FilePart, f as FileQuery, g as FileReturn, B as BaseStorage } from "../../packem_shared/storage.d-C9EdfTf1.js"; import { Readable } from 'node:stream'; import 'node:timers'; import 'node:crypto'; import 'node:http'; import 'lru-cache'; /** * Map-backed metadata storage used by {@link MemoryStorage}. Holds a deep-copied * snapshot of each `File` so callers can mutate the returned object without leaking * back into the backing store. */ declare class MemoryMetaStorage extends MetaStorage { private readonly store; constructor(config?: MetaStorageOptions & { store?: Map; }); override save(id: string, file: T): Promise; override get(id: string): Promise; override delete(id: string): Promise; override touch(id: string, file: T): Promise; /** Reset the in-memory metadata. Test/reset helper. */ clear(): void; } /** * Public options for {@link MemoryStorage}. The `initial` record lets tests seed the * store with a few key→bytes pairs; pass `metaStorage` to share metadata with another * `Files` instance (rarely needed — the memory adapter is meant to be ephemeral). */ interface MemoryStorageOptions extends BaseStorageOptions { /** Pre-populate the store with these key → bytes entries. */ initial?: Record; metaStorageConfig?: MetaStorageOptions; } /** * Stored entry in the backing {@link Map}. `bytes` is the raw payload; `meta` is a * lightweight per-key metadata snapshot so {@link MemoryStorage.list} and * `head` can answer without dragging the file class around. */ interface MemoryEntry { bytes: Buffer; contentType: string; createdAt: string; eTag: string; metadata: Record; modifiedAt: string; } /** * In-memory storage adapter backed by a {@link Map}. * * Implements the full {@link BaseStorage} surface without touching disk or any * external service — useful for tests, ephemeral environments, and as a * reference implementation. `raw` returns the backing map so tests can inspect * or reset state directly: * * ```ts * const storage = new MemoryStorage({ initial: { "users/1.json": '{"id":1}' } }); * storage.raw.clear(); * ``` * * Metadata is shallow-cloned on both write and read so callers never share a * mutable object with the store. */ declare class MemoryStorage extends BaseStorage { static override readonly name: string; override checksumTypes: string[]; override readonly supportsRange: boolean; meta: MemoryMetaStorage; private readonly store; constructor(config?: MemoryStorageOptions); override get raw(): Map; create(fileInit: FileInit, _options?: OperationOptions): Promise; write(part: FilePart | FileQuery, _options?: OperationOptions): Promise; get({ id }: FileQuery, _options?: OperationOptions & { range?: { end?: number; start: number; }; }): Promise; override getStream({ id }: FileQuery, _options?: OperationOptions & { range?: { end?: number; start: number; }; }): Promise<{ headers?: Record; size?: number; stream: Readable; }>; override exists({ id }: FileQuery): Promise; delete({ id }: FileQuery): Promise; copy(source: string, destination: string): Promise; move(source: string, destination: string): Promise; override list(): Promise; override getReadUrl(key: string): Promise; override getUploadUrl(key: string): Promise; } export { MemoryMetaStorage, MemoryStorage, type MemoryStorageOptions, MemoryStorage as default };