@flavoai/fastfold
Version:
Flavo frontend package
58 lines • 1.78 kB
TypeScript
import { DatabaseAdapter, TableDefinition, QueryParams, RequestContext } from '../types';
export declare class CrudGenerator {
private db;
private tables;
constructor(db: DatabaseAdapter, tables: Record<string, TableDefinition>);
/**
* Generate CRUD operations for a specific table
*/
generateTableOperations(tableName: string): {
findMany: (params: QueryParams, context: RequestContext) => Promise<any[]>;
findOne: (id: string | number, context: RequestContext) => Promise<any>;
count: (where: Record<string, any> | undefined, context: RequestContext) => Promise<number>;
create: (data: any, context: RequestContext) => Promise<any>;
update: (id: string | number, data: any, context: RequestContext) => Promise<any>;
delete: (id: string | number, context: RequestContext) => Promise<boolean>;
};
/**
* Create READ MANY operation
*/
private createFindManyOperation;
/**
* Create READ ONE operation
*/
private createFindOneOperation;
/**
* Create COUNT operation
*/
private createCountOperation;
/**
* Create CREATE operation
*/
private createCreateOperation;
/**
* Create UPDATE operation
*/
private createUpdateOperation;
/**
* Create DELETE operation
*/
private createDeleteOperation;
/**
* Apply security filters to query parameters
*/
private applySecurityFilters;
/**
* Apply security filters to where clause
*/
private applySecurityToWhere;
/**
* Validate data against table schema
*/
private validateData;
/**
* Validate individual field type
*/
private validateFieldType;
}
//# sourceMappingURL=generator.d.ts.map