bknd
Version:
Lightweight Firebase/Supabase alternative built to run anywhere — incl. Next.js, React Router, Astro, Cloudflare, Bun, Node, AWS Lambda & more.
21 lines (20 loc) • 992 B
TypeScript
import type { Entity, EntityManager } from "../entities";
import { ManyToOneRelation, type ManyToOneRelationConfig } from "./ManyToOneRelation";
import type { MutationInstructionResponse } from "./RelationMutator";
import { type RelationType } from "./relation-types";
/**
* Both source and target receive a mapping field
* Source gets the mapping field, and can $create the target
* @todo: determine if it should be removed
*/
export type OneToOneRelationConfig = ManyToOneRelationConfig;
export declare class OneToOneRelation extends ManyToOneRelation {
constructor(source: Entity, target: Entity, config?: OneToOneRelationConfig);
type(): RelationType;
/**
* One-to-one relations are not listable in either direction
*/
isListableFor(): boolean;
$set(em: EntityManager<any>, key: string, value: object): Promise<MutationInstructionResponse>;
$create(em: EntityManager<any>, key: string, value: unknown): Promise<void | MutationInstructionResponse>;
}