Socket
Socket
Sign inDemoInstall

twilio-notifications

Package Overview
Dependencies
Maintainers
2
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

twilio-notifications - npm Package Compare versions

Comparing version 0.1.4 to 0.1.5

25

lib/client.js

@@ -7,5 +7,17 @@ 'use strict';

const Bottleneck = require('bottleneck');
const NotificationsConfig = require('./configuration');
const Registrar = require('./registrar');
function limit(fn, to, per) {
// overflow since no token is passed to arguments
let limiter = new Bottleneck(to, per, 5, Bottleneck.strategy.OVERFLOW);
return function() {
let args = Array.prototype.slice.call(arguments, 0);
args.unshift(fn);
return limiter.schedule.apply(limiter, args);
};
}
/**

@@ -41,3 +53,4 @@ * @class

_twilsock: { value: twilsock },
_reliableTransportState: { value: reliableTransportState }
_reliableTransportState: { value: reliableTransportState },
_currentToken: { value: null, writable: true }
});

@@ -48,3 +61,6 @@

accessManager.on('tokenExpired', () => this.emit('tokenExpired', accessManager));
accessManager.on('tokenUpdated', () => this._updateAuthToken(accessManager.token));
accessManager.on('tokenUpdated', limit(() => {
this._updateAuthToken(accessManager.token);
return Promise.resolve();
}, 1, 10000));

@@ -157,3 +173,6 @@ this._twilsock.on('message', (type, message) => this._routeMessage(type, message));

log.info('NTFCN I: authTokenUpdated');
this._registrar.updateToken();
if (this._currentToken !== this._config.token) {
this._currentToken = this._config.token;
this._registrar.updateToken();
}
};

@@ -160,0 +179,0 @@

2

lib/twilsock.connector.js

@@ -65,3 +65,3 @@ 'use strict';

if (this._messageTypes.has(messageType)) {
log.debug('Message type already registered ', messageType);
log.trace('Message type already registered ', messageType);
return false;

@@ -68,0 +68,0 @@ }

{
"name": "twilio-notifications",
"version": "0.1.4",
"version": "0.1.5",
"description": "Client library for Twilio Notifications service",

@@ -17,2 +17,3 @@ "main": "lib/client.js",

"backoff": "^2.4.1",
"bottleneck": "^1.12.0",
"javascript-state-machine": "^2.3.5",

@@ -19,0 +20,0 @@ "loglevel": "^1.4.0",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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