import { Dictionary, FilterQuery, Populate } from '../typings'; import { ArrayCollection } from './ArrayCollection'; import { QueryOrderMap } from '../enums'; import { Reference } from './Reference'; export declare class Collection extends ArrayCollection { private snapshot; private dirty; private _populated; private _lazyInitialized; constructor(owner: O, items?: T[], initialized?: boolean); /** * Creates new Collection instance, assigns it to the owning entity and sets the items to it (propagating them to their inverse sides) */ static create(owner: O, prop: keyof O, items: undefined | T[], initialized: boolean): Collection; /** * Initializes the collection and returns the items */ loadItems(): Promise; /** * Returns the items (the collection must be initialized) */ getItems(check?: boolean): T[]; toJSON(): Dictionary[]; add(...items: (T | Reference)[]): void; set(items: (T | Reference)[]): void; /** * @internal */ hydrate(items: T[], validate?: boolean, takeSnapshot?: boolean): void; remove(...items: (T | Reference)[]): void; contains(item: (T | Reference), check?: boolean): boolean; count(): number; shouldPopulate(): boolean; populated(populated?: boolean): void; isDirty(): boolean; setDirty(dirty?: boolean): void; init(options?: InitOptions): Promise; init(populate?: string[], where?: FilterQuery, orderBy?: QueryOrderMap): Promise; /** * @internal */ takeSnapshot(): void; /** * @internal */ getSnapshot(): T[] | undefined; private createCondition; private createOrderBy; private createManyToManyCondition; private modify; private checkInitialized; /** * re-orders items after searching with `$in` operator */ private reorderItems; private cancelOrphanRemoval; private validateItemType; private validateModification; } export interface InitOptions { populate?: Populate; orderBy?: QueryOrderMap; where?: FilterQuery; }