# palmettoflow-event

> [![Build Status](https://travis-ci.org/twilson63/palmettoflow-event.svg?branch=master)](https://travis-ci.org/twilson63/palmettoflow-event)

Latest version **1.1.2** (published 2015-10-05) · ISC license · 0 weekly downloads

## Install

```sh
npm install palmettoflow-event
pnpm add palmettoflow-event
yarn add palmettoflow-event
bun add palmettoflow-event
```

## 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 | 1.1.2 |
| Published | 2015-10-05 |
| First published | 2015-10-01 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Node | ^4.x |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Tom |
| Maintainers | jrs |

## Links

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

## Dependencies (2)

- [uuid](https://npm.io/package/uuid.md) ^2.0.1
- [moment](https://npm.io/package/moment.md) ^2.10.6

## Recent versions

- 1.1.2 (latest) — 2015-10-05
- 1.1.1 — 2015-10-01
- 1.1.0 — 2015-10-01
- 1.0.0 — 2015-10-01

## README

# PalmettoFlow Event

[![Build Status](https://travis-ci.org/twilson63/palmettoflow-event.svg?branch=master)](https://travis-ci.org/twilson63/palmettoflow-event)

This module provides a template to create a palmetto flow event, the event contains the following keys:

Name | Type | Description
-----|-----|---------------------------
to   | string |
from | string |
subject | string | 
verb  | string |
object | object |
actor | object |
dateSubmitted | string (ISODate) |
duration | integer (milliseconds) |

## Usage

This module contains two functions:

### response(event, object)

``` js
var { response } = require('palmettoflow-event')

ee.on('/microservice', function (event) {
  // do stuff
  ee.emit('send', response(event, data))
})
```

The response method will generate the following event: 

``` js
{
  to: '1234',
  from: '/microservice',
  subject: 'microserice-response',
  verb: '....',
  object: {...},
  actor: {...},
  dateSubmitted: ,
  duration: 
}
```

### newEvent(subject, verb, object, [actor])



This function will create a new palmetto flow event:

``` js
var newEvent  = require('../').newEvent
var testEvent = newEvent('beep', 'boop', { foo: 'bar'})
```

### responseError(event, object) 

``` js
var responseError  = require('../').newEvent
var re = responseError(event, { data: 'here'})
```
## Why

This is a helper module to reduce boilier plate code in palmetto flow. The palmetto flow `event` is consistent to enable core subscriptions services to understand all messages for logging, metrics, etc.  Sometimes you need to customize the event, but in times that you don't need to customize, you can reduce a lot of typing by using this helper function.

## Collaborators

## License

MIT

## Thank you

* `moment` development team
* `uuid` development team
* `nodejs` development team

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