import { ISubscription, Subscription } from 'rxjs/Subscription'; import { Subject } from 'rxjs/Subject'; import Collection from './Collection'; import { IAttrTypes } from './IAttrTypes'; import { IFieldObject } from './IFieldObject'; export declare type MdlzrDescriptor = { idAttribute: keyof T; collection?: Collection; name: string; attrTypes: IAttrTypes; childFields: Array; }; export declare type MdlzrInstance = { attributes: { [key in KEYS]?: T[key]; }; changes: { [key in KEYS]?: T[key]; }; subject: Subject; subscriptions: { [cid: string]: Subscription; }; selfSubscription?: ISubscription; cid: string; }; export declare type EntityClass = { new (...x: any[]): Entity; prototype: T; name: string; __mdlzr__: MdlzrDescriptor; }; export declare type MaybeEntityClass = { new (...x: any[]): Entity; prototype: T; name: string; __mdlzr__?: MdlzrDescriptor; }; export declare type Entity = T & { __mdlzr__?: MdlzrInstance; constructor: EntityClass; }; /** * returns an obj with only the obj2 fields that differs from obj1 * @param obj1 * @param obj2 */ export declare function objectDif(obj1: T1, obj2: T2): Partial | null; export declare function notifyObservers(model: Entity): void; export declare function getClassName(t: T): string; export declare function isEmpty(obj: { [key: string]: any; } | null): boolean; export declare function getAttrTypes(model: MaybeEntityClass | Entity): IAttrTypes; export declare function getIdAttribute(entity: Entity | EntityClass): keyof T; export declare function getCollection(clazz: MaybeEntityClass): Collection; export declare function initEntityClass(entity: EntityClass): void; export declare function initEntity(entity: Entity): void; export declare function isEntity(model: any): model is Entity; export declare function isEntityClass(model: any): model is EntityClass; export declare function getCid(model: Entity): string; export declare function getCid(model: object): null; export declare function getId(model: Entity): string; export declare function getId(model: object): null; export declare function haveSameCid(modelA: Entity, modelB: Entity): boolean; export declare function getMdlzrInstance(model: Entity): MdlzrInstance; export declare function getMdlzrDescriptor(model: EntityClass | Entity): MdlzrDescriptor; export declare function clone(model: Entity): Entity; export declare function getChanges(model: Entity): { [key: string]: any; } | null; export declare function observeChanges(model: Entity, handler: (model: T) => void): Subscription; export declare function getAttributes(model: Entity): IFieldObject; export declare function resolveAttributes(clazz: EntityClass, setHash: IFieldObject): IFieldObject; export declare function fetch(model: Entity, setHash?: IFieldObject): Entity; export declare function handleChanges(model: Entity, current: IFieldObject, next: Partial>): void; export declare function handleChange(this: Entity, mdlzr: MdlzrInstance, key: keyof T, currentValue: any, nextValue: any): void; export declare function getRef(model: Entity): { [k: string]: string | number | null; };