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

webhook-elastic-search

v4.0.1

Published

Interface for interacting with the Elastic Search that backs a Webhook system.

Downloads

20

Readme

webhook-elastic-search

Interface for interacting with the Elastic Search that backs a Webhook system.

To install: npm install webhook-elastic-search

Example:

var elasticOptions = {
  node: elasticNode,
  auth: {
    apiKey: elasticApiKey,
  },
}

var elastic = WebHookElasticSearch(elasticOptions)

elastic.siteIndex(siteName)
  .then(siteIndex => console.log(siteIndex))

API

siteIndex(siteName) => Promise[siteIndex | error] returns all documents in Elastic Search for the site. Where siteName is the Webhook site name. The promise returns siteIndex, an array of Elastic Search documents for the Webhook site.

updateIndex({ siteName, siteData, siteIndex }) => Promise[results | error] issues bulk commands that update the siteIndex to be in sync with the siteData. siteData is the current Firebase data node ( /buckets/{site-name}/{site-key}/dev ) for the Webhook site.

indexSiteData({ siteName, siteData }) => Promise[results | error] is a convenience method that runs createIndex, siteIndex & updateIndex for a given site. This will get you from nothing to complete usuable site index in one go.

listIndicies({ verbose?, sort?, index? }) => Promise[indiciesTable | error] returns indicesTable, a string that contains a table of indicies in the elastic cluster.

createIndex({ siteName}) => Promise[results | error] creates an index in the elastic cluster that can be used to store and query documents.

deleteIndex({ siteName }) => Promise[results | error] deletes an entire site index.

queryIndex({ siteName, query, contentType?, page?, pageSize? }) => Promise[results | error] returns the query results that match the query for the site index and optionally the specified content type.

deleteDocument({ siteName, id }) => Promise[results | error] deletes the document whose id matches for the given site.

deleteContentType({ siteName, contentType }) => Promise[results | error] delets all documents for the specified content type and site.

indexDocument({ siteName, contentType, doc, id, oneOff? }) => Promise[results | error] adds a document to the specified site index under the id and content type provided. Use the oneOff key to specify if the given content type is a one off.

Test

Populate a .env file with the following environment variables:

ELASTIC_SEARCH_SERVER=
ELASTIC_SEARCH_USER=
ELASTIC_SEARCH_PASSWORD=

Run npm test