UNPKG

bknd

Version:

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

53 lines (52 loc) 3.52 kB
import { Field } from "../data/fields"; import { s } from "bknd/utils"; export declare const mediaFieldConfigSchema: s.ObjectSchema<{ readonly label: s.Schema<s.ISchemaOptions, string | undefined, string | undefined>; readonly description: s.Schema<s.ISchemaOptions, string | undefined, string | undefined>; readonly required: s.Schema<s.ISchemaOptions, boolean | undefined, boolean | 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, any, any>; readonly entity: s.Schema<s.ISchemaOptions, string | undefined, string | undefined>; readonly min_items: s.Schema<s.ISchemaOptions, number | undefined, number | undefined>; readonly max_items: s.Schema<s.ISchemaOptions, number | undefined, number | undefined>; readonly mime_types: s.Schema<s.ISchemaOptions, string[] | undefined, string[] | undefined>; }, s.Merge<s.IObjectOptions & { additionalProperties: false; }>>; export type MediaFieldConfig = s.Static<typeof mediaFieldConfigSchema>; export type MediaItem = { id: number; path: string; mime_type: string; size: number; scope: number; etag: string; modified_at: Date; folder: boolean; }; export declare class MediaField<Required extends true | false = false, TypeOverride = MediaItem[]> extends Field<MediaFieldConfig, TypeOverride, Required> { readonly type = "media"; constructor(name: string, config: Partial<MediaFieldConfig>); protected getSchema(): s.ObjectSchema<{ readonly label: s.Schema<s.ISchemaOptions, string | undefined, string | undefined>; readonly description: s.Schema<s.ISchemaOptions, string | undefined, string | undefined>; readonly required: s.Schema<s.ISchemaOptions, boolean | undefined, boolean | 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, any, any>; readonly entity: s.Schema<s.ISchemaOptions, string | undefined, string | undefined>; readonly min_items: s.Schema<s.ISchemaOptions, number | undefined, number | undefined>; readonly max_items: s.Schema<s.ISchemaOptions, number | undefined, number | undefined>; readonly mime_types: s.Schema<s.ISchemaOptions, string[] | undefined, string[] | undefined>; }, s.Merge<s.IObjectOptions & { additionalProperties: false; }>>; getMaxItems(): number | undefined; getAllowedMimeTypes(): string[] | undefined; getMinItems(): number | undefined; schema(): undefined; toJsonSchema(): any; }