UNPKG

bknd

Version:

Lightweight Firebase/Supabase alternative built to run anywhere — incl. Next.js, React Router, Astro, Cloudflare, Bun, Node, AWS Lambda & more.

68 lines (67 loc) 2.11 kB
import type { Entity, EntityManager, EntityRelation, TEntityType } from "../../data"; export type TEntityTSType = { name: string; type: TEntityType; comment?: string; fields: Record<string, TFieldTSType>; }; type TFieldContextType = boolean | [boolean, boolean, boolean]; export type TFieldTSType = { required?: TFieldContextType; fillable?: TFieldContextType; type: "PrimaryFieldType" | string; comment?: string; import?: { package: string; name: string; }[]; }; export type EntityTypescriptOptions = { indentWidth?: number; indentChar?: string; entityCommentMultiline?: boolean; fieldCommentMultiline?: boolean; }; export declare class EntityTypescript { protected em: EntityManager; protected _options: EntityTypescriptOptions; constructor(em: EntityManager, _options?: EntityTypescriptOptions); get options(): { indentWidth: number; indentChar: string; entityCommentMultiline: boolean; fieldCommentMultiline: boolean; }; toTypes(): { name: string; type: "regular" | "system" | "generated"; comment: string | undefined; fields: { [k: string]: TFieldTSType; }; }[]; protected getTab(count?: number): string; collectImports(type: TEntityTSType, imports?: Record<string, string[]>): Record<string, string[]>; typeName(name: string): string; fieldTypesToString(type: TEntityTSType, opts?: { ignore_fields?: string[]; indent?: number; }): string; relationToFieldType(relation: EntityRelation, entity: Entity): { fields: { [x: string]: { required: boolean; type: string; }; }; }; importsToString(imports: Record<string, string[]>): string[]; commentString(comment?: string, indents?: number, multiline?: boolean): string; entityToTypeString(entity: Entity, opts?: { ignore_fields?: string[]; indent?: number; export?: boolean; }): string; toString(): string; } export {};