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

decms-client

v0.1.4

Published

DeCMS client

Downloads

2

Readme

DeCMS Client

The DeCMS client consists of a client API and a CLI tool. It also supplies a test script that can be run against a DeCMS server.

API

var decms = require('decms-client'),
  client = new decms.Client('http://127.0.0.1:8080', 'ip');

client.get("search", {q:"sport"}, function(error, result) {
  console.log(error, result.response.docs);
});
  • Client(host, access_token)
  • Client.get(path, [parameters], callback(error, result))
  • Client.post(path, [parameters], data, callback(error, result))
  • Client.put(path, [parameters], data, callback(error, result))
  • Client.delete(path, [parameters], callback(error, result))

parameters should be an object with key-value pairs. data should either be an object that will be serialized as JSON, or a readable stream that will be piped.

The callback result will be the parsed JSON response from DeCMS. If we failed to parse the raw response it will be available on the error object as rawResponse.

CLI

Communicate with DeCMS: decms [options] [method] path method should be one of "get", "post", "put" or "delete" and will default to "get" if not provided.

Options

--help              Displays this help                                                               [boolean]
-t, --access_token  Access token, can also be supplied as a DECMS_ACCESS_TOKEN environment variable  [default: "ip"]
-h, --host          DeCMS host, can also be supplied as a DECMS_HOST environment variable            [default: "http://e.tv2.dk:8080"]
-f, --file          Load data from file
-u, --uri           Resolve the path as a document uri.                                              [boolean]
-p, --pretty        Prints prettified human readable JSON                                            [boolean]

Examples

Get document: $ decms document/3dba0b213c0d0e57f42301605bcd097897826fa6

...document by uri: $ decms --uri tvtid://program/25/27774915

Search: $ decms search?q=hugo

Post a document: $ ./bin/decms.js post document --file document.json

Test suite

DeCMS client provides a test suite that can be run using decms_test.

  • create_webhook_tokens - Creates two access tokens to use for webhook subscriptions.
  • set_up_webhooks - Registers webhook subscriptions for the tokens and sets up
  • write_docs - Writes a couple of documents to DeCMS.
  • read_docs - Reads the documents to verify that they were written.
  • check_taxonomy_channel - Checks that the documents have appeared in the proper channel.
  • delete_docs - Deletes the documents
  • verify_deleted - Verifies that we now get 404 for all the documents.
  • check_webhook_results - Checks if we got both create and delete events for all the documents.
  • tear_down_webhooks - Unregister subscriptions and stop the webhook servers.
  • delete_webhook_tokens
  • empty_taxonomy_channel

Options

--help              Displays this help                                                               [boolean]
-t, --access_token  Access token, can also be supplied as a DECMS_ACCESS_TOKEN environment variable  [default: "ip"]
-h, --host          DeCMS host, can also be supplied as a DECMS_HOST environment variable            [default: "http://e.tv2.dk:8080"]