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

@versesdev/genius-core-sdk

v0.0.2

Published

Typescript SDK for Genius Core

Readme

Genius Core Typescript SDK

Before you start

You will need the following information to connect to any genius core instance:

  1. The address of your Genius Core instance. Examples here will use [::1]:50052 as the address.
  2. The client ID, client secret, and authentication domain for your OAuth provider.
    • For Auth0, this would be the client ID, client secret, and "auth0.com"

Creating the client

Create the client using its constructor:

import { CollisionStrategy } from '@versesdev/proto-kortex/hstp/v1'
import { Client, ClientCredentials } from '../src/'

const client_id = process.env.CLIENT_ID
const client_secret = process.env.CLIENT_SECRET
const oauth_domain = process.env.OAUTH_DOMAIN

// Server address
const addr = 'http://127.0.0.1:50052'
let credentials: ClientCredentials | null = null

// If you do not have credentials, set them to None. This is only valid if the server accepts
// "localhost" or unauthenticated requests.
if (client_id && client_secret && oauth_domain) {
  credentials = new ClientCredentials(client_id, client_secret, oauth_domain)
}

// Create the client
const client = new Client({
  addr: addr,
  clientCredentials: credentials,
})

console.debug('Client is now created and connected');

Simple Queries

Send any HSML query with the .query() method.

const entity = JSON.stringify(`{ "swid": "${Client.makeSwid()}", "schema": ["entity"] }`);

client.query("#entity where name = 'Apple'");
client.upsert({
  entity,
  collisionStrategy: CollisionStrategy.MERGE
});
client.query(`%archive [${entity}]`)

Listen to Changes

You can listen to changes on a given entity, set of entities, link, or set of links by:

  1. Opening a listening port
  2. Adding the items to listen to, of the appropriate type
  3. Asynchronously iterating over the listener

If you would later like to keep the listen socket open but stop listening to certain changes, call the corresponding remove function. Listeners are automatically destroyed when no longer referenced.

const listener = client.listen();
// Add a single
listener.add_entity_listeners('swid:entity:r11C0fOzt0nBoCkr1lI4l')
// Add a list (repetition has no effect)
listener.add_entity_listeners(
  'swid:entity:95KAC7PRbNbwKEC9RaLFs',
  'swid:entity:r11C0fOzt0nBoCkr1lI4l'
)
// Add a link or links
listener.add_link_listeners('swid:link:pQ7ftgk9jZLfh5NfJxbLW')
// Remove an entity (will remove all listeners)
listener.remove_entity_listeners('swid:entity:r11C0fOzt0nBoCkr1lI4l')

// Iterate over the result
for await (const new_entity_or_link of listener.iterator()) {
  console.log(new_entity_or_link)
}