Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@agoric/marshal

Package Overview
Dependencies
Maintainers
5
Versions
156
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@agoric/marshal - npm Package Compare versions

Comparing version 0.5.1-dev-d667e9f.0 to 0.5.1-dev-d8aa4d6.0

src/typeGuards.js

10

index.js

@@ -7,2 +7,3 @@ export { mapIterable, filterIterable } from './src/helpers/iter-helpers.js';

getTag,
hasOwnPropertyOf,
} from './src/helpers/passStyle-helpers.js';

@@ -21,8 +22,3 @@

export {
passStyleOf,
assertPassable,
everyPassableChild,
somePassableChild,
} from './src/passStyleOf.js';
export { passStyleOf, assertPassable } from './src/passStyleOf.js';

@@ -47,2 +43,2 @@ export { pureCopy, sameValueZero } from './src/pureCopy.js';

isCopyArray,
} from './src/assertPassStyleOf.js';
} from './src/typeGuards.js';
{
"name": "@agoric/marshal",
"version": "0.5.1-dev-d667e9f.0+d667e9f",
"version": "0.5.1-dev-d8aa4d6.0+d8aa4d6",
"description": "marshal",

@@ -37,10 +37,9 @@ "type": "module",

"dependencies": {
"@agoric/assert": "0.3.16-dev-d667e9f.0+d667e9f",
"@agoric/eventual-send": "0.14.1-dev-d667e9f.0+d667e9f",
"@agoric/eventual-send": "0.14.1-dev-d8aa4d6.0+d8aa4d6",
"@agoric/nat": "^4.1.0",
"@agoric/promise-kit": "0.2.30-dev-d667e9f.0+d667e9f"
"@agoric/promise-kit": "0.2.30-dev-d8aa4d6.0+d8aa4d6"
},
"devDependencies": {
"@agoric/lockdown": "0.1.2-dev-d667e9f.0+d667e9f",
"@endo/ses-ava": "^0.2.8",
"@agoric/lockdown": "0.1.2-dev-d8aa4d6.0+d8aa4d6",
"@endo/ses-ava": "^0.2.13",
"ava": "^3.12.1",

@@ -72,3 +71,3 @@ "c8": "^7.7.2"

},
"gitHead": "d667e9f83a9ada0a4ec0ddb39096e3f64cc57a5b"
"gitHead": "d8aa4d616caef9d1aada125fbf5fddff53b6d121"
}

@@ -7,3 +7,2 @@ /* eslint-disable no-use-before-define */

import { assert, details as X } from '@agoric/assert';
import { E } from '@agoric/eventual-send';

@@ -18,2 +17,3 @@ import { isObject } from './helpers/passStyle-helpers.js';

const { ownKeys } = Reflect;
const { details: X } = assert;

@@ -20,0 +20,0 @@ const makeConverter = (mirrorConverter = undefined) => {

@@ -8,3 +8,2 @@ // @ts-check

import './internal-types.js';
import '@agoric/assert/exported.js';
import { assertChecker, checkNormalProperty } from './passStyle-helpers.js';

@@ -48,9 +47,4 @@

// Recursively validate that each member is passable.
CopyArrayHelper.every(candidate, v => !!passStyleOfRecur(v));
candidate.every(v => !!passStyleOfRecur(v));
},
every: (passable, fn) =>
// Note that we explicitly call `fn` with only the arguments we want
// to provide.
passable.every((v, i) => fn(v, i)),
});

@@ -14,3 +14,2 @@ // @ts-check

import './internal-types.js';
import '@agoric/assert/exported.js';

@@ -22,3 +21,2 @@ const { details: X } = assert;

getOwnPropertyDescriptors,
entries,
prototype: objectPrototype,

@@ -67,9 +65,4 @@ } = Object;

// Recursively validate that each member is passable.
CopyRecordHelper.every(candidate, v => !!passStyleOfRecur(v));
Object.values(candidate).every(v => !!passStyleOfRecur(v));
},
every: (passable, fn) =>
// Note that we explicitly call `fn` with only the arguments we want
// to provide.
entries(passable).every(([k, v]) => fn(v, k)),
});

@@ -8,3 +8,2 @@ // @ts-check

import './internal-types.js';
import '@agoric/assert/exported.js';
import { assertChecker } from './passStyle-helpers.js';

@@ -99,4 +98,2 @@

},
every: (_passable, _fn) => true,
});

@@ -103,0 +100,0 @@

@@ -30,8 +30,2 @@ // @ts-check

* ) => void} assertValid
*
* @property {(passable: Passable,
* fn: (passable: Passable, index: any) => boolean
* ) => boolean} every
* For recuring through the nested passable structure. Like
* `Array.prototype.every`, return `false` to stop early.
*/

@@ -8,3 +8,2 @@ // @ts-check

import './internal-types.js';
import '@agoric/assert/exported.js';

@@ -11,0 +10,0 @@ const { details: X, quote: q } = assert;

