Socket
Socket
Sign inDemoInstall

twilio-sync

Package Overview
Dependencies
7
Maintainers
2
Versions
607
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.4.0-dev-build.135 to 0.4.0-dev-build.137

10

lib/entity.js

@@ -80,2 +80,12 @@ 'use strict';

/**
* Report an error, which is occured during internal processes
*/
}, {
key: '_reportFailure',
value: function _reportFailure(err) {
this.emit('error', err);
}
/**
* Closes current entity

@@ -82,0 +92,0 @@ * Remove server subscription, local cache, and other related stuff

21

lib/subscriptions.js

@@ -43,5 +43,8 @@ 'use strict';

var _syncerror = require('./syncerror');
var _syncerror2 = _interopRequireDefault(_syncerror);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* eslint-disable key-spacing */
var MAX_BATCH_SIZE = 1000;

@@ -53,2 +56,3 @@

*/
/* eslint-disable key-spacing */

@@ -320,3 +324,3 @@ var SubscribedEntity = function () {

_this3._backoff.backoff(e);
_this3._persist();
});

@@ -531,6 +535,13 @@ }

var sid = message.object_sid;
var subscriptionIntent = this._subscriptions.get(sid);
var subscription = this._persisted.get(sid);
if (subscription && subscription.correlationId === correlationId) {
subscription.markAsFailed(message.error);
if (subscriptionIntent && subscription) {
if (subscription.correlationId === correlationId) {
subscription.markAsFailed(message.error);
subscriptionIntent._reportFailure(new _syncerror2.default('Failed to subscribe on service events'));
}
} else if (!subscriptionIntent && subscription) {
this._persisted.delete(sid);
}
this._persist();

@@ -544,3 +555,3 @@ }

message.event.type = message.event_type;
subscriptionIntent._update(message.event);
subscriptionIntent._update(message.event, true);
} else {

@@ -547,0 +558,0 @@ _logger2.default.debug('Message dropped for SID \'' + sid + '\', for which there is no subscription.');

@@ -457,3 +457,8 @@ 'use strict';

/**
* Handle update, which came from the server
* Handle update event
*
* @param {Object} update
* @param {Boolean} reliable Caller should point if transport reliable or not
* For reliable transport it will advance lastEventId even if gaps in events were found
*
* @private

@@ -464,3 +469,3 @@ */

key: '_update',
value: function _update(update) {
value: function _update(update, reliableTransport) {
var itemIndex = Number(update.item_index);

@@ -496,4 +501,7 @@ switch (update.type) {

if (this._lastEventId < update.id) {
this._revision = update.list_revision;
this._revision = update.list_revision;
var updateHasNoGap = update.id - this._lastEventId === 1;
var shouldAdvance = this._lastEventId < update.id && (reliableTransport || updateHasNoGap);
if (shouldAdvance) {
this._lastEventId = update.id;

@@ -500,0 +508,0 @@ }

@@ -563,3 +563,8 @@ 'use strict';

/**
* Handle update from the server
* Handle update event
*
* @param {Object} update
* @param {Boolean} reliable Caller should point if transport reliable or not
* For reliable transport it will advance lastEventId even if gaps in events were found
*
* @private

@@ -570,3 +575,3 @@ */

key: '_update',
value: function _update(update) {
value: function _update(update, reliableTransport) {
switch (update.type) {

@@ -601,4 +606,7 @@ case 'map_item_added':

if (this._lastEventId < update.id) {
this._revision = update.map_revision;
this._revision = update.map_revision;
var updateHasNoGap = update.id - this._lastEventId === 1;
var shouldAdvance = this._lastEventId < update.id && (reliableTransport || updateHasNoGap);
if (shouldAdvance) {
this._lastEventId = update.id;

@@ -605,0 +613,0 @@ }

{
"name": "twilio-sync",
"version": "0.4.0-dev-build.135",
"version": "0.4.0-dev-build.137",
"description": "Twilio Sync client library",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

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 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 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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc