bknd
Version:
Lightweight Firebase/Supabase alternative built to run anywhere — incl. Next.js, React Router, Astro, Cloudflare, Bun, Node, AWS Lambda & more.
59 lines (58 loc) • 2.83 kB
TypeScript
import type { ExpressionBuilder } from "kysely";
import type { Entity, EntityManager } from "../entities";
import { TextField } from "../fields";
import type { RepoQuery } from "../server/query";
import { EntityRelation, type KyselyQueryBuilder } from "./EntityRelation";
import { type RelationType } from "./relation-types";
import { s } from "bknd/utils";
import type { PrimaryFieldType } from "../..";
export type PolymorphicRelationConfig = s.Static<typeof PolymorphicRelation.schema>;
export declare class PolymorphicRelation extends EntityRelation<typeof PolymorphicRelation.schema> {
static schema: s.ObjectSchema<{
readonly mappedBy: {
default?: any;
maxLength?: number | undefined;
minLength?: number | undefined;
pattern?: (string | RegExp) | undefined;
format?: string | undefined;
enum?: (readonly any[] | any[]) | undefined;
const?: any;
} & s.Schema<s.ISchemaOptions, string | undefined, string | undefined>;
readonly inversedBy: {
default?: any;
maxLength?: number | undefined;
minLength?: number | undefined;
pattern?: (string | RegExp) | undefined;
format?: string | undefined;
enum?: (readonly any[] | any[]) | undefined;
const?: any;
} & s.Schema<s.ISchemaOptions, string | undefined, string | undefined>;
readonly required: {
default?: any;
enum?: (readonly any[] | any[]) | undefined;
const?: any;
} & s.Schema<s.ISchemaOptions, boolean | undefined, boolean | undefined>;
readonly targetCardinality: {
default?: any;
enum?: (readonly any[] | any[]) | undefined;
const?: any;
multipleOf?: number | undefined;
maximum?: number | undefined;
exclusiveMaximum?: number | undefined;
minimum?: number | undefined;
exclusiveMinimum?: number | undefined;
} & s.Schema<s.ISchemaOptions, number | undefined, number | undefined>;
}, s.Merge<s.IObjectOptions & {
additionalProperties: false;
}>>;
constructor(source: Entity, target: Entity, config?: Partial<PolymorphicRelationConfig>);
type(): RelationType;
private queryInfo;
buildJoin(entity: Entity, qb: KyselyQueryBuilder): import("kysely").SelectQueryBuilder<any, any, any>;
getReferenceQuery(entity: Entity, id: PrimaryFieldType): Partial<RepoQuery>;
buildWith(entity: Entity): (eb: ExpressionBuilder<any, any>) => import("kysely").SelectQueryBuilder<any, any, Partial<Omit<unknown, never>>>;
isListableFor(entity: Entity): boolean;
getReferenceField(): TextField;
getEntityIdField(): TextField;
initialize(em: EntityManager<any>): void;
}