import { Model } from "../model"; import { SerialMeta } from "./base"; import { BaseRelationField, BaseRelationMeta, BaseRelationOptions } from "./base_relation"; export interface RefOptions extends BaseRelationOptions { parent?: boolean; } export declare class ReferenceField, R> extends BaseRelationField<{} & BaseRelationMeta, RefOptions, S> { constructor(ctx: ClassMemberDecoratorContext, options?: RefOptions); get isPrimaryRelation(): boolean; protected getValue(inst: S): any; protected setValue(inst: S, v: any): void; offerObjectFromInverse(inst: S, object: any, inverseField: BaseRelationField): void; removeObjectFromInverse(inst: S, object: any, inverseField: BaseRelationField): void; private access; decorate(value: any, ctx: ClassMemberDecoratorContext): any; serialize(inst: S, object: any, meta: SerialMeta): void; deserialize(inst: S, object: any, meta: SerialMeta): void; attach(inst: S): void; detach(inst: S): void; protected updateInverseReference(inst: S, newInvInst: any): void; } export type AnyReferenceField = ReferenceField; /** * Mark a property as a Collection reference. * Automatically handles adding/removing Model instances from the collection when this property is changed. * Will not add the Model instance to the collection until it is saved (has an `id`). * @param collection_field The field_name on the Collection object */ export declare const reference: >(options: RefOptions) => (value: any, ctx: ClassAccessorDecoratorContext) => any; /** * Mark a property as an ID for a collection. * Requires a resolver function that, given an ID, returns the collections instance. * * Accepts an optional `name` parameter as the first parameter. This should be the same as the `@collection` property name. * If not provided, defaults to the `@collection_id` property name, minus the last underscore-separated segment. * Eg `some_collection_id` -> `some_collection` */ export declare function reference_id(retrieveReference: (id: number, self: T) => C): any; export declare function reference_id(reference_field: string, retrieveReference: (id: number, self: T) => C): any;