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 2.0.6 to 2.0.7

10

CHANGELOG.md

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

## [2.0.7][] - 2022-05-09
- Fix client to support falsy results parsing
- Add reading cors.origin from server config in impress
- Removed duplicated error handling
- Remove duplicated EventEmitter in MetacomInterface
## [2.0.6][] - 2022-04-26

@@ -182,3 +189,4 @@

[unreleased]: https://github.com/metarhia/metacom/compare/v2.0.6...HEAD
[unreleased]: https://github.com/metarhia/metacom/compare/v2.0.7...HEAD
[2.0.7]: https://github.com/metarhia/metacom/compare/v2.0.6...v2.0.7
[2.0.6]: https://github.com/metarhia/metacom/compare/v2.0.5...v2.0.6

@@ -185,0 +193,0 @@ [2.0.5]: https://github.com/metarhia/metacom/compare/v2.0.4...v2.0.5

33

dist/metacom.js

@@ -22,18 +22,6 @@ import { EventEmitter } from './events.js';

class MetacomInterface {
class MetacomInterface extends EventEmitter {
constructor() {
this._events = new Map();
super();
}
on(name, fn) {
const event = this._events.get(name);
if (event) event.add(fn);
else this._events.set(name, new Set([fn]));
}
emit(name, ...args) {
const event = this._events.get(name);
if (!event) return;
for (const fn of event.values()) fn(...args);
}
}

@@ -78,3 +66,3 @@

const args = packet[target];
if (callId && args) {
if (callId) {
if (callType === 'callback') {

@@ -238,12 +226,7 @@ const promised = this.calls.get(callId);

body: data,
}).then((res) => {
const { status } = res;
if (status === 200) {
return res.text().then((packet) => {
if (packet.error) throw new MetacomError(packet.error);
this.message(packet);
});
}
throw new Error(`Status Code: ${status}`);
});
}).then((res) =>
res.text().then((packet) => {
this.message(packet);
})
);
}

@@ -250,0 +233,0 @@ }

@@ -162,2 +162,7 @@ 'use strict';

module.exports = { createChannel };
const addHeaders = (headers) => {
const { origin } = headers;
if (origin) HEADERS['Access-Control-Allow-Origin'] = origin;
};
module.exports = { createChannel, addHeaders };

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

this.application = application;
const { host, balancer, protocol, ports, queue } = config;
const { host, balancer, protocol, ports, queue, cors } = config;
if (cors) transport.http.addHeaders(cors);
const concurrency = queue.concurrency || config.concurrency;

@@ -23,0 +24,0 @@ this.semaphore = new Semaphore(concurrency, queue.size, queue.timeout);

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

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

"dependencies": {
"metautil": "^3.5.19",
"ws": "^8.5.0"
"metautil": "^3.5.20",
"ws": "^8.6.0"
},
"devDependencies": {
"@types/node": "^17.0.28",
"@types/node": "^17.0.31",
"@types/ws": "^8.5.3",
"eslint": "^8.14.0",
"eslint": "^8.15.0",
"eslint-config-metarhia": "^7.0.1",

@@ -70,4 +70,4 @@ "eslint-config-prettier": "^8.5.0",

"prettier": "^2.6.2",
"typescript": "^4.6.3"
"typescript": "^4.6.4"
}
}
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