talizen
v0.1.0
Published
Talizen frontend SDK types for cms, form and core.
Readme
talizen
Talizen's frontend SDK package. It provides a small runtime client and shared types for:
talizen/coretalizen/cmstalizen/form
The package is designed to hold the platform-level APIs that frontend projects use directly, while project-specific CMS and form schema types can still be generated separately per project.
Install
npm install talizenUsage
Configure the client
import { setTalizenConfig } from "talizen/core"
setTalizenConfig({
baseUrl: "https://www.talizen.com",
})List CMS content
import { listContents, type BaseCmsItem } from "talizen/cms"
interface Blog extends BaseCmsItem {
readonly __cmsKey: "blogs"
body: {
title?: string
content?: string
}
}
const result = await listContents<Blog>("blogs", {
limit: 10,
orderBy: "-created_at",
})
console.log(result.list)
console.log(result.total)Get a single CMS content item
import { getContent, type BaseCmsItem } from "talizen/cms"
interface Blog extends BaseCmsItem {
readonly __cmsKey: "blogs"
body: {
title?: string
}
}
const blog = await getContent<Blog>("blogs", "hello-world")Submit a form
import { submitForm } from "talizen/form"
await submitForm("contact-form", {
email: "[email protected]",
message: "Hello from the website",
})Package Layout
talizen/core: shared runtime config, request helpers, and base data types.talizen/cms: CMS content types and content query APIs.talizen/form: form submission helpers and related types.
Publish
Build and prepare the package contents:
npm install
npm run build
node scripts/prepare-publish.mjsThe GitHub Actions workflow in .github/workflows/publish.yml publishes on a tag push. Release a new version with:
git tag v0.0.8
git push origin main
git push origin v0.0.8