Comparing version 3.0.0-alpha.13 to 3.0.0
@@ -135,8 +135,8 @@ import EventEmitter from './events.js'; | ||
class MetaWritable extends EventEmitter { | ||
constructor(id, name, size, transport) { | ||
constructor(transport, options = {}) { | ||
super(); | ||
this.id = id; | ||
this.name = name; | ||
this.size = size; | ||
this.transport = transport; | ||
this.id = options.id; | ||
this.name = options.name; | ||
this.size = options.size; | ||
this.init(); | ||
@@ -143,0 +143,0 @@ } |
@@ -63,3 +63,3 @@ 'use strict'; | ||
const id = ++this.streamId; | ||
return new MetaWritable(id, name, size, this); | ||
return new MetaWritable(this, { id, name, size }); | ||
} | ||
@@ -66,0 +66,0 @@ |
@@ -113,3 +113,3 @@ 'use strict'; | ||
const packet = { id, name, size }; | ||
const stream = new MetaWritable(this.#transport.connection, packet); | ||
const stream = new MetaWritable(this.#transport, packet); | ||
this.streams.set(id, stream); | ||
@@ -281,3 +281,3 @@ return stream; | ||
} | ||
if (result?.constructor?.name === 'Error') { | ||
if (metautil.isError(result)) { | ||
const { code, httpCode = 200 } = result; | ||
@@ -284,0 +284,0 @@ client.error(code, { id, error: result, httpCode }); |
@@ -134,8 +134,8 @@ 'use strict'; | ||
class MetaWritable extends EventEmitter { | ||
constructor(id, name, size, transport) { | ||
constructor(transport, options = {}) { | ||
super(); | ||
this.id = id; | ||
this.name = name; | ||
this.size = size; | ||
this.transport = transport; | ||
this.id = options.id; | ||
this.name = options.name; | ||
this.size = options.size; | ||
this.init(); | ||
@@ -147,3 +147,3 @@ } | ||
const packet = { type: 'stream', id, name, size }; | ||
this.transport.send(JSON.stringify(packet)); | ||
this.transport.send(packet); | ||
} | ||
@@ -153,3 +153,3 @@ | ||
const chunk = chunkEncode(this.id, data); | ||
this.transport.send(chunk); | ||
this.transport.write(chunk); | ||
return true; | ||
@@ -160,3 +160,3 @@ } | ||
const packet = { type: 'stream', id: this.id, status: 'end' }; | ||
this.transport.send(JSON.stringify(packet)); | ||
this.transport.send(packet); | ||
} | ||
@@ -166,3 +166,3 @@ | ||
const packet = { type: 'stream', id: this.id, status: 'terminate' }; | ||
this.transport.send(JSON.stringify(packet)); | ||
this.transport.send(packet); | ||
} | ||
@@ -169,0 +169,0 @@ } |
{ | ||
"name": "metacom", | ||
"version": "3.0.0-alpha.13", | ||
"version": "3.0.0", | ||
"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.9.0", | ||
"metautil": "^3.10.0", | ||
"ws": "^8.13.0" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^20.3.1", | ||
"@types/node": "^20.3.2", | ||
"@types/ws": "^8.5.5", | ||
"eslint": "^8.42.0", | ||
"eslint": "^8.43.0", | ||
"eslint-config-metarhia": "^8.1.0", | ||
"eslint-config-prettier": "^8.8.0", | ||
"eslint-plugin-import": "^2.27.5", | ||
"eslint-plugin-import": "^2.26.0", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"metatests": "^0.8.2", | ||
"prettier": "^2.8.8", | ||
"typescript": "^5.1.3" | ||
"typescript": "^5.1.6" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
0
54851
Updatedmetautil@^3.10.0