@udraft/core
Version:
uDraft is a language and stack agnostic code-generation tool that simplifies full-stack development by converting a single YAML file into code for rapid development.
30 lines (29 loc) • 1.13 kB
TypeScript
import { UModel } from "../entities/model";
import { URenderer } from "../entities/renderer";
import { RenderContent, RenderSelection } from "../types/renderer";
import { UModule } from "../entities/module";
import { UField } from "../entities/field";
export default class TSMongooseSchemaRenderer extends URenderer {
private _classRenderer;
private _where?;
private _schemaDir;
private _includeModuleInDir;
private _updatePackageJson;
constructor(options?: {
where?: (module: UModule, model: UModel) => boolean;
schemaDir?: string;
includeModuleInDir?: boolean;
updatePackageJson?: boolean;
});
$schema(model: UModel): string | null;
$key(model: UModel): string;
$keys(models: UModel[]): string[];
$schemaName(model: UModel): string;
$modelName(model: UModel): string;
$fileName(model: UModel, extension?: boolean): string;
$fieldName(field: UField): string;
$fieldType(field: UField): string | undefined;
$fieldDeclaration(field: UField): string;
select(): Promise<RenderSelection>;
render(): Promise<RenderContent[]>;
}