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

moleculer-web

Package Overview
Dependencies
Maintainers
3
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

moleculer-web - npm Package Compare versions

Comparing version 0.10.0 to 0.10.1

12

CHANGELOG.md

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

<a name="0.10.1"></a>
# 0.10.1 (2021-09-01)
## Changes
- set the default JSON bodyparser if `bodyParser: true`. [#258](https://github.com/moleculerjs/moleculer-web/issues/258)
- add `pathToRegexpOptions` to route options to make available to pass options to `path-to-regexp` library. [#268](https://github.com/moleculerjs/moleculer-web/issues/268)
- add `debounceTime` to route options to make available to change the debounce time at service changes. [#260](https://github.com/moleculerjs/moleculer-web/issues/260)
- new `errorHandler` method to allow developers to change the default error handling behaviour. [#266](https://github.com/moleculerjs/moleculer-web/issues/266)
- fixes CORS preflight request handling in case of full-path aliases. [#269](https://github.com/moleculerjs/moleculer-web/issues/269)
- update dependencies
-----------------------------
<a name="0.10.0"></a>

@@ -2,0 +14,0 @@ # 0.10.0 (2021-06-27)

28

package.json
{
"name": "moleculer-web",
"version": "0.10.0",
"version": "0.10.1",
"description": "Official API Gateway service for Moleculer framework",

@@ -37,5 +37,5 @@ "main": "index.js",

"compression": "^1.7.4",
"coveralls": "^3.1.0",
"coveralls": "^3.1.1",
"cross-env": "^7.0.3",
"eslint": "^7.29.0",
"eslint": "^7.32.0",
"eslint-plugin-node": "^11.1.0",

@@ -45,18 +45,18 @@ "eslint-plugin-promise": "^5.1.0",

"express": "^4.17.1",
"fakerator": "^0.3.3",
"jest": "^27.0.5",
"jest-cli": "^27.0.5",
"fakerator": "^0.3.4",
"jest": "^27.1.0",
"jest-cli": "^27.1.0",
"jsonwebtoken": "^8.5.1",
"lolex": "^5.1.2",
"mime-types": "^2.1.31",
"mime-types": "^2.1.32",
"mkdirp": "^1.0.4",
"moleculer": "^0.14.14",
"moleculer-repl": "^0.6.5",
"nats": "^2.0.8",
"nodemon": "^2.0.7",
"moleculer": "^0.14.16",
"moleculer-repl": "^0.6.6",
"nats": "^2.2.0",
"nodemon": "^2.0.12",
"npm-check": "^5.9.2",
"socket.io": "^4.1.2",
"socket.io": "^4.2.0",
"spdy": "^4.0.2",
"supertest": "^6.1.3",
"webpack": "^5.40.0",
"supertest": "^6.1.6",
"webpack": "^5.51.1",
"webpack-dev-middleware": "^5.0.0"

@@ -63,0 +63,0 @@ },

@@ -84,3 +84,3 @@ /*

this.keys = [];
this.re = pathToRegexp(this.fullPath, this.keys, {}); // Options: https://github.com/pillarjs/path-to-regexp#usage
this.re = pathToRegexp(this.fullPath, this.keys, route.opts.pathToRegexpOptions || {}); // Options: https://github.com/pillarjs/path-to-regexp#usage

@@ -87,0 +87,0 @@ if (this.type == "multipart") {

@@ -97,3 +97,6 @@ /*

// CallOption for the root action `api.rest`
rootCallOptions: null
rootCallOptions: null,
// Debounce wait time before call to regenerate aliases when received event "$services.changed"
debounceTime: 500
},

@@ -161,4 +164,9 @@

let method = req.method;
if (method == "OPTIONS") {
method = req.headers["access-control-request-method"];
}
// Check aliases
const found = this.resolveAlias(url, req.method);
const found = this.resolveAlias(url, method);
if (found) {

@@ -295,2 +303,17 @@ const route = found.alias.route;

/**
* Default error handling behaviour
*
* @param {HttpRequest} req
* @param {HttpResponse} res
* @param {Error} err
*/
errorHandler(req, res, err) {
// don't log client side errors unless it's configured
if (this.settings.log4XXResponses || (err && !_.inRange(err.code, 400, 500))) {
this.logger.error(" Request error!", err.name, ":", err.message, "\n", err.stack, "\nData:", err.data);
}
this.sendError(req, res, err);
},
/**
* HTTP request handler. It is called from native NodeJS HTTP server.

@@ -343,7 +366,3 @@ *

} catch (err) {
// don't log client side errors only it's configured
if (this.settings.log4XXResponses || (err && !_.inRange(err.code, 400, 500))) {
this.logger.error(" Request error!", err.name, ":", err.message, "\n", err.stack, "\nData:", err.data);
}
this.sendError(req, res, err);
this.errorHandler(req, res, err);
}

@@ -1209,3 +1228,3 @@ },

// Create body parsers as middlewares
if (opts.bodyParsers == null) {
if (opts.bodyParsers == null || opts.bodyParsers === true) {
// Set default JSON body-parser

@@ -1588,6 +1607,7 @@ opts.bodyParsers = {

// Regenerate all auto aliases routes
const debounceTime = this.settings.debounceTime > 0 ? parseInt(this.settings.debounceTime) : 500;
this.regenerateAllAutoAliases = _.debounce(() => {
/* istanbul ignore next */
this.routes.forEach(route => route.opts.autoAliases && this.regenerateAutoAliases(route));
}, 500);
}, debounceTime);
},

@@ -1594,0 +1614,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