supa-seed
Version:
A constraint-aware, framework-agnostic database seeding framework with deep PostgreSQL business logic discovery and MakerKit integration support
64 lines • 2.16 kB
TypeScript
/**
* Query Translation Layer
* FEAT-003: Memory Management & Schema Mapping Fixes - Phase 2
*
* Provides seamless query translation between framework-expected table names
* and actual schema table names. Wraps Supabase client operations.
*/
import { SupabaseClient } from '@supabase/supabase-js';
import { SchemaMapping } from '../core/config/schema-mappings';
export interface QueryTranslatorConfig {
framework: string;
customMappings?: Partial<SchemaMapping>;
enableValidation?: boolean;
enableCaching?: boolean;
}
/**
* Query translator that automatically maps table names in Supabase queries
*/
export declare class QueryTranslator {
private client;
private resolver;
private config;
private tableNameCache;
constructor(client: SupabaseClient, config: QueryTranslatorConfig);
/**
* Translate a framework-expected table name to actual table name
*/
translateTableName(expectedTableName: string): Promise<string>;
/**
* Create a translated Supabase query builder
*/
from(tableName: string): Promise<import("@supabase/postgrest-js").PostgrestQueryBuilder<any, any, string, unknown>>;
/**
* Infer table type from expected table name for mapping resolution
*/
private inferTableType;
/**
* Clear translation cache
*/
clearCache(): void;
/**
* Get translation statistics
*/
getStats(): {
cachedTranslations: number;
framework: string;
enableValidation: boolean;
enableCaching: boolean;
};
/**
* Get all current table mappings
*/
getAllMappings(): Promise<Record<string, string>>;
}
/**
* Factory function to create a query translator
*/
export declare function createQueryTranslator(client: SupabaseClient, config: QueryTranslatorConfig): QueryTranslator;
/**
* Utility function for one-off table name translation
*/
export declare function translateTableName(client: SupabaseClient, framework: string, expectedTableName: string, customMappings?: Partial<SchemaMapping>): Promise<string>;
export default QueryTranslator;
//# sourceMappingURL=query-translator.d.ts.map