Skip to content

fieldsToPopulateMap

fieldsToPopulateMap(props): string

Defined in: packages/core/src/fields/utils.ts:415

Renders one CollectionsPopulateMap entry for the generated declare module '@vexcms/core' block — the type-level counterpart of buildDepthPopulate’s runtime walk, except keyed by field STRUCTURE (relationship/upload leaf, or a group/blocks/array container to recurse through) rather than by target depth.

Only relationship/upload leaves and group/blocks/array/keyValue containers that themselves carry at least one such leaf (at any depth) produce an entry — a field with nothing populatable inside it (text, richtext, a group of plain strings, …) is omitted entirely, so PopulateShape/Populated never see it and can’t recurse into it.

array() is transparent here: its own map entry IS its items field’s entry (an array of relationship ids behaves like the relationship field itself; an array of group() items behaves like the group). tabs() / row() / collapsible() need no handling at all — getDataFields already hoists their fields to this same level before this function ever sees them.

Record<string, AdminField>

The resource’s resolved field map.

string

The map key — the collection or global slug.

string

TypeScript source for one entry, without wrapping braces.

fieldsToPopulateMap({ key: "posts", fields: posts.fields });
// → '\tposts: { author: { kind: "relationship"; target: "authors" } }'