import { ModelAggregate } from "./ModelAggregate"; import { ModelSync } from "./ModelSync"; import { RelationshipWithMany } from "./RelationshipWithMany"; import { CrudModel } from "./crud-model"; import { Joinable } from "./joinable"; import { Model } from "./model"; import { ChildModel, ModelDocument } from "./types"; export declare abstract class RelationshipModel extends CrudModel { /** * Sync with list */ syncWith: ModelSync[]; /** * Get relationship with the given model class */ hasMany(modelClass: typeof Model, column: string): RelationshipWithMany; /** * Get new aggregate for current model */ static aggregate(this: ChildModel): ModelAggregate; /** * Get query builder * @alias aggregate */ static queryBuilder(this: ChildModel): ModelAggregate; /** * Sync with the given model */ static sync(columns: string | string[], embedMethod?: string): ModelSync; /** * Sync data on saving */ startSyncing(saveMode: "create" | "update", oldModel?: Model): void; /** * Sync destruction * Called when destroy method is called */ syncDestruction(): void; /** * The syncing model (That calls startSyncing) is being embedded in multiple documents of current model * I.e Country.syncMany('cities') while current model is City */ static syncMany(columns: string | string[], embedMethod?: string): ModelSync; /** * Reassociate a model/object/document with the current model * If the model is already associated, it will be updated * If not, it will be associated * the model/document must have an id * * If it is a model, you can set the embed method to use */ reassociate(this: Model, column: string, model: Model | ModelDocument | any, embedWith?: string): Model; /** * Associate a model with the current model */ associate(this: Model, column: string, model: Model | ModelDocument | any, embedWith?: string): Model; /** * Disassociate a model with the current model */ disassociate(this: Model, column: string, model: Model | ModelDocument | any): Model; /** * Make a wrapper to list when models should be updated when only one of the given columns is updated */ syncUpdateWhenChange(columns: string | string[], syncModels: ModelSync[]): ModelSync[]; /** * Get a Joinable instance for current model */ static joinable(localField?: string, foreignField?: string, single?: boolean, as?: string): Joinable; } //# sourceMappingURL=relationships.d.ts.map