mappersmith
Advanced tools
Comparing version 2.6.1 to 2.7.0
@@ -26,3 +26,3 @@ 'use strict'; | ||
*/ | ||
function ClientBuilder(manifest, GatewayClassFactory) { | ||
function ClientBuilder(manifest, GatewayClassFactory, defaultGatewayConfigs) { | ||
if (!manifest) { | ||
@@ -36,3 +36,3 @@ throw new Error('[Mappersmith] invalid manifest (' + manifest + ')'); | ||
this.manifest = new _manifest2.default(manifest); | ||
this.manifest = new _manifest2.default(manifest, defaultGatewayConfigs); | ||
this.GatewayClassFactory = GatewayClassFactory; | ||
@@ -70,4 +70,5 @@ } | ||
var GatewayClass = this.GatewayClassFactory(); | ||
var gatewayConfigs = this.manifest.gatewayConfigs; | ||
var callGateway = function callGateway() { | ||
return new GatewayClass(finalRequest).call(); | ||
return new GatewayClass(finalRequest, gatewayConfigs).call(); | ||
}; | ||
@@ -74,0 +75,0 @@ |
@@ -18,3 +18,6 @@ 'use strict'; | ||
function Gateway(request) { | ||
var configs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
this.request = request; | ||
this.configs = configs; | ||
this.successCallback = function () {}; | ||
@@ -30,3 +33,3 @@ this.failCallback = function () {}; | ||
options: function options() { | ||
return _mappersmith.configs.gatewayConfigs; | ||
return this.configs; | ||
}, | ||
@@ -33,0 +36,0 @@ shouldEmulateHTTP: function shouldEmulateHTTP() { |
@@ -19,7 +19,11 @@ 'use strict'; | ||
* @param {String} obj.host | ||
* @param {String} obj.resources - default: {} | ||
* @param {String} obj.middlewares - default: [] | ||
* @param {Object} obj.gatewayConfigs - default: base values from mappersmith | ||
* @param {Object} obj.resources - default: {} | ||
* @param {Array} obj.middlewares - default: [] | ||
*/ | ||
function Manifest(obj) { | ||
var defaultGatewayConfigs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; | ||
this.host = obj.host; | ||
this.gatewayConfigs = (0, _utils.assign)({}, defaultGatewayConfigs, obj.gatewayConfigs); | ||
this.resources = obj.resources || {}; | ||
@@ -26,0 +30,0 @@ this.middlewares = obj.middlewares || []; |
@@ -85,5 +85,6 @@ 'use strict'; | ||
};function forge(manifest) { | ||
return new _clientBuilder2.default(manifest, function () { | ||
var GatewayClassFactory = function GatewayClassFactory() { | ||
return configs.gateway; | ||
}).build(); | ||
}; | ||
return new _clientBuilder2.default(manifest, GatewayClassFactory, configs.gatewayConfigs).build(); | ||
} |
{ | ||
"name": "mappersmith", | ||
"version": "2.6.1", | ||
"version": "2.7.0", | ||
"description": "It is a lightweight rest client for node.js and the browser", | ||
@@ -5,0 +5,0 @@ "author": "Tulio Ornelas <ornelas.tulio@gmail.com>", |
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
84354
1678