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

@hanzo/api-client

v0.6.4

Published

A TypeScript client library for interacting with the Huly Platform API.

Readme

Huly Platform API Client

A TypeScript client library for interacting with the Huly Platform API.

Installation

In order to be able to install required packages, you will need to obtain GitHub access token. You can create a token by following the instructions here.

npm install @hanzo/api-client

Authentication

There are two ways to connect to the platform, using email and password, or using token.

Parameters:

  • url: URL of the Huly instance
  • options: Connection options
    • workspace: Name of the workspace to connect to
    • token: Optional authentication token
    • email: Optional user email
    • password: Optional user password
    • connectionTimeout: Optional connection timeout
    • socketFactory: Optional socket factory

Using Email and Password

const client = await connect('http://localhost:8087', {
  email: 'user1',
  password: '1234',
  workspace: 'ws1'
})

...

await client.close()

Using Token

const client = await connect('http://localhost:8087', {
  token: '...',
  workspace: 'ws1'
})

...

await client.close()

Example usage

Fetch API

The client provides two main methods for retrieving documents: findOne and findAll.

findOne

Retrieves a single document matching the query criteria.

Parameters:

  • _class: Class of the object to find, results will include all subclasses of the targe class
  • query: Query criteria
  • options: Find options
    • limit: Limit the number of results returned
    • sort: Sorting criteria
    • lookup: Lookup criteria
    • projection: Projection criteria
    • total: If specified total will be returned

Example:

import contact from '@hanzo/contact'

...

const person = await client.findOne(
  contact.class.Person,
  {
    _id: 'person-id'
  }
)

findAll

Retrieves multiple document matching the query criteria.

Parameters:

  • _class: Class of the object to find, results will include all subclasses of the targe class
  • query: Query criteria
  • options: Find options
    • limit: Limit the number of results returned
    • sort: Sorting criteria
    • lookup: Lookup criteria
    • projection: Projection criteria
    • total: If specified total will be returned

Example:

import { SortingOrder } from '@hanzo/core'
import contact from '@hanzo/contact'

..

const persons = await client.findAll(
  contact.class.Person,
  {
    city: 'New York'
  },
  {
    limit: 10,
    sort: {
      name: SortingOrder.Ascending
    }
  }
)

Documents API

The client provides three main methods for managing documents: createDoc, updateDoc, and removeDoc. These methods allow you to perform CRUD operations on documents.

createDoc

Creates a new document in the specified space.

Parameters:

  • _class: Class of the object
  • space: Space of the object
  • attributes: Attributes of the object
  • id: Optional id of the object, if not provided, a new id will be generated

Example:

import contact, { AvatarType } from '@hanzo/contact'

..

const personId = await client.createDoc(
  contact.class.Person,
  contact.space.Contacts,
  {
    name: 'Doe,John',
    city: 'New York',
    avatarType: AvatarType.COLOR
  }
)

updateDoc

Updates exising document.

Parameters:

  • _class: Class of the object
  • space: Space of the object
  • objectId: Id of the object
  • operations: Attributes of the object to update

Example:

import contact from '@hanzo/contact'

..

await client.updateDoc(
  contact.class.Person,
  contact.space.Contacts,
  personId,
  {
    city: 'New York',
  }
)

removeDoc

Removes exising document.

Parameters:

  • _class: Class of the object
  • space: Space of the object
  • objectId: Id of the object

Example:

import contact from '@hanzo/contact'

..

await client.removeDoc(
  contact.class.Person,
  contact.space.Contacts,
  personId
)

Collections API

addCollection

Creates a new attached document in the specified collection.

Parameters:

  • _class: Class of the object to create
  • space: Space of the object to create
  • attachedTo: Id of the object to attach to
  • attachedToClass: Class of the object to attach to
  • collection: Name of the collection containing attached documents
  • attributes: Attributes of the object
  • id: Optional id of the object, if not provided, a new id will be generated

Example:

import contact, { AvatarType } from '@hanzo/contact'

..

const personId = await client.createDoc(
  contact.class.Person,
  contact.space.Contacts,
  {
    name: 'Doe,John',
    city: 'New York',
    avatarType: AvatarType.COLOR
  }
)

await client.addCollection(
  contact.class.Channel,
  contact.space.Contacts,
  personId,
  contact.class.Person,
  'channels',
  {
    provider: contact.channelProvider.Email,
    value: '[email protected]'
  }
)

updateCollection

Updates exising attached document in collection.

Parameters:

  • _class: Class of the object to update
  • space: Space of the object to update
  • objectId: Space of the object to update
  • attachedTo: Id of the parent object
  • attachedToClass: Class of the parent object
  • collection: Name of the collection containing attached documents
  • attributes: Attributes of the object to update

Example:

import contact from '@hanzo/contact'

..

await client.updateCollection(
  contact.class.Channel,
  contact.space.Contacts,
  channelId,
  personId,
  contact.class.Person,
  'channels',
  {
    city: 'New York',
  }
)

removeCollection

Removes exising attached document from collection.

Parameters:

  • _class: Class of the object to remove
  • space: Space of the object to remove
  • objectId: Space of the object to remove
  • attachedTo: Id of the parent object
  • attachedToClass: Class of the parent object
  • collection: Name of the collection containing attached documents

Example:

import contact from '@hanzo/contact'

..

await client.removeCollection(
  contact.class.Channel,
  contact.space.Contacts,
  channelId,
  personId,
  contact.class.Person,
  'channels'
)

Mixins API

The client provides two methods for managing mixins: createMixin and updateMixin.

createMixin

Creates a new mixin for a specified document.

Parameters:

  • objectId: Id of the object the mixin is attached to
  • objectClass: Class of the object the mixin is attached to
  • objectSpace: Space of the object the mixin is attached to
  • mixin: Id of the mixin type to update
  • attributes: Attributes of the mixin
import contact, { AvatarType } from '@hanzo/contact'

..

const personId = await client.createDoc(
  contact.class.Person,
  contact.space.Contacts,
  {
    name: 'Doe,John',
    city: 'New York',
    avatarType: AvatarType.COLOR
  }
)

await client.createMixin(
  personId,
  contact.class.Person,
  contact.space.Contacts,
  contact.mixin.Employee,
  {
    active: true,
    position: 'CEO'
  }
)

updateMixin

Updates an existing mixin.

Parameters:

  • objectId: Id of the object the mixin is attached to
  • objectClass: Class of the object the mixin is attached to
  • objectSpace: Space of the object the mixin is attached to
  • mixin: Id of the mixin type to update
  • attributes: Attributes of the mixin to update
import contact, { AvatarType } from '@hanzo/contact'

..

const person = await client.findOne(
  contact.class.Person,
  {
    _id: 'person-id'
  }
)

await client.updateMixin(
  personId,
  contact.class.Person,
  contact.space.Contacts,
  contact.mixin.Employee,
  {
    active: false
  }
)