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

aws-orchestrate

v0.17.6

Published

This library is intended to help projects intending to build a "micro-service architecture" to achieve those ambitions with some handy orchestration classes and types.

Downloads

38

Readme

AWS Orchestrate

Wallaby.js

This library is intended to help projects intending to build a "micro-service architecture" to achieve those ambitions with some handy orchestration classes and types.

LambdaSequence class

The LambdaSequence class provides a standardized way of chaining a set of Lambda functions together into a sequence. It provides the following high level features:

  1. Chaining

    A "conductor" can build the sequence simply and gracefully with the .add() method. For example, a conductor may build a sequence like this:

    const geoCode = '1234';
    const sequence = LambdaSequence.add('getCustomer', { id: "abcd" })
      .add('getProducts', { geoCode })
      .add('getSpecials', { products: ':data', geoCode })
      .add('specialsForUser', {
        customer: ':getCustomer.data',
        specials: ':data',
        includeAllSpecials: true
      });

    In this example we see that not only can we setup a sequence of functions but also we can state what inputs each function can get. These inputs can be:

    • values known at run time by the conductor (see geoCode and id for customer)
    • a remapping of the prior functions outputs into our inputs (see props with value of :data)
    • adding the output of a prior function's output (see props with value of :getCustomer.data)

    By allowing the conductor to not only provide data inputs for values it knows at the time of its execution but also use indirection to shape the input with future values coming out of the sequence's execution we give the conductor the ability to direct the flow with great control and at the same time allow the functions that are being orchestrated to stay ignorant about the sequence details.

  2. Branching

    For Boolean branches:

    const ifTrue = LambdaSequence.add('trueFn1').add('trueFn2');
    const ifFalse = LambdaSequence.add('falseFn1').add('falseFn2');
    const branchingCondition = (ctx) => ctx.value > 10;
    const sequence = LambdaSequence.add('fn1').branch(branchingCondition, ifTrue, ifFalse);

    For multiple outlet branches:

    const red = LambdaSequence.add('redFn1').add('redFn2');
    const orange = LambdaSequence.add('orangeFn1').add('orangeFn2');
    const blue = LambdaSequence.add('blueFn1').add('blueFn2');
    const branchingCondition = (ctx) => ctx.favoriteColor;
    const sequence = LambdaSequence.add('fn1').branch(branchingCondition, { red, orange, blue });
  3. Error Handling - send any task that fails with an error to a designated handler function:

    const sequence = LambdaSequence.add('fn1').add('fn2').errorHandler('errFn');

Usage / Chaining Execution

The current function must call the invoke function from the aws-log library and provide it with the parameters which come from this library's next() function:

export async function handler(event, context, cb) {
  try {
    // ... do stuff
    await invoke(...sequence.next(output));
    cb(null, output)
  } catch(e) {
    if(sequence.errorHandler) {
      await invoke(sequence.errorHandler);
    }
    cb(e);
  }
}

The next function in the chain will then pickup the sequence with:

export async function handler(event, context, cb) {
  const sequence = LambdaSequence.from(event);
  // ... do stuff
}

FanOut class

not yet implemented