@syncot/connection
Advanced tools
Comparing version 0.0.14 to 0.0.15
@@ -1,4 +0,2 @@ | ||
import { createDisconnectedError, createDuplicateIdError, createInvalidEntityError, createInvalidStreamError, createNoServiceError, } from '@syncot/error'; | ||
import { isOpenDuplexStream, isStream, SyncOtEmitter, validate, } from '@syncot/util'; | ||
import { strict as assert } from 'assert'; | ||
import { assert, createDisconnectedError, createDuplicateIdError, createInvalidEntityError, createInvalidStreamError, createNoServiceError, isOpenDuplexStream, isStream, SyncOtEmitter, validate, } from '@syncot/util'; | ||
import { Duplex } from 'readable-stream'; | ||
@@ -110,4 +108,4 @@ /** | ||
this.assertNotDestroyed(); | ||
assert.ok(isOpenDuplexStream(stream), 'Argument "stream" must be an open Duplex.'); | ||
assert.ok(!this.stream, 'Connection is already associated with a stream.'); | ||
assert(isOpenDuplexStream(stream), 'Argument "stream" must be an open Duplex.'); | ||
assert(!this.stream, 'Connection is already associated with a stream.'); | ||
this.stream = stream; | ||
@@ -172,7 +170,7 @@ this._connectionId++; | ||
this.assertNotDestroyed(); | ||
assert.ok(instance != null && typeof instance === 'object', 'Argument "instance" must be an object.'); | ||
assert.ok(!this.services.has(serviceName), `Service "${serviceName}" has been already registered.`); | ||
assert.equal(eventNames.size, 0, 'Connection events not implemented'); | ||
assert(instance != null && typeof instance === 'object', 'Argument "instance" must be an object.'); | ||
assert(!this.services.has(serviceName), `Service "${serviceName}" has been already registered.`); | ||
assert(eventNames.size === 0, 'Connection events not implemented'); | ||
requestNames.forEach(requestName => { | ||
assert.equal(typeof instance[requestName], 'function', `Service.${requestName} must be a function.`); | ||
assert(typeof instance[requestName] === 'function', `Service.${requestName} must be a function.`); | ||
}); | ||
@@ -196,4 +194,4 @@ this.services.set(serviceName, { | ||
this.assertNotDestroyed(); | ||
assert.ok(!this.proxies.has(proxyName), `Proxy "${proxyName}" has been already registered.`); | ||
assert.equal(eventNames.size, 0, 'Connection events not implemented'); | ||
assert(!this.proxies.has(proxyName), `Proxy "${proxyName}" has been already registered.`); | ||
assert(eventNames.size === 0, 'Connection events not implemented'); | ||
const instance = {}; | ||
@@ -204,3 +202,3 @@ let nextRequestId = 1; | ||
requestNames.forEach(requestName => { | ||
assert.ok(!(requestName in instance), `Proxy.${requestName} already exists.`); | ||
assert(!(requestName in instance), `Proxy.${requestName} already exists.`); | ||
instance[requestName] = (...args) => { | ||
@@ -207,0 +205,0 @@ if (this.stream) { |
@@ -1,2 +0,2 @@ | ||
import { createCompositeError } from '@syncot/error'; | ||
import { createCompositeError } from '@syncot/util'; | ||
/** | ||
@@ -3,0 +3,0 @@ * Tries the specified stream `factories` in order until one succeeds, |
@@ -1,3 +0,2 @@ | ||
import { randomInteger, SyncOtEmitter } from '@syncot/util'; | ||
import { strict as assert } from 'assert'; | ||
import { assert, randomInteger, SyncOtEmitter, } from '@syncot/util'; | ||
/** | ||
@@ -29,8 +28,8 @@ * Creates a new `StreamManager`. | ||
}; | ||
assert.ok(this.connection && !this.connection.destroyed, 'Argument "connection" must be a non-destroyed connection.'); | ||
assert.ok(typeof this.createStream === 'function', 'Argument "createStream" must be a function.'); | ||
assert.ok(Number.isSafeInteger(this.minDelay) && this.minDelay >= 1, 'Argument "minDelay" must be a safe integer >= 1.'); | ||
assert.ok(Number.isSafeInteger(this.maxDelay) && | ||
assert(this.connection && !this.connection.destroyed, 'Argument "connection" must be a non-destroyed connection.'); | ||
assert(typeof this.createStream === 'function', 'Argument "createStream" must be a function.'); | ||
assert(Number.isSafeInteger(this.minDelay) && this.minDelay >= 1, 'Argument "minDelay" must be a safe integer >= 1.'); | ||
assert(Number.isSafeInteger(this.maxDelay) && | ||
this.maxDelay >= this.minDelay, 'Argument "maxDelay" must be a safe integer >= minDelay.'); | ||
assert.ok(Number.isFinite(this.delayFactor) && | ||
assert(Number.isFinite(this.delayFactor) && | ||
(this.delayFactor >= 1 || this.delayFactor === 0), 'Argument "delayFactor" must be a finite number >= 1 or == 0.'); | ||
@@ -37,0 +36,0 @@ this.connection.on('connect', this.onConnect); |
{ | ||
"name": "@syncot/connection", | ||
"version": "0.0.14", | ||
"version": "0.0.15", | ||
"description": "An RPC library for communication over Duplex object streams.", | ||
@@ -30,4 +30,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@syncot/error": "^0.0.6", | ||
"@syncot/util": "^0.0.9", | ||
"@syncot/util": "^0.0.10", | ||
"@types/node": "^12.0.4", | ||
@@ -38,3 +37,3 @@ "@types/readable-stream": "^2.3.1", | ||
}, | ||
"gitHead": "59f7016cbffea18fc14049e00fd4351c08748887" | ||
"gitHead": "5c7ad0bf43495567d9fc857718802b7ea52d37bb" | ||
} |
5
37793
934
+ Added@syncot/util@0.0.10(transitive)
- Removed@syncot/error@^0.0.6
- Removed@syncot/error@0.0.6(transitive)
- Removed@syncot/util@0.0.9(transitive)
Updated@syncot/util@^0.0.10