dead-simple-orm
Version:
A simple ORM package.
30 lines • 1.22 kB
TypeScript
import type { ColumnType, SimpleORM, DatabaseDeclaration } from "./simpleOrm";
export type RendererFunc = (columnName: string, columnType: ColumnType, orm: SimpleORM) => Promise<string>;
/**
* A renderer function that returns an HTML input string for a given column.
*/
export declare class AdminUI {
private declaration;
private orm;
private renderers;
constructor(declaration: DatabaseDeclaration, orm: SimpleORM);
/**
* Allow user to override or add custom renderers for specific types.
*/
registerRenderers(custom: Record<string, RendererFunc>): void;
/**
* Get the input HTML for a single column by delegating to the appropriate renderer.
*/
getInput(columnName: string, columnType: ColumnType): Promise<string>;
/**
* Generate an HTML form for a given table using default or custom renderers.
* @param tableName Name of the table to build the form for
* @param apiEndpoint The form's action URL
*/
generateForm(tableName: string, apiEndpoint: string): Promise<string>;
/**
* Registers default renderers for primitive and relation types.
*/
private registerDefaultRenderers;
}
//# sourceMappingURL=adminUi.d.ts.map