@@ -8,3 +8,2 @@ // @ts-check

import './internal-types.js';
import '@agoric/assert/exported.js';
import {

@@ -11,0 +10,0 @@ assertChecker,

@@ -15,3 +15,2 @@ // @ts-check

import './internal-types.js';
import '@agoric/assert/exported.js';

@@ -55,6 +54,4 @@ const { details: X } = assert;

// Recursively validate that each member is passable.
TaggedHelper.every(candidate, v => !!passStyleOfRecur(v));
!!passStyleOfRecur(candidate.payload);
},
every: (passable, fn) => fn(passable.payload, 'payload'),
});

@@ -6,3 +6,2 @@ // @ts-check

import { assert, details as X, q } from '@agoric/assert';
import { assertChecker, PASS_STYLE } from './helpers/passStyle-helpers.js';

@@ -16,2 +15,4 @@ import {

const { quote: q, details: X } = assert;
const { prototype: functionPrototype } = Function;

@@ -18,0 +19,0 @@ const {

@@ -6,3 +6,2 @@ // @ts-check

import { assert, details as X } from '@agoric/assert';
import { PASS_STYLE } from './helpers/passStyle-helpers.js';

@@ -12,2 +11,3 @@ import { assertPassable } from './passStyleOf.js';

const { create, prototype: objectPrototype } = Object;
const { details: X } = assert;

@@ -14,0 +14,0 @@ export const makeTagged = (tag, payload) => {

@@ -7,3 +7,2 @@ // @ts-check

import { Nat } from '@agoric/nat';
import { assert, details as X, q } from '@agoric/assert';
import { QCLASS } from './marshal.js';

@@ -19,2 +18,3 @@

const { stringify: quote } = JSON;
const { quote: q, details: X } = assert;

@@ -21,0 +21,0 @@ /**

// @ts-check
/// <reference types="ses"/>
import { assert, details as X } from '@agoric/assert';
import { makeMarshal } from './marshal.js';

@@ -8,2 +8,4 @@

const { details: X } = assert;
/** @type {ConvertValToSlot<any>} */

@@ -10,0 +12,0 @@ const doNotConvertValToSlot = val =>

@@ -7,3 +7,2 @@ // @ts-check

import { Nat } from '@agoric/nat';
import { assert, details as X, q } from '@agoric/assert';
import { passStyleOf } from './passStyleOf.js';

@@ -25,2 +24,3 @@

const { getOwnPropertyDescriptors, defineProperties, is, fromEntries } = Object;
const { details: X, quote: q } = assert;

@@ -401,2 +401,6 @@ /**

: `Remote${EC.name}(${errorId})`;
// Due to a defect in the SES type definition, the next line is
// fails a type check.
// Pending https://github.com/endojs/endo/issues/977
// @ts-ignore-next-line
const error = assert.error(`${message}`, EC, { errorName });

@@ -403,0 +407,0 @@ return error;

@@ -31,5 +31,5 @@ // @ts-check

* accidents.
* @returns {{passStyleOf: PassStyleOf, HelperTable: any}}
* @returns {PassStyleOf}
*/
const makePassStyleOfKit = passStyleHelpers => {
const makePassStyleOf = passStyleHelpers => {
const HelperTable = {

@@ -183,6 +183,6 @@ __proto__: null,

};
return harden({ passStyleOf, HelperTable });
return harden(passStyleOf);
};
const { passStyleOf, HelperTable } = makePassStyleOfKit([
export const passStyleOf = makePassStyleOf([
CopyArrayHelper,

@@ -194,3 +194,2 @@ CopyRecordHelper,

]);
export { passStyleOf };

@@ -201,17 +200,1 @@ export const assertPassable = val => {

harden(assertPassable);
export const everyPassableChild = (passable, fn) => {
const passStyle = passStyleOf(passable);
const helper = HelperTable[passStyle];
if (helper) {
// everyPassable guards .every so that each helper only gets a
// genuine passable of its own flavor.
return helper.every(passable, fn);
}
return true;
};
harden(everyPassableChild);
export const somePassableChild = (passable, fn) =>
!everyPassableChild(passable, (v, i) => !fn(v, i));
harden(somePassableChild);
// @ts-check
import { assert, details as X, q } from '@agoric/assert';
import { getTag } from './helpers/passStyle-helpers.js';

@@ -9,2 +8,3 @@ import { makeTagged } from './makeTagged.js';

const { is } = Object;
const { details: X, quote: q } = assert;

@@ -11,0 +11,0 @@ /**

@@ -101,2 +101,12 @@ // @ts-nocheck TODO Fix the recursive types to it checks. Will this

/**
* @template T
* @typedef {T[]} CopyArray
*/
/**
* @template T
* @typedef {Record<string, T>} CopyRecord
*/
/**
* @typedef {{

@@ -103,0 +113,0 @@ * [PASS_STYLE]: 'tagged',

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc