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

mappersmith

Package Overview
Dependencies
Maintainers
3
Versions
121
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mappersmith - npm Package Compare versions

Comparing version 2.0.0-rc7 to 2.0.0

10

client-builder.js

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

this.manifest.eachResource(function (name, methods) {
client[name] = _this.buildResource(methods);
client[name] = _this.buildResource(name, methods);
});

@@ -56,3 +56,3 @@

},
buildResource: function buildResource(methods) {
buildResource: function buildResource(resourceName, methods) {
var _this2 = this;

@@ -63,8 +63,8 @@

var request = new _request2.default(method.descriptor, requestParams);
return _this2.invokeMiddlewares(request);
return _this2.invokeMiddlewares(resourceName, method.name, request);
}));
}, {});
},
invokeMiddlewares: function invokeMiddlewares(initialRequest) {
var middlewares = this.manifest.createMiddlewares();
invokeMiddlewares: function invokeMiddlewares(resourceName, resourceMethod, initialRequest) {
var middlewares = this.manifest.createMiddlewares(resourceName, resourceMethod);
var finalRequest = middlewares.reduce(function (request, middleware) {

@@ -71,0 +71,0 @@ return middleware.request(request);

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

},
createMiddlewares: function createMiddlewares() {
createMiddlewares: function createMiddlewares(resourceName, resourceMethod) {
var createInstance = function createInstance(middlewareFactory) {

@@ -67,3 +67,3 @@ return (0, _utils.assign)({

}
}, middlewareFactory());
}, middlewareFactory({ resourceName: resourceName, resourceMethod: resourceMethod }));
};

@@ -70,0 +70,0 @@

{
"name": "mappersmith",
"version": "2.0.0-rc7",
"version": "2.0.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>",

@@ -287,2 +287,14 @@ [![npm version](https://badge.fury.io/js/mappersmith.svg)](http://badge.fury.io/js/mappersmith)

It can, optionally, receive the `resourceName` and `resourceMethod`, example:
```javascript
const MyMiddleware = ({ resourceName, resourceMethod }) => ({
/* ... */
})
client.User.all()
// resourceName: 'User'
// resourceMethod: 'all'
```
### Built-in middlewares

@@ -289,0 +301,0 @@

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