From c3038c6ddd79cd781480c0b732f0de6b7f91742c Mon Sep 17 00:00:00 2001 From: Michael FIG Date: Tue, 20 Aug 2024 17:14:12 -0600 Subject: [PATCH] fix(vow): export vat-compatible tools by default --- packages/vow/src/index.js | 9 ++++++++- packages/vow/src/tools.js | 6 +++--- packages/vow/vat.js | 16 +++++++++++----- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/packages/vow/src/index.js b/packages/vow/src/index.js index 4b41d02b15a..5b14dd2afd2 100644 --- a/packages/vow/src/index.js +++ b/packages/vow/src/index.js @@ -1,8 +1,15 @@ // @ts-check -export * from './tools.js'; + +// We default to the vat-compatible version of this package, which is easy to +// reconfigure if not running under SwingSet. +export * from '../vat.js'; export { default as makeE } from './E.js'; export { VowShape, toPassableCap } from './vow-utils.js'; +/** + * @typedef {import('./tools.js').VowTools} VowTools + */ + // eslint-disable-next-line import/export export * from './types.js'; diff --git a/packages/vow/src/tools.js b/packages/vow/src/tools.js index ec224cbe078..ff35539726c 100644 --- a/packages/vow/src/tools.js +++ b/packages/vow/src/tools.js @@ -18,7 +18,7 @@ import { makeWhen } from './when.js'; * @param {object} [powers] * @param {IsRetryableReason} [powers.isRetryableReason] */ -export const prepareVowTools = (zone, powers = {}) => { +export const prepareBasicVowTools = (zone, powers = {}) => { const { isRetryableReason = /** @type {IsRetryableReason} */ (() => false) } = powers; const makeVowKit = prepareVowKit(zone); @@ -72,6 +72,6 @@ export const prepareVowTools = (zone, powers = {}) => { retriable, }); }; -harden(prepareVowTools); +harden(prepareBasicVowTools); -/** @typedef {ReturnType} VowTools */ +/** @typedef {ReturnType} VowTools */ diff --git a/packages/vow/vat.js b/packages/vow/vat.js index cc1170eaa7e..a486730b9c4 100644 --- a/packages/vow/vat.js +++ b/packages/vow/vat.js @@ -7,7 +7,9 @@ // @ts-check import { isUpgradeDisconnection } from '@agoric/internal/src/upgrade-api.js'; import { makeHeapZone } from '@agoric/base-zone/heap.js'; -import { makeE, prepareVowTools as rawPrepareVowTools } from './src/index.js'; + +import { prepareBasicVowTools } from './src/tools.js'; +import makeE from './src/E.js'; /** @type {import('./src/types.js').IsRetryableReason} */ const isRetryableReason = (reason, priorRetryValue) => { @@ -28,13 +30,17 @@ export const defaultPowers = harden({ /** * Produce SwingSet-compatible vowTools, with an arbitrary Zone type * - * @type {typeof rawPrepareVowTools} + * @type {typeof prepareBasicVowTools} */ export const prepareSwingsetVowTools = (zone, powers = {}) => - rawPrepareVowTools(zone, { ...defaultPowers, ...powers }); + prepareBasicVowTools(zone, { ...defaultPowers, ...powers }); +harden(prepareSwingsetVowTools); -/** @deprecated */ -export const prepareVowTools = prepareSwingsetVowTools; +/** + * Reexport as prepareVowTools, since that's the thing that people find easiest + * to reach. + */ +export { prepareSwingsetVowTools as prepareVowTools }; /** * `vowTools` that are not durable, but are useful in non-durable clients that