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

armiiller-aws-swf

v4.1.1

Published

A Node.js library for accessing Amazon SWF with special functions. Original fork from https://github.com/neyric/aws-swf.git

Downloads

15

Readme

npm version

A Node.js library for accessing Amazon Simple Workflow (SWF)

aws-swf provides high-level classes to build Amazon Simple Workflows using Node.js. Includes special functions. Original fork from https://github.com/neyric/aws-swf.git

It is built on top of the official Node.js aws-sdk for low-level API calls. You can find the full API reference here.

Requirements

Installation

npm install armiiller-aws-swf

Setting AWS Credentials

Cf. http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html#Setting_AWS_Credentials

Usage

Step 1 : Register Domains, ActivityTypes, WorkflowTypes

The AWS SDK is sufficient to register SWF objects, since those are just direct API calls. (You can also register them through the AWS console.)

You can run the following example to register the objects used in the following examples :

Example to register "test-domain", "simple-activity" and "simple-workflow"

Step 2 : Create Activity Workers

An ActivityPoller will wait for new tasks from SWF, and emit an activityTask event. The event receives an instance of ActivityTask, which makes it easier to send the response to SWF.

This example starts an Activity Worker which completes immediatly.

Step 3 : Create Workflow Deciders

The Decider class will wait for new decision tasks from SWF, and emit a decisionTask event. The event receives an instance of DecisionTask, composed of :

  • an EventList instance, to query the state of the workflow
  • a DecisionResponse instance, to prepare the decider response with decisions

Simple decider worker example : decision worker, which schedules an activity task, then stop the workflow.

Step 4 : Start a workflow

To start a workflow, call the start method on a Workflow instance. This call will return a WorkflowExecution instance, which you can use to signal or terminate a workflow.

AWS Options

Sometimes you may want to configure the AWS SDK instance. A possible reason is to set a specific region for aws-swf. Because Node.js allows multiple instances of the same package for maximal compatibility among libraries, you would need to do something similar to:

var AWS = require('./node_modules/aws-swf/node_modules/aws-sdk/lib/aws');

Instead, you simlpy need to do:

var AWS = require('aws-swf').AWS;

An example use case would be:

var AWS = require('aws-swf').AWS;

AWS.config = new AWS.Config({
  region: process.env.AWS_REGION || 'us-west-2',
  apiVersions: {
    swf: '2012-01-25'
  }
});

API Documentation

The API documentation is available online at http://armiiller.github.io/aws-swf/apidoc/

To rebuild the documentation, install jsdoc, then :

jsdoc lib/*.js README.md -d apidoc

Test

Tests can be executed with Mocha :

$ mocha

To get the coverage, run :

$ ./node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha

Then open coverage/lcov-report/index.html

To send the coverage to coveralls, I run locally (I don't know why travis-ci after-script doesn't work...):

$ NODE_ENV=test ./node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | COVERALLS_REPO_TOKEN=xxxx ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage

License

MIT License

See also