/** * Storage Module * * Provides unified access to storage providers. * Use getStorageProvider() to get the configured provider instance. * * Environment Variables: * - STORAGE_PROVIDER: "local" | "supabase" | "gcp" (default: "local") * * For Supabase: * - SUPABASE_URL * - SUPABASE_SERVICE_KEY * - SUPABASE_BUCKET * * For GCP: * - GCP_PROJECT * - GCP_BUCKET * - GOOGLE_APPLICATION_CREDENTIALS (optional) * * For Local: * - STORAGE_LOCAL_PATH (default: /tmp/comfyui-storage) */ export type { StorageProvider, StorageObject, UploadResult, HealthCheckResult, StorageProviderType, StorageConfig, } from "./provider.js"; export { getStorageConfigFromEnv } from "./provider.js"; export { LocalStorageProvider } from "./local.js"; export { SupabaseStorageProvider, SupabaseStorageError } from "./supabase.js"; export { GCPStorageProvider } from "./gcp.js"; export type { LocalStorageConfig } from "./local.js"; export type { SupabaseStorageConfig } from "./supabase.js"; export type { GCPStorageConfig } from "./gcp.js"; import type { StorageProvider, StorageConfig } from "./provider.js"; /** * Create a storage provider from configuration */ export declare function createStorageProvider(config: StorageConfig): StorageProvider; /** * Get the configured storage provider (singleton) * * Creates the provider on first call based on environment variables. * Subsequent calls return the same instance. */ export declare function getStorageProvider(): StorageProvider; /** * Reset the storage provider singleton * Useful for testing or reconfiguration */ export declare function resetStorageProvider(): void; /** * Check if cloud storage is configured * Returns true if provider is supabase or gcp */ export declare function isCloudStorageConfigured(): boolean; /** * Get the output prefix for organizing files */ export declare function getOutputPrefix(): string; /** * Generate a remote path for an asset * @param type - Asset type (images, videos, audio) * @param filename - Original filename * @returns Remote path with prefix and timestamp */ export declare function generateRemotePath(type: "images" | "videos" | "audio", filename: string): string; /** * Result of a cloud upload attempt */ export interface CloudUploadResult { /** Whether upload was attempted */ attempted: boolean; /** Whether upload succeeded */ success: boolean; /** Remote URL (signed URL preferred, falls back to public URL) */ remoteUrl?: string; /** Error message if upload failed */ error?: string; /** Whether the error is likely transient (network issues, rate limits) */ isTransient?: boolean; } /** * Upload a local file to cloud storage with proper error handling * * This is the recommended way to upload files from tools, as it: * - Handles the "cloud not configured" case gracefully * - Provides structured error information * - Doesn't throw on failures (returns error info instead) * * @param localPath - Path to the local file * @param assetType - Type of asset for path organization * @param filename - Filename for the remote path * @param uploadToCloud - Whether upload was requested * @returns CloudUploadResult with status and URL/error info */ export declare function uploadToCloudStorage(localPath: string, assetType: "images" | "videos" | "audio", filename: string, uploadToCloud?: boolean): Promise;