bknd
Version:
Lightweight Firebase/Supabase alternative built to run anywhere — incl. Next.js, React Router, Astro, Cloudflare, Bun, Node, AWS Lambda & more.
90 lines (89 loc) • 4.8 kB
TypeScript
import type { EntityManager } from "../../data/entities";
import { s } from "bknd/utils";
import { Field, type TActionContext } from "./Field";
export declare const textFieldConfigSchema: 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, string | undefined, string | undefined>;
readonly minLength: s.Schema<s.ISchemaOptions, number | undefined, number | undefined>;
readonly maxLength: s.Schema<s.ISchemaOptions, number | undefined, number | undefined>;
readonly pattern: s.Schema<s.ISchemaOptions, string | undefined, string | undefined>;
readonly html_config: s.Schema<s.ISchemaOptions, {
[x: string]: unknown;
element?: string | undefined;
props?: {
[x: string]: string | number;
} | undefined;
} | undefined, {
[x: string]: unknown;
element?: string | undefined;
props?: {
[x: string]: string | number;
} | undefined;
} | undefined>;
}, s.Merge<s.IObjectOptions & {
additionalProperties: false;
}>>;
export type TextFieldConfig = s.Static<typeof textFieldConfigSchema>;
export declare class TextField<Required extends true | false = false> extends Field<TextFieldConfig, string, Required> {
readonly type = "text";
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, string | undefined, string | undefined>;
readonly minLength: s.Schema<s.ISchemaOptions, number | undefined, number | undefined>;
readonly maxLength: s.Schema<s.ISchemaOptions, number | undefined, number | undefined>;
readonly pattern: s.Schema<s.ISchemaOptions, string | undefined, string | undefined>;
readonly html_config: s.Schema<s.ISchemaOptions, {
[x: string]: unknown;
element?: string | undefined;
props?: {
[x: string]: string | number;
} | undefined;
} | undefined, {
[x: string]: unknown;
element?: string | undefined;
props?: {
[x: string]: string | number;
} | undefined;
} | undefined>;
}, s.Merge<s.IObjectOptions & {
additionalProperties: false;
}>>;
getHtmlConfig(): any;
/**
* Transform value after retrieving from database
* @param value
*/
transformRetrieve(value: string): string | null;
transformPersist(_value: any, em: EntityManager<any>, context: TActionContext): Promise<string | undefined>;
toJsonSchema(): s.StringSchema<{
readonly default: any;
readonly minLength: number | undefined;
readonly maxLength: number | undefined;
readonly pattern: string | undefined;
}> & {
readonly default: any;
readonly minLength: number | undefined;
readonly maxLength: number | undefined;
readonly pattern: string | undefined;
};
toType(): {
type: string;
required?: boolean | [boolean, boolean, boolean];
fillable?: boolean | [boolean, boolean, boolean];
comment?: string;
import?: {
package: string;
name: string;
}[];
};
}