@endo/captp
Advanced tools
Comparing version 2.0.13 to 2.0.14
@@ -6,2 +6,11 @@ # Change Log | ||
### [2.0.14](https://github.com/endojs/endo/compare/@endo/captp@2.0.13...@endo/captp@2.0.14) (2022-09-14) | ||
### Bug Fixes | ||
* alt syntax for positive but faster assertions ([#1280](https://github.com/endojs/endo/issues/1280)) ([dc24f2f](https://github.com/endojs/endo/commit/dc24f2f2c3cac7ce239a64c503493c41a2334315)) | ||
### [2.0.13](https://github.com/endojs/endo/compare/@endo/captp@2.0.12...@endo/captp@2.0.13) (2022-08-26) | ||
@@ -8,0 +17,0 @@ |
{ | ||
"name": "@endo/captp", | ||
"version": "2.0.13", | ||
"version": "2.0.14", | ||
"description": "Capability Transfer Protocol for distributed objects", | ||
@@ -43,4 +43,4 @@ "type": "module", | ||
"devDependencies": { | ||
"@endo/init": "^0.5.47", | ||
"@endo/ses-ava": "^0.2.31", | ||
"@endo/init": "^0.5.48", | ||
"@endo/ses-ava": "^0.2.32", | ||
"ava": "^3.12.1", | ||
@@ -50,6 +50,6 @@ "c8": "^7.7.3" | ||
"dependencies": { | ||
"@endo/eventual-send": "^0.16.3", | ||
"@endo/marshal": "^0.7.3", | ||
"@endo/nat": "^4.1.18", | ||
"@endo/promise-kit": "^0.2.47" | ||
"@endo/eventual-send": "^0.16.4", | ||
"@endo/marshal": "^0.7.4", | ||
"@endo/nat": "^4.1.19", | ||
"@endo/promise-kit": "^0.2.48" | ||
}, | ||
@@ -77,3 +77,3 @@ "bugs": { | ||
}, | ||
"gitHead": "5935c16158f239ef9ad5a0c5443e02fed537cb6e" | ||
"gitHead": "44b17d92334592b2da54d91dba73f28db513412a" | ||
} |
@@ -26,6 +26,6 @@ // @ts-check | ||
const splitTransferBuffer = transferBuffer => { | ||
assert( | ||
transferBuffer.byteLength >= MIN_TRANSFER_BUFFER_LENGTH, | ||
X`Transfer buffer of ${transferBuffer.byteLength} bytes is smaller than MIN_TRANSFER_BUFFER_LENGTH ${MIN_TRANSFER_BUFFER_LENGTH}`, | ||
); | ||
transferBuffer.byteLength >= MIN_TRANSFER_BUFFER_LENGTH || | ||
assert.fail( | ||
X`Transfer buffer of ${transferBuffer.byteLength} bytes is smaller than MIN_TRANSFER_BUFFER_LENGTH ${MIN_TRANSFER_BUFFER_LENGTH}`, | ||
); | ||
const lenbuf = new BigUint64Array(transferBuffer, 0, 1); | ||
@@ -44,6 +44,6 @@ | ||
const databuf = new Uint8Array(transferBuffer, overheadLength); | ||
assert( | ||
databuf.byteLength >= MIN_DATA_BUFFER_LENGTH, | ||
X`Transfer buffer of size ${transferBuffer.byteLength} only supports ${databuf.byteLength} data bytes; need at least ${MIN_DATA_BUFFER_LENGTH}`, | ||
); | ||
databuf.byteLength >= MIN_DATA_BUFFER_LENGTH || | ||
assert.fail( | ||
X`Transfer buffer of size ${transferBuffer.byteLength} only supports ${databuf.byteLength} data bytes; need at least ${MIN_DATA_BUFFER_LENGTH}`, | ||
); | ||
return harden({ statusbuf, lenbuf, databuf }); | ||
@@ -50,0 +50,0 @@ }; |
@@ -67,6 +67,6 @@ // @ts-check | ||
// one case. | ||
assert( | ||
!(trapHost && trapGuest), | ||
X`CapTP ${ourId} can only be one of either trapGuest or trapHost`, | ||
); | ||
!(trapHost && trapGuest) || | ||
assert.fail( | ||
X`CapTP ${ourId} can only be one of either trapGuest or trapHost`, | ||
); | ||
@@ -395,6 +395,6 @@ const disconnectReason = id => | ||
if (trap) { | ||
assert( | ||
exportedTrapHandlers.has(val), | ||
X`Refused Trap(${val}) because target was not registered with makeTrapHandler`, | ||
); | ||
exportedTrapHandlers.has(val) || | ||
assert.fail( | ||
X`Refused Trap(${val}) because target was not registered with makeTrapHandler`, | ||
); | ||
assert.typeof( | ||
@@ -612,16 +612,14 @@ trapHost, | ||
const makeTrapImpl = implMethod => (target, ...implArgs) => { | ||
assert( | ||
Promise.resolve(target) !== target, | ||
X`Trap(${target}) target cannot be a promise`, | ||
); | ||
Promise.resolve(target) !== target || | ||
assert.fail(X`Trap(${target}) target cannot be a promise`); | ||
const slot = valToSlot.get(target); | ||
assert( | ||
slot && slot[1] === '-', | ||
X`Trap(${target}) target was not imported`, | ||
); | ||
assert( | ||
slot[0] === 't', | ||
X`Trap(${target}) imported target was not created with makeTrapHandler`, | ||
); | ||
(slot && slot[1] === '-') || | ||
assert.fail(X`Trap(${target}) target was not imported`); | ||
// @ts-expect-error TS apparently confused about `||` control flow | ||
// https://github.com/microsoft/TypeScript/issues/50739 | ||
slot[0] === 't' || | ||
assert.fail( | ||
X`Trap(${target}) imported target was not created with makeTrapHandler`, | ||
); | ||
@@ -659,2 +657,4 @@ // Send a "trap" message. | ||
trapMethod: implMethod, | ||
// @ts-expect-error TS apparently confused about `||` control flow | ||
// https://github.com/microsoft/TypeScript/issues/50739 | ||
slot, | ||
@@ -692,6 +692,6 @@ trapArgs: implArgs, | ||
const value = unserialize(serialized); | ||
assert( | ||
!isThenable(value), | ||
X`Trap(${target}) reply cannot be a Thenable; have ${value}`, | ||
); | ||
!isThenable(value) || | ||
assert.fail( | ||
X`Trap(${target}) reply cannot be a Thenable; have ${value}`, | ||
); | ||
@@ -698,0 +698,0 @@ if (isException) { |
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
80338
Updated@endo/eventual-send@^0.16.4
Updated@endo/marshal@^0.7.4
Updated@endo/nat@^4.1.19
Updated@endo/promise-kit@^0.2.48