twilio-sync
Advanced tools
Comparing version 0.4.2-dev.1 to 0.4.2-dev.3
@@ -129,5 +129,5 @@ "use strict"; | ||
var productId = options.productId = options.productId || SYNC_PRODUCT_ID; | ||
var emsClient = options.emsClient = options.emsClient || new twilio_ems_client_1.EmsClient(options); | ||
var twilsock = options.twilsockClient = options.twilsockClient || new Twilsock(fpaToken, options); | ||
var transport = options.transport = options.transport || new twilio_transport_1.Transport(options.twilsockClient); | ||
var emsClient = options.emsClient = options.emsClient || new twilio_ems_client_1.EmsClient(options); | ||
var notifications = options.notificationsClient = options.notificationsClient || new Notifications(fpaToken, options); | ||
@@ -134,0 +134,0 @@ var config = new configuration_1.Configuration(null, options); |
@@ -68,5 +68,4 @@ "use strict"; | ||
this.notifications.subscribe(SYNC_MAP_NOTIFICATION_TYPE); | ||
console.log('Scheduled registration'); | ||
this.notifications.on('message', function (message) { | ||
return _this.onMessage.bind(_this); | ||
this.notifications.on('message', function (messageType, payload) { | ||
return _this.onMessage(messageType, payload); | ||
}); | ||
@@ -89,3 +88,2 @@ this.notifications.on('transportReady', function (state) { | ||
value: function onMessage(type, message) { | ||
console.log('Message arrived!'); | ||
logger_1.default.trace('Notification type:', type, 'content:', message); | ||
@@ -148,3 +146,2 @@ this.subscriptions.acceptMessage(message); | ||
value: function onConnected() { | ||
console.log('ON CONNECTED!'); | ||
this.subscriptions.poke(); | ||
@@ -151,0 +148,0 @@ } |
@@ -274,7 +274,3 @@ "use strict"; | ||
_context.prev = 21; | ||
console.log('POKE: so post', requests.map(function (x) { | ||
return "{ sid: " + x.sid + ", type: " + x.type + " }"; | ||
})); | ||
_context.next = 25; | ||
_context.next = 24; | ||
return this.request(action, correlationId, requests.map(function (object) { | ||
@@ -288,9 +284,7 @@ return { | ||
case 25: | ||
case 24: | ||
response = _context.sent; | ||
console.log('-- OK'); | ||
if (!(action === 'establish')) { | ||
_context.next = 47; | ||
_context.next = 45; | ||
break; | ||
@@ -302,3 +296,3 @@ } | ||
_iteratorError3 = undefined; | ||
_context.prev = 31; | ||
_context.prev = 29; | ||
@@ -312,14 +306,14 @@ for (_iterator3 = (0, _getIterator3.default)(requests); !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { | ||
} | ||
_context.next = 39; | ||
_context.next = 37; | ||
break; | ||
case 35: | ||
_context.prev = 35; | ||
_context.t1 = _context["catch"](31); | ||
case 33: | ||
_context.prev = 33; | ||
_context.t1 = _context["catch"](29); | ||
_didIteratorError3 = true; | ||
_iteratorError3 = _context.t1; | ||
case 39: | ||
_context.prev = 39; | ||
_context.prev = 40; | ||
case 37: | ||
_context.prev = 37; | ||
_context.prev = 38; | ||
@@ -330,7 +324,7 @@ if (!_iteratorNormalCompletion3 && _iterator3.return) { | ||
case 42: | ||
_context.prev = 42; | ||
case 40: | ||
_context.prev = 40; | ||
if (!_didIteratorError3) { | ||
_context.next = 45; | ||
_context.next = 43; | ||
break; | ||
@@ -341,15 +335,15 @@ } | ||
case 45: | ||
return _context.finish(42); | ||
case 43: | ||
return _context.finish(40); | ||
case 46: | ||
return _context.finish(39); | ||
case 44: | ||
return _context.finish(37); | ||
case 47: | ||
case 45: | ||
this.backoff.reset(); | ||
_context.next = 72; | ||
_context.next = 70; | ||
break; | ||
case 50: | ||
_context.prev = 50; | ||
case 48: | ||
_context.prev = 48; | ||
_context.t2 = _context["catch"](21); | ||
@@ -359,3 +353,3 @@ _iteratorNormalCompletion4 = true; | ||
_iteratorError4 = undefined; | ||
_context.prev = 55; | ||
_context.prev = 53; | ||
@@ -367,14 +361,14 @@ for (_iterator4 = (0, _getIterator3.default)(requests); !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { | ||
} | ||
_context.next = 63; | ||
_context.next = 61; | ||
break; | ||
case 59: | ||
_context.prev = 59; | ||
_context.t3 = _context["catch"](55); | ||
case 57: | ||
_context.prev = 57; | ||
_context.t3 = _context["catch"](53); | ||
_didIteratorError4 = true; | ||
_iteratorError4 = _context.t3; | ||
case 63: | ||
_context.prev = 63; | ||
_context.prev = 64; | ||
case 61: | ||
_context.prev = 61; | ||
_context.prev = 62; | ||
@@ -385,7 +379,7 @@ if (!_iteratorNormalCompletion4 && _iterator4.return) { | ||
case 66: | ||
_context.prev = 66; | ||
case 64: | ||
_context.prev = 64; | ||
if (!_didIteratorError4) { | ||
_context.next = 69; | ||
_context.next = 67; | ||
break; | ||
@@ -396,9 +390,9 @@ } | ||
case 69: | ||
return _context.finish(66); | ||
case 67: | ||
return _context.finish(64); | ||
case 70: | ||
return _context.finish(63); | ||
case 68: | ||
return _context.finish(61); | ||
case 71: | ||
case 69: | ||
if (_context.t2 instanceof twilio_transport_1.TwilsockUnavailableError) { | ||
@@ -412,3 +406,3 @@ logger_1.default.debug("Twilsock connection (required for subscription) not ready (c:" + correlationId + "); waiting\u2026"); | ||
case 72: | ||
case 70: | ||
case "end": | ||
@@ -418,3 +412,3 @@ return _context.stop(); | ||
} | ||
}, _callee, this, [[5, 9, 13, 21], [14,, 16, 20], [21, 50], [31, 35, 39, 47], [40,, 42, 46], [55, 59, 63, 71], [64,, 66, 70]]); | ||
}, _callee, this, [[5, 9, 13, 21], [14,, 16, 20], [21, 48], [29, 33, 37, 45], [38,, 40, 44], [53, 57, 61, 69], [62,, 64, 68]]); | ||
})); | ||
@@ -545,3 +539,2 @@ } | ||
logger_1.default.trace('Subscriptions received', message); | ||
console.log('Subscriptions received', message); | ||
switch (message.event_type) { | ||
@@ -685,3 +678,2 @@ case 'subscription_established': | ||
console.log("POKE: have " + this.persisted.size + ", where " + failedSubscriptions.length + " are failed"); | ||
this.persisted.clear(); | ||
@@ -688,0 +680,0 @@ var _iteratorNormalCompletion6 = true; |
@@ -75,5 +75,5 @@ "use strict"; | ||
let productId = options.productId = options.productId || SYNC_PRODUCT_ID; | ||
let emsClient = options.emsClient = options.emsClient || new twilio_ems_client_1.EmsClient(options); | ||
let twilsock = options.twilsockClient = options.twilsockClient || new Twilsock(fpaToken, options); | ||
let transport = options.transport = options.transport || new twilio_transport_1.Transport(options.twilsockClient); | ||
let emsClient = options.emsClient = options.emsClient || new twilio_ems_client_1.EmsClient(options); | ||
let notifications = options.notificationsClient = options.notificationsClient || new Notifications(fpaToken, options); | ||
@@ -80,0 +80,0 @@ let config = new configuration_1.Configuration(null, options); |
@@ -28,4 +28,3 @@ "use strict"; | ||
this.notifications.subscribe(SYNC_MAP_NOTIFICATION_TYPE); | ||
console.log('Scheduled registration'); | ||
this.notifications.on('message', message => this.onMessage.bind(this)); | ||
this.notifications.on('message', (messageType, payload) => this.onMessage(messageType, payload)); | ||
this.notifications.on('transportReady', state => { if (state) { | ||
@@ -41,3 +40,2 @@ this.onConnected(); | ||
onMessage(type, message) { | ||
console.log('Message arrived!'); | ||
logger_1.default.trace('Notification type:', type, 'content:', message); | ||
@@ -67,3 +65,2 @@ this.subscriptions.acceptMessage(message); | ||
onConnected() { | ||
console.log('ON CONNECTED!'); | ||
this.subscriptions.poke(); | ||
@@ -70,0 +67,0 @@ } |
@@ -116,3 +116,2 @@ "use strict"; | ||
try { | ||
console.log('POKE: so post', requests.map(x => `{ sid: ${x.sid}, type: ${x.type} }`)); | ||
let response = yield this.request(action, correlationId, requests.map(object => ({ | ||
@@ -123,3 +122,2 @@ object_sid: object.sid, | ||
}))); | ||
console.log('-- OK'); | ||
if (action === 'establish') { | ||
@@ -250,3 +248,2 @@ for (const subscribed of requests) { | ||
logger_1.default.trace('Subscriptions received', message); | ||
console.log('Subscriptions received', message); | ||
switch (message.event_type) { | ||
@@ -366,3 +363,2 @@ case 'subscription_established': | ||
} | ||
console.log(`POKE: have ${this.persisted.size}, where ${failedSubscriptions.length} are failed`); | ||
this.persisted.clear(); | ||
@@ -369,0 +365,0 @@ for (let it of failedSubscriptions) { |
{ | ||
"name": "twilio-sync", | ||
"version": "0.4.2-dev.1", | ||
"version": "0.4.2-dev.3", | ||
"description": "Twilio Sync client library", | ||
@@ -14,7 +14,7 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"babel-runtime": "^6.20.0", | ||
"karibu": "^1.0.0", | ||
"babel-runtime": "^6.22.0", | ||
"karibu": "^1.0.1", | ||
"loglevel": "^1.4.1", | ||
"platform": "^1.3.3", | ||
"rfc6902": "^1.2.2", | ||
"rfc6902": "^1.3.0", | ||
"twilio-ems-client": "^0.1.5-dev.2", | ||
@@ -30,4 +30,4 @@ "twilio-notifications": "^0.3.0-dev.1", | ||
"@types/loglevel": "^1.4.29", | ||
"@types/mocha": "^2.2.36", | ||
"@types/node": "^6.0.58", | ||
"@types/mocha": "^2.2.38", | ||
"@types/node": "^7.0.4", | ||
"@types/sinon": "^1.16.34", | ||
@@ -37,10 +37,10 @@ "@types/sinon-as-promised": "^4.0.5", | ||
"async-test-tools": "^1.0.6", | ||
"babel-cli": "^6.18.0", | ||
"babel-cli": "^6.22.2", | ||
"babel-plugin-add-module-exports": "^0.2.1", | ||
"babel-plugin-transform-object-assign": "^6.8.0", | ||
"babel-plugin-transform-runtime": "^6.15.0", | ||
"babel-preset-es2015": "^6.18.0", | ||
"babel-plugin-transform-object-assign": "^6.22.0", | ||
"babel-plugin-transform-runtime": "^6.22.0", | ||
"babel-preset-es2015": "^6.22.0", | ||
"babelify": "^7.3.0", | ||
"backoff": "^2.5.0", | ||
"browserify": "^13.3.0", | ||
"browserify": "^14.0.0", | ||
"chai": "^3.5.0", | ||
@@ -63,3 +63,3 @@ "chai-as-promised": "^6.0.0", | ||
"gulp-typescript": "^3.1.4", | ||
"gulp-uglify": "^2.0.0", | ||
"gulp-uglify": "^2.0.1", | ||
"gulp-util": "^3.0.8", | ||
@@ -70,7 +70,7 @@ "ink-docstrap": "^1.3.0", | ||
"jsonwebtoken": "^7.2.1", | ||
"karma": "^1.3.0", | ||
"karma-browserify": "^5.1.0", | ||
"karma-browserstack-launcher": "^1.1.1", | ||
"karma": "^1.4.1", | ||
"karma-browserify": "^5.1.1", | ||
"karma-browserstack-launcher": "^1.2.0", | ||
"karma-mocha": "^1.3.0", | ||
"karma-mocha-reporter": "^2.2.1", | ||
"karma-mocha-reporter": "^2.2.2", | ||
"run-sequence": "^1.2.2", | ||
@@ -81,10 +81,10 @@ "sinon": "^1.17.7", | ||
"ts-node": "^2.0.0", | ||
"tslint": "^4.3.1", | ||
"tslint": "^4.4.2", | ||
"twilio": "^3.3.0-edge", | ||
"typescript": "^2.1.4", | ||
"typescript": "^2.1.5", | ||
"underscore": "^1.8.3", | ||
"vinyl-buffer": "^1.0.0", | ||
"vinyl-source-stream": "^1.1.0", | ||
"watchify": "^3.8.0" | ||
"watchify": "^3.9.0" | ||
} | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
1999936
107
29359
Updatedbabel-runtime@^6.22.0
Updatedkaribu@^1.0.1
Updatedrfc6902@^1.3.0