New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@agoric/internal

Package Overview
Dependencies
Maintainers
10
Versions
1860
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@agoric/internal - npm Package Compare versions

Comparing version 0.3.3-dev-d4385f0.0 to 0.3.3-dev-d461b05.0

10

package.json
{
"name": "@agoric/internal",
"version": "0.3.3-dev-d4385f0.0+d4385f0",
"version": "0.3.3-dev-d461b05.0+d461b05",
"description": "Externally unsupported utilities internal to agoric-sdk",

@@ -23,3 +23,3 @@ "type": "module",

"dependencies": {
"@agoric/base-zone": "0.1.1-dev-d4385f0.0+d4385f0",
"@agoric/base-zone": "0.1.1-dev-d461b05.0+d461b05",
"@endo/common": "^1.2.8",

@@ -38,3 +38,3 @@ "@endo/errors": "^1.2.8",

"devDependencies": {
"@agoric/cosmic-proto": "0.4.1-dev-d4385f0.0+d4385f0",
"@agoric/cosmic-proto": "0.4.1-dev-d461b05.0+d461b05",
"@endo/exo": "^1.5.7",

@@ -63,5 +63,5 @@ "@endo/init": "^1.1.7",

"typeCoverage": {
"atLeast": 93.14
"atLeast": 93.06
},
"gitHead": "d4385f04ae2735e8d2863e2be9bf341f8566b36c"
"gitHead": "d461b05af6903cf1f09be7aef4e93b61cf58dbda"
}

@@ -10,2 +10,3 @@ export * from "./config.js";

export * from "./types-index.js";
export { pureDataMarshaller } from "./marshal.js";
export { objectMap } from "@endo/common/object-map.js";

@@ -12,0 +13,0 @@ export { objectMetaMap } from "@endo/common/object-meta-map.js";

@@ -9,2 +9,3 @@ // @jessie-check

export * from './js-utils.js';
export { pureDataMarshaller } from './marshal.js';
export * from './method-tools.js';

@@ -11,0 +12,0 @@ export * from './ses-utils.js';

@@ -13,2 +13,8 @@ export function makeBoardRemote({ boardId, iface }: {

};
export const pureDataMarshaller: {
toCapData: import("@endo/marshal").ToCapData<import("@endo/marshal").CapData<unknown>>;
fromCapData: import("@endo/marshal").FromCapData<import("@endo/marshal").CapData<unknown>>;
serialize: import("@endo/marshal").ToCapData<import("@endo/marshal").CapData<unknown>>;
unserialize: import("@endo/marshal").FromCapData<import("@endo/marshal").CapData<unknown>>;
};
/**

@@ -15,0 +21,0 @@ * Should be a union with Remotable, but that's `any`, making this type

@@ -138,1 +138,8 @@ // @ts-check

};
/** @param {import('@endo/marshal').CapData<unknown>} cap */
const rejectOCap = cap => Fail`${cap} is not pure data`;
export const pureDataMarshaller = makeMarshal(rejectOCap, rejectOCap, {
serializeBodyFormat: 'smallcaps',
});
harden(pureDataMarshaller);

@@ -12,2 +12,6 @@ export function slotToRemotable(_slotId: string, iface?: string): import("@endo/pass-style").RemotableObject<string> & import("@endo/eventual-send").RemotableBrand<{}, {}>;

};
export namespace defaultSerializer {
let parse: (text: string) => unknown;
let stringify: (obj: any) => string;
}
export const slotStringUnserialize: (capData: any) => any;

@@ -24,2 +28,3 @@ export function makeFakeStorageKit(rootPath: string, rootOptions?: Parameters<typeof makeChainStorageRoot>[2]): {

data: Map<string, string>;
getValues: (path: string) => string[];
messages: StorageMessage[];

@@ -43,3 +48,5 @@ toStorage: ((message: StorageMessage) => string | number | any[] | {

replacement: string;
} | {})): Promise<void>;
} | {}) & {
showValue?: (v: string) => unknown;
}): Promise<void>;
export type FakeStorageKit = ReturnType<typeof makeFakeStorageKit>;

@@ -46,0 +53,0 @@ export type MockChainStorageRootMethods = {

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

import { makeMarshal, Remotable } from '@endo/marshal';
import { unmarshalFromVstorage } from './marshal.js';
import { makeTracer } from './debug.js';
import { NonNullish } from './errors.js';
import { isStreamCell, makeChainStorageRoot } from './lib-chainStorage.js';
import { unmarshalFromVstorage } from './marshal.js';
import { bindAllMethods } from './method-tools.js';

@@ -38,2 +39,12 @@ import { eventLoopIteration } from './testing-utils.js';

/**
* Serialize/deserialize functions using {@link defaultMarshaller}
*/
export const defaultSerializer = {
/** @type {(text: string) => unknown} */
parse: txt => defaultMarshaller.fromCapData(JSON.parse(txt)),
/** @type {(obj: any) => string} */
stringify: obj => JSON.stringify(defaultMarshaller.toCapData(obj)),
};
/**
* A deserializer which produces slot strings instead of Remotables, so if `a =

@@ -194,2 +205,17 @@ * Far('iface')`, and serializing `{ a }` into `capData` assigned it slot

const rootNode = makeChainStorageRoot(toStorage, rootPath, resolvedOptions);
/**
* Get the values at a sequence node
*
* @param {string} path
* @returns {string[]}
*/
const getValues = path => {
assert(resolvedOptions.sequence);
const nodeData = data.get(path);
assert(nodeData, `no data at path ${path}`);
const wrapper = JSON.parse(nodeData);
return wrapper.values;
};
return {

@@ -199,2 +225,3 @@ rootNode,

data: /** @type {Map<string, string>} */ (data),
getValues,
messages,

@@ -257,3 +284,5 @@ toStorage,

* @param {({ note: string } | { node: string; owner: string }) &
* ({ pattern: string; replacement: string } | {})} opts
* ({ pattern: string; replacement: string } | {}) & {
* showValue?: (v: string) => unknown;
* }} opts
*/

@@ -264,6 +293,15 @@ export const documentStorageSchema = async (t, storage, opts) => {

const getLast = (/** @type {string} */ cell) =>
JSON.parse(cell).values.at(-1) || assert.fail();
const { showValue = s => s } = opts;
/** @type {(d: Map<string, string>, k: string) => unknown} */
const getBodyDefault = (d, k) => showValue(getLast(NonNullish(d.get(k))));
const [keys, getBody] =
'keys' in storage
? [storage.keys(), (/** @type {string} */ k) => storage.getBody(k)]
: [storage.data.keys(), (/** @type {string} */ k) => storage.data.get(k)];
: [
storage.data.keys(),
(/** @type {string} */ k) => getBodyDefault(storage.data, k),
];

@@ -274,11 +312,18 @@ const { pattern, replacement } =

: { pattern: 'mockChainStorageRoot.', replacement: 'published.' };
const illustration = [...keys].sort().map(
const pruned = [...keys]
.sort()
.filter(
'node' in opts
? key =>
key
.replace(pattern, replacement)
.startsWith(`published.${opts.node}`)
: _entry => true,
);
const illustration = pruned.map(
/** @type {(k: string) => [string, unknown]} */
key => [key.replace(pattern, replacement), getBody(key)],
);
const pruned = illustration.filter(
'node' in opts
? ([key, _]) => key.startsWith(`published.${opts.node}`)
: _entry => true,
);

@@ -293,3 +338,3 @@ const note =

See also board marshalling conventions (_to appear_).`;
t.snapshot(pruned, note + boilerplate);
t.snapshot(illustration, note + boilerplate);
};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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