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 🙏

© 2024 – Pkg Stats / Ryan Hefner

hypertopic

v3.6.1

Published

Client library for the Hypertopic protocol.

Downloads

8

Readme

Client library for the Hypertopic protocol

Requirements

  • Install and run Argos (on port 80) with test data.

Install

npm install hypertopic

Use

Set the services to be called

const hypertopic = require('hypertopic');

let db = hypertopic([
  "http://localhost",
  "https://steatite.utt.fr"
]);

const _log = (x) => console.log(JSON.stringify(x, null, 2));
const _error = (x) => console.error(x.message);

Send distributed requests

  • on a user
db.getView('/user/vitraux')
  .then(_log);
  • on an item
db.getView('/item/Vitraux - Bénel/85bb03f5e4930f3b9d1ef9afbfa92421b8e2e23b')
  .then(_log);
  • on a corpus (with all its items)
db.getView('/corpus/Vitraux - Bénel')
  .then(_log);
  • on a viewpoint
db.getView('/viewpoint/a76306e4f17ed4f79e7e481eb9a1bd06')
  .then(_log);
  • on several of them
db.getView(['/corpus/Vitraux - Bénel','/corpus/Vitraux - Recensement'])
  .then(_log);
  • on all corpora and viewpoints of a user
db.getView('/user/vitraux')
  .then(x => [
    ...x.vitraux.viewpoint.map(y => `/viewpoint/${y.id}`),
    ...x.vitraux.corpus.map(y => `/corpus/${y.id}`)
  ])
  .then(db.getView)
  .then(_log);

Update objects with generic methods

  • Create an object (with an automatic ID)
db.auth('alice', 'whiterabbit')
  .post({item_name:'Bond', item_corpus:'TEST'})
  .then(_log)
  .catch(_error);
  • Create an object with a given ID
db.auth('alice', 'whiterabbit')
  .post({_id:'007', item_name:'Bond', item_corpus:'TEST'})
  .then(_log)
  .catch(_error);
  • Update an object
db.auth('alice', 'whiterabbit')
  .get({_id:'007'})
  .then(x => Object.assign(x, {item_name:'James Bond'}))
  .then(db.post)
  .then(_log)
  .catch(_error);
  • Delete an object with update conflict detection
db.auth('alice', 'whiterabbit')
  .delete({_id:'007', _rev:'1-xxxxxxxxx'})
  .then(_log)
  .catch(_error);
  • Delete an object with no conflict detection (to be used with caution!)
db.auth('alice', 'whiterabbit')
  .get({_id:'007'})
  .then(db.delete)
  .then(_log)
  .catch(_error);

Update (or create) Hypertopic objects (experimental)

  • Item attributes
db.auth('alice', 'whiterabbit')
  .item({_id:'007', item_corpus:'agents'})
  .setAttributes({item_name:'James Bond', weapon:'Walther PPK'})
  .then(_log)
  .catch(_error);
db.auth('alice', 'whiterabbit')
  .item({_id:'007', item_corpus:'agents'})
  .unsetAttribute('weapon')
  .then(_log)
  .catch(_error);
  • Item topics
db.auth('alice', 'whiterabbit')
  .item({_id:'007', item_corpus:'agents'})
  .setTopic('topic-octopussy', 'viewpoint-missions')
  .then(_log)
  .catch(_error);
db.auth('alice', 'whiterabbit')
  .item({_id:'007', item_corpus:'agents'})
  .unsetTopic('topic-octopussy')
  .then(_log)
  .catch(_error);
  • Item resources
db.auth('alice', 'whiterabbit')
  .item({_id:'007', item_corpus:'agents'})
  .setResource('hello.txt', 'text/plain', 'My name is Bond, James Bond.')
  .then(_log)
  .catch(_error);
db.auth('alice', 'whiterabbit')
  .item({_id:'007', item_corpus:'agents'})
  .unsetResource('hello.txt')
  .then(_log)
  .catch(_error);
  • Item links
db.auth('alice', 'whiterabbit')
  .item({_id:'007', item_corpus:'agents'})
  .setLink('has for superior', 'executives', 'M')
  .then(_log)
  .catch(_error);
db.auth('alice', 'whiterabbit')
  .item({_id:'007', item_corpus:'agents'})
  .unsetLink('has for superior', 'executives', 'M')
  .then(_log)
  .catch(_error);