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

cobrili-client

v1.0.14

Published

Modern TypeScript API client for Cobrili REST API - works in Browser and Node.js

Readme

Cobrili-Client

Modern TypeScript API client for the Cobrili™ Content Delivery System by Acolada GmbH.

Developed by dictaJet Ingenieurgesellschaft mbH.

About Cobrili

Cobrili™ is an HTML5-based Content Delivery System for online help and e-learning content. Key features include:

  • Online and offline availability
  • Faceted search and terminology-based search functions
  • Multi-language and multi-variant content delivery
  • Flexible metadata filtering
  • Rich API for integration into software applications

This client library provides a TypeScript/JavaScript interface to the Cobrili REST API.

Features

  • ✅ Full TypeScript support with type definitions
  • ✅ Registry-driven API with all methods auto-generated
  • ✅ Works in Browser and Node.js
  • ✅ XML-over-JSON communication (handled internally)
  • ✅ Promise/async-await API
  • ✅ Configurable base URL and headers
  • ✅ Explicit session initialization

Installation

npm install cobrili-client

Quick Start

import { createCobriliClient } from 'cobrili-client'

const client = createCobriliClient({
	baseUrl: 'https://your-server.com',
	endpoint: '/api/cobrili'
})

// Initialize session (required before making API calls)
await client.init()

// Now you can make API calls
const helpsets = await client.getAllHelpsets({
	masterHelpSetApplicationIdentifier: 'MyApp',
	withMetadata: true
})

if (helpsets.data) {
	console.log('Helpsets:', helpsets.data.helpsetInfos)
} else {
	console.error('Error:', helpsets.error.message)
}

Usage

Creating the Client

import { createCobriliClient } from 'cobrili-client'

const client = createCobriliClient({
	baseUrl: 'https://your-server.com', // Backend server URL
	endpoint: '/api/cobrili', // API endpoint path
	timeout: 30000, // Request timeout in ms (optional)
	headers: {}, // Custom headers (optional)
	debug: false // Enable debug logging (optional)
})

Server-Side Usage (Node.js)

For server-side usage, you need to provide a cookieStore to manage session cookies manually:

import { createCobriliClient, type CookieStore } from 'cobrili-client'

// Create a simple cookie store
let sessionCookie: string | undefined
const cookieStore: CookieStore = {
	get: () => sessionCookie,
	set: (value: string) => {
		sessionCookie = value
	}
}

const client = createCobriliClient({
	baseUrl: 'https://your-server.com',
	endpoint: '/api/cobrili',
	cookieStore // Required for Node.js/server environments
})

Initialization (Required)

The client must be initialized before making API calls. This creates a session with the backend:

// Initialize the session
await client.init()

// Check if initialized
if (client.isInitialized()) {
	// Ready to make API calls
}

Typical Workflow

// 1. Initialize
await client.init()

// 2. Activate a master helpset
const masterResult = await client.switchMasterHelpSet({
	masterHelpSetApplicationIdentifier: 'MyApp',
	initActiveHelpset: true
})

// 3. Get all helpsets
const helpsetsResult = await client.getAllHelpsets({
	masterHelpSetApplicationIdentifier: 'MyApp',
	withMetadata: true
})

// 4. Load a specific helpset
await client.loadActiveHelpset({ helpsetID: 123 })

// 5. Get navigation tree
const navResult = await client.getNavigationWithMetaData({
	currentNavigationID: 0,
	wantedMetaKeys: [],
	useHelpsetMetadataFallback: false
})

// 6. Get topic content
const contentResult = await client.getContent({ topicID: 456 })
if (contentResult.data) {
	// contentResult.data.content contains base64-encoded HTML
}

Response Format

All API methods return a discriminated union type:

type ApiResponse<T> =
	| { data: T; error?: never } // Success
	| { data?: never; error: CobriliError } // Error

interface CobriliError {
	code: string
	message: string
	details?: any
}

Handling Responses

const result = await client.getAllHelpsets({
	masterHelpSetApplicationIdentifier: 'MyApp',
	withMetadata: true
})

if (result.error) {
	// Handle error
	console.error(`${result.error.code}: ${result.error.message}`)
} else {
	// Use data
	const helpsets = result.data.helpsetInfos
}

API Methods

The client provides 163 auto-generated API methods. See API_COMPLETE_REFERENCE.md for the full list.

Key Method Categories

| Category | Examples | |----------|----------| | Session | init(), login(), logout() | | Helpsets | switchMasterHelpSet(), getAllHelpsets(), loadActiveHelpset() | | Navigation | getNavigation(), getBreadCrumb(), navigateToTopic() | | Content | getContent(), getTopicInfo(), getTopicForExternalId() | | Metadata | getPossibleMetaValues(), setCurrentMetaDataSetForSession() | | Search | startSearch(), getSearchResults(), getSuggestionsForSearchInput() | | Bookmarks | addBookmark(), deleteBookmark(), getBookmarkList() | | Users | createUser(), modifyUser(), getAllUsers() |

import { API_METHODS } from 'cobrili-client'

// List all available methods
console.log(Object.keys(API_METHODS))

CommonJS

const { createCobriliClient } = require('cobrili-client')

const client = createCobriliClient({ baseUrl: 'https://your-server.com' })
await client.init()

Documentation

For detailed documentation, see the docs folder:

  • COBRILI_CONCEPTS.md - Core concepts (MasterHelpset, Helpset, Topic, Navigation, Metadata), typical workflows, and architecture overview
  • API_COMPLETE_REFERENCE.md - Complete API reference with all 163 methods, parameters, and XML definitions

Links

License

MIT


Cobrili™ is a trademark of Acolada GmbH, Nürnberg, Germany.

cobrili-client is developed by dictaJet Ingenieurgesellschaft mbH, Wiesbaden, Germany.