UNPKG

bknd

Version:

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

63 lines (62 loc) 3.55 kB
import { s } from "bknd/utils"; import type { EntityManager } from "../../data/entities"; import { Field, type TActionContext, type TRenderContext } from "./Field"; export declare const booleanFieldConfigSchema: s.ObjectSchema<{ readonly description: s.Schema<s.ISchemaOptions, string | undefined, string | undefined>; readonly required: s.Schema<s.ISchemaOptions, boolean | undefined, boolean | undefined>; readonly label: s.Schema<s.ISchemaOptions, string | undefined, string | undefined>; readonly fillable: s.Schema<s.ISchemaOptions, boolean | ("create" | "read" | "update" | "delete")[] | undefined, boolean | ("create" | "read" | "update" | "delete")[] | undefined>; readonly hidden: s.Schema<s.ISchemaOptions, boolean | ("table" | "create" | "read" | "update" | "delete" | "form" | "submit")[] | undefined, boolean | ("table" | "create" | "read" | "update" | "delete" | "form" | "submit")[] | undefined>; readonly virtual: s.Schema<s.ISchemaOptions, boolean | undefined, boolean | undefined>; readonly default_value: s.Schema<s.ISchemaOptions, boolean | undefined, boolean | undefined>; }, s.Merge<s.IObjectOptions & { additionalProperties: false; }>>; export type BooleanFieldConfig = s.Static<typeof booleanFieldConfigSchema>; export declare class BooleanField<Required extends true | false = false> extends Field<BooleanFieldConfig, boolean, Required> { readonly type = "boolean"; protected getSchema(): s.ObjectSchema<{ readonly description: s.Schema<s.ISchemaOptions, string | undefined, string | undefined>; readonly required: s.Schema<s.ISchemaOptions, boolean | undefined, boolean | undefined>; readonly label: s.Schema<s.ISchemaOptions, string | undefined, string | undefined>; readonly fillable: s.Schema<s.ISchemaOptions, boolean | ("create" | "read" | "update" | "delete")[] | undefined, boolean | ("create" | "read" | "update" | "delete")[] | undefined>; readonly hidden: s.Schema<s.ISchemaOptions, boolean | ("table" | "create" | "read" | "update" | "delete" | "form" | "submit")[] | undefined, boolean | ("table" | "create" | "read" | "update" | "delete" | "form" | "submit")[] | undefined>; readonly virtual: s.Schema<s.ISchemaOptions, boolean | undefined, boolean | undefined>; readonly default_value: s.Schema<s.ISchemaOptions, boolean | undefined, boolean | undefined>; }, s.Merge<s.IObjectOptions & { additionalProperties: false; }>>; getValue(value: unknown, context: TRenderContext): unknown; schema(): Readonly<{ type: "boolean"; name: string; nullable?: boolean; dflt?: any; unique?: boolean; primary?: boolean; references?: string; onDelete?: import("kysely").OnModifyForeignAction; onUpdate?: import("kysely").OnModifyForeignAction; }>; getHtmlConfig(): { element: string; props?: import("react").InputHTMLAttributes<any>; }; transformRetrieve(value: unknown): boolean | null; transformPersist(val: unknown, em: EntityManager<any>, context: TActionContext): Promise<boolean | undefined>; toJsonSchema(): s.Schema<{ readonly default: any; }, boolean, boolean> & { readonly default: any; }; toType(): { type: string; required?: boolean | [boolean, boolean, boolean]; fillable?: boolean | [boolean, boolean, boolean]; comment?: string; import?: { package: string; name: string; }[]; }; }