import { EventListenerTree } from './EventListenerTree'; import { EventMapTree } from './EventMapTree'; import { Model } from './Model'; import { type Filter } from './filter'; import { type Query } from './Query'; import type { Path, PathLike, Segments } from '../types'; import { type RefListOptions } from './refList'; type Refable = string | number | Model | Query | Filter; export interface RefOptions { /** * If true, indicies will be updated. */ updateIndices: boolean; } declare module './Model' { interface Model { /** * Creates an array at `outputPath` that consists of references to all the * objects at `collectionPath` that have ids matching the ids at `idsPath`. * The array is automatically updated based on changes to the input paths. * * @param outputPath - Path at which to create the ref list. This must be * under a local collection, typically `'_page'` or a component model. * @param collectionPath - Path to a Racer collection or a collection-like * object, where each id string key maps to an object value with matching * `id` property. * @param idsPath - Path to an array of string ids * @param options - Optional * * @see https://derbyjs.github.io/derby/models/refs */ refList(outputPath: PathLike, collectionPath: PathLike, idsPath: PathLike, options?: RefListOptions): ChildModel; _canRefTo(value: Refable): boolean; /** * Creates a reference for this model pointing to another path `to`. Like a * symlink, any reads/writes on this `to` ref will work as if they were done on * `path` directly. * * @param to - Location that the reference points to * @return a model scoped to `path` * * @see https://derbyjs.github.io/derby/models/refs */ ref(to: Refable): ChildModel; /** * Creates a reference at `path` pointing to another path `to`. Like a * symlink, any reads/writes on `path` will work as if they were done on * `path` directly. * * @param path - Location at which to create the reference. This must be * under a local collection, typically `'_page'` or a component model. * @param to - Location that the reference points to * @params options - Optional {@link RefOptions} * @return a model scoped to `path` * * @see https://derbyjs.github.io/derby/models/refs */ ref(path: PathLike, to: Refable, options?: RefOptions): ChildModel; _ref(from: Segments, to: Segments, options?: RefOptions): void; /** * Removes a model reference. * * @param path - Location of the reference to remove * * @see https://derbyjs.github.io/derby/models/refs */ removeRef(path: PathLike): void; _removeRef(segments: Segments): void; removeAllRefs(subpath: PathLike): void; _removeAllRefs(segments: Segments): void; dereference(subpath: Path): Segments; _dereference(segments: Segments, forArrayMutator: any, ignore: boolean): Segments; _refs: any; _refLists: any; } } export declare class Ref { fromSegments: Segments; toSegments: Segments; updateIndices: boolean; constructor(fromSegments: Segments, toSegments: Segments, options?: RefOptions); } export declare class Refs { fromMap: EventMapTree; toListeners: EventListenerTree; constructor(); _removeInputListeners(ref: Ref): void; add(ref: any): void; remove(segments: any): void; removeAll(segments: any): void; toJSON(): any[]; } export {};