// Executor for `content.types`. Projects the registered content types down to // the wire-safe descriptor the editor renders forms from (dropping the // server-only `derived.transform` function + nested element/struct depth — the // two shipped types are flat, and deep widgets fall back to a placeholder). import type { AppContext } from '@voltro/runtime' import { contentTypes as registered } from '../content' const execute = async (_input: Record, _ctx: AppContext) => ({ types: registered.map((ct) => ({ name: ct.name, displayName: ct.displayName, pluralName: ct.pluralName, columns: ct.list?.columns ?? Object.keys(ct.fields), fields: Object.entries(ct.fields).map(([name, field]) => ({ name, kind: field.kind, editorHint: field.editorHint, isOptional: field.isOptional, ...(field.maxLength !== undefined ? { maxLength: field.maxLength } : {}), ...(field.literals !== undefined ? { literals: field.literals } : {}), ...(field.referenceType !== undefined ? { referenceType: field.referenceType } : {}), })), })), }) export default execute