@devicecloud.dev/dcd
Version:
Better cloud maestro testing
40 lines (39 loc) • 1.68 kB
TypeScript
export declare class SupabaseGateway {
private static SB;
static getSupabaseKeys(env: 'dev' | 'prod'): {
SUPABASE_PUBLIC_KEY: string;
SUPABASE_URL: string;
} | {
SUPABASE_PUBLIC_KEY: string;
SUPABASE_URL: string;
};
/**
* Upload to Supabase using resumable uploads (TUS protocol)
* Uploads to staging location (uploads/{id}/) using anon key
* File is later moved to final location by API after finalization
* @param env - Environment (dev or prod)
* @param path - Staging storage path (uploads/{id}/file.ext)
* @param file - File to upload
* @param debug - Enable debug logging
* @param onProgress - Optional callback for upload progress (bytesUploaded, bytesTotal)
* @returns Promise that resolves when upload completes
*/
static uploadResumable(env: 'dev' | 'prod', path: string, file: File, debug?: boolean, onProgress?: (bytesUploaded: number, bytesTotal: number) => void): Promise<void>;
static uploadToSignedUrl(env: 'dev' | 'prod', path: string, token: string, file: File, debug?: boolean): Promise<void>;
/**
* Logs network error details for debugging
* @param error - Error object to analyze for network-related issues
* @returns void
*/
private static logNetworkError;
/**
* Logs upload exception details for debugging
* @param error - Exception that occurred during upload
* @param env - Environment (dev or prod)
* @param supabaseUrl - Supabase URL being used
* @param path - Upload path
* @param file - File being uploaded
* @returns void
*/
private static logUploadException;
}