import { F as File, L as LocalMetaStorageOptions, i as BaseStorageOptions, M as MetaStorage, R as RetryConfig, 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 { getStore } from '@netlify/blobs'; import 'node:stream'; import 'node:timers'; import 'node:crypto'; import 'node:http'; import 'lru-cache'; declare class NetlifyBlobFile extends File { /** * The blob's public URL */ url?: string; /** * The blob's pathname within the store */ pathname?: string; } declare class NetlifyBlobMetaStorage extends LocalMetaStorage { constructor(config?: LocalMetaStorageOptions); } interface NetlifyBlobStorageOptions extends BaseStorageOptions { /** * Configure metafiles storage * @example * Using local metafiles * ```ts * const storage = new NetlifyBlobStorage({ * storeName: 'uploads', * metaStorageConfig: { directory: '/tmp/upload-metafiles' } * }) * ``` */ metaStorageConfig?: LocalMetaStorageOptions; /** * Netlify site ID (optional, used for explicit store access) */ siteID?: string; /** * Netlify Blob store name * @default 'default' */ storeName?: string; /** * Netlify API token (optional, can use environment variable NETLIFY_TOKEN) */ token?: string; } /** * Netlify Blob storage based backend. * @example * ```ts * const storage = new NetlifyBlobStorage({ * storeName: 'uploads', * metaStorageConfig: { directory: '/tmp/upload-metafiles' } * }); * ``` * @remarks * ## Supported Operations * - ✅ create, write, delete, get, list, copy, move * - ✅ Batch operations: deleteBatch, copyBatch, moveBatch (inherited from BaseStorage) * - ✅ exists: Implemented (checks metadata and Netlify Blob) * - ✅ update: Implemented (updates metadata file, Netlify Blob API doesn't support blob metadata updates) * - ❌ getStream: Not implemented (use get() for file retrieval) * - ❌ getUrl: Not implemented (Netlify Blob URLs available via Netlify Blob API) * - ❌ getUploadUrl: Not implemented (Netlify Blob upload URLs handled internally) */ declare class NetlifyBlobStorage extends BaseStorage { static override readonly name: string; override checksumTypes: string[]; override get raw(): ReturnType; protected meta: MetaStorage; private readonly storeName; private readonly siteID?; private readonly token?; private store; private readonly resolvedRetryConfig; constructor(config: NetlifyBlobStorageOptions); protected override getRetryConfig(): RetryConfig; create(config: FileInit, _options?: OperationOptions): Promise; write(part: FilePart | FileQuery | NetlifyBlobFile, options?: OperationOptions): Promise; /** * Deletes an upload and its metadata. * @param query File query containing the file ID to delete. * @param query.id File ID to delete. * @returns Promise resolving to the deleted file object with status: "deleted". * @throws {UploadError} If the file metadata cannot be found. */ delete({ id }: FileQuery, options?: OperationOptions): Promise; /** * Checks if a file exists by verifying both metadata and the actual Netlify Blob. * Returns true only if both the metadata and the blob exist. * @param query File query containing the file ID to check. * @returns Promise resolving to true if both metadata and blob exist, false otherwise. */ override exists({ id }: FileQuery, options?: OperationOptions): Promise; get({ id }: FileQuery, options?: OperationOptions): Promise; /** * Copies an upload file to a new location. * @param name Source file name/ID. * @param destination Destination file name/ID. * @returns Promise resolving to the copied file object. * @throws {UploadError} If the source file cannot be found. */ copy(name: string, destination: string, options?: OperationOptions & { storageClass?: string; }): Promise; /** * Moves an upload file to a new location. * @param name Source file name/ID. * @param destination Destination file name/ID. * @returns Promise resolving to the moved file object. * @throws {UploadError} If the source file cannot be found. */ move(name: string, destination: string, options?: OperationOptions): Promise; /** * Updates file metadata with user-provided key-value pairs. * Updates the metadata file (overwrites it) but does not update Netlify Blob metadata * since the Netlify Blob API doesn't support metadata updates. * @param query File query containing the file ID to update. * @param query.id File ID to update. * @param metadata Partial file object containing fields to update. * @returns Promise resolving to the updated file object. * @throws {UploadError} If the file cannot be found (ERRORS.FILE_NOT_FOUND). * @remarks * Supports TTL (time-to-live) option: if metadata contains a 'ttl' field, * it will be converted to an 'expiredAt' timestamp. * TTL can be a number (milliseconds) or string (e.g., "1h", "30m", "7d"). */ override update({ id }: FileQuery, metadata: Partial, _options?: OperationOptions): Promise; override list(limit?: number, options?: OperationOptions): Promise; private internalOnComplete; /** * Generate a URL for a blob in Netlify Blob store * Note: Netlify Blob doesn't provide direct public URLs like Vercel Blob * In production, you would typically serve these through Netlify Functions or Edge Functions */ private getBlobUrl; } export { NetlifyBlobFile, NetlifyBlobMetaStorage, NetlifyBlobStorage, type NetlifyBlobStorageOptions };