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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@codamic/codamai-utils

v1.0.11

Published

Utils to connect your frontend to a codamai cms instance with TS or JS.

Readme

Codamai Headless CMS Connector

Use this library to connect a frontend to a codamai headless CMS system easily. With a codamai headless CMS you get default CRUD-L (Create, Read, Update, Delete, List (Query)) Endpoints. This library is an easy way to access your data.

Codamai Headless CMS Information

Codamai CMS is a headless CMS for ERP systems. You can configure your own CMS with keycloak user management, ready to use, docker ready CMS, stored in your own git repository. See https://www.codamai-cms.com for further details.

Setup

Access to non-public endpoints in the codamai cms requires a bearer auth token. You can set the token by insert current auth token into session storage "authToken".

Install via npm

npm install -s codamai-utils

use in your project

import { CodamaiCmsApi } from '@codamic/codamai-utils'

const API = new CodamaiCmsApi('%baseUrl%', '%CmsGroup%', '%CmsModel%', GroupModel.prototype)

Replace %baseUrl%, %CmsGroup% and %CmsModel% with your CMS specified details.

Response of CMS

The Codamai REST API is a graphql-like query. You use it like this:

const response = {
    id: true,
    prename: true,
    address: {  // we get only id and street of address model
        id: true,
        street: true
    },
    animal: {
        '*': true, // all string, number, etc information of animal, but no lists or models.
        'name': false // exclude name from response
    },
    connections: {
        'db-*': true // all properties start with "db-" 
    }
}

Why not graphql?

We decided to make an easier query api instead of graphql. Remembering graphql is developed by Facebook. They have other requirements than an ERP System. So we will add a graphql support if required. Please feed free to add a feature request.

Examples

create object

const API = new CodamaiCmsApi('https://myapp.com/cms/', 'customer', 'person', CustomerPerson.prototype)
const responsePerson = await API.create({prename: 'Daniel', 'lastname': 'Mertins'}, {'*': true})
console.log(responsePerson.id) // --> results new database id

Read Object by ID

Fetch an object by its id, return all values requested in second param.

const API = new CodamaiCmsApi('https://myapp.com/cms/', 'customer', 'person', CustomerPerson.prototype)
const person = await API.read('1111-2222-3333-4444', {id: true, prename: true, lastname: true})

You can use wildcards and get all base fields as response.

const API = new CodamaiCmsApi('https://myapp.com/cms/', 'customer', 'person', CustomerPerson.prototype)
const person = await API.read('1111-2222-3333-4444', {'*': true})

update (replace) object

Use simple update to overwrite a hole object. CMS could be deleting child models if CMS settings are set. You can fetch a response if you need to update your frontend. If not required, just fetch "id" and ignore response.

const API = new CodamaiCmsApi('https://myapp.com/cms/', 'customer', 'person', CustomerPerson.prototype)
const responsePerson = await API.update({prename: 'Daniel', 'lastname': 'Mertins'}, {'*': true})

patch update object (recommended)

Same as update, but PATCH Update only check the particular send data. Use this if no other reason is given.

const API = new CodamaiCmsApi('https://myapp.com/cms/', 'customer', 'person', CustomerPerson.prototype)
const responsePerson = await API.patch({prename: 'Daniel', 'lastname': 'Mertins'}, {'*': true})

delete an object

Delete an object doesn't have a response. It will work or throw an error.

const API = new CodamaiCmsApi('https://myapp.com/cms/', 'customer', 'person', CustomerPerson.prototype)
try {
    await API.delete('1111-2222-3333-4444')
} catch (e) {
    console.log(e) // should give you more informations. 
}

Search and list objects

List and search is more complex of course.

List Customer Persons where field "city" is "Wiesbaden" AND "name" like "Dan" OR lastname like "Dan".

const API = new CodamaiCmsApi('https://myapp.com/cms/', 'customer', 'person', CustomerPerson.prototype)
let page = 0 // first page
let perPage = 10 // items per page
let sortBy = 'prename' // field to sort
const queryLogic = Logic.AND(
    Filter.equals("city", "Wiesbaden"),
    Logic.OR(
        Filter.like("name", "Dan%"),
        Filter.like("lastname", "%Dan%")
    )
)
const responsePerson = await API.list(page, perPage, queryLogic, sortBy, 'ASC', {'*': true})