Socket
Socket
Sign inDemoInstall

metacom

Package Overview
Dependencies
Maintainers
1
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

metacom - npm Package Compare versions

Comparing version 1.8.0 to 1.8.1

9

CHANGELOG.md

@@ -5,2 +5,8 @@ # Changelog

## [1.8.1][] - 2021-07-10
- Move split and parseParams to metautil
- Fix custom errors over http transport
- Remove timeout in Server duplicated in rpc call (Procedure class)
## [1.8.0][] - 2021-07-07

@@ -120,3 +126,4 @@

[unreleased]: https://github.com/metarhia/metacom/compare/v1.8.0...HEAD
[unreleased]: https://github.com/metarhia/metacom/compare/v1.8.1...HEAD
[1.8.1]: https://github.com/metarhia/metacom/compare/v1.8.0...v1.8.1
[1.8.0]: https://github.com/metarhia/metacom/compare/v1.7.5...v1.8.0

@@ -123,0 +130,0 @@ [1.7.5]: https://github.com/metarhia/metacom/compare/v1.7.4...v1.7.5

3

lib/channel.js

@@ -170,3 +170,4 @@ 'use strict';

if (res.writableEnded) return;
res.writeHead(code, { 'Content-Type': MIME_TYPES.json, ...HEADERS });
const httpCode = status ? code : 500;
res.writeHead(httpCode, { 'Content-Type': MIME_TYPES.json, ...HEADERS });
res.end(JSON.stringify({ error }));

@@ -173,0 +174,0 @@ }

@@ -23,10 +23,2 @@ 'use strict';

const split = (s, separator) => {
const i = s.indexOf(separator);
if (i < 0) return [s, ''];
return [s.slice(0, i), s.slice(i + separator.length)];
};
const parseParams = (params) => Object.fromEntries(new URLSearchParams(params));
class Server {

@@ -93,14 +85,5 @@ constructor(config, application) {

const timer = setTimeout(() => {
if (finished) return;
finished = true;
channels.delete(client);
channel.error(504);
channel.destroy();
}, this.config.timeouts.request);
res.on('close', () => {
if (finished) return;
finished = true;
clearTimeout(timer);
channels.delete(client);

@@ -140,5 +123,5 @@ channel.destroy();

const pathname = req.url.slice('/api/'.length);
const [path, params] = split(pathname, '?');
const args = data ? JSON.parse(data) : parseParams(params);
const [interfaceName, methodName] = split(path, '/');
const [path, params] = metautil.split(pathname, '?');
const args = data ? JSON.parse(data) : metautil.parseParams(params);
const [interfaceName, methodName] = metautil.split(path, '/');
const hook = this.application.getHook(interfaceName);

@@ -145,0 +128,0 @@ if (hook) channel.hook(hook.router, interfaceName, methodName, args);

{
"name": "metacom",
"version": "1.8.0",
"version": "1.8.1",
"author": "Timur Shemsedinov <timur.shemsedinov@gmail.com>",

@@ -56,7 +56,7 @@ "description": "Communication protocol for Metarhia stack with rpc, events, binary streams, memory and db access",

"dependencies": {
"metautil": "^3.5.4",
"ws": "^7.5.2"
"metautil": "^3.5.5",
"ws": "^7.5.3"
},
"devDependencies": {
"@types/node": "^16.0.1",
"@types/node": "^16.3.1",
"@types/ws": "^7.4.6",

@@ -63,0 +63,0 @@ "eslint": "^7.30.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