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

teapi

v0.0.3

Published

Teapi Node.JS Management Client

Downloads

6

Readme

teapi.io Node Library

This is a node driver for http://teapi.io.

Installation

npm install teapi

Configuration

Create a teapi instance by specifying your host, key and secret (obtained through teapi's management dashboard):

var teapi = require('teapi')('m01.teapi.io', 'KEY', 'SECRET');

Usage

Documents can be created, updated or deleted one at a time:

teapi.documents.create('people', {id: 4, name: 'leto atreides', power: 9001})
teapi.documents.update('people', {id: 4, name: 'leto atreides', power: 9002})
teapi.documents.delete('people', 4)

A third, optional, parameter can be provided. This dictionary, internally called meta, is used for building indexes with values that aren't part of the document (or at least, aren't part of the document's data to be displayed by the API). For example:

teapi.documents.create(
  'people',
  {id: 4, name: 'leto atreides', power: 9001},
  {active: true, power: 52334}
)

if indexes were created for name, active and power, Teapi would index the values leto atreides, true and 52334 respectively (notice that the meta value overwrites the document's value).

Bulk Updates

More efficiently, bulk changes can be provided for a given type:

# Create or update leto and jessica and delete the documents
# with ids 9, 29 and 23
teapi.documents.bulk('people',
  [
    {doc: {id: 4, name: 'leto atreides', power: 9001}},
    {doc: {id: 5, name: 'jessica atreides', power: 9201}}
  ],
  [{id: 9}, {id: 29}, {id: 23}]
)

Up to 1000 items can be inserted/updated and 1000 items deleted per call.

Use the meta key for meta values:

# Create or update leto and jessica and delete the documents
# with ids 9, 29 and 23
teapi.documents.bulk('people',
  [
    {doc: {id: 4, name: 'leto atreides', power: 9001}, meta: {...}},
    {doc: {id: 5, name: 'jessica atreides', power: 9201}, meta: {...}}
  ],
  [{id: 9}, {id: 29}, {id: 23}]
)

Lists

Document ids can be pushed onto and removed from lists:

teapi.lists.insert('people', 'newest', [1, 4, 992])
teapi.lists.delete('people', 'newest', 992)

For both insert and delete, the ids can either be a single value or an array (up to 1000 ids can be inserted / deleted at a time). You can also pass no ids to delete. This will remove all ids from the list:

teapi.lists.delete('people', 'newest')

insert takes a 4th, optional, parameter: truncate. This defaults to false, but when set to true, it'll delete all existing ids then insert the newly provide one(s):

// this will result in a list of only 1 id (99)
teapi.lists.insert('people', 'newest', 99, true)

Return value

The teapi library returns a promise:

teapi.document.delete('articles', 4).spread(function(res, body) {
  console.log(res.statusCode, body)
});