@nuasite/cms-client
v0.47.4
Published
Headless TypeScript SDK for the Nua CMS — typed client over the cms-sidecar /cms/v1 contract plus the pure entry-draft form model (zero React).
Readme
@nuasite/cms-client
Headless TypeScript SDK for the Nua CMS. Zero React/DOM-framework coupling — just
a typed fetch client over the cms-sidecar /cms/v1 HTTP contract plus the pure
entry-draft form model.
Build any collections UI on top of it:
import {
createClient,
draftFromEntry,
setDraftField,
} from '@nuasite/cms-client'
const client = createClient('/app/project/acme/session/123/cms') // host adds /cms/v1
const collections = await client.getCollections()
const entry = await client.getEntry('posts', 'hello-world')What's here
createClient(apiBase)→CmsClient:getProject/getCollections/getEntries/getEntryplus mutations (updateEntrywith409conflict result,createEntry,deleteEntry,renameEntry, array item ops) and media (listMedia/uploadMedia/deleteMedia, degrades to501when the sidecar has no adapter — seeisMediaUnavailable).CmsClientError— carries the sidecar errorcode(unauthorized/forbidden/not_found/…).- Form model —
draftFromEntry,draftForCreate,draftFromServerFrontmatter,setDraftField,coerceInput,parseWireValue, andvalueTo*readers. Pure, unit-testable wire ↔ native mapping for the entry editor.
The structural contract (collections/fields/entries/media) is re-used 1:1 from
@nuasite/cms-types. The default React UI built on this SDK is
@nuasite/collections-admin.
