import { IOPromise } from '../io-tools'; import { EventMap, EventsDefinition, TheType } from '../object-plus'; import { Record } from '../record'; import { CloneOptions, Transactional, TransactionalDefinition, TransactionOptions } from '../transactions'; import { AddOptions } from './add'; import { CollectionCore } from './commons'; export declare type GenericComparator = string | ((x: Record) => number) | ((a: Record, b: Record) => number); export interface CollectionOptions extends TransactionOptions { comparator?: GenericComparator; model?: typeof Record; } export interface CollectionDefinition extends TransactionalDefinition { model?: typeof Record; itemEvents?: EventsDefinition; _itemEvents?: EventMap; } export interface CollectionConstructor extends TheType { new (records?: ElementsArg, options?: CollectionOptions): Collection; prototype: Collection; Refs: CollectionConstructor; } export declare class Collection extends Transactional implements CollectionCore, Iterable { static of(Ctor: M): M['Collection'] extends CollectionConstructor> ? M['Collection'] : CollectionConstructor>; static ofRefs(Ctor: M): M['Collection'] extends CollectionConstructor> ? M['Collection'] : CollectionConstructor>; static Subset: typeof Collection; static Refs: any; createSubset(models: ElementsArg, options?: CollectionOptions): Collection; static onExtend(BaseClass: typeof Transactional): void; static onDefine(definition: CollectionDefinition, BaseClass: any): void; models: R[]; comparator: GenericComparator; getStore(): Transactional; get(objOrId: string | { id?: string; cid?: string; }): R; [Symbol.iterator](): IterableIterator; updateEach(iteratee: (val: R, key?: number) => void): void; model: typeof Record; idAttribute: string; constructor(records?: ElementsArg, options?: CollectionOptions, shared?: number); initialize(): void; clone(options?: CloneOptions): this; toJSON(options?: object): any; set(elements?: ElementsArg, options?: TransactionOptions): this; liveUpdates(enabled: LiveUpdatesOption): IOPromise; fetch(a_options?: { liveUpdates?: LiveUpdatesOption; } & TransactionOptions): IOPromise; dispose(): void; reset(a_elements?: ElementsArg, options?: TransactionOptions): R[]; add(a_elements: ElementsArg, options?: AddOptions): any; remove(recordsOrIds: any, options?: CollectionOptions): R[] | R; sort(options?: TransactionOptions): this; unset(modelOrId: R | string, options?: any): R; modelId(attrs: {}): any; toggle(model: R, a_next?: boolean): boolean; getClassName(): string; readonly length: number; push(model: ElementsArg, options?: CollectionOptions): any; pop(options?: CollectionOptions): R; unshift(model: ElementsArg, options?: CollectionOptions): any; shift(options?: CollectionOptions): R; } import { ArrayMixin } from './arrayMethods'; export interface Collection extends ArrayMixin { } export declare type LiveUpdatesOption = boolean | ((x: any) => boolean); export declare type ElementsArg = Partial | Partial[];