The shape you pass to cms0<T>() becomes the shape of the client.
const homePage = await cms.homePage();
const articles = await cms.articles();Accessors are generated from the TypeScript shape that the CLI publishes. If an accessor is missing, republish the schema.
Root content
Root content is a singleton.
const homePage = await cms.homePage();
await cms.homePage.update({
headline: "A better headline",
});Collections
Array fields become collection accessors.
const articles = await cms.articles();
const article = await cms.articles.byId("article_id");
await cms.articles.create({
title: "Launch notes",
slug: "launch-notes",
});
await cms.articles.update("article_id", {
title: "Updated title",
});
await cms.articles.delete("article_id");Options
Accessors accept read options:
const homePage = await cms.homePage({
fields: ["headline", "seo.title"],
exclude: ["seo.jsonLd"],
graph: {
pageSize: "full",
paths: {
"seo.openGraph.images": { pageSize: 50 },
},
},
includeId: true,
locale: "en",
});Use:
fieldsto include specific nested pathsexcludeto remove specific nested pathsgraph.page,graph.pageSize,graph.orderBy,graph.orderDir, andgraph.searchto control resolved graph arrays recursivelygraph.pathsto override graph controls for a nested dot path such asseo.openGraph.imagesincludeIdto include cms0 object IDslocalewhen reading localized contentresponse: "envelope"when you need response metadata
fields and exclude control the returned shape. Graph pagination and sorting live under graph so a read like cms.homePage({ fields: "seo", graph: { pageSize: "full" } }) applies the full page size to nested graph-backed arrays inside seo. Resolved root reads default to graph.pageSize: "full".
Success check
Accessor calls should match your TypeScript schema. If a field does not exist on the client, publish the schema again and confirm the entry file in cms0.config.ts points at the file that calls cms0<T>().