Skip to content

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",
}
}
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)
  • Omit<BaseFieldInput<TCollectionSlug, TFieldKey, TFieldMeta>, "required" | "defaultValue" | "admin">

TCollectionSlug extends VexResourceSlug = VexResourceSlug

TFieldKey extends string = never

TFieldMeta extends object = { }

optional admin?: CommitTsFieldAdminInput<TCollectionSlug>

Defined in: packages/core/src/fields/commitTs/types.ts:89


optional description?: string

Defined in: packages/core/src/fields/baseTypes.ts:516

Semantic description of the field. Used in three places:

  1. Helper text rendered below the field input in the admin form UI.
  2. As the Zod .meta({ description }) value for form validation.
  3. As the JSDoc comment on the generated document interface property.

To write a separate JSDoc comment, use interfaceDescription in addition.

BaseFieldInput.description


optional index?: 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.

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"])

Omit.index


optional interfaceDescription?: string

Defined in: packages/core/src/fields/baseTypes.ts:518

The JSDoc comment on the generated document interface property

BaseFieldInput.interfaceDescription


optional label?: string

Defined in: packages/core/src/fields/baseTypes.ts:507

Display label for the field in the admin form.

BaseFieldInput.label


optional meta?: TFieldMeta

Defined in: packages/core/src/fields/baseTypes.ts:546

Omit.meta


optional on?: CommitTsFieldOn

Defined in: packages/core/src/fields/commitTs/types.ts:88

Which write events stamp this field. Default: "save".

CommitTsFieldOn


optional validate?: (props) => void | Promise<void>

Defined in: packages/core/src/fields/baseTypes.ts:551

Server-only async validation, run after the generated Zod schema passes.

FieldValidateProps<TCollectionSlug>

void | Promise<void>

FieldValidate

Omit.validate