@agoric/base-zone
Advanced tools
Comparing version
{ | ||
"name": "@agoric/base-zone", | ||
"version": "0.1.1-dev-bd0b2a9.0+bd0b2a9", | ||
"version": "0.1.1-dev-bd136ed.0+bd136ed", | ||
"description": "Allocation zone abstraction library and heap implementation", | ||
@@ -10,11 +10,11 @@ "type": "module", | ||
"build": "exit 0", | ||
"prepack": "tsc --build tsconfig.build.json", | ||
"prepack": "yarn run -T tsc --build tsconfig.build.json", | ||
"postpack": "git clean -f '*.d.ts*' '*.tsbuildinfo'", | ||
"test": "ava", | ||
"test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js", | ||
"test:c8": "c8 --all $C8_OPTIONS ava", | ||
"test:xs": "exit 0", | ||
"lint-fix": "yarn lint:eslint --fix", | ||
"lint": "run-s --continue-on-error lint:*", | ||
"lint:types": "tsc", | ||
"lint:eslint": "eslint ." | ||
"lint": "yarn run -T run-s --continue-on-error 'lint:*'", | ||
"lint:types": "yarn run -T tsc", | ||
"lint:eslint": "yarn run -T eslint ." | ||
}, | ||
@@ -31,13 +31,13 @@ "exports": { | ||
"dependencies": { | ||
"@agoric/store": "0.9.3-dev-bd0b2a9.0+bd0b2a9", | ||
"@endo/common": "^1.2.7", | ||
"@endo/errors": "^1.2.7", | ||
"@endo/exo": "^1.5.6", | ||
"@endo/far": "^1.1.8", | ||
"@endo/pass-style": "^1.4.6", | ||
"@endo/patterns": "^1.4.6" | ||
"@agoric/store": "workspace:*", | ||
"@endo/common": "^1.2.10", | ||
"@endo/errors": "^1.2.10", | ||
"@endo/exo": "^1.5.9", | ||
"@endo/far": "^1.1.11", | ||
"@endo/pass-style": "^1.5.0", | ||
"@endo/patterns": "^1.5.0" | ||
}, | ||
"devDependencies": { | ||
"@endo/init": "^1.1.6", | ||
"@endo/ses-ava": "^1.2.7", | ||
"@endo/init": "^1.1.9", | ||
"@endo/ses-ava": "^1.2.10", | ||
"ava": "^5.3.0" | ||
@@ -49,3 +49,3 @@ }, | ||
"engines": { | ||
"node": "^18.12 || ^20.9" | ||
"node": "^20.9 || ^22.11" | ||
}, | ||
@@ -63,5 +63,5 @@ "ava": { | ||
"typeCoverage": { | ||
"atLeast": 91.4 | ||
"atLeast": 93.22 | ||
}, | ||
"gitHead": "bd0b2a9f67af973d5bd789894e723251b83a8dff" | ||
"gitHead": "bd136ede475826a9465d3f431a4fdc1ff9ab1b7b" | ||
} |
@@ -1,2 +0,2 @@ | ||
export function makeHeapZone(baseLabel?: string | undefined): import("./types.js").Zone; | ||
export function makeHeapZone(baseLabel?: string): import("./types.js").Zone; | ||
//# sourceMappingURL=heap.d.ts.map |
export function isPassable(specimen: any): specimen is Passable; | ||
import type { Passable } from '@endo/pass-style'; | ||
//# sourceMappingURL=is-passable.d.ts.map |
import { isPassable as realIsPassable } from '@endo/pass-style'; | ||
/** | ||
* @import {Passable} from '@endo/pass-style'; | ||
*/ | ||
/** | ||
* @deprecated Import `isPassable` directly from `@endo/pass-style` | ||
@@ -5,0 +9,0 @@ * @param {any} specimen |
@@ -1,5 +0,5 @@ | ||
export function makeOnceKit(debugName: string, stores: import("./types.js").Stores, backingStore?: globalThis.MapStore<string, any> | undefined): { | ||
export function makeOnceKit(debugName: string, stores: import("./types.js").Stores, backingStore?: import("@agoric/swingset-liveslots").MapStore<string, any>): { | ||
makeOnce: <V>(key: string, maker: (key: string) => V) => V; | ||
wrapProvider: <T extends (key: string, ...rest: any[]) => any>(provider: T, labelToKeys?: ((label: string) => string[]) | undefined) => T; | ||
wrapProvider: <T extends (key: string, ...rest: any[]) => any>(provider: T, labelToKeys?: (label: string) => string[]) => T; | ||
}; | ||
//# sourceMappingURL=make-once.d.ts.map |
@@ -1,2 +0,4 @@ | ||
export function prepareRevocableMakerKit<U = any>(zone: import("@agoric/base-zone").Zone, uKindName: string, uMethodNames: (string | symbol)[], options?: RevocableKitOptions<any> | undefined): RevocableMakerKit<U>; | ||
export function prepareRevocableMakerKit<U = any>(zone: import("@agoric/base-zone").Zone, uKindName: string, uMethodNames: PropertyKey[], options?: RevocableKitOptions<U>): RevocableMakerKit<U>; | ||
export type MakeRevocable<U = any> = (underlying: U) => Partial<U>; | ||
export type MakeRevocableKit<U = any> = (underlying: U) => RevocableKit<U>; | ||
export type RevocableMakerKit<U = any> = { | ||
@@ -7,3 +9,4 @@ revoke: (revocable: U) => boolean; | ||
*/ | ||
makeRevocable: (underlying: U) => U; | ||
makeRevocable: MakeRevocable<U>; | ||
makeRevocableKit: MakeRevocableKit<U>; | ||
}; | ||
@@ -18,3 +21,3 @@ export type RevokerFacet = { | ||
*/ | ||
revocable: U; | ||
revocable: Partial<U>; | ||
}; | ||
@@ -38,3 +41,3 @@ export type RevocableKitThis<U = any> = { | ||
*/ | ||
extraMethodGuards?: Record<string | symbol, import("@endo/patterns").MethodGuard> | undefined; | ||
extraMethodGuards?: Record<PropertyKey, import("@endo/patterns").MethodGuard> | undefined; | ||
/** | ||
@@ -44,4 +47,4 @@ * Extra methods adding behavior only to the revocable caretaker, and | ||
*/ | ||
extraMethods?: Record<string | symbol, (this: RevocableKitThis<U>, ...args: any[]) => any> | undefined; | ||
extraMethods?: Record<PropertyKey, (this: RevocableKitThis<U>, ...args: any[]) => any> | undefined; | ||
}; | ||
//# sourceMappingURL=prepare-revocable.d.ts.map |
@@ -1,13 +0,33 @@ | ||
import { Fail, q } from '@endo/errors'; | ||
import { fromUniqueEntries } from '@endo/common/from-unique-entries.js'; | ||
import { M } from '@endo/patterns'; | ||
import { wrapperMethods } from './prepare-attenuator.js'; | ||
/** @import {Amplify} from '@endo/exo'; */ | ||
// This revocable kit implementation provides for both attenuation and | ||
// revocation, since both can be provided at the cost of one level of | ||
// indirection. But if you just need attenuation without revocation, better to | ||
// use the attenuator implementation in prepare-attenuator.js. | ||
// Please co-maintain these two modules. | ||
/** | ||
* @template [U=any] | ||
* @callback MakeRevocable | ||
* @param {U} underlying | ||
* @returns {Partial<U>} | ||
*/ | ||
/** | ||
* @template [U=any] | ||
* @callback MakeRevocableKit | ||
* @param {U} underlying | ||
* @returns {RevocableKit<U>} | ||
*/ | ||
/** | ||
* @template [U=any] | ||
* @typedef {object} RevocableMakerKit | ||
* @property {(revocable: U) => boolean} revoke | ||
* @property {(underlying: U) => U} makeRevocable | ||
* @property {MakeRevocable<U>} makeRevocable | ||
* Forwards to the underlying exo object, until revoked | ||
* @property {MakeRevocableKit<U>} makeRevocableKit | ||
*/ | ||
@@ -24,3 +44,3 @@ | ||
* @property {RevokerFacet} revoker | ||
* @property {U} revocable | ||
* @property {Partial<U>} revocable | ||
* Forwards to the underlying exo object, until revoked | ||
@@ -43,3 +63,3 @@ */ | ||
* @property {Record< | ||
* string|symbol, | ||
* PropertyKey, | ||
* import('@endo/patterns').MethodGuard | ||
@@ -51,3 +71,3 @@ * >} [extraMethodGuards] | ||
* @property {Record< | ||
* string|symbol, | ||
* PropertyKey, | ||
* (this: RevocableKitThis<U>, ...args: any[]) => any | ||
@@ -67,6 +87,6 @@ * >} [extraMethods] | ||
* The `kindName` of the underlying exo class | ||
* @param {(string|symbol)[]} uMethodNames | ||
* @param {PropertyKey[]} uMethodNames | ||
* The method names of the underlying exo class that should be represented | ||
* by transparently-forwarding methods of the revocable caretaker. | ||
* @param {RevocableKitOptions} [options] | ||
* @param {RevocableKitOptions<U>} [options] | ||
* @returns {RevocableMakerKit<U>} | ||
@@ -82,4 +102,4 @@ */ | ||
uInterfaceName = uKindName, | ||
extraMethodGuards = undefined, | ||
extraMethods = undefined, | ||
extraMethodGuards = {}, | ||
extraMethods = {}, | ||
} = options; | ||
@@ -90,11 +110,5 @@ const RevocableIKit = harden({ | ||
}), | ||
revocable: M.interface( | ||
`${uInterfaceName}_revocable`, | ||
{ | ||
...extraMethodGuards, | ||
}, | ||
{ | ||
defaultGuards: 'raw', | ||
}, | ||
), | ||
revocable: M.interface(`${uInterfaceName}_revocable`, extraMethodGuards, { | ||
defaultGuards: 'raw', | ||
}), | ||
}); | ||
@@ -110,5 +124,3 @@ | ||
RevocableIKit, | ||
underlying => ({ | ||
underlying, | ||
}), | ||
underlying => ({ underlying }), | ||
{ | ||
@@ -125,26 +137,6 @@ revoker: { | ||
}, | ||
revocable: { | ||
...fromUniqueEntries( | ||
uMethodNames.map(name => [ | ||
name, | ||
{ | ||
// Use concise method syntax for exo methods | ||
[name](...args) { | ||
// @ts-expect-error normal exo-this typing confusion | ||
const { underlying } = this.state; | ||
underlying !== undefined || | ||
Fail`${q(revocableKindName)} revoked`; | ||
return underlying[name](...args); | ||
}, | ||
// @ts-expect-error using possible symbol as index type | ||
}[name], | ||
]), | ||
), | ||
...extraMethods, | ||
}, | ||
revocable: wrapperMethods(revocableKindName, uMethodNames, extraMethods), | ||
}, | ||
{ | ||
stateShape: { | ||
underlying: M.opt(M.remotable('underlying')), | ||
}, | ||
stateShape: { underlying: M.opt(M.remotable('underlying')) }, | ||
receiveAmplifier: amp => { | ||
@@ -157,8 +149,5 @@ amplifier = amp; | ||
/** | ||
* @param {U} underlying | ||
* @returns {U} | ||
* @type {MakeRevocable} | ||
*/ | ||
const makeRevocable = underlying => | ||
// @ts-expect-error some confusion about UU vs Guarded<U> I think | ||
makeRevocableKit(underlying).revocable; | ||
const makeRevocable = underlying => makeRevocableKit(underlying).revocable; | ||
@@ -181,4 +170,6 @@ /** | ||
makeRevocable, | ||
/** @type {MakeRevocableKit} */ | ||
makeRevocableKit, | ||
}); | ||
}; | ||
harden(prepareRevocableMakerKit); |
@@ -46,3 +46,3 @@ export type KeyCategories = "exoClass" | "exoClassKit" | "exo" | "store" | "zone"; | ||
*/ | ||
mapStore: (label: string, options?: StoreOptions) => MapStore<any, any>; | ||
mapStore: <K, V>(label: string, options?: StoreOptions) => MapStore<K, V>; | ||
/** | ||
@@ -64,3 +64,8 @@ * provide a Set-like store named `label` in the zone | ||
import { defineExoClassKit } from '@endo/exo'; | ||
import type { StoreOptions } from '@agoric/store'; | ||
import { watchPromise } from './watch-promise.js'; | ||
import type { MapStore } from '@agoric/store'; | ||
import type { SetStore } from '@agoric/store'; | ||
import type { WeakMapStore } from '@agoric/store'; | ||
import type { WeakSetStore } from '@agoric/store'; | ||
//# sourceMappingURL=types.d.ts.map |
@@ -10,2 +10,3 @@ // eslint-disable-next-line no-unused-vars | ||
/** | ||
* @import {MapStore, SetStore, StoreOptions, WeakMapStore, WeakSetStore} from '@agoric/store'; | ||
* @import {Key} from '@endo/patterns'; | ||
@@ -37,3 +38,3 @@ * @import {Passable} from '@endo/pass-style'; | ||
* @property {(specimen: unknown) => boolean} isStorable return true if the specimen can be stored in the zone, whether as exo-object state or in a store | ||
* @property {(label: string, options?: StoreOptions) => MapStore<any, any>} mapStore provide a Map-like store named `label` in the zone | ||
* @property {<K, V>(label: string, options?: StoreOptions) => MapStore<K, V>} mapStore provide a Map-like store named `label` in the zone | ||
* @property {<K>(label: string, options?: StoreOptions) => SetStore<K>} setStore provide a Set-like store named `label` in the zone | ||
@@ -40,0 +41,0 @@ * @property {<K, V>( |
export * from "./src/prepare-revocable.js"; | ||
export * from "./src/prepare-attenuator.js"; | ||
//# sourceMappingURL=zone-helpers.d.ts.map |
export * from './src/prepare-revocable.js'; | ||
export * from './src/prepare-attenuator.js'; |
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
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
60998
23.41%49
8.89%1205
31.26%Updated
Updated
Updated
Updated
Updated
Updated
Updated