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

resource-client

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

resource-client - npm Package Compare versions

Comparing version 1.3.1 to 1.3.2

85

lib/index.js

@@ -45,3 +45,3 @@ // Generated by CoffeeScript 1.8.0

requestUrl = UrlAssembler().template(url).param(paramConfig).query(queryParams).toString();
return actionRequest({
return actionRequest.get({
url: requestUrl

@@ -60,3 +60,3 @@ }, function(err, response) {

requestUrl = UrlAssembler().template(baseUrl).query(queryParams).toString();
return actionRequest({
return actionRequest.get({
url: requestUrl

@@ -69,32 +69,13 @@ }, function(err, response) {

actionUrl = options.method === 'POST' ? baseUrl : url;
Resource[actionName] = function(body, queryParams, done) {
var requestUrl;
if (queryParams == null) {
queryParams = {};
return (function(methodFn) {
if (methodFn === 'delete') {
methodFn = 'del';
}
done = arguments[arguments.length - 1];
requestUrl = (function() {
var idField, _i, _len;
requestUrl = UrlAssembler().template(actionUrl);
for (_i = 0, _len = idFields.length; _i < _len; _i++) {
idField = idFields[_i];
requestUrl.param(idField, body[idField]);
Resource[actionName] = function(body, queryParams, done) {
var requestUrl;
if (queryParams == null) {
queryParams = {};
}
return requestUrl.query(queryParams).toString();
})();
return actionRequest({
url: requestUrl,
body: body
}, function(err, response) {
return handleResponse(err, response, null, done);
});
};
return Resource.prototype[actionName] = function(queryParams, done) {
var requestUrl;
if (queryParams == null) {
queryParams = {};
}
done = arguments[arguments.length - 1];
requestUrl = (function(_this) {
return function() {
done = arguments[arguments.length - 1];
requestUrl = (function() {
var idField, _i, _len;

@@ -104,14 +85,38 @@ requestUrl = UrlAssembler().template(actionUrl);

idField = idFields[_i];
requestUrl.param(idField, _this[idField]);
requestUrl.param(idField, body[idField]);
}
return requestUrl.query(queryParams).toString();
};
})(this)();
return actionRequest({
url: requestUrl,
body: this
}, function(err, response) {
return handleResponse(err, response, this, done);
});
};
})();
return actionRequest[methodFn]({
url: requestUrl,
body: body
}, function(err, response) {
return handleResponse(err, response, null, done);
});
};
return Resource.prototype[actionName] = function(queryParams, done) {
var requestUrl;
if (queryParams == null) {
queryParams = {};
}
done = arguments[arguments.length - 1];
requestUrl = (function(_this) {
return function() {
var idField, _i, _len;
requestUrl = UrlAssembler().template(actionUrl);
for (_i = 0, _len = idFields.length; _i < _len; _i++) {
idField = idFields[_i];
requestUrl.param(idField, _this[idField]);
}
return requestUrl.query(queryParams).toString();
};
})(this)();
return actionRequest[methodFn]({
url: requestUrl,
body: this
}, function(err, response) {
return handleResponse(err, response, this, done);
});
};
})(options.method.toLowerCase());
}

@@ -118,0 +123,0 @@ };

{
"name": "resource-client",
"version": "1.3.1",
"version": "1.3.2",
"description": "Easily create api clients for your server side resources.",

@@ -27,4 +27,3 @@ "author": "Good Eggs <open-source@goodeggs.com>",

"lodash": "^3.0.0",
"url-assembler": "0.0.3",
"chai": "^2.1.0"
"url-assembler": "0.0.3"
},

@@ -34,2 +33,3 @@ "devDependencies": {

"mocha": "~1.x.x",
"chai": "^2.1.0",
"express": "^4.11.1",

@@ -36,0 +36,0 @@ "body-parser": "^1.10.2",

Sorry, the diff of this file is not supported yet

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