/** * Store user-generated media (photos, audio, docs) in R2 with a predictable * key scheme and public URL. * * Distinct from `R2Cache` (which caches framework-generated TTS output keyed * by a hash): this class handles inbound media the bot receives from users or * external sources, keyed by (scope, id) so each conversation's uploads are * isolated and easy to enumerate. * * store.upload({ scope: '5511999999999', id: 'wamid.abc', body, contentType }) * → { key: '5511999999999/wamid.abc', url: 'https://cdn.example.com/5511999999999/wamid.abc' } * * If `publicHost` is empty, `url` returns the key alone (consumers can compose * their own URL — e.g. a Worker route that streams the R2 object). */ export interface R2MediaStoreOptions { bucket: R2Bucket; /** Public host that serves `bucket` — e.g. `https://cdn.example.com`. Trailing slash optional. */ publicHost?: string; /** * Filename appended after `//`. Defaults to just `/` (no filename segment). * Set (e.g.) `'photo.jpg'` if you want a stable extension for CDN sniffing. */ fileSuffix?: string; } export interface UploadArgs { scope: string; id: string; body: ArrayBuffer | Uint8Array | Blob | ReadableStream; contentType?: string; metadata?: Record; } export interface UploadResult { key: string; url: string; } export declare class R2MediaStore { private readonly bucket; private readonly publicHost; private readonly fileSuffix; constructor(opts: R2MediaStoreOptions); buildKey(scope: string, id: string): string; buildUrl(key: string): string; upload({ scope, id, body, contentType, metadata }: UploadArgs): Promise; delete(key: string): Promise; } //# sourceMappingURL=r2_media_store.d.ts.map