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

autobahn

Package Overview
Dependencies
Maintainers
2
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

autobahn - npm Package Compare versions

Comparing version 20.4.1 to 20.6.1

4

lib/auth/persona.js

@@ -14,6 +14,2 @@ ///////////////////////////////////////////////////////////////////////////////

var when = require('when');
var when_fn = require("when/function");
function auth(session, user, extra) {

@@ -20,0 +16,0 @@

14

lib/autobahn.js

@@ -19,4 +19,10 @@ ///////////////////////////////////////////////////////////////////////////////

var when = require('when');
//var fn = require("when/function");
let when;
let HAS_WHEN;
try {
when = require('when');
HAS_WHEN = true;
} catch (e) {
HAS_WHEN = false;
}

@@ -67,3 +73,5 @@ var msgpack = require('msgpack5');

exports.when = when;
if (HAS_WHEN) {
exports.when = when;
}
exports.msgpack = msgpack;

@@ -70,0 +78,0 @@ exports.cbor = cbor;

@@ -14,4 +14,2 @@ ///////////////////////////////////////////////////////////////////////////////

var when = require('when');
var session = require('./session.js');

@@ -18,0 +16,0 @@ var util = require('./util.js');

@@ -17,8 +17,5 @@ ///////////////////////////////////////////////////////////////////////////////

var when = require('when');
var when_fn = require("when/function");
const log = require('./log.js');
const util = require('./util.js');
var log = require('./log.js');
var util = require('./util.js');
// IE fallback (http://afuchs.tumblr.com/post/23550124774/date-now-in-ie8)

@@ -797,8 +794,3 @@ Date.now = Date.now || function() { return +new Date; };

// We use the following whenjs call wrapper, which automatically
// wraps a plain, non-promise value in a (immediately resolved) promise
//
// See: https://github.com/cujojs/when/blob/master/docs/api.md#fncall
//
when_fn.call(reg.endpoint, args, kwargs, cd).then(
util.as_promise(reg.endpoint, args, kwargs, cd).then(

@@ -945,3 +937,3 @@ function (res) {

when_fn.call(self._onchallenge, self, method, extra).then(
util.as_promise(self._onchallenge, self, method, extra).then(
function (signature) {

@@ -1434,3 +1426,11 @@

var subs = self._subscriptions[subscription.id];
var i = subs.indexOf(subscription);
if (!self.isOpen) {
if (i !== -1) {
// remove handler subscription
subs.splice(i, 1);
subscription.active = false;
}
throw "session not open";

@@ -1440,8 +1440,11 @@ }

if (!subscription.active || !(subscription.id in self._subscriptions)) {
if (i !== -1) {
// remove handler subscription
subs.splice(i, 1);
subscription.active = false;
}
throw "subscription not active";
}
var subs = self._subscriptions[subscription.id];
var i = subs.indexOf(subscription);
if (i === -1) {

@@ -1448,0 +1451,0 @@ throw "subscription not active";

@@ -15,3 +15,2 @@ ///////////////////////////////////////////////////////////////////////////////

var when = require('when');
var util = require('../util.js');

@@ -29,3 +28,3 @@ var log = require('../log.js');

self._options = options;
};
}

@@ -32,0 +31,0 @@

@@ -14,5 +14,12 @@ ///////////////////////////////////////////////////////////////////////////////

var log = require('./log.js');
let HAS_WHEN;
let when;
try {
when = require('when');
HAS_WHEN = true;
} catch (e) {
HAS_WHEN = false;
}
var when = require('when');
let log = require('./log.js');

@@ -103,3 +110,2 @@

var is_object = function(variable) {

@@ -110,3 +116,2 @@ return !Array.isArray(variable) && (variable instanceof Object || typeof variable === 'object')

var assert = function (cond, text) {

@@ -133,3 +138,3 @@ if (cond) {

var d = when.defer();
var d = deferred_factory();
var req = new XMLHttpRequest();

@@ -201,3 +206,3 @@ req.withCredentials = true; // pass along cookies

var d = when.defer();
var d = deferred_factory();
var req = new XMLHttpRequest();

@@ -369,23 +374,38 @@ req.withCredentials = true; // pass along cookies

var deferred_factory = function(options) {
var defer = null;
let deferred_factory = function(options) {
let defer;
if (options && options.use_es6_promises) {
// Our strategy is to default to whenjs-based promise if a promise
// preference is not provided *and* whenjs is available.
// In the absence of whenjs and promise preference, we
// use the ES6 Promise because we are ES6+ so always expect
// that to be available.
if ('Promise' in global) {
let get_es6_promise_factory = function () {
return function () {
let deferred = {};
deferred.promise = new Promise(function (resolve, reject) {
deferred.resolve = resolve;
deferred.reject = reject;
});
return deferred;
};
}
if (options) {
if (options.use_es6_promises) {
// ES6-based deferred factory
//
defer = function () {
var deferred = {};
defer = get_es6_promise_factory();
deferred.promise = new Promise(function (resolve, reject) {
deferred.resolve = resolve;
deferred.reject = reject;
});
} else if (options.use_deferred) {
return deferred;
};
} else {
// use explicit deferred factory, e.g. jQuery.Deferred or Q.defer
//
defer = options.use_deferred;
log.debug("Warning: ES6 promises requested, but not found! Falling back to whenjs.");
} else if (HAS_WHEN) {

@@ -395,15 +415,22 @@ // whenjs-based deferred factory

defer = when.defer;
} else {
// ES6-based deferred factory
//
defer = get_es6_promise_factory();
}
} else if (HAS_WHEN) {
} else if (options && options.use_deferred) {
// use explicit deferred factory, e.g. jQuery.Deferred or Q.defer
// whenjs-based deferred factory
//
defer = options.use_deferred;
defer = when.defer;
} else {
// whenjs-based deferred factory
// ES6-based deferred factory
//
defer = when.defer;
defer = get_es6_promise_factory();
}

@@ -440,2 +467,12 @@

let as_promise = function (func, ...args) {
return new Promise((resolve, reject) => {
try {
resolve(func.call(this, ...args));
} catch (e) {
reject(e);
}
});
}
if ('fs' in global) {

@@ -459,1 +496,2 @@ exports.read_file = _read_file;

exports.sleep = sleep;
exports.as_promise = as_promise;
{
"name": "autobahn",
"version": "20.4.1",
"version": "20.6.1",
"description": "An implementation of The Web Application Messaging Protocol (WAMP).",

@@ -21,3 +21,2 @@ "main": "index.js",

"tweetnacl": ">= 0.14.3",
"when": ">= 3.7.7",
"ws": ">= 1.1.4"

@@ -27,3 +26,4 @@ },

"bufferutil": ">= 1.2.1",
"utf-8-validate": ">= 1.2.1"
"utf-8-validate": ">= 1.2.1",
"when": ">= 3.7.7"
},

@@ -30,0 +30,0 @@ "devDependencies": {

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