Skip to content

FileField

Defined in: packages/schema/src/file-field.ts:6

f.file(): a text column holding a file’s URI, uploaded through :upload. See Files.

V

readonly def: FieldTypeDef

Defined in: packages/schema/src/field.ts:91

Its field type.

Field.def


readonly meta: FieldMeta

Defined in: packages/schema/src/field.ts:93

What its builder methods have set.

Field.meta


readonly schema: ZodType<V>

Defined in: packages/schema/src/field.ts:87

The Zod schema a value is checked with on every create and update: the type’s, nullable and defaulted as set.

Field.schema

accept(types): FileField<V>

Defined in: packages/schema/src/file-field.ts:8

Allowed types, checked against the type detected from the content: ['image/*', 'application/pdf'].

readonly string[]

FileField<V>


access(rules): FileField<V>

Defined in: packages/schema/src/file-field.ts:79

Role-based rules for reading and writing the file; uploading needs write access to the field.

FieldAccess

FileField<V>

Field.access


ai(o): Field<V>

Defined in: packages/schema/src/field.ts:177

A job fills the field from prompt, {field} replaced by the record’s values, after a create, and after an update that changes a field the prompt names, as the user who wrote; see AI fields and actions.

string

Field<V>

Field.ai


alias(…names): Field<V>

Defined in: packages/schema/src/field.ts:144

Other names filters may use for the field.

…string[]

Field<V>

Field.alias


column(name): FileField<V>

Defined in: packages/schema/src/file-field.ts:74

The column, when it is not the snake_case of the field’s name.

string

FileField<V>

Field.column


dbDefault(): Field<V>

Defined in: packages/schema/src/field.ts:139

The database supplies a value when none is given (identity, now(), …).

Field<V>

Field.dbDefault


default(value): Field<V>

Defined in: packages/schema/src/field.ts:118

The value a create uses when none is given; the admin’s create form shows it.

V

Field<V>

Field.default


derive(processors): FileField<V>

Defined in: packages/schema/src/file-field.ts:31

Values computed from each upload, written to other fields of the resource (read-only ones) in the same write as the file: { image_width: imageSize('width') }. Clearing the file clears them.

Record<string, FileProcessor>

FileField<V>


externalUrls(): FileField<V>

Defined in: packages/schema/src/file-field.ts:59

Also takes an https URL of a file elsewhere, such as https://images.example.com/photos/42.jpg, stored as it is: never uploaded, without variants, and drawn from that address. See External URLs.

FileField<V>


filterable(): Field<V>

Defined in: packages/schema/src/field.ts:149

The field may appear in filter, in filter widgets and in the filters of composed pages. Give it an index.

Field<V>

Field.filterable


max(value): Field<V>

Defined in: packages/schema/src/field.ts:169

The greatest value of an integer, or the longest length of a text. Only f.integer() and f.text() take it.

number

Field<V>

Field.max


maxSize(size): FileField<V>

Defined in: packages/schema/src/file-field.ts:13

The largest upload, as bytes or text such as 10 MB; default 50 MB.

string | number

FileField<V>


min(value): Field<V>

Defined in: packages/schema/src/field.ts:164

The least value of an integer, or the shortest length of a text. Only f.integer() and f.text() take it.

number

Field<V>

Field.min


optional(): FileField<V | null>

Defined in: packages/schema/src/file-field.ts:64

The column is nullable: the field may hold no file.

FileField<V | null>

Field.optional


placeholder(field): FileField<V>

Defined in: packages/schema/src/file-field.ts:39

Computes a ThumbHash of each image into a read-only text field (photo_placeholder), which the admin app shows while the image loads. Other files leave it null.

string

FileField<V>


public(): FileField<V>

Defined in: packages/schema/src/file-field.ts:18

Stored with the public provider, at a permanent URL anyone with it may open.

FileField<V>


readOnly(): FileField<V>

Defined in: packages/schema/src/file-field.ts:69

Never written through the API.

FileField<V>

Field.readOnly


regex(re, message): Field<V>

Defined in: packages/schema/src/field.ts:159

Text must match re; a value that does not gets an issue with message. Only f.text() takes it.

RegExp

string

Field<V>

Field.regex


sensitive(): Field<V>

Defined in: packages/schema/src/field.ts:134

Hidden like a password: never part of a list, record, search or write response. A caller who may read it fetches the value of one record on its own (POST /{resource}/{key}:reveal), and every reveal is published as an audit event.

Field<V>

Field.sensitive


sortable(): Field<V>

Defined in: packages/schema/src/field.ts:154

The field may appear in order_by and in sorts.

Field<V>

Field.sortable


storage(provider): FileField<V>

Defined in: packages/schema/src/file-field.ts:23

Stored with this provider of files.providers; default private.

string

FileField<V>


variants(variants, options?): FileField<V>

Defined in: packages/schema/src/file-field.ts:47

Resized copies of each image, stored beside it under these names: { card: { width: 640, height: 480, fit: 'cover', format: 'webp' } }. { original } stores that image instead of the upload. Other files get none.

Record<string, ImageVariant>

ImageVariantOptions = {}

FileField<V>