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 { StorageClient } from '@supabase/storage-js'; import 'node:stream'; import 'node:timers'; import 'node:crypto'; import 'node:http'; import 'lru-cache'; declare class SupabaseFile extends File { bucket?: string; path?: string; publicUrl?: string; } declare class SupabaseMetaStorage extends LocalMetaStorage { constructor(config?: LocalMetaStorageOptions); } interface SupabaseStorageOptions extends BaseStorageOptions { /** * Storage bucket name. Created in the Supabase dashboard. The adapter * does not create or delete buckets. */ bucket: string; /** * Pre-built `StorageClient` from `@supabase/storage-js`. Mutually * exclusive with `serviceKey` + `url`. Use this when you want to share * a `StorageClient` instance, customize `fetch`, or pass extra headers. */ client?: StorageClient; /** * Default expiry, in seconds, for `getReadUrl`. Capped at 1 week (Supabase * maximum). Defaults to 3600 (1 hour). */ defaultUrlExpiresIn?: number; /** * Override the global `fetch` (e.g. for tests, custom timeouts, retries). * Ignored when `client` is supplied. */ fetch?: typeof globalThis.fetch; /** * Configure metafiles storage. Used for TUS-style resumable upload * bookkeeping. Defaults to {@link LocalMetaStorage} under the OS tmp * directory. */ metaStorageConfig?: LocalMetaStorageOptions; /** * Supabase service-role key (or anon key with appropriate RLS). * Ignored when `client` is supplied. Falls back to `SUPABASE_SERVICE_ROLE_KEY` * or `SUPABASE_KEY`. */ serviceKey?: string; /** * Supabase project URL (e.g. `https://abc.supabase.co`). The adapter * appends `/storage/v1` automatically. Ignored when `client` is supplied. * Falls back to `SUPABASE_URL`. */ url?: string; } /** * Supabase Storage backend. * * Single-shot uploads only — Supabase Storage exposes a TUS endpoint but * the JS SDK's `upload()` is HTTP `POST` with the full body. This adapter * buffers the part stream and uploads in one request. Use `signedUploadUrl` * for direct-from-client large transfers. * @example * ```ts * import { SupabaseStorage } from "@visulima/storage/provider/supabase"; * * const storage = new SupabaseStorage({ * url: process.env.SUPABASE_URL, * serviceKey: process.env.SUPABASE_SERVICE_ROLE_KEY, * bucket: "avatars", * }); * ``` * @remarks * - ⚠️ 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 SupabaseStorage extends BaseStorage { static override readonly name: string; override checksumTypes: string[]; protected meta: MetaStorage; private readonly bucket; private readonly defaultUrlExpiresIn; private readonly storageClient; constructor(config: SupabaseStorageOptions); override get raw(): StorageClient; create(config: FileInit, _options?: OperationOptions): Promise; write(part: FilePart | FileQuery | SupabaseFile, options?: OperationOptions): Promise; delete({ id }: FileQuery, options?: OperationOptions): Promise; override exists({ id }: FileQuery, options?: OperationOptions): Promise; get({ id }: FileQuery, options?: OperationOptions): Promise; 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 getMetaSafe; private internalOnComplete; } export { SupabaseFile, SupabaseMetaStorage, SupabaseStorage, type SupabaseStorageOptions };