@t1mmen/srtd
Version:
Supabase Repeatable Template Definitions (srtd): 🪄 Live-reloading SQL templates for Supabase DX. Make your database changes reviewable and migrations maintainable! 🚀
64 lines (63 loc) • 2.41 kB
TypeScript
/**
* Doctor checks - Pure functions for validating SRTD setup
* Each check returns a DoctorCheckResult with name, passed status, and optional message
*/
import type { CLIConfig } from '../types.js';
import { type ValidationWarning } from './schemas.js';
/**
* Result of a single doctor check
*/
export interface DoctorCheckResult {
name: string;
passed: boolean;
message?: string;
/** Actionable suggestion for fixing the issue */
hint?: string;
}
/**
* Check 1: Config file exists
*/
export declare function checkConfigExists(projectRoot: string): Promise<DoctorCheckResult>;
/**
* Check 2: Config schema is valid
*/
export declare function checkConfigSchemaValid(warnings: ValidationWarning[]): Promise<DoctorCheckResult>;
/**
* Check 3: Template directory exists
*/
export declare function checkTemplateDirExists(projectRoot: string, config: CLIConfig): Promise<DoctorCheckResult>;
/**
* Check 4: Migration directory exists
*/
export declare function checkMigrationDirExists(projectRoot: string, config: CLIConfig): Promise<DoctorCheckResult>;
/**
* Check 5: Template directory is readable
*/
export declare function checkTemplateDirReadable(projectRoot: string, config: CLIConfig): Promise<DoctorCheckResult>;
/**
* Check 6: Migration directory is writable
*/
export declare function checkMigrationDirWritable(projectRoot: string, config: CLIConfig): Promise<DoctorCheckResult>;
/**
* Check 7: Build log is valid (if exists)
*/
export declare function checkBuildLogValid(projectRoot: string, config: CLIConfig): Promise<DoctorCheckResult>;
/**
* Check 8: Local build log is valid (if exists)
*/
export declare function checkLocalBuildLogValid(projectRoot: string, config: CLIConfig): Promise<DoctorCheckResult>;
/**
* Check 9: Database connection works
*
* Uses Promise.race for timeout. The dispose() method handles cleanup
* gracefully even if connection attempts are still in progress.
*/
export declare function checkDatabaseConnection(config: CLIConfig, timeoutMs?: number): Promise<DoctorCheckResult>;
/**
* Check 10: At least one SQL template exists
*/
export declare function checkTemplateCount(projectRoot: string, config: CLIConfig): Promise<DoctorCheckResult>;
/**
* Run all 10 doctor checks in order
*/
export declare function runAllChecks(projectRoot: string, config: CLIConfig, warnings: ValidationWarning[]): Promise<DoctorCheckResult[]>;