UNPKG

bknd

Version:

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

56 lines (55 loc) 2.59 kB
import type { Static } from "../../core/utils"; import type { EntityManager } from "../../data"; import { Field, type TActionContext, type TRenderContext } from "./Field"; import * as tb from "@sinclair/typebox"; export declare const booleanFieldConfigSchema: tb.TObject<{ default_value: tb.TOptional<tb.TIntersect<[tb.TBoolean, tb.TAny]>>; required: tb.TOptional<tb.TBoolean>; description: tb.TOptional<tb.TString>; label: tb.TOptional<tb.TString>; fillable: tb.TOptional<tb.TUnion<[tb.TBoolean, tb.TArray<tb.TUnsafe<"create" | "read" | "update" | "delete">>]>>; hidden: tb.TOptional<tb.TUnion<[tb.TBoolean, tb.TArray<tb.TUnsafe<"form" | "table" | "create" | "read" | "update" | "delete" | "submit">>]>>; virtual: tb.TOptional<tb.TBoolean>; }>; export type BooleanFieldConfig = Static<typeof booleanFieldConfigSchema>; export declare class BooleanField<Required extends true | false = false> extends Field<BooleanFieldConfig, boolean, Required> { readonly type = "boolean"; protected getSchema(): tb.TObject<{ default_value: tb.TOptional<tb.TIntersect<[tb.TBoolean, tb.TAny]>>; required: tb.TOptional<tb.TBoolean>; description: tb.TOptional<tb.TString>; label: tb.TOptional<tb.TString>; fillable: tb.TOptional<tb.TUnion<[tb.TBoolean, tb.TArray<tb.TUnsafe<"create" | "read" | "update" | "delete">>]>>; hidden: tb.TOptional<tb.TUnion<[tb.TBoolean, tb.TArray<tb.TUnsafe<"form" | "table" | "create" | "read" | "update" | "delete" | "submit">>]>>; virtual: tb.TOptional<tb.TBoolean>; }>; 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(): tb.TBoolean | tb.TOptional<tb.TBoolean>; toType(): { type: string; required?: boolean | [boolean, boolean, boolean]; fillable?: boolean | [boolean, boolean, boolean]; comment?: string; import?: { package: string; name: string; }[]; }; }