@endo/marshal
Advanced tools
Comparing version 0.5.1 to 0.5.2
@@ -6,2 +6,14 @@ # Change Log | ||
### [0.5.2](https://github.com/endojs/endo/compare/@endo/marshal@0.5.1...@endo/marshal@0.5.2) (2022-01-25) | ||
### Bug Fixes | ||
* **marshal:** error serialization uses name from prototype ([#1010](https://github.com/endojs/endo/issues/1010)) ([aff3ff7](https://github.com/endojs/endo/commit/aff3ff71144df359e12949b0c2d8a1a5f491810a)) | ||
* assert that unserialize makes only passables ([#996](https://github.com/endojs/endo/issues/996)) ([b34817b](https://github.com/endojs/endo/commit/b34817b9910fd0c9092dc9c1d11a14709ff11542)) | ||
* only shallow freeze needed ([#994](https://github.com/endojs/endo/issues/994)) ([edeaf8a](https://github.com/endojs/endo/commit/edeaf8a111ad4dc625484555d317c38f38ae7641)) | ||
* remove more extraneous spaced-comment comments ([#1009](https://github.com/endojs/endo/issues/1009)) ([980a798](https://github.com/endojs/endo/commit/980a79898a4643a359d905c308eecf70d8ab2758)) | ||
### 0.5.1 (2022-01-23) | ||
@@ -8,0 +20,0 @@ |
30
NEWS.md
@@ -1,7 +0,15 @@ | ||
User-visible changes in marshal: | ||
User-visible changes in `@endo/marshal`: | ||
## Release 0.1.2 (17-Dec-2019) | ||
# v0.5.1 (2021-01-22) | ||
* depend on @agoric/eventual-send (#6) | ||
Moved from https://github.com/Agoric/agoric-sdk to | ||
https://github.com/endojs/endo, still in a `packages/marshal` directory. | ||
--- | ||
# v0.1.2 (2019-12-17) | ||
- depend on @agoric/eventual-send (#6) | ||
Moved from https://github.com/Agoric/marshal into the `packages/marshal/` | ||
@@ -11,3 +19,3 @@ directory in the monorepo at https://github.com/Agoric/agoric-sdk . | ||
## Release 0.1.1 (02-Oct-2019) | ||
# v0.1.1 (2019-10-02) | ||
@@ -17,3 +25,3 @@ Remove unneeded SES dependency. | ||
## Release 0.1.0 (11-Sep-2019) | ||
# v0.1.0 (2019-19-11) | ||
@@ -23,12 +31,12 @@ Breaking API change: applications must change how they use m.serialize() | ||
* change API to use 'CapData' format: `{body, slots}` (#8) | ||
* `m.serialize()` now returns `{body, slots}` instead of `{argsString, slots}` | ||
* `m.unserialize()` now takes `(capdata, cyclePolicy)` instead of | ||
- change API to use 'CapData' format: `{body, slots}` | ||
- `m.serialize()` now returns `{body, slots}` instead of `{argsString, slots}` | ||
- `m.unserialize()` now takes `(capdata, cyclePolicy)` instead of | ||
`(body, slots, cyclePolicy)`. The `cyclePolicy` argument remains optional. | ||
* the return value of `m.serialize()` is now hardened (#11) | ||
* improve error messages (#3) | ||
- the return value of `m.serialize()` is now hardened | ||
- improve error messages | ||
## Release 0.0.1 (06-Jun-2019) | ||
# v0.0.1 (2019-06-06) | ||
First release. |
{ | ||
"name": "@endo/marshal", | ||
"version": "0.5.1", | ||
"version": "0.5.2", | ||
"description": "marshal", | ||
@@ -37,9 +37,9 @@ "type": "module", | ||
"dependencies": { | ||
"@endo/eventual-send": "^0.14.1", | ||
"@endo/nat": "^4.1.1", | ||
"@endo/promise-kit": "^0.2.30" | ||
"@endo/eventual-send": "^0.14.2", | ||
"@endo/nat": "^4.1.2", | ||
"@endo/promise-kit": "^0.2.31" | ||
}, | ||
"devDependencies": { | ||
"@endo/lockdown": "^0.1.2", | ||
"@endo/ses-ava": "^0.2.14", | ||
"@endo/lockdown": "^0.1.3", | ||
"@endo/ses-ava": "^0.2.15", | ||
"ava": "^3.12.1", | ||
@@ -71,3 +71,3 @@ "c8": "^7.7.3" | ||
}, | ||
"gitHead": "b986f1b0afbec1261fb2c047257751b9d418df7c" | ||
"gitHead": "c46f8d5d40f71014a099c53d26c75b149ea56d09" | ||
} |
// @ts-check | ||
// eslint-disable-next-line spaced-comment | ||
/// <reference types="ses"/> | ||
@@ -5,0 +4,0 @@ |
/* eslint-disable no-use-before-define */ | ||
// @ts-check | ||
// eslint-disable-next-line spaced-comment | ||
/// <reference types="ses"/> | ||
@@ -6,0 +5,0 @@ |
// @ts-check | ||
// eslint-disable-next-line spaced-comment | ||
/// <reference types="ses"/> | ||
@@ -5,0 +4,0 @@ |
// @ts-check | ||
// eslint-disable-next-line spaced-comment | ||
/// <reference types="ses"/> | ||
@@ -5,0 +4,0 @@ |
// @ts-check | ||
// eslint-disable-next-line spaced-comment | ||
/// <reference types="ses"/> | ||
@@ -56,3 +55,3 @@ | ||
const proto = getPrototypeOf(candidate); | ||
const { name } = candidate; | ||
const { name } = proto; | ||
const EC = getErrorConstructor(name); | ||
@@ -67,2 +66,3 @@ if (!EC || EC.prototype !== proto) { | ||
const { | ||
// Must allow `cause`, `errors` | ||
message: mDesc, | ||
@@ -69,0 +69,0 @@ // Allow but ignore only extraneous own `stack` property. |
// @ts-check | ||
// eslint-disable-next-line spaced-comment | ||
/// <reference path="../extra-types.d.ts" /> | ||
@@ -5,0 +4,0 @@ |
// @ts-check | ||
// eslint-disable-next-line spaced-comment | ||
/// <reference types="ses"/> | ||
@@ -5,0 +4,0 @@ |
// @ts-check | ||
// eslint-disable-next-line spaced-comment | ||
/// <reference types="ses"/> | ||
@@ -5,0 +4,0 @@ |
// @ts-check | ||
// eslint-disable-next-line spaced-comment | ||
/// <reference types="ses"/> | ||
@@ -5,0 +4,0 @@ |
// @ts-check | ||
// eslint-disable-next-line spaced-comment | ||
/// <reference types="ses"/> | ||
@@ -5,0 +4,0 @@ |
// @ts-check | ||
// eslint-disable-next-line spaced-comment | ||
/// <reference types="ses"/> | ||
@@ -5,0 +4,0 @@ |
// @ts-check | ||
// eslint-disable-next-line spaced-comment | ||
/// <reference types="ses"/> | ||
@@ -5,0 +4,0 @@ |
// @ts-check | ||
// eslint-disable-next-line spaced-comment | ||
/// <reference types="ses"/> | ||
import { Nat } from '@endo/nat'; | ||
import { passStyleOf } from './passStyleOf.js'; | ||
import { assertPassable, passStyleOf } from './passStyleOf.js'; | ||
@@ -22,3 +21,9 @@ import './types.js'; | ||
const { isArray } = Array; | ||
const { getOwnPropertyDescriptors, defineProperties, is, fromEntries } = Object; | ||
const { | ||
getOwnPropertyDescriptors, | ||
defineProperties, | ||
is, | ||
fromEntries, | ||
freeze, | ||
} = Object; | ||
const { details: X, quote: q } = assert; | ||
@@ -82,2 +87,3 @@ | ||
if (slotMap.has(val)) { | ||
// TODO assert that it's the same iface as before | ||
slotIndex = slotMap.get(val); | ||
@@ -94,2 +100,3 @@ assert.typeof(slotIndex, 'number'); | ||
// TODO explore removing this special case | ||
if (iface === undefined) { | ||
@@ -118,2 +125,4 @@ return harden({ | ||
const encodeError = err => { | ||
// Must encode `cause`, `errors`. | ||
// nested non-passable errors must be ok from here. | ||
if (errorTagging === 'on') { | ||
@@ -229,3 +238,4 @@ // We deliberately do not share the stack, but it would | ||
original: encode(qclassValue), | ||
rest: encode(harden(rest)), | ||
// See https://github.com/Agoric/agoric-sdk/issues/4313 | ||
rest: encode(freeze(rest)), | ||
}); | ||
@@ -287,2 +297,4 @@ return result; | ||
} | ||
// TODO SECURITY HAZARD: must enfoce that remotable vs promise | ||
// is according to the encoded string. | ||
const slot = slots[Number(Nat(index))]; | ||
@@ -388,2 +400,3 @@ const val = convertSlotToVal(slot, iface); | ||
case 'error': { | ||
// Must decode `cause` and `errors` properties | ||
const { name, message, errorId } = rawTree; | ||
@@ -493,3 +506,6 @@ assert.typeof( | ||
const fullRevive = makeFullRevive(data.slots); | ||
return harden(fullRevive(rawTree)); | ||
const result = harden(fullRevive(rawTree)); | ||
// See https://github.com/Agoric/agoric-sdk/issues/4337 | ||
assertPassable(result); | ||
return result; | ||
}; | ||
@@ -496,0 +512,0 @@ |
// @ts-check | ||
// eslint-disable-next-line spaced-comment | ||
/// <reference types="ses"/> | ||
@@ -5,0 +4,0 @@ |
// @ts-nocheck TODO Fix the recursive types to it checks. Will this | ||
// require a .d.ts file? I don't know. | ||
// eslint-disable-next-line spaced-comment | ||
/// <reference path="extra-types.d.ts" /> | ||
@@ -6,0 +5,0 @@ |
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
136016
2890
Updated@endo/eventual-send@^0.14.2
Updated@endo/nat@^4.1.2
Updated@endo/promise-kit@^0.2.31