bknd
Version:
Lightweight Firebase/Supabase alternative built to run anywhere — incl. Next.js, React Router, Astro, Cloudflare, Bun, Node, AWS Lambda & more.
38 lines (37 loc) • 2.14 kB
TypeScript
import type { Static } from "../../core/utils";
import type { EntityManager } from "../../data";
import { Field, type TActionContext, type TRenderContext } from "./Field";
import * as tbbox from "@sinclair/typebox";
import type { TFieldTSType } from "../../data/entities/EntityTypescript";
export declare const jsonFieldConfigSchema: tbbox.TObject<{
default_value: tbbox.TOptional<tbbox.TAny>;
required: tbbox.TOptional<tbbox.TBoolean>;
description: tbbox.TOptional<tbbox.TString>;
label: tbbox.TOptional<tbbox.TString>;
fillable: tbbox.TOptional<tbbox.TUnion<[tbbox.TBoolean, tbbox.TArray<tbbox.TUnsafe<"create" | "read" | "update" | "delete">>]>>;
hidden: tbbox.TOptional<tbbox.TUnion<[tbbox.TBoolean, tbbox.TArray<tbbox.TUnsafe<"form" | "table" | "create" | "read" | "update" | "delete" | "submit">>]>>;
virtual: tbbox.TOptional<tbbox.TBoolean>;
}>;
export type JsonFieldConfig = Static<typeof jsonFieldConfigSchema>;
export declare class JsonField<Required extends true | false = false, TypeOverride = object> extends Field<JsonFieldConfig, TypeOverride, Required> {
readonly type = "json";
protected getSchema(): tbbox.TObject<{
default_value: tbbox.TOptional<tbbox.TAny>;
required: tbbox.TOptional<tbbox.TBoolean>;
description: tbbox.TOptional<tbbox.TString>;
label: tbbox.TOptional<tbbox.TString>;
fillable: tbbox.TOptional<tbbox.TUnion<[tbbox.TBoolean, tbbox.TArray<tbbox.TUnsafe<"create" | "read" | "update" | "delete">>]>>;
hidden: tbbox.TOptional<tbbox.TUnion<[tbbox.TBoolean, tbbox.TArray<tbbox.TUnsafe<"form" | "table" | "create" | "read" | "update" | "delete" | "submit">>]>>;
virtual: tbbox.TOptional<tbbox.TBoolean>;
}>;
/**
* Transform value after retrieving from database
* @param value
*/
transformRetrieve(value: any): any;
isSerializable(value: any): boolean;
isSerialized(value: any): boolean;
getValue(value: any, context: TRenderContext): any;
transformPersist(_value: any, em: EntityManager<any>, context: TActionContext): Promise<string | undefined>;
toType(): TFieldTSType;
}