UNPKG

@serafin/pipeline

Version:

CRUD data access library with a functional approach

18 lines (17 loc) 1.27 kB
import { IdentityInterface } from "./IdentityInterface"; import { ReadOnlyPipelineInterface } from "./PipelineInterface"; import { RelationType } from "./RelationType"; /** * Represents a Relation for the given pipeline */ export declare class Relation<M extends IdentityInterface, NameKey extends string, R extends IdentityInterface, ReadQuery, ReadMeta, Type extends RelationType> { private holdingPipeline; name: NameKey; pipeline: ReadOnlyPipelineInterface<R, ReadQuery, ReadMeta>; query: Partial<ReadQuery>; type: Type; constructor(holdingPipeline: ReadOnlyPipelineInterface<M>, name: NameKey, pipeline: ReadOnlyPipelineInterface<R, ReadQuery, ReadMeta>, query: Partial<ReadQuery>, type: Type); fetch(resource: M, query?: Partial<ReadQuery>, context?: any): Promise<import("./ResultsInterface").ResultsInterface<R, ReadMeta>>; assignToResource(resource: M, query?: Partial<ReadQuery>, context?: any): Promise<M & { [k in NameKey]: Type extends RelationType.many ? R[] : Type extends RelationType.one ? R : R | R[]; }>; assignToResources(resources: M[], query?: Partial<ReadQuery>, context?: any): Promise<Awaited<M & { [k in NameKey]: Type extends RelationType.many ? R[] : Type extends RelationType.one ? R : R | R[]; }>[]>; }