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

@b4m-oss/kiyax-js-sdk

v0.10.3

Published

KIYAX Public API SDK for JavaScript/TypeScript

Readme

@b4m-oss/kiyax-js-sdk

KIYAX Public API SDK for JavaScript/TypeScript

Installation

As an npm package

npm install @b4m-oss/kiyax-js-sdk

Via script tag (CDN)

<script src="https://example.com/@b4m-oss/kiyax-js-sdk/dist/index.min.umd.js"></script>

Usage

ES Module

import { KiyaxSDK } from '@b4m-oss/kiyax-js-sdk'

const sdk = new KiyaxSDK({
  apiBase: 'https://example.com/', // Base URL of the KIYAX API
  timeout: 10000, // Timeout in milliseconds
})

// Load a document and render it into a DOM element
await sdk.loadAndRenderDocument(1, '#document-container')

// Fetch document data only
const document = await sdk.getData(1)
console.log(document.title)

// Load a CMS article and render it
await sdk.loadAndRenderCMSArticle(1, '#article-container')

// Load a CMS article list
const list = await sdk.loadCMSList(1, { page: 1, limit: 10 })

UMD (via script tag)

<div id="document-container"></div>

<script src="https://example.com/@b4m-oss/kiyax-js-sdk/dist/index.min.umd.js"></script>
<script>
  const sdk = new KiyaxSDK.KiyaxSDK({
    apiBase: 'https://example.com/'
  })

  sdk.loadAndRenderDocument(1, '#document-container')
    .then(data => {
      console.log('Loaded:', data)
    })
    .catch(error => {
      console.error('Error:', error)
    })
</script>

API

KiyaxSDK

Constructor

new KiyaxSDK(config?: SDKConfig)

config:

  • apiBase?: string - Base URL of the KIYAX API (default: https://example.com/)
  • timeout?: number - Request timeout in milliseconds (default: 10000)

Methods

loadDocument(docId: number, options?: LoadOptions): Promise<DocumentData>

Loads a document.

Parameters:

  • docId: number - Document ID
  • options?: LoadOptions
    • apiBase?: string - Overrides the instance-level apiBase
    • timeout?: number - Overrides the instance-level timeout

Returns: Promise<DocumentData>

loadCMSArticle(announcementId: number, options?: LoadOptions): Promise<CMSArticleData>

Loads a CMS article.

loadCMSList(symbolId: number, options?: LoadOptions & { page?: number; limit?: number }): Promise<CMSListData>

Loads a CMS article list.

getData(docId: number, options?: LoadOptions): Promise<DocumentData>

Fetches document data without rendering.

renderToElement(element: HTMLElement | string, data: DocumentData | CMSArticleData, options?: RenderOptions): Promise<void>

Renders data into a DOM element.

Parameters:

  • element: HTMLElement | string - Target element or CSS selector
  • data: DocumentData | CMSArticleData - Data to render
  • options?: RenderOptions
    • format?: 'html' | 'markdown' - Output format (default: 'html')
    • className?: string - Base CSS class name (default: 'kiyax-document' or 'kiyax-cms-article')
    • wrapperTag?: string - Wrapper tag (default: 'div' or 'article')
loadAndRenderDocument(docId: number, element: HTMLElement | string, loadOptions?: LoadOptions, renderOptions?: RenderOptions): Promise<DocumentData>

Loads a document and renders it into a DOM element.

loadAndRenderCMSArticle(announcementId: number, element: HTMLElement | string, loadOptions?: LoadOptions, renderOptions?: RenderOptions): Promise<CMSArticleData>

Loads a CMS article and renders it into a DOM element.

Types

DocumentData

interface DocumentData {
  id: number
  title: string
  description: string | null
  body: string
  status: string
  slug: string
  created_at: string
  updated_at: string
}

CMSArticleData

interface CMSArticleData {
  id: number
  title: string
  description: string | null
  symbol_title: string | null
  current_revision: {
    id: number
    title: string
    description: string | null
    body: string
  }
  created_at: string
  updated_at: string
}

Error handling

import { APIError, NetworkError } from '@b4m-oss/kiyax-js-sdk'

try {
  const document = await sdk.loadDocument(1)
} catch (error) {
  if (error instanceof APIError) {
    console.error('API Error:', error.code, error.message)
  } else if (error instanceof NetworkError) {
    console.error('Network Error:', error.message)
  }
}

Authentication

The JS SDK supports the following modes:

  • No authentication: Default
  • Origin restriction: Handled via CORS configuration on the server

API key–based authentication is intended for server-side usage only (see the PHP SDK).

Development

npm install
npm run dev
npm run build

License

MIT