Skip to content

Commit

Permalink
fix(vow): export vat-compatible tools by default
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed Aug 20, 2024
1 parent 9986152 commit eedd1c8
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
9 changes: 8 additions & 1 deletion packages/vow/src/index.js
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
6 changes: 3 additions & 3 deletions packages/vow/src/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { makeWhen } from './when.js';
* @param {object} [powers]
* @param {IsRetryableReason} [powers.isRetryableReason]
*/
export const prepareVowTools = (zone, powers = {}) => {
export const prepareVowToolsForTesting = (zone, powers = {}) => {
const { isRetryableReason = /** @type {IsRetryableReason} */ (() => false) } =
powers;
const makeVowKit = prepareVowKit(zone);
Expand Down Expand Up @@ -72,6 +72,6 @@ export const prepareVowTools = (zone, powers = {}) => {
retriable,
});
};
harden(prepareVowTools);
harden(prepareVowToolsForTesting);

/** @typedef {ReturnType<typeof prepareVowTools>} VowTools */
/** @typedef {ReturnType<typeof prepareVowToolsForTesting>} VowTools */
16 changes: 11 additions & 5 deletions packages/vow/vat.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 { prepareVowToolsForTesting } from './src/tools.js';
import makeE from './src/E.js';

/** @type {import('./src/types.js').IsRetryableReason} */
const isRetryableReason = (reason, priorRetryValue) => {
Expand All @@ -28,13 +30,17 @@ export const defaultPowers = harden({
/**
* Produce SwingSet-compatible vowTools, with an arbitrary Zone type
*
* @type {typeof rawPrepareVowTools}
* @type {typeof prepareVowToolsForTesting}
*/
export const prepareSwingsetVowTools = (zone, powers = {}) =>
rawPrepareVowTools(zone, { ...defaultPowers, ...powers });
prepareVowToolsForTesting(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
Expand Down

0 comments on commit eedd1c8

Please sign in to comment.