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

@stellarjs/abstract-transport

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stellarjs/abstract-transport - npm Package Compare versions

Comparing version 0.10.1 to 0.10.4

yarn-error.log

9

lib-es6/index.js

@@ -6,3 +6,3 @@ 'use strict';

});
exports.localRequestHandlersDecorator = exports.RemoteTransport = exports.Transport = undefined;
exports.RemoteTransport = exports.Transport = undefined;

@@ -17,10 +17,5 @@ var _Transport = require('./Transport');

var _localRequestHandlersDecorator = require('./localRequestHandlersDecorator');
var _localRequestHandlersDecorator2 = _interopRequireDefault(_localRequestHandlersDecorator);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.Transport = _Transport2.default;
exports.RemoteTransport = _RemoteTransport2.default;
exports.localRequestHandlersDecorator = _localRequestHandlersDecorator2.default;
exports.RemoteTransport = _RemoteTransport2.default;

@@ -12,16 +12,15 @@ 'use strict';

var _defaults = require('lodash/defaults');
var _defaults2 = _interopRequireDefault(_defaults);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function decorate(transport) {
function getLocalHandler(req) {
function decorate(Transport) {
Transport.prototype.getLocalHandler = function (req) {
const url = (0, _get2.default)(req, 'headers.queueName');
return (0, _get2.default)(transport.registries.requestHandlers, url);
}
return (0, _get2.default)(this.registries.requestHandlers, url);
};
function _request(req, requestTimeout) {
const localHandler = getLocalHandler(req);
Transport.prototype._request = Transport.prototype.request;
Transport.prototype._fireAndForget = Transport.prototype.fireAndForget;
Transport.prototype.request = function (req, requestTimeout) {
const localHandler = this.getLocalHandler(req);
if (localHandler) {

@@ -31,7 +30,7 @@ return localHandler(req);

return transport.request(req, requestTimeout);
}
return this._request(req, requestTimeout);
};
function _fireAndForget(req) {
const localHandler = getLocalHandler(req);
Transport.prototype.fireAndForget = function (req) {
const localHandler = this.getLocalHandler(req);
if (localHandler) {

@@ -42,9 +41,6 @@ localHandler(req);

transport.fireAndForget(req);
}
this._fireAndForget(req);
};
const decorations = { request: _request.bind(transport), fireAndForget: _fireAndForget.bind(transport) };
const result = (0, _defaults2.default)(decorations, transport);
return result;
return Transport;
}

@@ -1,1 +0,1 @@

!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r(require("lodash/get"),require("uuid/v1"),require("@stellarjs/stellar-error"),require("bluebird"),require("lodash/defaults"),require("lodash/fromPairs"),require("lodash/isEmpty"),require("lodash/map"),require("lodash/set"),require("lodash/split")):"function"==typeof define&&define.amd?define(["lodash/get","uuid/v1","@stellarjs/stellar-error","bluebird","lodash/defaults","lodash/fromPairs","lodash/isEmpty","lodash/map","lodash/set","lodash/split"],r):"object"==typeof exports?exports["@stellarjs/abstract-transport"]=r(require("lodash/get"),require("uuid/v1"),require("@stellarjs/stellar-error"),require("bluebird"),require("lodash/defaults"),require("lodash/fromPairs"),require("lodash/isEmpty"),require("lodash/map"),require("lodash/set"),require("lodash/split")):e["@stellarjs/abstract-transport"]=r(e["lodash/get"],e["uuid/v1"],e["@stellarjs/stellar-error"],e.bluebird,e["lodash/defaults"],e["lodash/fromPairs"],e["lodash/isEmpty"],e["lodash/map"],e["lodash/set"],e["lodash/split"])}(this,function(e,r,t,o,n,s,i,u,a,l){return function(e){function r(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,r),n.l=!0,n.exports}var t={};return r.m=e,r.c=t,r.i=function(e){return e},r.d=function(e,t,o){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:o})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},r.p="",r(r.s=5)}([function(e,r,t){"use strict";function o(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function n(e,r){var t=e[0],o=e.slice(1),s=d()(o)||n(o,r[t]);return s?(delete r[t],d()(r)):s}var s=t(9),i=t.n(s),u=t(1),a=t.n(u),l=t(10),d=t.n(l),f=t(11),c=t.n(f),p=t(12),h=t.n(p),q=t(13),b=t.n(q),m=t(2),y=t.n(m),g=function(){function e(r,t){o(this,e),this.source=r,this.log=t,this.registries={requestHandlers:{},subscribers:{}}}return e.prototype._registerHandler=function(e,r,t){var o=this;if(a()(this.registries[e],r))throw new Error("Cannot have more that once per url in registries."+e+'. "'+r+'" has already added');return h()(this.registries[e],r,t),function(){return n(b()(r,"."),o.registries[e])}},e.prototype.registerSubscriberGroupHandler=function(e,r,t){return this._registerHandler("subscribers",r+"."+e,t)},e.prototype.registerSubscriberHandler=function(e,r){var t=y()();return this._registerHandler("subscribers",e+"."+t,r)},e.prototype.registerRequestHandler=function(e,r){return this._registerHandler("requestHandlers",e,r)},e.prototype.getLocalHandler=function(e){var r=a()(e,"headers.queueName");return a()(this.registries.requestHandlers,r)},e.prototype.publish=function(e,r){throw new Error('"publish" was called but was not implemented!')},e.prototype.subscribe=function(e,r){throw new Error('"subscribe" was called but was not implemented!')},e.prototype.subscribeGroup=function(e,r,t){throw new Error('"subscribeGroup" was called but was not implemented!')},e.prototype.request=function(e,r){throw new Error('"request" was called but was not implemented!')},e.prototype.fireAndForget=function(e){throw new Error('"fireAndForget" was called but was not implemented!')},e.prototype.addRequestHandler=function(e,r){throw new Error('"addHandler" was called but was not implemented!')},e.prototype.generateId=function(){throw new Error('"generateId" was called but was not implemented!')},e.prototype.reset=function(){this.registries=i()(c()(this.registries,function(e,r){return[r,{}]}))},e}();r.a=g},function(e,r){e.exports=require("lodash/get")},function(e,r){e.exports=require("uuid/v1")},function(e,r,t){"use strict";function o(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function n(e,r){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!r||"object"!=typeof r&&"function"!=typeof r?e:r}function s(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(e,r):e.__proto__=r)}function i(e){e&&clearTimeout(e)}var u=t(7),a=t.n(u),l=t(2),d=t.n(l),f=t(6),c=t.n(f),p=t(0),h=function(e){function r(t,s,i){o(this,r);var u=n(this,e.call(this,t,s));return u.defaultRequestTimeout=i,u.inflightRequests={},u}return s(r,e),r.prototype.generateId=function(){return d()()},r.prototype.request=function(e){var r=this,t=e.headers,o=void 0===t?{}:t,n=e.body,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.requestTimeout||this.defaultRequestTimeout;return new a.a(function(e,t){return r.inflightRequests[o.id]=[e,t,r._startRequestTimer(o,s)],r.remoteRequest({headers:o,body:n})})},r.prototype.fireAndForget=function(e){return this.remoteRequest(e)},r.prototype.remoteRequest=function(e){throw new Error("remoteRequest must be implemented")},r.prototype._handleRequestTimeout=function(e,r){if(!this.inflightRequests[e.id]){var t={id:e.id},o="@RemoteTransport: MISSING inflightRequest handler for TIMEOUT after "+r+"ms.";throw this.log.error(o,t),new Error(o+" "+JSON.stringify(t))}var n=this.inflightRequests[e.id][1];delete this.inflightRequests[e.id];var s="@RemoteTransport: TIMEOUT after "+r+"ms";this.log.warn(s,{id:e.id}),n(new c.a(s+". requestId="+e.id))},r.prototype._startRequestTimer=function(e,r){var t=this;if(r)return setTimeout(function(){return t._handleRequestTimeout(e,r)},r)},r.prototype.reset=function(){return this.inflightRequests={},e.prototype.reset.call(this)},r.prototype._responseHandler=function(e){var r=e.headers,t=e.body,o=r.requestId,n=this.inflightRequests[o];if(!n)return void this.log.error("@RemoteTransport: MISSING inflightRequest handler for response",{id:r.id});delete this.inflightRequests[o],i(n[2]),n[0]({headers:r,body:t})},r}(p.a);r.a=h},function(e,r,t){"use strict";function o(e){function r(r){var t=s()(r,"headers.queueName");return s()(e.registries.requestHandlers,t)}function t(t,o){var n=r(t);return n?n(t):e.request(t,o)}function o(t){var o=r(t);if(o)return void o(t);e.fireAndForget(t)}var n={request:t.bind(e),fireAndForget:o.bind(e)};return u()(n,e)}r.a=o;var n=t(1),s=t.n(n),i=t(8),u=t.n(i)},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o=t(0),n=t(3),s=t(4);t.d(r,"Transport",function(){return o.a}),t.d(r,"RemoteTransport",function(){return n.a}),t.d(r,"localRequestHandlersDecorator",function(){return s.a})},function(e,r){e.exports=require("@stellarjs/stellar-error")},function(e,r){e.exports=require("bluebird")},function(e,r){e.exports=require("lodash/defaults")},function(e,r){e.exports=require("lodash/fromPairs")},function(e,r){e.exports=require("lodash/isEmpty")},function(e,r){e.exports=require("lodash/map")},function(e,r){e.exports=require("lodash/set")},function(e,r){e.exports=require("lodash/split")}])});
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r(require("uuid/v1"),require("@stellarjs/stellar-error"),require("bluebird"),require("lodash/fromPairs"),require("lodash/get"),require("lodash/isEmpty"),require("lodash/map"),require("lodash/set"),require("lodash/split")):"function"==typeof define&&define.amd?define(["uuid/v1","@stellarjs/stellar-error","bluebird","lodash/fromPairs","lodash/get","lodash/isEmpty","lodash/map","lodash/set","lodash/split"],r):"object"==typeof exports?exports["@stellarjs/abstract-transport"]=r(require("uuid/v1"),require("@stellarjs/stellar-error"),require("bluebird"),require("lodash/fromPairs"),require("lodash/get"),require("lodash/isEmpty"),require("lodash/map"),require("lodash/set"),require("lodash/split")):e["@stellarjs/abstract-transport"]=r(e["uuid/v1"],e["@stellarjs/stellar-error"],e.bluebird,e["lodash/fromPairs"],e["lodash/get"],e["lodash/isEmpty"],e["lodash/map"],e["lodash/set"],e["lodash/split"])}(this,function(e,r,t,o,n,s,i,u,a){return function(e){function r(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,r),n.l=!0,n.exports}var t={};return r.m=e,r.c=t,r.i=function(e){return e},r.d=function(e,t,o){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:o})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},r.p="",r(r.s=3)}([function(e,r,t){"use strict";function o(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function n(e,r){var t=e[0],o=e.slice(1),s=d()(o)||n(o,r[t]);return s?(delete r[t],d()(r)):s}var s=t(6),i=t.n(s),u=t(7),a=t.n(u),l=t(8),d=t.n(l),p=t(9),f=t.n(p),c=t(10),h=t.n(c),b=t(11),m=t.n(b),q=t(1),y=t.n(q),w=function(){function e(r,t){o(this,e),this.source=r,this.log=t,this.registries={requestHandlers:{},subscribers:{}}}return e.prototype._registerHandler=function(e,r,t){var o=this;if(a()(this.registries[e],r))throw new Error("Cannot have more that once per url in registries."+e+'. "'+r+'" has already added');return h()(this.registries[e],r,t),function(){return n(m()(r,"."),o.registries[e])}},e.prototype.registerSubscriberGroupHandler=function(e,r,t){return this._registerHandler("subscribers",r+"."+e,t)},e.prototype.registerSubscriberHandler=function(e,r){var t=y()();return this._registerHandler("subscribers",e+"."+t,r)},e.prototype.registerRequestHandler=function(e,r){return this._registerHandler("requestHandlers",e,r)},e.prototype.getLocalHandler=function(e){var r=a()(e,"headers.queueName");return a()(this.registries.requestHandlers,r)},e.prototype.publish=function(e,r){throw new Error('"publish" was called but was not implemented!')},e.prototype.subscribe=function(e,r){throw new Error('"subscribe" was called but was not implemented!')},e.prototype.subscribeGroup=function(e,r,t){throw new Error('"subscribeGroup" was called but was not implemented!')},e.prototype.request=function(e,r){throw new Error('"request" was called but was not implemented!')},e.prototype.fireAndForget=function(e){throw new Error('"fireAndForget" was called but was not implemented!')},e.prototype.addRequestHandler=function(e,r){throw new Error('"addHandler" was called but was not implemented!')},e.prototype.generateId=function(){throw new Error('"generateId" was called but was not implemented!')},e.prototype.reset=function(){this.registries=i()(f()(this.registries,function(e,r){return[r,{}]}))},e}();r.a=w},function(e,r){e.exports=require("uuid/v1")},function(e,r,t){"use strict";function o(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function n(e,r){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!r||"object"!=typeof r&&"function"!=typeof r?e:r}function s(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(e,r):e.__proto__=r)}function i(e){e&&clearTimeout(e)}var u=t(5),a=t.n(u),l=t(1),d=t.n(l),p=t(4),f=t.n(p),c=t(0),h=function(e){function r(t,s,i){o(this,r);var u=n(this,e.call(this,t,s));return u.defaultRequestTimeout=i,u.inflightRequests={},u}return s(r,e),r.prototype.generateId=function(){return d()()},r.prototype.request=function(e){var r=this,t=e.headers,o=void 0===t?{}:t,n=e.body,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.requestTimeout||this.defaultRequestTimeout;return new a.a(function(e,t){return r.inflightRequests[o.id]=[e,t,r._startRequestTimer(o,s)],r.remoteRequest({headers:o,body:n})})},r.prototype.fireAndForget=function(e){return this.remoteRequest(e)},r.prototype.remoteRequest=function(e){throw new Error("remoteRequest must be implemented")},r.prototype._handleRequestTimeout=function(e,r){if(!this.inflightRequests[e.id]){var t={id:e.id},o="@RemoteTransport: MISSING inflightRequest handler for TIMEOUT after "+r+"ms.";throw this.log.error(o,t),new Error(o+" "+JSON.stringify(t))}var n=this.inflightRequests[e.id][1];delete this.inflightRequests[e.id];var s="@RemoteTransport: TIMEOUT after "+r+"ms";this.log.warn(s,{id:e.id}),n(new f.a(s+". requestId="+e.id))},r.prototype._startRequestTimer=function(e,r){var t=this;if(r)return setTimeout(function(){return t._handleRequestTimeout(e,r)},r)},r.prototype.reset=function(){return this.inflightRequests={},e.prototype.reset.call(this)},r.prototype._responseHandler=function(e){var r=e.headers,t=e.body,o=r.requestId,n=this.inflightRequests[o];if(!n)return void this.log.error("@RemoteTransport: MISSING inflightRequest handler for response",{id:r.id});delete this.inflightRequests[o],i(n[2]),n[0]({headers:r,body:t})},r}(c.a);r.a=h},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var o=t(0),n=t(2);t.d(r,"Transport",function(){return o.a}),t.d(r,"RemoteTransport",function(){return n.a})},function(e,r){e.exports=require("@stellarjs/stellar-error")},function(e,r){e.exports=require("bluebird")},function(e,r){e.exports=require("lodash/fromPairs")},function(e,r){e.exports=require("lodash/get")},function(e,r){e.exports=require("lodash/isEmpty")},function(e,r){e.exports=require("lodash/map")},function(e,r){e.exports=require("lodash/set")},function(e,r){e.exports=require("lodash/split")}])});
{
"name": "@stellarjs/abstract-transport",
"version": "0.10.1",
"version": "0.10.4",
"license": "MIT",

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

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