Socket
Socket
Sign inDemoInstall

twilio-sync

Package Overview
Dependencies
Maintainers
2
Versions
608
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

twilio-sync - npm Package Compare versions

Comparing version 0.3.0-rc5 to 0.3.0-rc6

49

lib/subscriptions.js

@@ -117,2 +117,3 @@ 'use strict';

_types: { value: new _map2.default() },
_subscriptions: { value: new _map2.default() },

@@ -149,2 +150,4 @@ _persisted: { value: new _map2.default() }

value: function _getAction() {
var _this2 = this;
var listToAdd = substract(this._subscriptions, this._persisted);

@@ -155,3 +158,5 @@ if (listToAdd.length > 0) {

var listToRemove = substract(this._persisted, this._subscriptions);
var listToRemove = substract(this._persisted, this._subscriptions).map(function (x) {
return { id: x.id, type: _this2._types.get(x.id) };
});
if (listToRemove.length > 0) {

@@ -178,3 +183,3 @@ return { action: 'cancel', list: listToRemove };

value: function _request(action, requests) {
var _this2 = this;
var _this3 = this;

@@ -192,6 +197,7 @@ _logger2.default.debug('Modifying server subscriptions: ', action, requests);

if (!persisted.subscription) {
_this2._persisted.delete(persisted.object_sid);
_this3._persisted.delete(persisted.object_sid);
_this3._types.delete(persisted.object_sid);
} else {
_this2._persisted.set(persisted.object_sid, persisted.subscription);
var subscription = _this2._subscriptions.get(persisted.object_sid);
_this3._persisted.set(persisted.object_sid, persisted.subscription);
var subscription = _this3._subscriptions.get(persisted.object_sid);
if (subscription) {

@@ -215,3 +221,3 @@ subscription.resolve(true);

value: function add(sid, entity) {
var _this3 = this;
var _this4 = this;

@@ -222,19 +228,24 @@ var subscribed = this._subscriptions.has(sid);

if (subscribed && persisted) {
var subscription = this._subscriptions.get(sid);
subscription.add(entity);
var _subscription = this._subscriptions.get(sid);
_subscription.subscribers.add(entity);
return _promise2.default.resolve(false);
} else if (this._subscribed && !persisted) {
var _subscription = this._subscriptions.get(sid);
return _subscription.promise;
var _subscription2 = this._subscriptions.get(sid);
return _subscription2.promise;
}
var subscription = { type: entity.type,
subscribers: new _set2.default([entity]),
promise: null,
resolve: null,
reject: null
};
this._subscriptions.set(sid, subscription);
var promiseToSubscribe = new _promise2.default(function (resolve, reject) {
_this3._subscriptions.set(sid, { type: entity.type,
subscribers: new _set2.default([entity]),
promise: promiseToSubscribe,
resolve: resolve,
reject: reject
});
_this3._persist();
subscription.resolve = resolve;
subscription.reject = reject;
_this4._persist();
});
subscription.promise = promiseToSubscribe;
return promiseToSubscribe;

@@ -266,2 +277,6 @@ }

// It's a hack: since server responce doesn't contain a type, but we need it
// we should always keep it locally
this._types.set(id, subscription.type);
this._subscriptions.delete(id);

@@ -268,0 +283,0 @@ this._persist();

{
"name": "twilio-sync",
"version": "0.3.0-rc5",
"version": "0.3.0-rc6",
"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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc