# baggywrinkle

> Run a machine from an AWS Lambda function.

Latest version **2.2.1** (published 2018-01-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install baggywrinkle
pnpm add baggywrinkle
yarn add baggywrinkle
bun add baggywrinkle
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.2.1 |
| Published | 2018-01-24 |
| First published | 2017-12-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Scott Gress |
| Maintainers | sgress454 |

## Links

- npm: https://www.npmjs.com/package/baggywrinkle
- npm.io page: https://npm.io/package/baggywrinkle

## Dependencies (6)

- [rttc](https://npm.io/package/rttc.md) ^9.8.2
- [async](https://npm.io/package/async.md) 2.6.0
- [machine](https://npm.io/package/machine.md) 15.0.0-20
- [statuses](https://npm.io/package/statuses.md) 1.4.0
- [@sailshq/lodash](https://npm.io/package/@sailshq/lodash.md) ^3.10.2
- [machine-as-action](https://npm.io/package/machine-as-action.md) ^10.0.0-0

## Recent versions

- 2.2.1 (latest) — 2018-01-24
- 2.2.0 — 2018-01-16
- 2.1.1 — 2018-01-15
- 2.1.0 — 2018-01-15
- 2.0.0 — 2017-12-13
- 1.6.0 — 2017-12-12
- 1.5.1 — 2017-12-11
- 1.5.0 — 2017-12-11
- 1.4.1 — 2017-12-11
- 1.4.0 — 2017-12-11
- 1.3.0 — 2017-12-07
- 1.2.0 — 2017-12-06
- 1.1.0 — 2017-12-06
- 1.0.0 — 2017-12-05

## README

# baggywrinkle

Want to [reduce chafing](https://en.wikipedia.org/wiki/Baggywrinkle) when using Sails actions inside of AWS Lambda?  Baggywrinkle is the answer!

Baggywrinkle builds a modified version of a machine that proxies its inputs from the Lambda function's `event` argument, and proxies its exits through the Lambda function's callback.  It is intended to be used with Lambda functions that are triggered via the AWS API Gateway (that is, via HTTP requests).

```sh
$ npm install baggywrinkle --save
```


## Usage

```js
var lambdaFunction = require('baggywrinkle')(actionMachine);
```

## Example

```js
// handler.js
var asLambda = require('baggywrinkle');

module.exports = asLambda({
  inputs: {
    name: {
      example: 'Joe',
      description: 'The person to greet'
    }
  },
  exits: {
    success: {
      statusCode: 200,
      description: 'Greeting was successful!'
    }
  }
  fn: function (inputs, exits) {
    return exits.success(`Hello ${inputs.name}!`);
  }
});
```

Note that the input to Baggywrinkle can be either:

* a machine definition compatible with [machine-as-action](https://www.npmjs.com/package/machine-as-action) _or_
* a machine instance _generated by_ [machine-as-action](https://www.npmjs.com/package/machine-as-action)

## Options

For available options, see the [machine-as-action](https://www.npmjs.com/package/machine-as-action) documentation.  Note however that Baggywrinkle does not currently support:

* The `view` response type
* The `redirect` response type
* Custom Sails response types such as `badRequest`
* File uploads
* Streaming

## Bugs &nbsp; [![NPM version](https://badge.fury.io/js/baggywrinkle.svg)](http://npmjs.com/package/baggywrinkle)

To report a bug, [click here](http://sailsjs.com/bugs).


## Contributing &nbsp; [![Build Status](https://travis-ci.org/sailshq/baggywrinkle.svg?branch=master)](https://travis-ci.org/sailshq/baggywrinkle)

Please observe the guidelines and conventions laid out in the [Sails project contribution guide](http://sailsjs.com/documentation/contributing) when opening issues or submitting pull requests.

[![NPM](https://nodei.co/npm/baggywrinkle.png?downloads=true)](http://npmjs.com/package/baggywrinkle)


## License

MIT &copy; 2015-2016 The Sails Company

The [Sails framework](http://sailsjs.com) is free and open-source under the [MIT License](http://sailsjs.com/license).

---
_Source: https://npm.io/package/baggywrinkle · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
