bknd
Version:
Lightweight Firebase/Supabase alternative built to run anywhere — incl. Next.js, React Router, Astro, Cloudflare, Bun, Node, AWS Lambda & more.
74 lines (73 loc) • 4.74 kB
TypeScript
import type { EntityManager } from "../../data/entities";
import { Field, type TActionContext, type TRenderContext } from "./Field";
import type { TFieldTSType } from "../../data/entities/EntityTypescript";
import { s } from "bknd/utils";
export declare const numberFieldConfigSchema: 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, number | undefined, number | undefined>;
readonly minimum: s.Schema<s.ISchemaOptions, number | undefined, number | undefined>;
readonly maximum: s.Schema<s.ISchemaOptions, number | undefined, number | undefined>;
readonly exclusiveMinimum: s.Schema<s.ISchemaOptions, number | undefined, number | undefined>;
readonly exclusiveMaximum: s.Schema<s.ISchemaOptions, number | undefined, number | undefined>;
readonly multipleOf: s.Schema<s.ISchemaOptions, number | undefined, number | undefined>;
}, s.Merge<s.IObjectOptions & {
additionalProperties: false;
}>>;
export type NumberFieldConfig = s.Static<typeof numberFieldConfigSchema>;
export declare class NumberField<Required extends true | false = false> extends Field<NumberFieldConfig, number, Required> {
readonly type = "number";
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, number | undefined, number | undefined>;
readonly minimum: s.Schema<s.ISchemaOptions, number | undefined, number | undefined>;
readonly maximum: s.Schema<s.ISchemaOptions, number | undefined, number | undefined>;
readonly exclusiveMinimum: s.Schema<s.ISchemaOptions, number | undefined, number | undefined>;
readonly exclusiveMaximum: s.Schema<s.ISchemaOptions, number | undefined, number | undefined>;
readonly multipleOf: s.Schema<s.ISchemaOptions, number | undefined, number | undefined>;
}, s.Merge<s.IObjectOptions & {
additionalProperties: false;
}>>;
getHtmlConfig(): {
element: string;
props: any;
};
schema(): Readonly<{
type: "integer";
name: string;
nullable?: boolean;
dflt?: any;
unique?: boolean;
primary?: boolean;
references?: string;
onDelete?: import("kysely").OnModifyForeignAction;
onUpdate?: import("kysely").OnModifyForeignAction;
}>;
getValue(value: any, context?: TRenderContext): any;
transformPersist(_value: unknown, em: EntityManager<any>, context: TActionContext): Promise<number | undefined>;
toJsonSchema(): s.Schema<{
readonly default: any;
readonly minimum: number | undefined;
readonly maximum: number | undefined;
readonly exclusiveMinimum: number | undefined;
readonly exclusiveMaximum: number | undefined;
readonly multipleOf: number | undefined;
}, number, number> & {
readonly default: any;
readonly minimum: number | undefined;
readonly maximum: number | undefined;
readonly exclusiveMinimum: number | undefined;
readonly exclusiveMaximum: number | undefined;
readonly multipleOf: number | undefined;
};
toType(): TFieldTSType;
}