import { type FirebaseStorageAccessorDriver, type FirebaseStorageAccessorFile, type FirebaseStorageAccessorFolder, type StorageListFilesOptions } from '../../common/storage/driver/accessor'; import { type StoragePath } from '../../common/storage/storage'; import { type ListResult, type StorageReference, type FirebaseStorage as ClientFirebaseStorage } from 'firebase/storage'; import { type ErrorInput, type Maybe } from '@dereekb/util'; /** * Checks whether an error is a Firebase Storage "object not found" error. * * Useful for distinguishing missing-file errors from other storage failures, * e.g., to silently handle deletion of already-deleted files. * * @param input - the error or error message to check * @returns `true` if the error message contains `'storage/object-not-found'`, `false` otherwise * * @example * ```ts * try { * await deleteObject(ref); * } catch (e) { * if (isFirebaseStorageObjectNotFoundError(e)) { * // file already deleted, safe to ignore * } * } * ``` */ export declare function isFirebaseStorageObjectNotFoundError(input: Maybe): boolean; /** * Creates a `StorageReference` from an abstract {@link StoragePath} using the client `firebase/storage` SDK. * * @param storage - the client Firebase Storage instance * @param path - abstract storage path to resolve * @returns a `StorageReference` pointing to the resolved storage path */ export declare function firebaseStorageRefForStorageFilePath(storage: ClientFirebaseStorage, path: StoragePath): StorageReference; /** * Checks whether a file exists at the given `StorageReference` by attempting to read its metadata. * * Returns `true` if metadata is successfully retrieved, `false` for any error (including permission errors). * * @param ref - the storage reference to check * @returns a promise that resolves to `true` if the file exists, `false` otherwise */ export declare function firebaseStorageFileExists(ref: StorageReference): Promise; /** * Client-side specialization of {@link FirebaseStorageAccessorFile} using `StorageReference` as the native reference type. */ export type FirebaseStorageClientAccessorFile = FirebaseStorageAccessorFile; /** * Creates a client-side {@link FirebaseStorageAccessorFile} for a specific storage path. * * Provides all file operations (upload, download, metadata, delete, resumable upload) backed by * the `firebase/storage` SDK. Resumable uploads expose an Observable stream of upload progress snapshots. * * @param storage - the client Firebase Storage instance * @param storagePath - the abstract storage path for the file * @returns a {@link FirebaseStorageClientAccessorFile} providing CRUD and upload operations for the given path * * @example * ```ts * const file = firebaseStorageClientAccessorFile(storage, { bucketId: 'my-bucket', pathString: 'uploads/photo.jpg' }); * const url = await file.getDownloadUrl(); * ``` */ export declare function firebaseStorageClientAccessorFile(storage: ClientFirebaseStorage, storagePath: StoragePath): FirebaseStorageClientAccessorFile; /** * Client-side specialization of {@link FirebaseStorageAccessorFolder} using `StorageReference` as the native reference type. */ export type FirebaseStorageClientAccessorFolder = FirebaseStorageAccessorFolder; /** * Internal result wrapper for client-side storage list operations, holding the raw `ListResult` * and the options used to produce it. Used by {@link firebaseStorageClientListFilesResultFactory} * to support pagination and nested listing. */ export interface FirebaseStorageClientListResult { listResult: ListResult; options?: StorageListFilesOptions; } /** * Pre-configured {@link storageListFilesResultFactory} for the client `firebase/storage` SDK. * * Handles pagination tokens, nested folder traversal, and mapping between Firebase `ListResult` * items and the abstract {@link StorageListItemResult} interface. */ export declare const firebaseStorageClientListFilesResultFactory: import("../..").StorageListFilesResultFactory; /** * Creates a client-side {@link FirebaseStorageAccessorFolder} for a specific storage path. * * Supports existence checks, paginated file/folder listing, and recursive nested listing * when `includeNestedResults` is enabled. * * @param storage - the client Firebase Storage instance * @param storagePath - the abstract storage path for the folder * @returns a {@link FirebaseStorageClientAccessorFolder} providing listing and existence operations for the given path * * @example * ```ts * const folder = firebaseStorageClientAccessorFolder(storage, { bucketId: 'my-bucket', pathString: 'uploads/' }); * const result = await folder.list({ maxResults: 10 }); * const files = result.files(); * ``` */ export declare function firebaseStorageClientAccessorFolder(storage: ClientFirebaseStorage, storagePath: StoragePath): FirebaseStorageClientAccessorFolder; /** * Creates the client-side {@link FirebaseStorageAccessorDriver} that maps the abstract storage * accessor interface to the `firebase/storage` SDK. * * Provides file and folder accessor factories and default bucket resolution. * Used internally by {@link firebaseStorageClientDrivers}. * * @returns a {@link FirebaseStorageAccessorDriver} backed by the `firebase/storage` client SDK * * @example * ```ts * const driver = firebaseStorageClientAccessorDriver(); * const file = driver.file(storage, storagePath); * ``` */ export declare function firebaseStorageClientAccessorDriver(): FirebaseStorageAccessorDriver;