CommitTsFieldInput
Defined in: packages/core/src/fields/commitTs/types.ts:82
Configuration input for a commitTs() field.
commitTs fields store Convex’s own commit-serialization clock value
(ctx.db.vars.commitTs, a nanosecond Int64 resolved server-side at
commit) — never a client-supplied or app-computed timestamp. The field is
always read-only in the admin form and never appears in create/update
input validation; the ONLY way its value changes is by being written with
the on-policy’s matching event, which stampCommitTsFields
(db/documents.ts) does automatically.
Defaults applied by commitTs():
{ type: "commitTs", label: "", // inferred from the field key by defineCollection on: "save", // stamped on create/update/publish/unpublish, never on an autosave draft admin: { hidden: false, readOnly: true, // always — never user-editable, regardless of input position: "main", width: "100%", cellAlignment: "left", enableSorting: true, // always has an auto-index; sortable by default format: "datetime", }}Example
Section titled “Example”import { commitTs, defineCollection } from '@vexcms/core'
posts: defineCollection({ fields: { // Stamped on create/update/publish/unpublish — not autosave drafts updatedAt: commitTs(),
// Stamped only when a version actually goes live publishedCommitTs: commitTs({ on: "publish", label: "Published At" }),
// Stamped on every write, including autosave drafts lastTouchedAt: commitTs({ on: "all", admin: { format: "relative" } }), }})- CommitTsField for the resolved type after defaults are applied
- commitTs for the config function that applies defaults
- BaseFieldInput for shared properties (
label,description,index)
Extends
Section titled “Extends”Omit<BaseFieldInput<TCollectionSlug,TFieldKey,TFieldMeta>,"required"|"defaultValue"|"admin">
Type Parameters
Section titled “Type Parameters”TCollectionSlug
Section titled “TCollectionSlug”TCollectionSlug extends VexResourceSlug = VexResourceSlug
TFieldKey
Section titled “TFieldKey”TFieldKey extends string = never
TFieldMeta
Section titled “TFieldMeta”TFieldMeta extends object = { }
Properties
Section titled “Properties”admin?
Section titled “admin?”
optionaladmin?:CommitTsFieldAdminInput<TCollectionSlug>
Defined in: packages/core/src/fields/commitTs/types.ts:89
description?
Section titled “description?”
optionaldescription?:string
Defined in: packages/core/src/fields/baseTypes.ts:516
Semantic description of the field. Used in three places:
- Helper text rendered below the field input in the admin form UI.
- As the Zod
.meta({ description })value for form validation. - As the JSDoc comment on the generated document interface property.
To write a separate JSDoc comment, use interfaceDescription in addition.
Inherited from
Section titled “Inherited from”index?
Section titled “index?”
optionalindex?:FieldIndexConfigInput<TCollectionSlug,TFieldKey>
Defined in: packages/core/src/fields/baseTypes.ts:545
Create a database index on this field. The string value becomes the index name in Convex.
Example
Section titled “Example”slug: { type: "text", index: "by_slug", required: true }// Generates: .index("by_slug", ["slug"])
author: { type: "relationship", index: { name: "by_author_status", additionalFields: ["status"] } }// Generates: .index("by_author_status", ["author", "status"])Inherited from
Section titled “Inherited from”Omit.index
interfaceDescription?
Section titled “interfaceDescription?”
optionalinterfaceDescription?:string
Defined in: packages/core/src/fields/baseTypes.ts:518
The JSDoc comment on the generated document interface property
Inherited from
Section titled “Inherited from”BaseFieldInput.interfaceDescription
label?
Section titled “label?”
optionallabel?:string
Defined in: packages/core/src/fields/baseTypes.ts:507
Display label for the field in the admin form.
Inherited from
Section titled “Inherited from”
optionalmeta?:TFieldMeta
Defined in: packages/core/src/fields/baseTypes.ts:546
Inherited from
Section titled “Inherited from”Omit.meta
optionalon?:CommitTsFieldOn
Defined in: packages/core/src/fields/commitTs/types.ts:88
Which write events stamp this field. Default: "save".
validate?
Section titled “validate?”
optionalvalidate?: (props) =>void|Promise<void>
Defined in: packages/core/src/fields/baseTypes.ts:551
Server-only async validation, run after the generated Zod schema passes.
Parameters
Section titled “Parameters”FieldValidateProps<TCollectionSlug>
Returns
Section titled “Returns”void | Promise<void>
Inherited from
Section titled “Inherited from”Omit.validate