import { Model } from "../Model" ; import { FuseDB } from "../FuseDB" ; import { storeProp } from "../Utils" ; import { Schema } from "../Schema" ; const formatMetadataKey = Symbol ( "Field" ) ; export interface FieldType { cls ? : typeof Model ; name ? : string ; hidden ? : boolean ; toJSON ? : ( value : any ) => any ; } export function Field ( type ? ) { return function PropertyDecorator ( target , propertyKey ) { const schema = storeProp ( target , "$schema" , ( ) => new Schema ( target ) ) ; schema . add ( propertyKey , type ) ; } ; }