import { PureModel } from './PureModel'; import { IType } from './interfaces/IType'; import { ReferenceType } from './enums/ReferenceType'; import { IModelConstructor } from './interfaces/IModelConstructor'; import { IIdentifier } from './interfaces/IIdentifier'; import { PureCollection } from './PureCollection'; export declare function getClass(obj: T): typeof PureModel; declare type BasicRefModel = typeof PureModel | IType; export declare type FunctionRefModel = (data: object, parentModel: PureModel, key: string, collection?: PureCollection) => BasicRefModel; export declare type ParsedRefModel = IType | FunctionRefModel; export declare type DynamicRefModel = BasicRefModel | FunctionRefModel; interface IAttributeFieldOptions { defaultValue?: any; isIdentifier?: true; isType?: true; map?: string; parse?: (value: any, data: object) => any; serialize?: (value: any, data: object) => any; } interface IAttributeNoReference { toOne?: undefined; toOneOrMany?: undefined; toMany?: undefined; referenceProperty?: undefined; } interface IAttributeToOne { toOne: DynamicRefModel; toOneOrMany?: undefined; toMany?: undefined; referenceProperty?: undefined; } interface IAttributeToOneOrMany { toOne?: undefined; toOneOrMany: DynamicRefModel; toMany?: undefined; referenceProperty?: undefined; } interface IAttributeToMany { toOne?: undefined; toOneOrMany?: undefined; toMany: DynamicRefModel; referenceProperty?: string; } declare type IAttributeOptions = IAttributeFieldOptions & (IAttributeNoReference | IAttributeToOne | IAttributeToOneOrMany | IAttributeToMany); export interface IReferenceDefinition { type: ReferenceType; model: ParsedRefModel; property?: string; } export interface IFieldDefinition { referenceDef: IReferenceDefinition | false; defaultValue?: any; } /** * Set a model attribute as tracked */ export declare function Attribute({ defaultValue, isIdentifier, isType, toOne, toOneOrMany, toMany, referenceProperty, map, parse, serialize, }?: IAttributeOptions): (obj: T, key: string, opts?: object | undefined) => void; export declare function ViewAttribute(modelType: IModelConstructor | IType, options?: { sortMethod?: string | ((item: TModel) => any); models?: Array; unique?: boolean; mixins?: Array<(view: any) => any>; }): (obj: TCollection, key: string, opts?: object | undefined) => void; declare function propFn(obj: T, key: string, opts?: object): void; export declare const prop: typeof propFn & { defaultValue(value: any): (obj: PureModel, key: string, opts?: object | undefined) => void; toOne(refModel: typeof PureModel | IType): (obj: PureModel, key: string, opts?: object | undefined) => void; toMany(refModel: typeof PureModel | IType, property?: string | undefined): (obj: PureModel, key: string, opts?: object | undefined) => void; toOneOrMany(refModel: typeof PureModel | IType): (obj: PureModel, key: string, opts?: object | undefined) => void; identifier: (obj: PureModel, key: string, opts?: object | undefined) => void; type: (obj: PureModel, key: string, opts?: object | undefined) => void; }; export declare const view: typeof ViewAttribute; export {};