UNPKG

bknd

Version:

Lightweight Firebase/Supabase alternative built to run anywhere — incl. Next.js, React Router, Astro, Cloudflare, Bun, Node, AWS Lambda & more.

33 lines (32 loc) 1.17 kB
import type { Entity } from "../entities"; import type { EntityRelation } from "../relations"; export declare class RelationAccessor { private readonly _relations; constructor(relations: EntityRelation[]); get all(): EntityRelation[]; /** * Searches for the relations of [entity_name] */ relationsOf(entity: Entity): EntityRelation[]; sourceRelationsOf(entity: Entity): EntityRelation[]; /** * Search for relations that have [entity] as target * - meaning it returns entities that holds a local reference field */ targetRelationsOf(entity: Entity): EntityRelation[]; listableRelationsOf(entity: Entity): EntityRelation[]; /** * Searches for the relations of [entity_name] and * return the one that has [reference] as source or target. */ relationOf(entity: Entity, reference: string): EntityRelation | undefined; hasRelations(entity: Entity): boolean; /** * Get a list of related entities of [entity_name] */ relatedEntitiesOf(entity: Entity): Entity[]; /** * Get relation names of [entity_name] */ relationReferencesOf(entity: any): string[]; }