@agoric/captp
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -14,5 +14,5 @@ // This logic was mostly lifted from @agoric/swingset-vat liveSlots.js | ||
// eslint-disable-next-line no-use-before-define | ||
serializeSlot, | ||
convertValToSlot, | ||
// eslint-disable-next-line no-use-before-define | ||
unserializeSlot, | ||
convertSlotToVal, | ||
); | ||
@@ -30,45 +30,33 @@ | ||
function serializeSlot(val, slots, slotMap) { | ||
if (!slotMap.has(val)) { | ||
function convertValToSlot(val) { | ||
if (!valToSlot.has(val)) { | ||
let slot; | ||
if (!valToSlot.has(val)) { | ||
// new export | ||
if (HandledPromise.resolve(val) === val) { | ||
lastPromiseID += 1; | ||
const promiseID = lastPromiseID; | ||
slot = `p+${promiseID}`; | ||
val.then( | ||
res => | ||
send({ | ||
type: 'CTP_RESOLVE', | ||
promiseID, | ||
res: serialize(harden(res)), | ||
}), | ||
rej => | ||
send({ | ||
type: 'CTP_RESOLVE', | ||
promiseID, | ||
rej: serialize(harden(rej)), | ||
}), | ||
); | ||
} else { | ||
lastExportID += 1; | ||
const exportID = lastExportID; | ||
slot = `o+${exportID}`; | ||
} | ||
valToSlot.set(val, slot); | ||
slotToVal.set(slot, val); | ||
// new export | ||
if (HandledPromise.resolve(val) === val) { | ||
lastPromiseID += 1; | ||
const promiseID = lastPromiseID; | ||
slot = `p+${promiseID}`; | ||
val.then( | ||
res => | ||
send({ | ||
type: 'CTP_RESOLVE', | ||
promiseID, | ||
res: serialize(harden(res)), | ||
}), | ||
rej => | ||
send({ | ||
type: 'CTP_RESOLVE', | ||
promiseID, | ||
rej: serialize(harden(rej)), | ||
}), | ||
); | ||
} else { | ||
lastExportID += 1; | ||
const exportID = lastExportID; | ||
slot = `o+${exportID}`; | ||
} | ||
slot = valToSlot.get(val); | ||
const slotIndex = slots.length; | ||
slots.push(slot); | ||
slotMap.set(val, slotIndex); | ||
valToSlot.set(val, slot); | ||
slotToVal.set(slot, val); | ||
} | ||
const slotIndex = slotMap.get(val); | ||
return harden({ | ||
[QCLASS]: 'slot', | ||
index: slotIndex, | ||
}); | ||
return valToSlot.get(val); | ||
} | ||
@@ -119,4 +107,3 @@ | ||
function unserializeSlot(data, slots) { | ||
const theirSlot = slots[Nat(data.index)]; | ||
function convertSlotToVal(theirSlot) { | ||
let val; | ||
@@ -123,0 +110,0 @@ const otherDir = theirSlot[1] === '+' ? '-' : '+'; |
{ | ||
"name": "@agoric/captp", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "Capability Transfer Protocol for distributed objects", | ||
@@ -11,6 +11,6 @@ "keywords": [ | ||
"author": "Michael FIG <michael@fig.org>", | ||
"homepage": "https://github.com/Agoric/CapTP#readme", | ||
"homepage": "https://github.com/Agoric/agoric-sdk#readme", | ||
"license": "Apache-2.0", | ||
"main": "dist/captp.cjs.js", | ||
"module": "dist/captp.esm.js", | ||
"module": "lib/captp.js", | ||
"browser": "dist/captp.umd.js", | ||
@@ -27,3 +27,3 @@ "directories": { | ||
"type": "git", | ||
"url": "git+https://github.com/Agoric/CapTP.git" | ||
"url": "git+https://github.com/Agoric/agoric-sdk.git" | ||
}, | ||
@@ -33,6 +33,6 @@ "scripts": { | ||
"test": "tape -r esm 'test/**/*.js'", | ||
"lint-fix": "eslint --fix '**/*.{js,jsx}'", | ||
"lint-check": "eslint '**/*.{js,jsx}'", | ||
"lint-fix-jessie": "eslint -c '.eslintrc-jessie.js' --fix '**/*.{js,jsx}'", | ||
"lint-check-jessie": "eslint -c '.eslintrc-jessie.js' '**/*.{js,jsx}'" | ||
"lint-fix": "eslint --fix '**/*.js'", | ||
"lint-check": "eslint '**/*.js'", | ||
"lint-fix-jessie": "eslint -c '.eslintrc-jessie.js' --fix '**/*.js'", | ||
"lint-check-jessie": "eslint -c '.eslintrc-jessie.js' '**/*.js'" | ||
}, | ||
@@ -45,5 +45,5 @@ "devDependencies": { | ||
"dependencies": { | ||
"@agoric/eventual-send": "^0.5.0", | ||
"@agoric/eventual-send": "^0.6.0", | ||
"@agoric/harden": "^0.0.4", | ||
"@agoric/marshal": "^0.1.1", | ||
"@agoric/marshal": "^0.1.3", | ||
"@agoric/nat": "^2.0.1", | ||
@@ -56,4 +56,8 @@ "esm": "^3.2.5", | ||
"bugs": { | ||
"url": "https://github.com/Agoric/CapTP/issues" | ||
} | ||
"url": "https://github.com/Agoric/agoric-sdk/issues" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"gitHead": "fab9b8247f684b3a849c09611e0e9d16fffbea3a" | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
275747
8
7739
0
+ Added@agoric/eventual-send@0.6.0(transitive)
- Removed@agoric/eventual-send@0.5.1(transitive)
Updated@agoric/eventual-send@^0.6.0
Updated@agoric/marshal@^0.1.3