import { F as File, L as LocalMetaStorageOptions, i as BaseStorageOptions, M as MetaStorage, 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 { L as LocalMetaStorage } from "../../packem_shared/local-meta-storage.d-CYWYyCUo.js"; import { Readable } from 'node:stream'; import 'node:timers'; import 'node:crypto'; import 'node:http'; import 'lru-cache'; declare class BunS3File extends File { /** * ETag reported by the S3-compatible backend (when present on the * stored object). */ bunS3ETag?: string; /** * Object key within the bucket. */ bunS3Key?: string; } declare class BunS3MetaStorage extends LocalMetaStorage { constructor(config?: LocalMetaStorageOptions); } /** * Object metadata returned by `Bun.S3Client.stat` / `S3File.stat`. */ interface BunS3Stat { etag?: string; lastModified?: Date; size: number; type?: string; } /** * Options accepted by `S3File.presign` / `S3Client.presign`. */ interface BunS3PresignOptions { acl?: string; contentDisposition?: string; expiresIn?: number; method?: "DELETE" | "GET" | "HEAD" | "POST" | "PUT"; type?: string; } /** * Acceptable upload bodies for `Bun.S3Client.write` / `S3File.write`. */ type BunS3WriteData = ArrayBuffer | Blob | ReadableStream | Response | string | Uint8Array; /** * Structural view of a Bun `S3File` reference. Declared locally so the * adapter type-checks under Node (where the `Bun` global is absent) while * still binding to the real runtime object. */ interface BunS3FileRef { arrayBuffer: () => Promise; delete: () => Promise; exists: () => Promise; presign: (options?: BunS3PresignOptions) => string; slice: (start: number, end?: number) => BunS3FileRef; stat: () => Promise; stream: () => ReadableStream; write: (data: BunS3WriteData, options?: { type?: string; }) => Promise; } /** * One entry of a `Bun.S3Client.list` response. */ interface BunS3ListEntry { eTag?: string; key?: string; lastModified?: Date | string; size?: number; } /** * Structural view of `Bun.S3Client`. Either pass a real instance via * `client`, or run under Bun and let the adapter construct one. */ interface BunS3ClientLike { delete: (key: string) => Promise; exists: (key: string) => Promise; file: (key: string) => BunS3FileRef; list: (input?: { continuationToken?: string; maxKeys?: number; prefix?: string; startAfter?: string; }) => Promise<{ contents?: BunS3ListEntry[]; isTruncated?: boolean; nextContinuationToken?: string; }>; presign: (key: string, options?: BunS3PresignOptions) => string; stat: (key: string) => Promise; write: (key: string, data: BunS3WriteData, options?: { type?: string; }) => Promise; } interface BunS3StorageOptions extends BaseStorageOptions { /** * S3 access key ID. Falls back to Bun's own env resolution * (`S3_ACCESS_KEY_ID`, then `AWS_ACCESS_KEY_ID`). Ignored when `client` * is supplied. */ accessKeyId?: string; /** * Canned ACL applied to uploads (e.g. `"public-read"`). Passed through * to Bun's S3 client. */ acl?: string; /** * S3 bucket name. Falls back to Bun's env resolution (`S3_BUCKET`, then * `AWS_BUCKET`). Ignored when `client` is supplied. */ bucket?: string; /** * Pre-built `Bun.S3Client` (or `Bun.s3` singleton). Use this to share an * instance or inject a test stub. Mutually exclusive with the inline * credential options. */ client?: BunS3ClientLike; /** * Custom S3-compatible endpoint. Falls back to Bun's env resolution * (`S3_ENDPOINT`, then `AWS_ENDPOINT`). Ignored when `client` is * supplied. */ endpoint?: string; /** * Configure metafiles storage for resumable-upload bookkeeping. */ metaStorageConfig?: LocalMetaStorageOptions; /** * S3 region. Falls back to Bun's env resolution (`S3_REGION`, then * `AWS_REGION`). Ignored when `client` is supplied. */ region?: string; /** * S3 secret access key. Falls back to Bun's env resolution * (`S3_SECRET_ACCESS_KEY`, then `AWS_SECRET_ACCESS_KEY`). Ignored when * `client` is supplied. */ secretAccessKey?: string; /** * Temporary session token for STS credentials. Ignored when `client` is * supplied. */ sessionToken?: string; /** * Use virtual-hosted-style addressing (`https://<bucket>.<host>/...`). * Ignored when `client` is supplied. */ virtualHostedStyle?: boolean; } /** * Bun-native S3 storage backend, backed by `Bun.S3Client` instead of the AWS * SDK. Use this when you are already running on Bun and want to skip the AWS * SDK dependency. * * Limitations (inherent to `Bun.S3Client`, which exposes no low-level * multipart or server-side copy primitives): * * - No resumable / TUS multipart protocol. Each `write` uploads the supplied body in one shot (Bun handles large-object chunking internally). For resumable uploads use the `aws` or `aws-light` provider. * - `copy` / `move` are client-side read-then-write — Bun has no server-side `CopyObject`. * - `getUploadUrl` returns a presigned `PUT`; a `contentLength` cap cannot be enforced (Bun presign has no max-size policy) and is ignored. * - ⚠️ Per-operation `signal`/`timeout` are best-effort: the underlying SDK does not support request cancellation, so an in-flight call may complete server-side even after abort. `retries` is honored. */ declare class BunS3Storage extends BaseStorage { static override readonly name: string; protected meta: MetaStorage; private readonly client; constructor(config: BunS3StorageOptions); override get raw(): BunS3ClientLike; create(config: FileInit, _options?: OperationOptions): Promise; write(part: BunS3File | FilePart | FileQuery, options?: OperationOptions): Promise; delete({ id }: FileQuery, options?: OperationOptions): Promise; get({ id }: FileQuery, options?: OperationOptions): Promise; override getStream({ id }: FileQuery, options?: OperationOptions): Promise<{ headers?: Record; size?: number; stream: Readable; }>; copy(name: string, destination: string, options?: OperationOptions & { storageClass?: string; }): Promise; move(name: string, destination: string, options?: OperationOptions): Promise; override list(limit?: number, options?: OperationOptions): Promise; override getReadUrl(key: string, options?: { expiresIn?: number; responseContentDisposition?: string; responseContentType?: string; }): Promise; override getUploadUrl(key: string, options?: { contentLength?: number; contentType?: string; expiresIn?: number; }): Promise; private internalOnComplete; } export { type BunS3ClientLike, BunS3File, BunS3MetaStorage, BunS3Storage, type BunS3StorageOptions };