import { F as File, s as MetaStorageOptions, M as MetaStorage, S as StoredObject, C as ConditionalSupport, f as BaseStorageOptions, e as FileInit, g as ConditionalOptions, O as OperationOptions, h as FilePart, i as FileQuery, c as FileReturn, j as CopyConditionalOptions, B as BaseStorage } from "../../packem_shared/storage.d-Cnjmzau5.js"; import { Readable } from 'node:stream'; import "../../packem_shared/types.d-DFh9698o.js"; 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 { override readonly supportsConditionalSave: boolean; private readonly store; constructor(config?: MetaStorageOptions & { store?: Map; }); override save(id: string, file: T): Promise; override saveIfVersion(id: string, file: T, version: string): Promise; override get(id: string): Promise; override list(): 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 readonly storageKind: string; protected override statObject(id: string): Promise; /** No checksum is verified against the written bytes, so none is advertised. */ override checksumTypes: string[]; override readonly supportsRange: boolean; /** Every predicate is checked and applied in one synchronous step, so no other call interleaves. */ override readonly conditionalSupport: ConditionalSupport; meta: MemoryMetaStorage; private readonly store; constructor(config?: MemoryStorageOptions); override get raw(): Map; create(fileInit: FileInit, options?: ConditionalOptions & OperationOptions): Promise; write(part: FilePart | FileQuery, options?: ConditionalOptions & OperationOptions): Promise; get({ id }: FileQuery, options?: ConditionalOptions & 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, options?: ConditionalOptions & OperationOptions): Promise; copy(source: string, destination: string, options?: CopyConditionalOptions & OperationOptions): Promise; move(source: string, destination: string): Promise; /** * Writes `incoming` at `part.start` and saves the metadata; call with the id's lock held. A * `conditional` upload replaces the object wholesale once its predicate holds. */ private storeBytes; /** The stored entry is authoritative: a record may outlive its bytes. */ protected override currentETag(file: TFile): Promise; override list(): Promise; override getReadUrl(key: string): Promise; override getUploadUrl(key: string): Promise; } export { MemoryMetaStorage, MemoryStorage, type MemoryStorageOptions, MemoryStorage as default };