Model - Model serialize
API reference for src/core/modelSerialize on @huukhanhnguyen/model, reachable from ..
See the Guide for the ModelJSON / evaluate pipeline.
API reference
Signatures are generated from the live package .d.ts - not hand-written.
modelSections
function
Partition a flat runtime node collection into the persisted sections (empty arrays omitted): value nodes (ParameterNode) and header containers (lane "parameters") → parameters; everything else → objects (body / scene role). THE one partition rule — Model.toJSON and any host that saves a bare NodeCollection (no owning Model) share it.
A body node that is NOT a container serializes as-is, which is a document the schema rejects by design: SCHEMA 46 has no root operation, and a named validate error ("wrap it in an object") is the right place to say so — silently wrapping one would invent an object the author never wrote, and silently dropping it would lose their work.
modelSections(nodes: NodeCollection<ChildNode>): Pick<ModelJSON, "parameters" | "objects">