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

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.2.1 to 0.3.0-dev

3

gulpfile.js

@@ -74,3 +74,4 @@ const gulp = require('gulp');

],
publicConstructors: ['NotificationsClient'],
publicConstructors: ['Client'],
privateConstructors: []
};

@@ -77,0 +78,0 @@

@@ -7,6 +7,2 @@ 'use strict';

var _freeze = require('babel-runtime/core-js/object/freeze');
var _freeze2 = _interopRequireDefault(_freeze);
var _promise = require('babel-runtime/core-js/promise');

@@ -68,2 +64,4 @@

var _twilioEmsClient = require('twilio-ems-client');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -93,11 +91,11 @@

var NotificationsClient = function (_EventEmitter) {
(0, _inherits3.default)(NotificationsClient, _EventEmitter);
var Client = function (_EventEmitter) {
(0, _inherits3.default)(Client, _EventEmitter);
function NotificationsClient(token, options) {
(0, _classCallCheck3.default)(this, NotificationsClient);
function Client(fpaToken, options) {
(0, _classCallCheck3.default)(this, Client);
var _this = (0, _possibleConstructorReturn3.default)(this, (NotificationsClient.__proto__ || (0, _getPrototypeOf2.default)(NotificationsClient)).call(this));
var _this = (0, _possibleConstructorReturn3.default)(this, (Client.__proto__ || (0, _getPrototypeOf2.default)(Client)).call(this));
if (!token) {
if (!fpaToken) {
throw new Error('Token is required for Notifications client');

@@ -114,4 +112,5 @@ }

options.twilsockClient = options.twilsockClient || new _twilsock2.default(token, options);
options.twilsockClient = options.twilsockClient || new _twilsock2.default(fpaToken, options);
options.transport = options.transport || new _twilioTransport2.default(options.twilsockClient);
options.emsClient = options.emsClient || new _twilioEmsClient.EMSClient(options);

@@ -127,6 +126,7 @@ var twilsock = options.twilsockClient;

var config = new _configuration2.default(token, options);
var config = new _configuration2.default(null, options);
(0, _defineProperties2.default)(_this, {
_config: { value: config },
_emsClient: { value: options.emsClient },
_registrar: { value: new _registrar2.default(productId, transport, twilsock, config) },

@@ -154,2 +154,9 @@ _twilsock: { value: twilsock },

_this._emsClient.setToken(fpaToken).then(function (response) {
return response.token;
}).then(function (token) {
_this._config.updateToken(token);
_this._registrar.updateToken();
});
_this._onTransportStateChange(_this._twilsock.connected);

@@ -184,3 +191,3 @@

(0, _createClass3.default)(NotificationsClient, [{
(0, _createClass3.default)(Client, [{
key: '_routeMessage',

@@ -286,2 +293,3 @@ value: function _routeMessage(type, message) {

* @param {string} token Authentication token for registrations
* @alias updateToken
* @public

@@ -292,21 +300,22 @@ */

key: '_updateToken',
value: function _updateToken(token) {
value: function _updateToken(fpaToken) {
var _this2 = this;
_logger2.default.info('authTokenUpdated');
if (this._config.token !== token) {
this._twilsock.updateToken(token);
if (this._fpaToken === fpaToken) {
return _promise2.default.resolve();
}
this._config.updateToken(token);
this._registrar.updateToken();
}
return _promise2.default.resolve();
this._twilsock.updateToken(fpaToken);
return this._emsClient.setToken(fpaToken).then(function (response) {
return response.token;
}).then(function (token) {
_this2._config.updateToken(token);
_this2._registrar.updateToken();
});
}
}]);
return NotificationsClient;
return Client;
}(_events2.default);
exports.default = NotificationsClient;
(0, _freeze2.default)(NotificationsClient);
/**

@@ -337,2 +346,4 @@ * Fired when new message arrived.

exports.default = Client;
module.exports = exports['default'];

@@ -181,2 +181,7 @@ 'use strict';

value: function _updateContext() {
if (!this.config.token) {
// no token, can't do anything, ignore
return;
}
var messageTypes = toArray(this._messageTypes);

@@ -183,0 +188,0 @@

{
"name": "twilio-notifications",
"version": "0.2.1",
"version": "0.3.0-dev",
"description": "Client library for Twilio Notifications service",

@@ -21,3 +21,4 @@ "main": "lib/index.js",

"loglevel": "^1.4.1",
"twilio-transport": "^0.0.8",
"twilio-ems-client": "^0.1.4",
"twilio-transport": "^0.1.0",
"twilsock": "^0.2.0",

@@ -28,2 +29,3 @@ "uuid": "^3.0.0"

"async": "^2.1.2",
"async-test-tools": "^1.0.5",
"babel-cli": "^6.14.0",

@@ -57,2 +59,3 @@ "babel-eslint": "^7.0.0",

"jsdoc": "^3.4.3",
"jsonwebtoken": "^7.1.6",
"proxyquire": "^1.7.10",

@@ -63,7 +66,6 @@ "run-sequence": "^1.2.2",

"sinon-chai": "^2.8.0",
"jsonwebtoken": "^7.1.6",
"twilio": "^3.3.0-edge",
"vinyl-buffer": "^1.0.0",
"vinyl-source-stream": "^1.1.0",
"twilio": "^3.3.0-edge"
"vinyl-source-stream": "^1.1.0"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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