UNPKG

bknd

Version:

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

23 lines (22 loc) 1.02 kB
import type { PrimaryFieldType } from "../../core"; import type { Entity, EntityManager } from "../entities"; import { type EntityRelation, RelationField } from "../relations"; export type MutationInstructionResponse = [string, PrimaryFieldType | null]; export declare class RelationMutator { protected entity: Entity; protected em: EntityManager<any>; constructor(entity: Entity, em: EntityManager<any>); /** * Returns all keys that are somehow relational. * Includes local fields (users_id) and references (users|author) * * @param em * @param entity_name * * @returns string[] */ getRelationalKeys(): string[]; persistRelationField(field: RelationField, key: string, value: PrimaryFieldType): Promise<MutationInstructionResponse>; persistReference(relation: EntityRelation, key: string, value: unknown): Promise<void | MutationInstructionResponse>; persistRelation(key: string, value: unknown): Promise<void | MutationInstructionResponse>; }