/** The storage contract, declared here rather than imported from `@eponyme/storage`. */ export interface EponymeStoragePutMeta { contentType: string; size: number; } export interface EponymeStorageUrlOptions { expiresIn?: number; download?: string; } export interface EponymeStorageListOptions { limit?: number; cursor?: string; delimiter?: string; } export interface EponymeStorageObject { key: string; size: number; lastModified: Date; } export interface EponymeStorageListResult { objects: EponymeStorageObject[]; prefixes: string[]; cursor?: string; } export interface EponymeStorageDriver { put(key: string, data: ReadableStream | Uint8Array, meta: EponymeStoragePutMeta): Promise; get(key: string): Promise>; delete(key: string): Promise; stat(key: string): Promise; list(prefix?: string, options?: EponymeStorageListOptions): Promise; move(from: string, to: string, meta: EponymeStoragePutMeta): Promise; url(key: string, opts?: EponymeStorageUrlOptions): Promise; presignPut?(key: string, meta: EponymeStoragePutMeta): Promise<{ url: string; method: 'PUT'; headers: Record; }>; } export interface EponymeStorageFactoryContext { credentials?: { accessKeyId: string; secretAccessKey: string; sessionToken?: string; }; } export type EponymeStorageFactory = (context: EponymeStorageFactoryContext) => EponymeStorageDriver | Promise; /** One entry of the media library, as the dashboard receives it. */ export interface EponymeMediaItem { key: string; /** What a page renders; either a public URL or a signed one, depending on the driver. */ url: string; size: number; /** ISO 8601, because the value crosses the JSON boundary. */ lastModified: string; contentType: string; /** Text alternative, size and focal point recorded for an image, when there are any. */ meta?: EponymeMediaMeta; } /** * What the library remembers about an image, so picking it again does not mean describing it again. Kept * next to the object, as `.eponyme.json`, which needs no table and survives a bucket copied elsewhere. */ export interface EponymeMediaMeta { alt?: string; caption?: string; width?: number; height?: number; focal?: { x: number; y: number; }; }