twilio-notifications
Advanced tools
Comparing version 0.2.0-alpha.8 to 0.2.0-alpha.9
@@ -33,9 +33,10 @@ 'use strict'; | ||
* @constructor | ||
* @param {string} productId id of a product, which uses notification library | ||
* @param {string} token - Twilio access token | ||
* @param {Notifications#ClientOptions} options - Options to customize client behavior | ||
*/ | ||
function NotificationsClient(productId, token, options) { | ||
function NotificationsClient(token, options) { | ||
if (!token) { | ||
throw new Error('Token is required for Notifications client'); | ||
} | ||
EventEmitter.call(this); | ||
@@ -48,2 +49,3 @@ options = options || {}; | ||
const minTokenRefreshInterval = options.minTokenRefreshInterval || 10000; | ||
const productId = options.productId || 'notifications'; | ||
@@ -69,20 +71,21 @@ options.twilsockClient = options.twilsockClient || new Twilsock(token, options); | ||
connectionState: { get: () => { | ||
if (this._twilsock.state === 'disconnected') { | ||
return 'disconnected'; | ||
} else if (this._twilsock.state === 'disconnecting') { | ||
return 'disconnecting'; | ||
} else if (this._twilsock.state === 'connected' && this._reliableTransportState.registration) { | ||
return 'connected'; | ||
} else if (this._twilsock.state === 'rejected') { | ||
return 'denied'; | ||
updateToken: { value: limit(this._updateToken.bind(this), 1, minTokenRefreshInterval), enumerable: true }, | ||
connectionState: { | ||
get: () => { | ||
if (this._twilsock.state === 'disconnected') { | ||
return 'disconnected'; | ||
} else if (this._twilsock.state === 'disconnecting') { | ||
return 'disconnecting'; | ||
} else if (this._twilsock.state === 'connected' && this._reliableTransportState.registration) { | ||
return 'connected'; | ||
} else if (this._twilsock.state === 'rejected') { | ||
return 'denied'; | ||
} | ||
return 'connecting'; | ||
} | ||
return 'connecting'; | ||
} }, | ||
updateToken: { value: limit(this._updateToken.bind(this), 1, minTokenRefreshInterval), enumerable: true } | ||
} | ||
}); | ||
EventEmitter.call(this); | ||
this._onTransportStateChange(this._twilsock.connected); | ||
@@ -224,3 +227,10 @@ this._registrar.on('transportReady', state => { this._onRegistrationStateChange(state ? 'registered' : ''); }); | ||
/** | ||
* These options can be passed to Client constructor | ||
* @typedef {Object} Notifications#ClientOptions | ||
* @property {String} [logLevel='error'] - The level of logging to enable. Valid options | ||
* (from strictest to broadest): ['silent', 'error', 'warn', 'info', 'debug', 'trace'] | ||
*/ | ||
module.exports = NotificationsClient; | ||
{ | ||
"name": "twilio-notifications", | ||
"version": "0.2.0-alpha.8", | ||
"version": "0.2.0-alpha.9", | ||
"description": "Client library for Twilio Notifications service", | ||
@@ -17,12 +17,12 @@ "main": "lib/client.js", | ||
"backoff": "^2.5.0", | ||
"bottleneck": "^1.14.0", | ||
"bottleneck": "^1.15.0", | ||
"javascript-state-machine": "^2.3.5", | ||
"loglevel": "^1.4.1", | ||
"twilio-transport": "^0.0.8", | ||
"twilsock": "^0.2.0-alpha.1", | ||
"uuid": "^2.0.3" | ||
"twilsock": "^0.2.0-alpha", | ||
"uuid": "^3.0.0" | ||
}, | ||
"devDependencies": { | ||
"async": "^2.1.2", | ||
"babel-eslint": "^7.0.0", | ||
"babel-eslint": "^7.1.1", | ||
"chai": "^3.5.0", | ||
@@ -38,3 +38,3 @@ "chai-as-promised": "^6.0.0", | ||
"ink-docstrap": "^1.3.0", | ||
"jsdoc": "^3.4.2", | ||
"jsdoc": "^3.4.3", | ||
"proxyquire": "^1.7.10", | ||
@@ -45,4 +45,4 @@ "run-sequence": "^1.2.2", | ||
"sinon-chai": "^2.8.0", | ||
"twilio": "^2.11.0" | ||
"twilio": "^2.11.1" | ||
} | ||
} |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
256061
1283
39
- Removeduuid@2.0.3(transitive)
Updatedbottleneck@^1.15.0
Updatedtwilsock@^0.2.0-alpha
Updateduuid@^3.0.0