fn-wash
Helper functions for Web App services
Last updated a year ago by fiscalnote .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install fn-wash 
SYNC missed versions from official npm registry.

FN-Web-App-Service-Helpers (fn-wash)

Helper functions for Web App services

Compatibility

node 6 or higher

Getting Started

npm install --save git+ssh://github.com/FiscalNote/FN-Web-App-Service-Helpers.git#<current-version>

Usage

const userInfoHelpers    = require('fn-wash/user-info');
const currentUserGroupId = userInfoHelpers.getCurrentUserGroupId(userInfo);

emit-events usage

In your service's app/lib/config.js or in an initializer file:

...
const emitEvents = require('fn-wash/emit-events');
emitEvents.initializeConnection(exports); // initializes the emitEvents module
...

Publishing (emitting)

Elsewhere in your service:

const emitEvents = require('fn-wash/emit-events');
emitEvents.emitUserDeactivated(userId);

Consuming

const emitEvents = require('fn-wash/emit-events');
const procesPayload = function(payload) {
  // payload is a JSON object in the form:
  /*
    {
      type    : 'deactivatedUser',
      payload : { userId: 1 }
    }
  */
};
emitEvents.consumeUserDeactivated(processPayload);

stubbing emit-events

in your tests:

const mock = require('mock-require');
mock('fn-wash/emit-events', {
  initializeConnection : () => null,
  emitUserDeactivated  : () => new Promise((resolve) => setTimeout(resolve, 100))
});

Node v6 compatibility

If your service is using node version 6.x.x, use the compiled version of emit-events const emitEvents = require('fn-wash/emit-events-node-6'); ...

Note

CircleCi builds of repos that depend on this library may not have access to this private repo.

  • Go to repo's CircleCi project settings
  • Go to "Checkout SSH keys"
  • Under "Add user key" section, authorize CircleCi to access your Github account
  • Click "Create and add user key"

Thrift Headers

Documentation: https://github.com/FiscalNote/FN-Web-App-Service-Helpers/pull/11

Current Tags

  • 1.6.1                                ...           latest (a year ago)

1 Versions

  • 1.6.1                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 0
Dependencies (9)
Dev Dependencies (7)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |