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

@agoric/base-zone

Package Overview
Dependencies
Maintainers
9
Versions
1043
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@agoric/base-zone - npm Package Compare versions

Comparing version 0.1.1-dev-21c29e2.0 to 0.1.1-dev-21fe8d9.0

24

package.json
{
"name": "@agoric/base-zone",
"version": "0.1.1-dev-21c29e2.0+21c29e2",
"version": "0.1.1-dev-21fe8d9.0+21fe8d9",
"description": "Allocation zone abstraction library and heap implementation",

@@ -30,12 +30,12 @@ "type": "module",

"dependencies": {
"@agoric/store": "0.9.3-dev-21c29e2.0+21c29e2",
"@endo/common": "^1.1.0",
"@endo/exo": "^1.2.1",
"@endo/far": "^1.0.4",
"@endo/pass-style": "^1.2.0",
"@endo/patterns": "^1.2.0"
"@agoric/store": "0.9.3-dev-21fe8d9.0+21fe8d9",
"@endo/common": "^1.2.0",
"@endo/exo": "^1.3.0",
"@endo/far": "^1.1.0",
"@endo/pass-style": "^1.3.0",
"@endo/patterns": "^1.3.0"
},
"devDependencies": {
"@endo/init": "^1.0.4",
"@endo/ses-ava": "^1.1.2",
"@endo/init": "^1.1.0",
"@endo/ses-ava": "^1.2.0",
"ava": "^5.3.0"

@@ -47,3 +47,3 @@ },

"engines": {
"node": ">=14.15.0"
"node": "^18.12 || ^20.9"
},

@@ -61,5 +61,5 @@ "ava": {

"typeCoverage": {
"atLeast": 89.25
"atLeast": 88.55
},
"gitHead": "21c29e2e09fc3055857c143eb6c8ee95786e86d7"
"gitHead": "21fe8d921225214fb388191548ad63d81912e65f"
}

@@ -8,3 +8,2 @@ /* eslint-disable import/export */

// @ts-expect-error TS1383: Only named exports may use 'export type'.
export type * from './types.js';

@@ -1,2 +0,2 @@

export function isPassable(specimen: any): specimen is any;
export function isPassable(specimen: any): specimen is Passable;
//# sourceMappingURL=is-passable.d.ts.map

@@ -1,7 +0,14 @@

export function prepareRevocableKit<U extends unknown = any>(zone: import('@agoric/base-zone').Zone, uKindName: string, uMethodNames: (string | symbol)[], options?: RevocableKitOptions<any> | undefined): (underlying: U) => RevocableKit<U>;
export type Revoker = {
export function prepareRevocableMakerKit<U = any>(zone: import('@agoric/base-zone').Zone, uKindName: string, uMethodNames: (string | symbol)[], options?: RevocableKitOptions<any> | undefined): RevocableMakerKit<U>;
export type RevocableMakerKit<U = any> = {
revoke: (revocable: U) => boolean;
/**
* Forwards to the underlying exo object, until revoked
*/
makeRevocable: (underlying: U) => U;
};
export type RevokerFacet = {
revoke: () => boolean;
};
export type RevocableKit<U extends unknown = any> = {
revoker: Revoker;
export type RevocableKit<U = any> = {
revoker: RevokerFacet;
/**

@@ -18,3 +25,3 @@ * Forwards to the underlying exo object, until revoked

};
export type RevocableKitOptions<U extends unknown = any> = {
export type RevocableKitOptions<U = any> = {
/**

@@ -21,0 +28,0 @@ * The `interfaceName` of the underlying interface guard.

@@ -7,3 +7,11 @@ import { M } from '@endo/patterns';

/**
* @typedef {object} Revoker
* @template [U=any]
* @typedef {object} RevocableMakerKit
* @property {(revocable: U) => boolean} revoke
* @property {(underlying: U) => U} makeRevocable
* Forwards to the underlying exo object, until revoked
*/
/**
* @typedef {object} RevokerFacet
* @property {() => boolean} revoke

@@ -13,5 +21,5 @@ */

/**
* @template {any} [U=any]
* @template [U=any]
* @typedef {object} RevocableKit
* @property {Revoker} revoker
* @property {RevokerFacet} revoker
* @property {U} revocable

@@ -29,3 +37,3 @@ * Forwards to the underlying exo object, until revoked

/**
* @template {any} [U=any]
* @template [U=any]
* @typedef {object} RevocableKitOptions

@@ -54,4 +62,3 @@ * @property {string} [uInterfaceName]

*
* @deprecated Change to `prepareRevocableMakerKit` once #8977 happens
* @template {any} [U=any]
* @template [U=any]
* @param {import('@agoric/base-zone').Zone} zone

@@ -64,5 +71,5 @@ * @param {string} uKindName

* @param {RevocableKitOptions} [options]
* @returns {(underlying: U) => RevocableKit<U>}
* @returns {RevocableMakerKit<U>}
*/
export const prepareRevocableKit = (
export const prepareRevocableMakerKit = (
zone,

@@ -95,2 +102,4 @@ uKindName,

let amplifier;
const makeRevocableKit = zone.exoClassKit(

@@ -137,9 +146,34 @@ revocableKindName,

},
receiveAmplifier: amp => {
amplifier = amp;
},
},
);
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
// @ts-ignore parameter confusion
return makeRevocableKit;
/**
* @param {U} underlying
* @returns {U}
*/
const makeRevocable = underlying =>
// @ts-expect-error some confusion about UU vs Guarded<U> I think
makeRevocableKit(underlying).revocable;
/**
* @param {U} revocable
* @returns {boolean}
*/
const revoke = revocable => {
/** @type {RevocableKit<U>} */
const facets = amplifier(revocable);
if (facets === undefined) {
return false;
}
return facets.revoker.revoke();
};
return harden({
revoke,
makeRevocable,
});
};
harden(prepareRevocableKit);
harden(prepareRevocableMakerKit);
export type KeyCategories = 'exoClass' | 'exoClassKit' | 'exo' | 'store' | 'zone';
export type KeyMakers = {
exoClass: (label: string) => string[];
exoClassKit: (label: string) => string[];
exo: (label: string) => string[];
store: (label: string) => string[];
zone: (label: string) => string[];
};
export type KeyMakers = Record<KeyCategories, (label: string) => string[]>;
/**

@@ -48,15 +42,15 @@ * A bag of methods for creating defensible objects and

*/
mapStore: <K, V>(label: string, options?: StoreOptions) => MapStore<K, V>;
mapStore: <K, V>(label: string, options?: StoreOptions) => globalThis.MapStore<K, V>;
/**
* provide a Set-like store named `label` in the zone
*/
setStore: <K_1>(label: string, options?: StoreOptions) => SetStore<K_1>;
setStore: <K_1>(label: string, options?: StoreOptions) => globalThis.SetStore<K_1>;
/**
* provide a WeakMap-like store named `label` in the zone
*/
weakMapStore: <K_2, V_1>(label: string, options?: StoreOptions) => WeakMapStore<K_2, V_1>;
weakMapStore: <K_2, V_1>(label: string, options?: StoreOptions) => globalThis.WeakMapStore<K_2, V_1>;
/**
* provide a WeakSet-like store named `label` in the zone
*/
weakSetStore: <K_3>(label: string, options?: StoreOptions) => WeakSetStore<K_3>;
weakSetStore: <K_3>(label: string, options?: StoreOptions) => globalThis.WeakSetStore<K_3>;
};

@@ -63,0 +57,0 @@ import { makeExo } from '@endo/exo';

@@ -8,3 +8,3 @@ // Modeled on test-heap-classes.js

import { makeHeapZone } from '../src/heap.js';
import { prepareRevocableKit } from '../src/prepare-revocable.js';
import { prepareRevocableMakerKit } from '../src/prepare-revocable.js';

@@ -42,12 +42,13 @@ const UpCounterI = M.interface('UpCounter', {

const makeRevocableUpCounterKit = prepareRevocableKit(zone, 'UpCounter', [
'incr',
]);
const { revoke, makeRevocable } = prepareRevocableMakerKit(
zone,
'UpCounter',
['incr'],
);
const makeUpCounterKit = x =>
makeRevocableUpCounterKit(makeUnderlyingUpCounter(x));
const makeUpCounter = x => makeRevocable(makeUnderlyingUpCounter(x));
const { revoker, revocable: upCounter } = makeUpCounterKit(3);
const upCounter = makeUpCounter(3);
t.is(upCounter.incr(5), 8);
t.is(revoker.revoke(), true);
t.is(revoke(upCounter), true);
t.throws(() => upCounter.incr(1), {

@@ -84,3 +85,3 @@ message: '"UpCounter_caretaker" revoked',

const makeRevocableUpCounterKit = prepareRevocableKit(
const { revoke, makeRevocable } = prepareRevocableMakerKit(
zone,

@@ -95,4 +96,8 @@ 'UpCounter',

selfRevoke() {
const { revoker } = this.facets;
return revoker.revoke();
// Could directly use the revoker facet instead, but this
// should now be considered more of an internal detail that
// we should deemphasize. This tests the code pattern we wish
// to encourage.
const { revocable } = this.facets;
return revoke(revocable);
},

@@ -105,4 +110,3 @@ },

const { up: upCounter, down: downCounter } = makeUnderlyingCounterKit(x);
const { revocable: revocableUpCounter } =
makeRevocableUpCounterKit(upCounter);
const revocableUpCounter = makeRevocable(upCounter);
return harden({

@@ -109,0 +113,0 @@ up: revocableUpCounter,

Sorry, the diff of this file is not supported yet

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