Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ft-poller

Package Overview
Dependencies
Maintainers
2
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ft-poller - npm Package Compare versions

Comparing version 2.9.4 to 3.0.0

35

package.json

@@ -1,1 +0,34 @@

{"name":"ft-poller","version":"2.9.4","repository":{"type":"git","url":"https://github.com/Financial-Times/ft-poller"},"license":"MIT","description":"An http client to periodically fetch and cache data from web services","main":"./src/server.js","directories":{"lib":"./lib"},"dependencies":{"isomorphic-fetch":"^2.0.0","n-eager-fetch":"^2.0.0"},"devDependencies":{"@financial-times/n-gage":"^1.8.9","chai":"^3.3.0","eslint":"^2.9.0","lintspaces-cli":"^0.1.1","mocha":"^2.3.3","nock":"^2.13.0","npm-prepublish":"^1.2.2","sinon":"^1.10.3","timer-shim":"^0.3.0"},"scripts":{"precommit":"make verify && node_modules/.bin/secret-squirrel","prepush":"make unit-test"}}
{
"name": "ft-poller",
"version": "3.0.0",
"repository": {
"type": "git",
"url": "https://github.com/Financial-Times/ft-poller"
},
"license": "MIT",
"description": "An http client to periodically fetch and cache data from web services",
"main": "./src/server.js",
"directories": {
"lib": "./lib"
},
"dependencies": {
"isomorphic-fetch": "^2.0.0",
"n-eager-fetch": "^2.0.0"
},
"devDependencies": {
"@financial-times/n-gage": "^1.8.10",
"chai": "^3.3.0",
"eslint": "^2.9.0",
"lintspaces-cli": "^0.1.1",
"mocha": "^2.3.3",
"nock": "^2.13.0",
"npm-prepublish": "^1.2.2",
"sinon": "^1.10.3",
"timer-shim": "^0.3.0"
},
"scripts": {
"precommit": "node_modules/.bin/secret-squirrel",
"prepush": "make unit-test && make verify -j3",
"commitmsg": "node_modules/.bin/secret-squirrel-commitmsg"
}
}

2

README.md

@@ -22,3 +22,3 @@

* `defaultData` [recommended]: Data to return if the poller is yet to make a successful request. Typically this will be an empty object of the same type/structure as a successful response e.g. if a successful response would give you an array of users then set `defaultData: []`
* `options` [optional]: options object to pass to isomorphic-fetch. If optiosn is not defined or doesn't contain a `timeout` property, request timeout will be set to 4000ms by default. If `retry` is specified then n-eager-fetch is used to send the request instead of fetch
* `options` [optional]: options object to pass to isomorphic-fetch. If options is not defined or doesn't contain a `timeout` property, request timeout will be set to 4000ms by default. If `retry` is specified then n-eager-fetch is used to send the request instead of fetch
* `refreshInterval` [default: 60000]: Number of milliseconds to wait between request for data

@@ -25,0 +25,0 @@ * `autostart` [default: false]: Whether to start the poller automatically when the instance is created

@@ -96,4 +96,4 @@ 'use strict';

})
.then ((s) => {
this.data = this.parseData (s);
.then (async s => {
this.data = await this.parseData (s);
this.emit ('data', this.data);

@@ -100,0 +100,0 @@ })

@@ -280,2 +280,21 @@ /* global it, describe, xit */

it ('Should allow async data parser', function (done) {
nock ('http://example.com')
.get ('/json')
.reply (200, { 'foo': 1 });
const p = new Poller( {
url: 'http://example.com/json',
defaultData: {},
parseData: () => Promise.resolve({bar: 2})
});
p.fetch ();
setTimeout (function () {
expect (p.getData ()).to.deep.equal ({bar: 2});
done ();
}, 10);
});
it ('Should be possible to autostart', function () {

@@ -282,0 +301,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc