npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@konso/cms-client

v0.7.2

Published

TypeScript client for the Konso CMS REST API

Readme

@konso/cms-client

TypeScript client for the Konso CMS REST API.

Installation

npm install @konso/cms-client
# or
pnpm add @konso/cms-client

Setup

import { KonsoCmsClient } from "@konso/cms-client";

const client = new KonsoCmsClient({
  projectId: "your-project-id",
  apiKey: "your-api-key",
});

| Option | Default | Description | | --- | --- | --- | | projectId | — | Your Konso project ID | | apiKey | KONSO_API_KEY env | Your Konso API key | | baseUrl | KONSO_BASE_URL env → https://apis-spb.konso.io | API base URL |

Resources

Pages

// List
const { list, total } = await client.pages.list({ isPublished: true });

// Get by id or slug
const page = await client.pages.get(42);
const page = await client.pages.getBySlug("home");

// Create
const { result: id } = await client.pages.create({
  name: "home",
  slug: "home",
  title: "Home",
  pageType: PageType.Content,   // 1 = Master, 2 = Content
  isActive: true,
  publish: true,
  contents: [
    { contentType: PageContentType.Html, content: "<h1>Hello</h1>" },
  ],
});

// Update
await client.pages.update({ id, title: "New Title" });

// Delete
await client.pages.delete(id);
import { PageType, PageContentType } from "@konso/cms-client";
// PageType:        Master = 1, Content = 2
// PageContentType: Html = 2, Markdown = 6, Json = 9

Contents

const { list } = await client.contents.list({ type: 1 });

const { result: id } = await client.contents.create({
  name: "article-1",
  title: "My Article",
  body: "<p>Body</p>",
  announce: "",
  type: 1,
});

await client.contents.update({ ...existing, id, title: "Updated" });
await client.contents.delete(id);

Categories

const { list } = await client.categories.list({ section: 1 });
const category   = await client.categories.get(id);

const { result: id } = await client.categories.create({
  name: "News",
  slug: "news",
  section: 1,
});

await client.categories.update({ id, name: "Latest News" });
await client.categories.delete(id);

Menus

const { list } = await client.menus.list();
const menu      = await client.menus.get(id);
const menu      = await client.menus.getByName("Main Nav");

const { result: menuId } = await client.menus.create({
  name: "Main Nav",
  items: [
    { text: "Home", link: "/", order: 1 },
  ],
});

await client.menus.update({ id: menuId, name: "Primary Nav" });
await client.menus.delete(menuId);

Menu items

const { list } = await client.menus.listItems(menuId);

const { result: itemId } = await client.menus.createItem({
  menuId,
  text: "About",
  link: "/about",
  order: 2,
});

await client.menus.updateItem({ id: itemId, menuId, text: "About Us" });
await client.menus.deleteItem(itemId);

Tags

const { list } = await client.tags.list();
const tag      = await client.tags.get(id);
const tag      = await client.tags.getByName("typescript");

// Create accepts an array, returns an array of new ids
const { result: ids } = await client.tags.create([
  { tag: "typescript" },
  { tag: "cms" },
]);

await client.tags.update({ id, tag: "ts" });
await client.tags.delete(id);

Error handling

All API errors throw KonsoHttpError:

import { KonsoHttpError } from "@konso/cms-client";

try {
  await client.pages.get(99999);
} catch (err) {
  if (err instanceof KonsoHttpError) {
    console.error(err.status); // HTTP status code
    console.error(err.message); // "Konso API error 404: ..."
    console.error(err.body);   // raw ApiResponse body
  }
}

Requirements

Node.js 18 or later (uses native fetch).