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

coucheye

v1.0.3

Published

Tool to publish CouchDb _changes to Amazon AWS SNS

Downloads

3

Readme

CouchEye

The CouchEye tool can be used to monitor changes in one or more CouchDb databases and send notifications to topics in the Amazon Simple Notification Service (SNS). Multiple databases can be monitored by one running CouchEye instance and changes can be routed to multiple topics, which may even be in different regions or require diferrent credentials.

To use CouchEye, simple install is using npm:

npm install --save coucheye

Below you'll find an example configuration using CoffeeScript syntax.

Configuration options

| Key | Description | |------------------------------|-----------------------------------------------------------------------------------------| | redis | Object as returned by createClient in the redis package | | redisUrl | URL of the Redis server; required unless redis option is given | | redisPrefix | Sequence numbers for a feed are stored under #{redisPrefix}#{feedName} | | feeds | A set of CouchDb feeds | | feeds.{name}.* | Properties as accepted by the follow package | | endpoints | A set of Amazon AWS endpoints, including credentials | | endpoints.{name}.* | Properties as accepted by the aws-sdk package | | topics | A set of SNS topics to which changes can be published | | topics.{name}.arn | ARN of an SNS topic | | pipes | A set of pipes that connect feeds, endpoints and topics | | pipes.{name}.feed | Name of the feed to draw change from | | pipes.{name}.endpoint | Name of the endpoint to send notifications to | | pipes.{name}.topic | Name of the topic to send notifications to | | pipes.{name}.transformChange | Function to transform a change object | | pipes.{name}.transformDoc | Function to transform a change document; depends on feeds.<name>.include_docs options |

The pipes.<name>.transformChange and pipes.<name>.transformDoc options are not required, but are mutually exclusive. When either of those is used, the return value is used as content for the notification. If null or undefined is returned, not notification is published.

Example configuration

coucheye = (require 'coucheye')
    redisUrl: 'redis://username:[email protected]:9356/'
    redisPrefix: 'coucheye.'
    feeds:
        examples:
            db: 'https://username:[email protected]/examples'
            include_docs: true
        extensions:
            db: 'https://username:[email protected]/extensions'
            include_docs: true
    endpoints:
        sns:
            accessKeyId: 'akid'
            secretAccessKey: 'secret'
            region: 'eu-west-1'
    topics:
        exampleUpdated: 'arn:aws:sns:eu-west-1:123456789012:ExampleUpdated'
        exampleCompleted: 'arn:aws:sns:eu-west-1:123456789012:ExampleCompleted'
        extensionCreated: 'arn:aws:sns:eu-west-1:123456789012:ExtensionCreated'
        extensionApproved: 'arn:aws:sns:eu-west-1:123456789012:ExtensionApproved'
    pipes:
        exampleUpdated:
            feed: 'examples'
            endpoint: 'sns'
            topic: 'exampleUpdated'
            transformChange: (change) ->
                # Ignore deletions
                return null if change.deleted
                exampleId: change.id
        exampleCompleted:
            feed: 'examples'
            endpoint: 'sns'
            topic: 'exampleCompleted'
            transformDocument: (doc) ->
                # Only notify for completed example
                return null unless doc.status is 'COMPLETED'
                exampleId: doc._id
        extentionCreated:
            feed: 'extensions'
            endpoint: 'sns'
            topic: 'extensionCreated'
            transformDocument: (doc) ->
                # First revision means document has just been created
                return null unless doc._rev.match(/^1-/)?
                extensionId: doc._id
        extensionApproved:
            feed: 'extensions'
            endpoint: 'sns'
            topic: 'extensionApproved'
            transformDocument: (doc) ->
                # Require an approval
                return null unless doc.approval?
                # But not an error
                return null if doc.error?
                extensionId: doc._id

coucheye.on 'error', (err) ->
    console.err err
    process.exit 1

coucheye.start()