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 3.0.0 to 3.0.1

5

dist/events.js

@@ -57,6 +57,3 @@ class EventEmitter {

clear(name) {
if (!name) {
this.events.clear();
return;
}
if (!name) return void this.events.clear();
this.events.delete(name);

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

3

dist/metacom.js

@@ -105,4 +105,3 @@ import EventEmitter from './events.js';

if (packet.error) {
reject(new MetacomError(packet.error));
return;
return void reject(new MetacomError(packet.error));
}

@@ -109,0 +108,0 @@ resolve(packet.result);

@@ -26,2 +26,5 @@ 'use strict';

}
post(...args) {
super.emit(...args);
}
}

@@ -93,3 +96,9 @@

}
const { type, id, method } = packet;
const { type, id, name } = packet;
if (type === 'event') {
const [unit, eventName] = name.split('/');
const metacomUnit = this.api[unit];
if (metacomUnit) metacomUnit.post(eventName, packet.data);
return;
}
if (id) {

@@ -103,10 +112,5 @@ if (type === 'callback') {

if (packet.error) {
reject(new MetacomError(packet.error));
return;
return void reject(new MetacomError(packet.error));
}
resolve(packet.result);
} else if (type === 'event') {
const [unit, name] = method.split('/');
const metacomUnit = this.api[unit];
if (metacomUnit) metacomUnit.emit(name, packet.data);
} else if (type === 'stream') {

@@ -113,0 +117,0 @@ const { name, size, status } = packet;

@@ -59,6 +59,3 @@ 'use strict';

clear(name) {
if (!name) {
this.events.clear();
return;
}
if (!name) return void this.events.clear();
this.events.delete(name);

@@ -65,0 +62,0 @@ }

@@ -81,6 +81,3 @@ 'use strict';

emit(name, data) {
if (name === 'close') {
super.emit(name, data);
return;
}
if (name === 'close') return void super.emit(name, data);
this.#transport.sendEvent(name, data);

@@ -192,4 +189,3 @@ }

if (!req.url.startsWith('/api')) {
application.static.serve(req.url, transport);
return;
return void application.static.serve(req.url, transport);
}

@@ -235,4 +231,3 @@ if (balancer) this.balancing(transport);

if (Buffer.compare(EMPTY_PACKET, data) === 0) {
client.send('{}');
return;
return void client.send('{}');
}

@@ -256,10 +251,6 @@ const packet = metautil.jsonParse(data) || {};

const proc = this.application.getMethod(unit, ver, methodName);
if (!proc) {
client.error(404, { id });
return;
}
if (!proc) return void client.error(404, { id });
const context = client.createContext();
if (!client.session && proc.access !== 'public') {
client.error(403, { id });
return;
return void client.error(403, { id });
}

@@ -269,4 +260,3 @@ try {

} catch {
client.error(503, { id });
return;
return void client.error(503, { id });
}

@@ -280,4 +270,3 @@ let result = null;

}
client.error(error.code, { id, error });
return;
return void client.error(error.code, { id, error });
} finally {

@@ -288,4 +277,3 @@ proc.leave();

const { code, httpCode = 200 } = result;
client.error(code, { id, error: result, httpCode });
return;
return void client.error(code, { id, error: result, httpCode });
}

@@ -305,4 +293,3 @@ client.send({ type: 'callback', id, result });

if (status === 'terminate') await stream.terminate();
client.streams.delete(id);
return;
return void client.streams.delete(id);
}

@@ -356,6 +343,3 @@ const valid = typeof name === 'string' && Number.isSafeInteger(size);

const { id, method, args } = packet;
if (!proc) {
client.error(404, { id });
return;
}
if (!proc) return void client.error(404, { id });
const context = client.createContext();

@@ -362,0 +346,0 @@ try {

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

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

"dependencies": {
"metautil": "^3.10.0",
"metautil": "^3.11.0",
"ws": "^8.13.0"
},
"devDependencies": {
"@types/node": "^20.3.2",
"@types/node": "^20.4.3",
"@types/ws": "^8.5.5",
"eslint": "^8.43.0",
"eslint-config-metarhia": "^8.1.0",
"eslint": "^8.45.0",
"eslint-config-metarhia": "^8.2.1",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-prettier": "^5.0.0",
"metatests": "^0.8.2",
"prettier": "^2.8.8",
"prettier": "^3.0.0",
"typescript": "^5.1.6"
}
}
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