UNPKG

@goatlab/fluent

Version:

Readable query Interface & API generator for TS and Node

48 lines (47 loc) 1.72 kB
import { ColumnType } from 'typeorm'; import { Primitives } from './types'; interface PropertyInterface { required?: boolean; unique?: boolean; hidden?: boolean; type?: ColumnType; } interface EnumProperty { enum: any[]; default?: Primitives; } export declare type DbEntity<T> = new () => T; interface ManyToManyInterface<T> { entity: (type?: any) => DbEntity<T>; joinTableName: string; foreignKey: string; inverseForeignKey: string; } interface BelongsToInterface<T> { entity: (type?: any) => DbEntity<T>; inverse: string | ((object: T) => any); pivotColumnName?: string; } interface hasManyInterface<T> { entity: (type?: any) => DbEntity<T>; inverse: string | ((object: T) => any); } export declare class DecoratorsClass { id(): PropertyDecorator; mongoId(): PropertyDecorator; entity(name: string): ClassDecorator; property(params?: PropertyInterface): PropertyDecorator; embed(e: any): PropertyDecorator; embedArray(e: any, params?: PropertyInterface): PropertyDecorator; stringArray(e: any, params?: PropertyInterface): PropertyDecorator; Enum(e: EnumProperty, params?: PropertyInterface): PropertyDecorator; created(e?: any): PropertyDecorator; updated(e?: any): PropertyDecorator; deleted(e?: any): PropertyDecorator; version(e?: any): PropertyDecorator; belongsToMany<T>({ entity, joinTableName, foreignKey, inverseForeignKey }: ManyToManyInterface<T>): PropertyDecorator; belongsTo<T>({ entity, inverse, pivotColumnName }: BelongsToInterface<T>): PropertyDecorator; hasMany<T>({ entity, inverse }: hasManyInterface<T>): PropertyDecorator; } export declare const f: DecoratorsClass; export {};