Interface: DocumentVersion
Defined in: packages/core/src/document.types.ts:79
One version of a page's composition — the input to compile, and what an editing session
reads and rewrites. Flat by design: elements is an index keyed by id and a node's slots hold
child ids, so every operation addresses a node directly rather than walking a tree to reach it.
setNodeProp, addNode, removeNode and moveNode each return a new one, copy-on-write,
with every untouched node kept by reference. None of them bumps version.
Example
const version: DocumentVersion = {
documentId: "d1",
version: 1,
roots: ["n1"],
elements: {
n1: { id: "n1", block: "Hero", props: { title: "T" }, slots: { items: ["n2"] } },
n2: { id: "n2", block: "Card", props: { label: "L" } },
},
meta: { title: "Summer promotion" },
createdAt: "2026-01-01T00:00:00Z",
createdBy: "studio",
};
Properties
createdAt
createdAt:
string
Defined in: packages/core/src/document.types.ts:98
When this version was authored, as an ISO 8601 timestamp. Not carried into the artifact.
createdBy
createdBy:
string
Defined in: packages/core/src/document.types.ts:103
Who authored it, in whatever identity the consumer's authoring surface uses. Not carried into the artifact either — both fields describe the draft, not the published page.
documentId
documentId:
string
Defined in: packages/core/src/document.types.ts:81
The page this is a version of, stable across every version of it. Stamped into the artifact.
elements
elements:
Record<string,Node>
Defined in: packages/core/src/document.types.ts:94
Every node in the document, keyed by its own id. A node no slot and no root reaches is
unreachable, which compile refuses rather than dropping in silence.
meta
meta:
DocumentMeta
Defined in: packages/core/src/document.types.ts:96
What the page says about itself. Copied into the artifact unchanged.
roots
roots: readonly
string[]
Defined in: packages/core/src/document.types.ts:89
Ordered entry elements — the artifact's tree is these, denormalized, in this order. An id
with no element behind it is a dangling-child, and an empty list is no-roots. See
A document has many roots.
version
version:
number
Defined in: packages/core/src/document.types.ts:83
Which version of that page. Appending a version belongs to the authoring store, not to one edit.