From 8cb331d906263011450e716c78117e1c8571e4b5 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Wed, 20 Dec 2023 16:24:13 -0500 Subject: [PATCH] yarn format --- .../SwingSet/misc-tools/replay-transcript.js | 16 +- .../SwingSet/src/controller/startXSnap.js | 8 +- packages/SwingSet/src/kernel/kernel.js | 8 +- .../vat-loader/manager-subprocess-xsnap.js | 16 +- packages/SwingSet/src/kernel/vat-warehouse.js | 14 +- .../src/supervisors/supervisor-helper.js | 14 +- packages/SwingSet/src/types-external.js | 24 +-- packages/access-token/src/json-store.js | 5 +- packages/agoric-cli/src/commands/auction.js | 8 +- packages/agoric-cli/src/lib/chain.js | 14 +- packages/agoric-cli/src/lib/format.js | 8 +- packages/agoric-cli/src/lib/rpc.js | 8 +- packages/agoric-cli/src/lib/wallet.js | 10 +- packages/agoric-cli/test/test-inter-cli.js | 10 +- packages/assert/src/types.js | 11 +- packages/base-zone/src/is-passable.js | 1 + packages/boot/test/test-boot-config.js | 8 +- packages/casting/src/follower-cosmjs.js | 8 +- packages/casting/src/follower.js | 8 +- packages/casting/test/fake-rpc-server.js | 8 +- packages/casting/test/net-access-fixture.js | 4 +- .../casting/test/test-interpose-net-access.js | 8 +- .../cosmic-swingset/src/export-kernel-db.js | 12 +- .../cosmic-swingset/src/import-kernel-db.js | 7 +- packages/cosmic-swingset/src/kernel-stats.js | 10 +- packages/cosmic-swingset/test/test-make.js | 8 +- .../src/coreProposalBehavior.js | 14 +- .../src/extract-proposal.js | 20 ++- .../src/getBundlerMaker.js | 8 +- .../src/writeCoreProposal.js | 8 +- packages/governance/src/committee.js | 10 +- .../src/contractGovernance/paramManager.js | 144 ++++++++++-------- .../governance/src/contractGovernorKit.js | 12 +- packages/governance/src/contractHelper.js | 10 +- packages/governance/src/electorateTools.js | 12 +- packages/governance/src/types-ambient.js | 3 +- .../committeeBinary/vat-voter.js | 8 +- packages/internal/src/callback.js | 6 +- packages/internal/src/lib-chainStorage.js | 10 +- packages/internal/src/storage-test-utils.js | 8 +- packages/internal/src/testing-utils.js | 6 +- packages/internal/src/utils.js | 32 ++-- packages/internal/test/test-callback.js | 48 +++--- packages/notifier/src/publish-kit.js | 10 +- packages/notifier/src/subscribe.js | 4 +- packages/notifier/src/types-ambient.js | 6 +- packages/notifier/test/test-publish-kit.js | 24 +-- packages/smart-wallet/src/smartWallet.js | 18 ++- packages/smart-wallet/src/utils.js | 16 +- packages/smart-wallet/src/walletFactory.js | 8 +- packages/smart-wallet/test/supports.js | 14 +- .../upgradeWalletFactory/walletFactory-V2.js | 8 +- packages/smart-wallet/test/test-addAsset.js | 24 +-- .../test/test-startWalletFactory.js | 8 +- .../smart-wallet/test/test-walletFactory.js | 8 +- packages/swing-store/src/swingStore.js | 5 +- .../src/virtualObjectManager.js | 40 +++-- .../lib/supervisor-helper.js | 14 +- .../lib/supervisor-subprocess-xsnap.js | 6 +- packages/telemetry/src/flight-recorder.js | 4 +- packages/telemetry/src/make-slog-sender.js | 8 +- .../src/slog-sender-pipe-entrypoint.js | 8 +- packages/telemetry/src/slog-to-otel.js | 8 +- packages/vat-data/src/exo-utils.js | 26 ++-- packages/vat-data/src/index.js | 8 +- packages/vat-data/src/vat-data-bindings.js | 12 +- packages/wallet/api/src/types.js | 4 +- packages/wallet/api/test/test-lib-wallet.js | 40 +++-- packages/xsnap/src/avaAssertXS.js | 46 +++--- packages/xsnap/src/avaXS.js | 10 +- packages/xsnap/src/xsnap.js | 24 +-- packages/zoe/src/contractFacet/zcfMint.js | 10 +- .../zoe/src/contractSupport/zoeHelpers.js | 3 +- .../zoe/src/zoeService/installationStorage.js | 20 ++- packages/zoe/src/zoeService/types.js | 15 +- .../swingsetTests/makeKind/test-makeKind.js | 8 +- .../swingsetTests/offerArgs/test-offerArgs.js | 8 +- .../privateArgs/test-privateArgs.js | 8 +- .../swingsetTests/runMint/test-runMint.js | 8 +- .../unitTests/contractSupport/test-ratio.js | 18 ++- .../test/unitTests/contracts/test-oracle.js | 8 +- .../contracts/test-priceAggregator.js | 20 +-- .../zoe/test/unitTests/setupBasicMints.js | 8 +- packages/zoe/test/unitTests/test-zoe.js | 16 +- packages/zoe/tools/fakePriceAuthority.js | 10 +- packages/zoe/tools/setup-zoe.js | 6 +- packages/zoe/tools/types-ambient.js | 7 +- packages/zone/src/virtual.js | 9 +- 88 files changed, 716 insertions(+), 492 deletions(-) diff --git a/packages/SwingSet/misc-tools/replay-transcript.js b/packages/SwingSet/misc-tools/replay-transcript.js index fd5e405a00a..df133498dae 100644 --- a/packages/SwingSet/misc-tools/replay-transcript.js +++ b/packages/SwingSet/misc-tools/replay-transcript.js @@ -333,9 +333,11 @@ async function replay(transcriptFile) { } // @ts-expect-error missing symbol - /** @type {Partial< - Record, Map> ->} */ + /** + * @type {Partial< + * Record, Map> + * >} + */ let syscallResults = {}; const analyzeSyscallResults = () => { @@ -427,9 +429,11 @@ async function replay(transcriptFile) { const currentBundleIDs = await bundleHandler.getCurrentBundleIDs(); const managerOptions = /** @type {import('../src/types-internal.js').ManagerOptions} */ ( - /** @type {Partial< - import('../src/types-internal.js').ManagerOptions ->} */ ({ + /** + * @type {Partial< + * import('../src/types-internal.js').ManagerOptions + * >} + */ ({ sourcedConsole: console, vatParameters, useTranscript: true, diff --git a/packages/SwingSet/src/controller/startXSnap.js b/packages/SwingSet/src/controller/startXSnap.js index 3a0fa267831..a8493c63e0b 100644 --- a/packages/SwingSet/src/controller/startXSnap.js +++ b/packages/SwingSet/src/controller/startXSnap.js @@ -27,9 +27,11 @@ const NETSTRING_MAX_CHUNK_SIZE = 12_000_000; * TODO: transition to direct snapshot stream, and remove this option */ -/** @typedef {StartXSnapInitFromBundlesDetails - | StartXSnapInitFromSnapshotStreamDetails - | StartXSnapInitFromSnapStoreDetails} StartXSnapInitDetails */ +/** + * @typedef {StartXSnapInitFromBundlesDetails + * | StartXSnapInitFromSnapshotStreamDetails + * | StartXSnapInitFromSnapStoreDetails} StartXSnapInitDetails + */ /** @typedef {ReturnType} StartXSnap */ diff --git a/packages/SwingSet/src/kernel/kernel.js b/packages/SwingSet/src/kernel/kernel.js index 911867c1a85..86b50cc5ac8 100644 --- a/packages/SwingSet/src/kernel/kernel.js +++ b/packages/SwingSet/src/kernel/kernel.js @@ -595,9 +595,11 @@ export default function buildKernel( if (!vatWarehouse.lookup(vatID)) { return NO_DELIVERY_CRANK_RESULTS; // can't collect from the dead } - /** @type {KernelDeliveryDropExports - | KernelDeliveryRetireExports - | KernelDeliveryRetireImports} */ + /** + * @type {KernelDeliveryDropExports + * | KernelDeliveryRetireExports + * | KernelDeliveryRetireImports} + */ const kd = harden([type, krefs]); if (type === 'retireExports') { for (const kref of krefs) { diff --git a/packages/SwingSet/src/kernel/vat-loader/manager-subprocess-xsnap.js b/packages/SwingSet/src/kernel/vat-loader/manager-subprocess-xsnap.js index 412a9d9ffc9..afb7b1718a5 100644 --- a/packages/SwingSet/src/kernel/vat-loader/manager-subprocess-xsnap.js +++ b/packages/SwingSet/src/kernel/vat-loader/manager-subprocess-xsnap.js @@ -148,9 +148,11 @@ export function makeXsSubprocessFactory({ init: snapshotInfo && { from: 'snapStore', vatID }, }); - /** @type {( - item: import('./types.js').Tagged, -) => Promise} */ + /** + * @type {( + * item: import('./types.js').Tagged, + * ) => Promise} + */ async function issueTagged(item) { parentLog(item[0], '...', item.length - 1); const result = await worker.issueStringCommand(JSON.stringify(item)); @@ -273,9 +275,11 @@ export function makeXsSubprocessFactory({ ]); await closeP; - /** @type {Partial< - import('@agoric/swing-store/src/snapStore.js').SnapshotInfo ->} */ + /** + * @type {Partial< + * import('@agoric/swing-store/src/snapStore.js').SnapshotInfo + * >} + */ const reloadSnapshotInfo = { snapPos, hash: snapshotResults.hash, diff --git a/packages/SwingSet/src/kernel/vat-warehouse.js b/packages/SwingSet/src/kernel/vat-warehouse.js index c0c6a5abee3..fdbf3b0e347 100644 --- a/packages/SwingSet/src/kernel/vat-warehouse.js +++ b/packages/SwingSet/src/kernel/vat-warehouse.js @@ -510,12 +510,14 @@ export function makeVatWarehouse({ await evict(lru); } - /** @type {( - vatID: string, - kd: KernelDeliveryObject, - d: VatDeliveryObject, - vs: VatSlog, -) => Promise} */ + /** + * @type {( + * vatID: string, + * kd: KernelDeliveryObject, + * d: VatDeliveryObject, + * vs: VatSlog, + * ) => Promise} + */ async function deliverToVat(vatID, kd, vd, vs) { await applyAvailabilityPolicy(vatID); diff --git a/packages/SwingSet/src/supervisors/supervisor-helper.js b/packages/SwingSet/src/supervisors/supervisor-helper.js index 61bd67f621f..729f7c8a871 100644 --- a/packages/SwingSet/src/supervisors/supervisor-helper.js +++ b/packages/SwingSet/src/supervisors/supervisor-helper.js @@ -95,12 +95,14 @@ function makeSupervisorSyscall(syscallToManager) { // this will be given to liveslots, it should have distinct methods that // return immediate results or throw errors const syscallForVat = { - /** @type {( - target: string, - method: string, - args: SwingSetCapData, - result?: string, -) => unknown} */ + /** + * @type {( + * target: string, + * method: string, + * args: SwingSetCapData, + * result?: string, + * ) => unknown} + */ send: (target, methargs, result) => doSyscall(['send', target, { methargs, result }]), subscribe: vpid => doSyscall(['subscribe', vpid]), diff --git a/packages/SwingSet/src/types-external.js b/packages/SwingSet/src/types-external.js index eac5fee4e9f..8a9b8be1591 100644 --- a/packages/SwingSet/src/types-external.js +++ b/packages/SwingSet/src/types-external.js @@ -355,9 +355,9 @@ export {}; */ /** - * @typedef {{ meter?: Meter }} OptMeter If a meter is provided, the new - * dynamic vat is limited to a fixed amount of computation and allocation that - * can occur during any given crank. Peak stack frames are limited as well. In + * @typedef {{ meter?: Meter }} OptMeter If a meter is provided, the new dynamic + * vat is limited to a fixed amount of computation and allocation that can + * occur during any given crank. Peak stack frames are limited as well. In * addition, the given meter's "remaining" value will be reduced by the amount * of computation used by each crank. The meter will eventually underflow * unless it is topped up, at which point the vat is terminated. If undefined, @@ -374,13 +374,13 @@ export {}; * * @typedef {{ vatParameters?: object; upgradeMessage?: string }} VatUpgradeOptions * @typedef {{ incarnationNumber: number }} VatUpgradeResults - * @callback ShutdownWithFailure Called to shut something down because - * something went wrong, where the reason is supposed to be an Error that - * describes what went wrong. Some valid implementations of - * `ShutdownWithFailure` will never return, either because they throw or - * because they immediately shutdown the enclosing unit of computation. - * However, they also might return, so the caller should follow this call by - * their own defensive `throw reason;` if appropriate. + * @callback ShutdownWithFailure Called to shut something down because something + * went wrong, where the reason is supposed to be an Error that describes what + * went wrong. Some valid implementations of `ShutdownWithFailure` will never + * return, either because they throw or because they immediately shutdown the + * enclosing unit of computation. However, they also might return, so the + * caller should follow this call by their own defensive `throw reason;` if + * appropriate. * @param {Error} reason * @returns {void} * @typedef {object} VatAdminFacet A powerful object corresponding with a vat @@ -390,8 +390,8 @@ export {}; * or rejected when the vat is terminated. If the vat terminates with a * failure, the promise will be rejected with the reason. If the vat * terminates successfully, the promise will fulfill to the completion value. - * @property {ShutdownWithFailure} terminateWithFailure Terminate the vat with - * a failure reason. + * @property {ShutdownWithFailure} terminateWithFailure Terminate the vat with a + * failure reason. * @property {( * bundlecap: BundleCap, * options?: VatUpgradeOptions, diff --git a/packages/access-token/src/json-store.js b/packages/access-token/src/json-store.js index e67cfd95495..66eb1b4d578 100644 --- a/packages/access-token/src/json-store.js +++ b/packages/access-token/src/json-store.js @@ -330,9 +330,8 @@ export function setAllState(storage, stuff) { * * @param {string} dirPath Path to a directory in which database files might be * present. This directory need not actually exist - * @returns {boolean} If the directory is present and contains the files - * created by initJSONStore or openJSONStore, returns true. Else returns - * false. + * @returns {boolean} If the directory is present and contains the files created + * by initJSONStore or openJSONStore, returns true. Else returns false. */ export function isJSONStore(dirPath) { if (`${dirPath}` !== dirPath) { diff --git a/packages/agoric-cli/src/commands/auction.js b/packages/agoric-cli/src/commands/auction.js index fa89ae03979..96e876992d9 100644 --- a/packages/agoric-cli/src/commands/auction.js +++ b/packages/agoric-cli/src/commands/auction.js @@ -20,9 +20,11 @@ const { Fail } = assert; * }} ParamValues */ -/** @typedef {ReturnType< - import('@agoric/inter-protocol/src/auction/params.js').makeAuctioneerParams ->} AuctionParamRecord */ +/** + * @typedef {ReturnType< + * import('@agoric/inter-protocol/src/auction/params.js').makeAuctioneerParams + * >} AuctionParamRecord + */ /** @typedef {ParamValues>} AuctionParams */ /** diff --git a/packages/agoric-cli/src/lib/chain.js b/packages/agoric-cli/src/lib/chain.js index ba680b1f484..6a07d3ea206 100644 --- a/packages/agoric-cli/src/lib/chain.js +++ b/packages/agoric-cli/src/lib/chain.js @@ -178,12 +178,14 @@ export const pollTx = async (txhash, opts) => { { stdio: ['ignore', 'pipe', 'ignore'] }, ); // XXX this type is defined in a .proto file somewhere - /** @type {{ - height: string; - txhash: string; - code: number; - timestamp: string; -}} */ + /** + * @type {{ + * height: string; + * txhash: string; + * code: number; + * timestamp: string; + * }} + */ const info = JSON.parse(out.toString()); return info; }; diff --git a/packages/agoric-cli/src/lib/format.js b/packages/agoric-cli/src/lib/format.js index f8dbf4a1fca..3d94f56612f 100644 --- a/packages/agoric-cli/src/lib/format.js +++ b/packages/agoric-cli/src/lib/format.js @@ -26,9 +26,11 @@ export const Natural = str => { */ export const bigintReplacer = (k, v) => (typeof v === 'bigint' ? `${v}` : v); -/** @type {Partial< - import('@agoric/vats/tools/board-utils.js').VBankAssetDetail ->} */ +/** + * @type {Partial< + * import('@agoric/vats/tools/board-utils.js').VBankAssetDetail + * >} + */ // eslint-disable-next-line no-unused-vars const exampleAsset = { brand: makeBoardRemote({ boardId: 'board0425', iface: 'Alleged: BLD brand' }), diff --git a/packages/agoric-cli/src/lib/rpc.js b/packages/agoric-cli/src/lib/rpc.js index 38866927a65..1a572358aea 100644 --- a/packages/agoric-cli/src/lib/rpc.js +++ b/packages/agoric-cli/src/lib/rpc.js @@ -236,9 +236,11 @@ export const makeAgoricNames = async (ctx, vstorage) => { const content = await vstorage.readLatest( `published.agoricNames.${kind}`, ); - /** @type {Array< - [string, import('@agoric/vats/tools/board-utils.js').BoardRemote] ->} */ + /** + * @type {Array< + * [string, import('@agoric/vats/tools/board-utils.js').BoardRemote] + * >} + */ const parts = storageHelper.unserializeTxt(content, ctx).at(-1); for (const [name, remote] of parts) { if ('getBoardId' in remote) { diff --git a/packages/agoric-cli/src/lib/wallet.js b/packages/agoric-cli/src/lib/wallet.js index d1ba34ff7b7..28d65ba7706 100644 --- a/packages/agoric-cli/src/lib/wallet.js +++ b/packages/agoric-cli/src/lib/wallet.js @@ -30,10 +30,12 @@ const emptyCurrentRecord = { export const getCurrent = async (addr, { readLatestHead }) => { // Partial because older writes may not have had all properties // NB: assumes changes are only additions - let current = /** @type {Partial< - import('@agoric/smart-wallet/src/smartWallet').CurrentWalletRecord - > - | undefined} */ (await readLatestHead(`published.wallet.${addr}.current`)); + let current = /** + * @type {Partial< + * import('@agoric/smart-wallet/src/smartWallet').CurrentWalletRecord + * > + * | undefined} + */ (await readLatestHead(`published.wallet.${addr}.current`)); if (current === undefined) { throw new Error(`undefined current node for ${addr}`); } diff --git a/packages/agoric-cli/test/test-inter-cli.js b/packages/agoric-cli/test/test-inter-cli.js index 2220254c75d..abaf8e09de4 100644 --- a/packages/agoric-cli/test/test-inter-cli.js +++ b/packages/agoric-cli/test/test-inter-cli.js @@ -37,10 +37,12 @@ const agoricNames = harden({ auctioneer: makeBoardRemote({ boardId: 'board434', iface: 'Instance' }), }, - /** @type {Record< - string, - import('agoric/src/lib/format.js').AssetDescriptor ->} */ + /** + * @type {Record< + * string, + * import('agoric/src/lib/format.js').AssetDescriptor + * >} + */ vbankAsset: { ubld: { denom: 'ubld', diff --git a/packages/assert/src/types.js b/packages/assert/src/types.js index fd3337a4bbc..8006dfdaf4b 100644 --- a/packages/assert/src/types.js +++ b/packages/assert/src/types.js @@ -169,10 +169,9 @@ // ///////////////////////////////////////////////////////////////////////////// /** - * @typedef {{}} DetailsToken A call to the `details` template literal makes - * and returns a fresh details token, which is a frozen empty object - * associated with the arguments of that `details` template literal - * expression. + * @typedef {{}} DetailsToken A call to the `details` template literal makes and + * returns a fresh details token, which is a frozen empty object associated + * with the arguments of that `details` template literal expression. */ /** @@ -181,8 +180,8 @@ */ /** - * @typedef {object} StringablePayload Holds the payload passed to quote so - * that its printed form is visible. + * @typedef {object} StringablePayload Holds the payload passed to quote so that + * its printed form is visible. * @property {() => string} toString How to print the payload */ diff --git a/packages/base-zone/src/is-passable.js b/packages/base-zone/src/is-passable.js index 3769823035d..921219a095e 100644 --- a/packages/base-zone/src/is-passable.js +++ b/packages/base-zone/src/is-passable.js @@ -6,6 +6,7 @@ import { passStyleOf } from '@endo/pass-style'; * normal circumstance should `isPassable(specimen)` throw. * * TODO implement an isPassable that does not rely on try/catch, and move it to + * * @endo/pass-style. This implementation is just a standin until then * * @param {any} specimen diff --git a/packages/boot/test/test-boot-config.js b/packages/boot/test/test-boot-config.js index 9b2397f0897..4d0d8628bde 100644 --- a/packages/boot/test/test-boot-config.js +++ b/packages/boot/test/test-boot-config.js @@ -17,9 +17,11 @@ const importConfig = configName => u => new URL(u).pathname, ); -const test = /** @type {import('ava').TestFn< - Awaited> ->} } */ (anyTest); +const test = /** + * @type {import('ava').TestFn< + * Awaited> + * >} } + */ (anyTest); const PROD_CONFIG_FILES = [ 'decentral-main-vaults-config.json', diff --git a/packages/casting/src/follower-cosmjs.js b/packages/casting/src/follower-cosmjs.js index b1fb2007290..81c981be68a 100644 --- a/packages/casting/src/follower-cosmjs.js +++ b/packages/casting/src/follower-cosmjs.js @@ -15,9 +15,11 @@ const { Tendermint34Client } = tendermint34; const { details: X, quote: q, Fail } = assert; const textDecoder = new TextDecoder(); -/** @template T @typedef - {import('./types.js').Follower>} - ValueFollower */ +/** + * @template T @typedef + * {import('./types.js').Follower>} + * ValueFollower + */ // Copied from https://github.com/cosmos/cosmjs/pull/1328/files until release /** diff --git a/packages/casting/src/follower.js b/packages/casting/src/follower.js index 086758cbc86..d0a1e0a57e4 100644 --- a/packages/casting/src/follower.js +++ b/packages/casting/src/follower.js @@ -16,9 +16,11 @@ import { makeCastingSpec } from './casting-spec.js'; const makeSubscriptionFollower = spec => { const transform = value => harden({ value, blockHeight: NaN, currentBlockHeight: NaN }); - /** @type {import('./types').Follower< - import('./types.js').ValueFollowerElement ->} */ + /** + * @type {import('./types').Follower< + * import('./types.js').ValueFollowerElement + * >} + */ const follower = Far('subscription/notifier follower', { getLatestIterable: async () => { const { notifier, subscription } = await spec; diff --git a/packages/casting/test/fake-rpc-server.js b/packages/casting/test/fake-rpc-server.js index 3aa37970347..21a97b21a89 100644 --- a/packages/casting/test/fake-rpc-server.js +++ b/packages/casting/test/fake-rpc-server.js @@ -72,9 +72,11 @@ const fakeStatusResult = { }, }; -/** @typedef {Partial< - import('ava').ExecutionContext<{ cleanups: Array<() => void> }> -> & { context }} FakeServerTestContext */ +/** + * @typedef {Partial< + * import('ava').ExecutionContext<{ cleanups: Array<() => void> }> + * > & { context }} FakeServerTestContext + */ /** * @param {FakeServerTestContext} t * @param {Array<{ any }>} fakeValues diff --git a/packages/casting/test/net-access-fixture.js b/packages/casting/test/net-access-fixture.js index fa8ed9ecc39..54d5a432d08 100644 --- a/packages/casting/test/net-access-fixture.js +++ b/packages/casting/test/net-access-fixture.js @@ -152,8 +152,8 @@ const normalizeID = argsKey => { /** * Wrap `fetch` to capture JSON RPC IO traffic. * - * @param {typeof window.fetch} fetch returns wraped fetch along with a .web - * map for use with {@link replayIO} + * @param {typeof window.fetch} fetch returns wraped fetch along with a .web map + * for use with {@link replayIO} */ export const captureIO = fetch => { const web = new Map(); diff --git a/packages/casting/test/test-interpose-net-access.js b/packages/casting/test/test-interpose-net-access.js index c36fc752f89..b1173e44428 100644 --- a/packages/casting/test/test-interpose-net-access.js +++ b/packages/casting/test/test-interpose-net-access.js @@ -12,9 +12,11 @@ import { QueryClientImpl } from '@agoric/cosmic-proto/vstorage/query.js'; import { makeHttpClient } from '../src/makeHttpClient.js'; import { captureIO, replayIO, web1, web2 } from './net-access-fixture.js'; -/** @type {import('ava').TestFn< - Awaited> ->} */ +/** + * @type {import('ava').TestFn< + * Awaited> + * >} + */ const test = /** @type {any} */ (anyTest); const RECORDING = false; diff --git a/packages/cosmic-swingset/src/export-kernel-db.js b/packages/cosmic-swingset/src/export-kernel-db.js index 612865db20f..ef7231b0418 100755 --- a/packages/cosmic-swingset/src/export-kernel-db.js +++ b/packages/cosmic-swingset/src/export-kernel-db.js @@ -54,9 +54,11 @@ export const getEffectiveArtifactMode = artifactMode => { } }; -/** @type {( - artifactMode: string | undefined, -) => asserts artifactMode is SwingStoreArtifactMode | undefined} */ +/** + * @type {( + * artifactMode: string | undefined, + * ) => asserts artifactMode is SwingStoreArtifactMode | undefined} + */ export const checkArtifactMode = getEffectiveArtifactMode; /** @@ -95,8 +97,8 @@ export const checkExportDataMode = (mode, isImport = false) => { * @property {number} blockHeight the block height corresponding to this export * @property {SwingStoreArtifactMode} [artifactMode] * @property {string} [data] file name containing the swingStore "export data" - * @property {Array<[artifactName: string, fileName: string]>} artifacts List - * of swingStore export artifacts which can be validated by the export data + * @property {Array<[artifactName: string, fileName: string]>} artifacts List of + * swingStore export artifacts which can be validated by the export data */ /** diff --git a/packages/cosmic-swingset/src/import-kernel-db.js b/packages/cosmic-swingset/src/import-kernel-db.js index 287ebf46edc..8e8a7d906d0 100755 --- a/packages/cosmic-swingset/src/import-kernel-db.js +++ b/packages/cosmic-swingset/src/import-kernel-db.js @@ -270,9 +270,10 @@ export const main = async ( /** @type {string} */ (processValue.getFlag('export-dir', '.')), ); - const artifactMode = - /** @type {import('./export-kernel-db.js').SwingStoreArtifactMode - | undefined} */ (processValue.getFlag('artifact-mode')); + const artifactMode = /** + * @type {import('./export-kernel-db.js').SwingStoreArtifactMode + * | undefined} + */ (processValue.getFlag('artifact-mode')); checkArtifactMode(artifactMode); const exportDataMode = processValue.getFlag('export-data-mode'); diff --git a/packages/cosmic-swingset/src/kernel-stats.js b/packages/cosmic-swingset/src/kernel-stats.js index eb2cd285ac8..8e889ca8790 100644 --- a/packages/cosmic-swingset/src/kernel-stats.js +++ b/packages/cosmic-swingset/src/kernel-stats.js @@ -102,10 +102,12 @@ export function makeDefaultMeterProvider() { return new MeterProvider({ views: getMetricsProviderViews() }); } -/** @param {Omit< - NonNullable[0]>, - 'views' ->} [powers] */ +/** + * @param {Omit< + * NonNullable[0]>, + * 'views' + * >} [powers] + */ export function getTelemetryProviders(powers = {}) { return getTelemetryProvidersOriginal({ ...powers, diff --git a/packages/cosmic-swingset/test/test-make.js b/packages/cosmic-swingset/test/test-make.js index 4bf92378a7b..1498e121409 100644 --- a/packages/cosmic-swingset/test/test-make.js +++ b/packages/cosmic-swingset/test/test-make.js @@ -7,9 +7,11 @@ import * as ambientPath from 'path'; import { makeScenario2, pspawn } from './scenario2.js'; -/** @type {import('ava').TestFn< - Awaited> ->} */ +/** + * @type {import('ava').TestFn< + * Awaited> + * >} + */ const test = anyTest; const makeTestContext = async t => { diff --git a/packages/deploy-script-support/src/coreProposalBehavior.js b/packages/deploy-script-support/src/coreProposalBehavior.js index b4854ee4715..9ee9adfef07 100644 --- a/packages/deploy-script-support/src/coreProposalBehavior.js +++ b/packages/deploy-script-support/src/coreProposalBehavior.js @@ -77,9 +77,11 @@ export const makeCoreProposalBehavior = ({ }; const makeRestoreRef = (vatAdminSvc, zoe) => { - /** @type {( - ref: import('./externalTypes.js').ManifestBundleRef, -) => Promise>} */ + /** + * @type {( + * ref: import('./externalTypes.js').ManifestBundleRef, + * ) => Promise>} + */ const defaultRestoreRef = async bundleRef => { // extract-proposal.js creates these records, and bundleName is // the optional name under which the bundle was installed into @@ -95,8 +97,10 @@ export const makeCoreProposalBehavior = ({ return defaultRestoreRef; }; - /** @param {ChainBootstrapSpace & - BootstrapPowers & { evaluateBundleCap: any }} powers */ + /** + * @param {ChainBootstrapSpace & + * BootstrapPowers & { evaluateBundleCap: any }} powers + */ const coreProposalBehavior = async powers => { // NOTE: `powers` is expected to match or be a superset of the above `permits` export, // which should therefore be kept in sync with this deconstruction code. diff --git a/packages/deploy-script-support/src/extract-proposal.js b/packages/deploy-script-support/src/extract-proposal.js index 96d9996e0bf..c2bf8b073f7 100644 --- a/packages/deploy-script-support/src/extract-proposal.js +++ b/packages/deploy-script-support/src/extract-proposal.js @@ -89,10 +89,12 @@ export const extractCoreProposalBundles = async ( .stat(dirname) .then(stbuf => (stbuf.isDirectory() ? dirname : path.dirname(dirname))); - /** @type {Map< - { bundleID?: string; bundleName?: string }, - { source: string; bundle?: string } ->} */ + /** + * @type {Map< + * { bundleID?: string; bundleName?: string }, + * { source: string; bundle?: string } + * >} + */ const bundleHandleToAbsolutePaths = new Map(); const bundleToSource = new Map(); @@ -125,10 +127,12 @@ export const extractCoreProposalBundles = async ( const thisProposalSequence = getSequenceForProposal(i); const initPath = findModule(dirname, module); const initDir = path.dirname(initPath); - /** @type {Record< - string, - import('./externalTypes.js').ProposalBuilder ->} */ + /** + * @type {Record< + * string, + * import('./externalTypes.js').ProposalBuilder + * >} + */ const ns = await import(initPath); const install = (srcSpec, bundlePath) => { const absoluteSrc = findModule(initDir, srcSpec); diff --git a/packages/deploy-script-support/src/getBundlerMaker.js b/packages/deploy-script-support/src/getBundlerMaker.js index 4a3c15f771d..09e0e556414 100644 --- a/packages/deploy-script-support/src/getBundlerMaker.js +++ b/packages/deploy-script-support/src/getBundlerMaker.js @@ -13,9 +13,11 @@ import { E } from '@endo/far'; import url from 'url'; -/** @typedef {ReturnType< - import('./endo-pieces-contract.js')['start'] ->['publicFacet']} BundleMaker */ +/** + * @typedef {ReturnType< + * import('./endo-pieces-contract.js')['start'] + * >['publicFacet']} BundleMaker + */ export const makeGetBundlerMaker = (homeP, { lookup, bundleSource }) => diff --git a/packages/deploy-script-support/src/writeCoreProposal.js b/packages/deploy-script-support/src/writeCoreProposal.js index 375028dbf0a..4ed9d52419e 100644 --- a/packages/deploy-script-support/src/writeCoreProposal.js +++ b/packages/deploy-script-support/src/writeCoreProposal.js @@ -70,9 +70,11 @@ export const makeWriteCoreProposal = ( }; }; - let mutex = /** @type {Promise< - import('./externalTypes.js').ManifestBundleRef | undefined ->} */ (Promise.resolve()); + let mutex = /** + * @type {Promise< + * import('./externalTypes.js').ManifestBundleRef | undefined + * >} + */ (Promise.resolve()); /** @type {WriteCoreProposal} */ const writeCoreProposal = async (filePrefix, proposalBuilder) => { /** diff --git a/packages/governance/src/committee.js b/packages/governance/src/committee.js index 39e707a6d98..a8c5a6d7758 100644 --- a/packages/governance/src/committee.js +++ b/packages/governance/src/committee.js @@ -57,10 +57,12 @@ harden(meta); * }} */ export const start = (zcf, privateArgs, baggage) => { - /** @type {MapStore< - Handle<'Question'>, - import('./electorateTools.js').QuestionRecord ->} */ + /** + * @type {MapStore< + * Handle<'Question'>, + * import('./electorateTools.js').QuestionRecord + * >} + */ const allQuestions = provideDurableMapStore(baggage, 'Question'); // CRUCIAL: voteCap carries the ability to cast votes for any voter at diff --git a/packages/governance/src/contractGovernance/paramManager.js b/packages/governance/src/contractGovernance/paramManager.js index 36e8a180948..1d48d6e7398 100644 --- a/packages/governance/src/contractGovernance/paramManager.js +++ b/packages/governance/src/contractGovernance/paramManager.js @@ -140,11 +140,13 @@ const makeParamManagerBuilder = (publisherKit, zoe) => { // HANDLERS FOR EACH PARAMETER TYPE ///////////////////////////////////////// - /** @type {( - name: string, - value: Amount, - builder: ParamManagerBuilder, -) => ParamManagerBuilder} */ + /** + * @type {( + * name: string, + * value: Amount, + * builder: ParamManagerBuilder, + * ) => ParamManagerBuilder} + */ const addAmount = (name, value, builder) => { const assertAmount = a => { a.brand || Fail`Expected an Amount for ${q(name)}, got: ${a}`; @@ -154,44 +156,52 @@ const makeParamManagerBuilder = (publisherKit, zoe) => { return builder; }; - /** @type {( - name: string, - value: Brand, - builder: ParamManagerBuilder, -) => ParamManagerBuilder} */ + /** + * @type {( + * name: string, + * value: Brand, + * builder: ParamManagerBuilder, + * ) => ParamManagerBuilder} + */ const addBrand = (name, value, builder) => { const assertBrand = makeLooksLikeBrand(name); buildCopyParam(name, value, assertBrand, ParamTypes.BRAND); return builder; }; - /** @type {( - name: string, - value: Installation, - builder: ParamManagerBuilder, -) => ParamManagerBuilder} */ + /** + * @type {( + * name: string, + * value: Installation, + * builder: ParamManagerBuilder, + * ) => ParamManagerBuilder} + */ const addInstallation = (name, value, builder) => { const assertInstallation = makeAssertInstallation(name); buildCopyParam(name, value, assertInstallation, ParamTypes.INSTALLATION); return builder; }; - /** @type {( - name: string, - value: Instance, - builder: ParamManagerBuilder, -) => ParamManagerBuilder} */ + /** + * @type {( + * name: string, + * value: Instance, + * builder: ParamManagerBuilder, + * ) => ParamManagerBuilder} + */ const addInstance = (name, value, builder) => { const assertInstance = makeAssertInstance(name); buildCopyParam(name, value, assertInstance, ParamTypes.INSTANCE); return builder; }; - /** @type {( - name: string, - value: bigint, - builder: ParamManagerBuilder, -) => ParamManagerBuilder} */ + /** + * @type {( + * name: string, + * value: bigint, + * builder: ParamManagerBuilder, + * ) => ParamManagerBuilder} + */ const addNat = (name, value, builder) => { const assertNat = v => { assert.typeof(v, 'bigint'); @@ -202,22 +212,26 @@ const makeParamManagerBuilder = (publisherKit, zoe) => { return builder; }; - /** @type {( - name: string, - value: Ratio, - builder: ParamManagerBuilder, -) => ParamManagerBuilder} */ + /** + * @type {( + * name: string, + * value: Ratio, + * builder: ParamManagerBuilder, + * ) => ParamManagerBuilder} + */ const addRatio = (name, value, builder) => { const assertBrandedRatio = makeAssertBrandedRatio(name, value); buildCopyParam(name, value, assertBrandedRatio, ParamTypes.RATIO); return builder; }; - /** @type {( - name: string, - value: import('@endo/marshal').CopyRecord, - builder: ParamManagerBuilder, -) => ParamManagerBuilder} */ + /** + * @type {( + * name: string, + * value: import('@endo/marshal').CopyRecord, + * builder: ParamManagerBuilder, + * ) => ParamManagerBuilder} + */ const addRecord = (name, value, builder) => { const assertRecord = v => { passStyleOf(v); @@ -227,42 +241,50 @@ const makeParamManagerBuilder = (publisherKit, zoe) => { return builder; }; - /** @type {( - name: string, - value: string, - builder: ParamManagerBuilder, -) => ParamManagerBuilder} */ + /** + * @type {( + * name: string, + * value: string, + * builder: ParamManagerBuilder, + * ) => ParamManagerBuilder} + */ const addString = (name, value, builder) => { const assertString = v => assert.typeof(v, 'string'); buildCopyParam(name, value, assertString, ParamTypes.STRING); return builder; }; - /** @type {( - name: string, - value: import('@agoric/time').Timestamp, - builder: ParamManagerBuilder, -) => ParamManagerBuilder} */ + /** + * @type {( + * name: string, + * value: import('@agoric/time').Timestamp, + * builder: ParamManagerBuilder, + * ) => ParamManagerBuilder} + */ const addTimestamp = (name, value, builder) => { buildCopyParam(name, value, assertTimestamp, ParamTypes.TIMESTAMP); return builder; }; - /** @type {( - name: string, - value: import('@agoric/time').RelativeTime, - builder: ParamManagerBuilder, -) => ParamManagerBuilder} */ + /** + * @type {( + * name: string, + * value: import('@agoric/time').RelativeTime, + * builder: ParamManagerBuilder, + * ) => ParamManagerBuilder} + */ const addRelativeTime = (name, value, builder) => { buildCopyParam(name, value, assertRelativeTime, ParamTypes.RELATIVE_TIME); return builder; }; - /** @type {( - name: string, - value: any, - builder: ParamManagerBuilder, -) => ParamManagerBuilder} */ + /** + * @type {( + * name: string, + * value: any, + * builder: ParamManagerBuilder, + * ) => ParamManagerBuilder} + */ const addUnknown = (name, value, builder) => { const assertUnknown = _v => true; buildCopyParam(name, value, assertUnknown, ParamTypes.UNKNOWN); @@ -367,11 +389,13 @@ const makeParamManagerBuilder = (publisherKit, zoe) => { return name; }; - /** @type {( - name: string, - value: Invitation, - builder: ParamManagerBuilder, -) => ParamManagerBuilder} */ + /** + * @type {( + * name: string, + * value: Invitation, + * builder: ParamManagerBuilder, + * ) => ParamManagerBuilder} + */ const addInvitation = (name, value, builder) => { assertKeywordName(name); value !== null || Fail`param ${q(name)} must be defined`; diff --git a/packages/governance/src/contractGovernorKit.js b/packages/governance/src/contractGovernorKit.js index 511c4ad3f64..ca72e23cb33 100644 --- a/packages/governance/src/contractGovernorKit.js +++ b/packages/governance/src/contractGovernorKit.js @@ -170,11 +170,13 @@ export const prepareContractGovernorKit = (baggage, powers) => { */ replaceElectorate(poserInvitation) { const { creatorFacet } = this.state; - /** @type {Promise< - import('./contractGovernance/typedParamManager.js').TypedParamManager<{ - Electorate: 'invitation'; - }> ->} */ + /** + * @type {Promise< + * import('./contractGovernance/typedParamManager.js').TypedParamManager<{ + * Electorate: 'invitation'; + * }> + * >} + */ // eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error -- the build config doesn't expect an error here // @ts-ignore cast const paramMgr = E(E(creatorFacet).getParamMgrRetriever()).get({ diff --git a/packages/governance/src/contractHelper.js b/packages/governance/src/contractHelper.js index 4dc91f54cf9..62411e15317 100644 --- a/packages/governance/src/contractHelper.js +++ b/packages/governance/src/contractHelper.js @@ -158,10 +158,12 @@ const facetHelpers = (zcf, paramManager) => { * @param {LCF} limitedCreatorFacet */ const makeVirtualGovernorFacet = limitedCreatorFacet => { - /** @type {import('@agoric/swingset-liveslots').FunctionsPlusContext< - unknown, - GovernedCreatorFacet ->} */ + /** + * @type {import('@agoric/swingset-liveslots').FunctionsPlusContext< + * unknown, + * GovernedCreatorFacet + * >} + */ const governorFacet = harden({ getParamMgrRetriever: () => Far('paramRetriever', { get: () => paramManager }), diff --git a/packages/governance/src/electorateTools.js b/packages/governance/src/electorateTools.js index 2bfa61b019f..630724d3bcc 100644 --- a/packages/governance/src/electorateTools.js +++ b/packages/governance/src/electorateTools.js @@ -38,11 +38,13 @@ const startCounter = async ( const { deadline } = questionSpec.closingRule; // facets of the voteCounter. creatorInvitation and adminFacet not used - /** @type {{ - creatorFacet: VoteCounterCreatorFacet; - publicFacet: VoteCounterPublicFacet; - instance: Instance; -}} */ + /** + * @type {{ + * creatorFacet: VoteCounterCreatorFacet; + * publicFacet: VoteCounterPublicFacet; + * instance: Instance; + * }} + */ const { creatorFacet, publicFacet, instance } = await E( zcf.getZoeService(), ).startInstance( diff --git a/packages/governance/src/types-ambient.js b/packages/governance/src/types-ambient.js index 907d2906bb2..96b26765d07 100644 --- a/packages/governance/src/types-ambient.js +++ b/packages/governance/src/types-ambient.js @@ -703,8 +703,7 @@ */ /** - * @callback CreatedQuestion Was this question created by this - * ContractGovernor? + * @callback CreatedQuestion Was this question created by this ContractGovernor? * @param {Instance} questionInstance * @returns {boolean} */ diff --git a/packages/governance/test/swingsetTests/committeeBinary/vat-voter.js b/packages/governance/test/swingsetTests/committeeBinary/vat-voter.js index 5fd4d2fa5db..209fbd84cf9 100644 --- a/packages/governance/test/swingsetTests/committeeBinary/vat-voter.js +++ b/packages/governance/test/swingsetTests/committeeBinary/vat-voter.js @@ -40,9 +40,11 @@ const verify = async (log, issue, electoratePublicFacet, instances) => { const build = async (log, zoe) => { return Far('voter', { createVoter: async (name, invitation, choice) => { - /** @type {import('@agoric/zoe/src/zoeService/utils.js').Instance< - typeof import('@agoric/governance/src/committee.js').start ->} */ + /** + * @type {import('@agoric/zoe/src/zoeService/utils.js').Instance< + * typeof import('@agoric/governance/src/committee.js').start + * >} + */ const electorateInstance = await E(zoe).getInstance(invitation); const electoratePublicFacet = E(zoe).getPublicFacet(electorateInstance); const seat = E(zoe).offer(invitation); diff --git a/packages/internal/src/callback.js b/packages/internal/src/callback.js index 6c0307df441..6f1646d7d13 100644 --- a/packages/internal/src/callback.js +++ b/packages/internal/src/callback.js @@ -30,8 +30,10 @@ const ownKeys = * @typedef {import('./types').SyncCallback} SyncCallback */ -/** @template T @typedef {import('@endo/eventual-send').RemotableBrand<{}, T> & - T} Farable */ +/** + * @template T @typedef {import('@endo/eventual-send').RemotableBrand<{}, T> & + * T} Farable + */ /** * @param {unknown} key diff --git a/packages/internal/src/lib-chainStorage.js b/packages/internal/src/lib-chainStorage.js index 0bbb2449572..f9b9e274c4b 100644 --- a/packages/internal/src/lib-chainStorage.js +++ b/packages/internal/src/lib-chainStorage.js @@ -188,10 +188,12 @@ export const prepareChainStorageNode = zone => { args: [path], }); }, - /** @type {( - name: string, - childNodeOptions?: { sequence?: boolean }, -) => StorageNode} */ + /** + * @type {( + * name: string, + * childNodeOptions?: { sequence?: boolean }, + * ) => StorageNode} + */ makeChildNode(name, childNodeOptions = {}) { const { sequence, path, messenger } = this.state; assertPathSegment(name); diff --git a/packages/internal/src/storage-test-utils.js b/packages/internal/src/storage-test-utils.js index 7047b8c87ac..2d89c0a8f94 100644 --- a/packages/internal/src/storage-test-utils.js +++ b/packages/internal/src/storage-test-utils.js @@ -222,9 +222,11 @@ export const makeMockChainStorageRoot = () => { */ getBody: (path, marshaller = defaultMarshaller, index = -1) => { data.size || Fail`no data in storage`; - /** @type {ReturnType< - typeof import('@endo/marshal').makeMarshal ->['fromCapData']} */ + /** + * @type {ReturnType< + * typeof import('@endo/marshal').makeMarshal + * >['fromCapData']} + */ const fromCapData = (...args) => Reflect.apply(marshaller.fromCapData, marshaller, args); return unmarshalFromVstorage(data, path, fromCapData, index); diff --git a/packages/internal/src/testing-utils.js b/packages/internal/src/testing-utils.js index 8bbd7f83100..9b5e4d47349 100644 --- a/packages/internal/src/testing-utils.js +++ b/packages/internal/src/testing-utils.js @@ -1,5 +1,7 @@ -/** @file note this cannot be called test-utils.js due to - https://github.com/Agoric/agoric-sdk/issues/7503 */ +/** + * @file note this cannot be called test-utils.js due to + * https://github.com/Agoric/agoric-sdk/issues/7503 + */ /* global setImmediate */ /** diff --git a/packages/internal/src/utils.js b/packages/internal/src/utils.js index 2f83cfb1d2c..ce3a1b9a34a 100644 --- a/packages/internal/src/utils.js +++ b/packages/internal/src/utils.js @@ -303,9 +303,11 @@ export const untilTrue = produce => /** @type {(xs: X[], ys: Y[]) => [X, Y][]} */ export const zip = (xs, ys) => harden(xs.map((x, i) => [x, ys[+i]])); -/** @type {>>( - obj: T, -) => Promise<{ [K in keyof T]: Awaited }>} */ +/** + * @type {>>( + * obj: T, + * ) => Promise<{ [K in keyof T]: Awaited }>} + */ export const allValues = async obj => { const resolved = await Promise.all(values(obj)); // @ts-expect-error cast @@ -325,9 +327,11 @@ export const synchronizedTee = (sourceStream, readerCount) => { /** @type {IteratorReturnResult | undefined} */ let doneResult; - /** @typedef {IteratorResult< - (value: PromiseLike>) => void ->} QueuePayload */ + /** + * @typedef {IteratorResult< + * (value: PromiseLike>) => void + * >} QueuePayload + */ /** @type {import('@endo/stream').AsyncQueue[]} */ const queues = []; @@ -387,17 +391,21 @@ export const synchronizedTee = (sourceStream, readerCount) => { /** @type {AsyncGenerator} */ const reader = harden({ async next() { - /** @type {import('@endo/promise-kit').PromiseKit< - IteratorResult ->} */ + /** + * @type {import('@endo/promise-kit').PromiseKit< + * IteratorResult + * >} + */ const { promise, resolve } = makePromiseKit(); queue.put({ value: resolve, done: false }); return promise; }, async return() { - /** @type {import('@endo/promise-kit').PromiseKit< - IteratorResult ->} */ + /** + * @type {import('@endo/promise-kit').PromiseKit< + * IteratorResult + * >} + */ const { promise, resolve } = makePromiseKit(); queue.put({ value: resolve, done: true }); return promise; diff --git a/packages/internal/test/test-callback.js b/packages/internal/test/test-callback.js index 0fef14ded22..8fb8e75e6db 100644 --- a/packages/internal/test/test-callback.js +++ b/packages/internal/test/test-callback.js @@ -18,9 +18,11 @@ test('near function callbacks', t => { const cb0 = cb.makeSyncFunctionCallback(f); t.deepEqual(cb0, { target: f, bound: [], isSync: true }); - /** @type {import('../src/callback').SyncCallback< - (b: number, c: string) => string ->} */ + /** + * @type {import('../src/callback').SyncCallback< + * (b: number, c: string) => string + * >} + */ const cb1 = cb.makeSyncFunctionCallback(f, 9); t.deepEqual(cb1, { target: f, bound: [9], isSync: true }); @@ -41,9 +43,11 @@ test('near function callbacks', t => { t.is(cb.callSync(cb1, 10, 'go'), '19go'); t.is(cb.callSync(cb2, 'go'), '19go'); - const cbp2 = /** @type {import('../src/callback').SyncCallback< - (...args: unknown[]) => any ->} */ ({ + const cbp2 = /** + * @type {import('../src/callback').SyncCallback< + * (...args: unknown[]) => any + * >} + */ ({ target: Promise.resolve(f), methodName: undefined, bound: [9, 10], @@ -79,9 +83,11 @@ test('near method callbacks', t => { const cb0 = cb.makeSyncMethodCallback(o, 'm1'); t.deepEqual(cb0, { target: o, methodName: 'm1', bound: [], isSync: true }); - /** @type {import('../src/callback').SyncCallback< - (b: number, c: string) => string ->} */ + /** + * @type {import('../src/callback').SyncCallback< + * (b: number, c: string) => string + * >} + */ const cb1 = cb.makeSyncMethodCallback(o, 'm1', 9); t.deepEqual(cb1, { target: o, methodName: 'm1', bound: [9], isSync: true }); @@ -148,9 +154,11 @@ test('far method callbacks', async t => { }, }); - /** @type {import('../src/callback').Callback< - (c: string) => Promise ->} */ + /** + * @type {import('../src/callback').Callback< + * (c: string) => Promise + * >} + */ const cbp2 = cb.makeMethodCallback(Promise.resolve(o), 'm1', 9, 10); t.like(cbp2, { methodName: 'm1', bound: [9, 10] }); t.assert(cbp2.target instanceof Promise); @@ -158,9 +166,11 @@ test('far method callbacks', async t => { t.assert(p2r instanceof Promise); t.is(await p2r, '19go'); - /** @type {import('../src/callback').Callback< - (c: string) => Promise ->} */ + /** + * @type {import('../src/callback').Callback< + * (c: string) => Promise + * >} + */ const cbp3 = cb.makeMethodCallback(Promise.resolve(o), m2, 9, 10); t.like(cbp3, { methodName: m2, bound: [9, 10] }); t.assert(cbp3.target instanceof Promise); @@ -182,9 +192,11 @@ test('far function callbacks', async t => { */ const f = async (a, b, c) => `${a + b}${c}`; - /** @type {import('../src/callback').Callback< - (c: string) => Promise ->} */ + /** + * @type {import('../src/callback').Callback< + * (c: string) => Promise + * >} + */ const cbp2 = cb.makeFunctionCallback(Promise.resolve(f), 9, 10); t.like(cbp2, { bound: [9, 10] }); t.assert(cbp2.target instanceof Promise); diff --git a/packages/notifier/src/publish-kit.js b/packages/notifier/src/publish-kit.js index a8698e5c4d1..3ccd2524079 100644 --- a/packages/notifier/src/publish-kit.js +++ b/packages/notifier/src/publish-kit.js @@ -250,10 +250,12 @@ const getEphemeralKey = facets => facets.publisher; * (undefined when the publish kit has terminated) */ -/** @type {WeakMap< - DurablePublishKitEphemeralKey, - DurablePublishKitEphemeralData ->} */ +/** + * @type {WeakMap< + * DurablePublishKitEphemeralKey, + * DurablePublishKitEphemeralData + * >} + */ const durablePublishKitEphemeralData = new WeakMap(); /** diff --git a/packages/notifier/src/subscribe.js b/packages/notifier/src/subscribe.js index 762dda50aac..280b40d6be0 100644 --- a/packages/notifier/src/subscribe.js +++ b/packages/notifier/src/subscribe.js @@ -83,8 +83,8 @@ export const subscribe = itP => * * @template T * @param {ERef>} topic - * @param {ERef>} nextCellP PublicationRecord - * corresponding with the first iteration result + * @param {ERef>} nextCellP PublicationRecord corresponding + * with the first iteration result * @returns {ForkableAsyncIterableIterator} */ const makeEachIterator = (topic, nextCellP) => { diff --git a/packages/notifier/src/types-ambient.js b/packages/notifier/src/types-ambient.js index 5f8b39c1518..58b7832f3be 100644 --- a/packages/notifier/src/types-ambient.js +++ b/packages/notifier/src/types-ambient.js @@ -292,8 +292,10 @@ // ///////////////////////////////////////////////////////////////////////////// -/** @template [Slot=unknown] @typedef {import('@endo/marshal').Marshal} - Marshaller */ +/** + * @template [Slot=unknown] @typedef {import('@endo/marshal').Marshal} + * Marshaller + */ /** @typedef {Pick} Unserializer */ /** diff --git a/packages/notifier/test/test-publish-kit.js b/packages/notifier/test/test-publish-kit.js index 453213fbea0..d26a7610185 100644 --- a/packages/notifier/test/test-publish-kit.js +++ b/packages/notifier/test/test-publish-kit.js @@ -96,10 +96,12 @@ const verifyPublishKit = test.macro(async (t, makePublishKit) => { t.deepEqual(ownKeys(publishKit).sort(), ['publisher', 'subscriber']); const { publisher, subscriber } = publishKit; - /** @type {Map< - PublicationRecord['publishCount'], - PublicationRecord ->} */ + /** + * @type {Map< + * PublicationRecord['publishCount'], + * PublicationRecord + * >} + */ const cells = new Map(); const getLatestPromises = () => { const promises = [ @@ -251,12 +253,14 @@ test('durable publish kit upgrade trauma (full-vat integration)', async t => { }; const { kernelStorage } = initSwingStore(); const { kernel: kernelBundle, ...kernelBundles } = await buildKernelBundles(); - const initOpts = /** @type {{ - kernelBundles: Record< - string, - import('@agoric/swingset-vat/src/types-external.js').Bundle - >; -}} */ ({ + const initOpts = /** + * @type {{ + * kernelBundles: Record< + * string, + * import('@agoric/swingset-vat/src/types-external.js').Bundle + * >; + * }} + */ ({ kernelBundles, }); const runtimeOpts = { kernelBundle }; diff --git a/packages/smart-wallet/src/smartWallet.js b/packages/smart-wallet/src/smartWallet.js index d340c26d0ee..b579bfc751f 100644 --- a/packages/smart-wallet/src/smartWallet.js +++ b/packages/smart-wallet/src/smartWallet.js @@ -651,14 +651,16 @@ export const prepareSmartWallet = (baggage, shared) => { } } }, - /** @type {( - offerId: string, - invitationAmount: Amount<'set'>, - invitationMakers: import('./types').InvitationMakers, - publicSubscribers?: - | import('./types').PublicSubscribers - | import('@agoric/zoe/src/contractSupport').TopicsRecord, -) => Promise} */ + /** + * @type {( + * offerId: string, + * invitationAmount: Amount<'set'>, + * invitationMakers: import('./types').InvitationMakers, + * publicSubscribers?: + * | import('./types').PublicSubscribers + * | import('@agoric/zoe/src/contractSupport').TopicsRecord, + * ) => Promise} + */ onNewContinuingOffer: async ( offerId, invitationAmount, diff --git a/packages/smart-wallet/src/utils.js b/packages/smart-wallet/src/utils.js index 9860f31ade5..9e49068da91 100644 --- a/packages/smart-wallet/src/utils.js +++ b/packages/smart-wallet/src/utils.js @@ -9,10 +9,12 @@ const trace = makeTracer('WUTIL', false); /** @param {Brand<'set'>} [invitationBrand] */ export const makeWalletStateCoalescer = (invitationBrand = undefined) => { - /** @type {Map< - import('./offers').OfferId, - import('./offers').OfferStatus ->} */ + /** + * @type {Map< + * import('./offers').OfferId, + * import('./offers').OfferStatus + * >} + */ const offerStatuses = new Map(); /** @type {Map} */ const balances = new Map(); @@ -31,8 +33,10 @@ export const makeWalletStateCoalescer = (invitationBrand = undefined) => { */ const invitationsReceived = new Map(); - /** @param {import('./smartWallet').UpdateRecord | {}} updateRecord newer than - previous */ + /** + * @param {import('./smartWallet').UpdateRecord | {}} updateRecord newer than + * previous + */ const update = updateRecord => { if (!('updated' in updateRecord)) { return; diff --git a/packages/smart-wallet/src/walletFactory.js b/packages/smart-wallet/src/walletFactory.js index a01ebbf1284..587f7cc81f3 100644 --- a/packages/smart-wallet/src/walletFactory.js +++ b/packages/smart-wallet/src/walletFactory.js @@ -268,9 +268,11 @@ export const prepare = async (zcf, privateArgs, baggage) => { provideSmartWallet(address, bank, namesByAddressAdmin) { let isNew = false; - /** @type {( - address: string, -) => Promise} */ + /** + * @type {( + * address: string, + * ) => Promise} + */ const maker = async _address => { const invitationPurse = await E(invitationIssuer).makeEmptyPurse(); const walletStorageNode = E(storageNode).makeChildNode(address); diff --git a/packages/smart-wallet/test/supports.js b/packages/smart-wallet/test/supports.js index 6f82f87f3fe..250fd3243bb 100644 --- a/packages/smart-wallet/test/supports.js +++ b/packages/smart-wallet/test/supports.js @@ -92,12 +92,14 @@ const makeFakeBridgeManager = () => */ export const makeMockTestSpace = async log => { const space = /** @type {any} */ (makePromiseSpace(log)); - const { consume, produce } = /** @type {BootstrapPowers & { - consume: { - loadVat: (n: 'mints') => MintsVat; - loadCriticalVat: (n: 'mints') => MintsVat; - }; -}} */ (space); + const { consume, produce } = /** + * @type {BootstrapPowers & { + * consume: { + * loadVat: (n: 'mints') => MintsVat; + * loadCriticalVat: (n: 'mints') => MintsVat; + * }; + * }} + */ (space); const { agoricNames, agoricNamesAdmin, spaces } = await makeAgoricNamesAccess(); produce.agoricNames.resolve(agoricNames); diff --git a/packages/smart-wallet/test/swingsetTests/upgradeWalletFactory/walletFactory-V2.js b/packages/smart-wallet/test/swingsetTests/upgradeWalletFactory/walletFactory-V2.js index ac036cf0550..a6e1c5bccfe 100644 --- a/packages/smart-wallet/test/swingsetTests/upgradeWalletFactory/walletFactory-V2.js +++ b/packages/smart-wallet/test/swingsetTests/upgradeWalletFactory/walletFactory-V2.js @@ -122,9 +122,11 @@ export const prepare = async (zcf, privateArgs, baggage) => { */ provideSmartWallet(address, bank, namesByAddressAdmin) { let makerCalled = false; - /** @type {() => Promise< - import('../../../src/smartWallet').SmartWallet ->} */ + /** + * @type {() => Promise< + * import('../../../src/smartWallet').SmartWallet + * >} + */ const maker = async () => { const invitationPurse = await E(invitationIssuer).makeEmptyPurse(); const walletStorageNode = E(storageNode).makeChildNode(address); diff --git a/packages/smart-wallet/test/test-addAsset.js b/packages/smart-wallet/test/test-addAsset.js index 44bb97546ed..fbb4da851b4 100644 --- a/packages/smart-wallet/test/test-addAsset.js +++ b/packages/smart-wallet/test/test-addAsset.js @@ -19,9 +19,11 @@ const { Fail } = assert; const importSpec = spec => importMetaResolve(spec, import.meta.url).then(u => new URL(u).pathname); -/** @type {import('ava').TestFn< - Awaited> ->} */ +/** + * @type {import('ava').TestFn< + * Awaited> + * >} + */ const test = anyTest; test.before(async t => { @@ -132,9 +134,11 @@ const the = async xP => { const IST_UNIT = 1_000_000n; const CENT = IST_UNIT / 100n; -/** @param {import('ava').ExecutionContext< - Awaited> ->} t */ +/** + * @param {import('ava').ExecutionContext< + * Awaited> + * >} t + */ const makeScenario = t => { /** * A player and their user agent (wallet UI, signer) @@ -527,9 +531,11 @@ test.serial('non-vbank asset: give before deposit', async t => { vsGet(`agoricNames.brand`); vsGet(`agoricNames.instance`); - /** @type {import('../src/smartWallet.js').UpdateRecord & { - updated: 'offerStatus'; -}} */ + /** + * @type {import('../src/smartWallet.js').UpdateRecord & { + * updated: 'offerStatus'; + * }} + */ let offerUpdate; let ix = -1; for (;;) { diff --git a/packages/smart-wallet/test/test-startWalletFactory.js b/packages/smart-wallet/test/test-startWalletFactory.js index fc24c8da24d..40686c92507 100644 --- a/packages/smart-wallet/test/test-startWalletFactory.js +++ b/packages/smart-wallet/test/test-startWalletFactory.js @@ -8,9 +8,11 @@ import { makeMockTestSpace } from './supports.js'; import '@agoric/vats/src/core/types-ambient.js'; -/** @type {import('ava').TestFn< - Awaited> ->} */ +/** + * @type {import('ava').TestFn< + * Awaited> + * >} + */ const test = anyTest; const makeTestContext = async () => { diff --git a/packages/smart-wallet/test/test-walletFactory.js b/packages/smart-wallet/test/test-walletFactory.js index 5495603682a..a24c3b2dba8 100644 --- a/packages/smart-wallet/test/test-walletFactory.js +++ b/packages/smart-wallet/test/test-walletFactory.js @@ -13,9 +13,11 @@ import { import '@agoric/vats/src/core/types-ambient.js'; -/** @type {import('ava').TestFn< - Awaited> ->} */ +/** + * @type {import('ava').TestFn< + * Awaited> + * >} + */ const test = anyTest; const mockAddress1 = 'mockAddress1'; diff --git a/packages/swing-store/src/swingStore.js b/packages/swing-store/src/swingStore.js index a42e721da0a..af95fe0c5eb 100644 --- a/packages/swing-store/src/swingStore.js +++ b/packages/swing-store/src/swingStore.js @@ -649,9 +649,8 @@ export function openSwingStore(dirPath, options = {}) { * * @param {string} dirPath Path to a directory in which database files might be * present. This directory need not actually exist - * @returns {boolean} If the directory is present and contains the files - * created by initSwingStore or openSwingStore, returns true. Else returns - * false. + * @returns {boolean} If the directory is present and contains the files created + * by initSwingStore or openSwingStore, returns true. Else returns false. */ export function isSwingStore(dirPath) { typeof dirPath === 'string' || Fail`dirPath must be a string`; diff --git a/packages/swingset-liveslots/src/virtualObjectManager.js b/packages/swingset-liveslots/src/virtualObjectManager.js index 14df41a0e03..a5197f863e3 100644 --- a/packages/swingset-liveslots/src/virtualObjectManager.js +++ b/packages/swingset-liveslots/src/virtualObjectManager.js @@ -14,8 +14,10 @@ import { checkAndUpdateFacetiousness, } from './facetiousness.js'; -/** @template T @typedef {import('@agoric/vat-data').DefineKindOptions} - DefineKindOptions */ +/** + * @template T @typedef {import('@agoric/vat-data').DefineKindOptions} + * DefineKindOptions + */ const { hasOwn, defineProperty, getOwnPropertyNames, entries } = Object; const { ownKeys } = Reflect; @@ -112,10 +114,12 @@ const LABEL_INSTANCES = (env.DEBUG || '') */ const makeDataCache = syscall => { - /** @type {(baseRef: string) => { - capdatas: any; - valueMap: Map; -}} */ + /** + * @type {(baseRef: string) => { + * capdatas: any; + * valueMap: Map; + * }} + */ const readBacking = baseRef => { const rawState = syscall.vatstoreGet(`vom.${baseRef}`); assert(rawState); @@ -123,10 +127,12 @@ const makeDataCache = syscall => { const valueMap = new Map(); // populated lazily by each state getter return { capdatas, valueMap }; // both mutable }; - /** @type {( - baseRef: string, - value: { capdatas: any; valueMap: Map }, -) => void} */ + /** + * @type {( + * baseRef: string, + * value: { capdatas: any; valueMap: Map }, + * ) => void} + */ const writeBacking = (baseRef, value) => { const rawState = JSON.stringify(value.capdatas); syscall.vatstoreSet(`vom.${baseRef}`, rawState); @@ -632,8 +638,8 @@ export const makeVirtualObjectManager = ( * @param {any} behavior A bag of functions (in the case of a single-faceted * object) or a bag of bags of functions (in the case of a multi-faceted * object) that will become the methods of the object or its facets. - * @param {DefineKindOptions} options Additional options to configure - * the virtual object kind being defined. See the documentation of + * @param {DefineKindOptions} options Additional options to configure the + * virtual object kind being defined. See the documentation of * DefineKindOptions for the meaning of each option. * @param {boolean} isDurable A flag indicating whether or not the newly * defined kind should be a durable kind. @@ -869,10 +875,12 @@ export const makeVirtualObjectManager = ( // (capdata) contents of the virtual-object state record. // dataCache[baseRef] -> { capdatas, valueMap } // valueCD=capdatas[prop], value=valueMap.get(prop) - /** @type {import('./cache.js').Cache<{ - capdatas: any; - valueMap: Map; -}>} */ + /** + * @type {import('./cache.js').Cache<{ + * capdatas: any; + * valueMap: Map; + * }>} + */ const dataCache = makeDataCache(syscall); allCaches.push(dataCache); diff --git a/packages/swingset-xsnap-supervisor/lib/supervisor-helper.js b/packages/swingset-xsnap-supervisor/lib/supervisor-helper.js index cc17a050b37..e24e18553f9 100644 --- a/packages/swingset-xsnap-supervisor/lib/supervisor-helper.js +++ b/packages/swingset-xsnap-supervisor/lib/supervisor-helper.js @@ -94,12 +94,14 @@ function makeSupervisorSyscall(syscallToManager) { // this will be given to liveslots, it should have distinct methods that // return immediate results or throw errors const syscallForVat = { - /** @type {( - target: string, - method: string, - args: SwingSetCapData, - result?: string, -) => unknown} */ + /** + * @type {( + * target: string, + * method: string, + * args: SwingSetCapData, + * result?: string, + * ) => unknown} + */ send: (target, methargs, result) => doSyscall(['send', target, { methargs, result }]), subscribe: vpid => doSyscall(['subscribe', vpid]), diff --git a/packages/swingset-xsnap-supervisor/lib/supervisor-subprocess-xsnap.js b/packages/swingset-xsnap-supervisor/lib/supervisor-subprocess-xsnap.js index cfe92a07a76..ffb3e6f18ed 100644 --- a/packages/swingset-xsnap-supervisor/lib/supervisor-subprocess-xsnap.js +++ b/packages/swingset-xsnap-supervisor/lib/supervisor-subprocess-xsnap.js @@ -185,8 +185,10 @@ function abbreviateReplacer(_, arg) { * @param {ReturnType} port */ function makeWorker(port) { - /** @type {((delivery: VatDeliveryObject) => Promise) - | null} */ + /** + * @type {((delivery: VatDeliveryObject) => Promise) + * | null} + */ let dispatch = null; /** diff --git a/packages/telemetry/src/flight-recorder.js b/packages/telemetry/src/flight-recorder.js index 5cd6c6c11c8..200d95488db 100644 --- a/packages/telemetry/src/flight-recorder.js +++ b/packages/telemetry/src/flight-recorder.js @@ -84,8 +84,8 @@ export const makeMemoryMappedCircularBuffer = async ({ ); /** - * @type {Uint8Array} BufferFromFile mmap()s the file into the process - * address space. + * @type {Uint8Array} BufferFromFile mmap()s the file into the process address + * space. */ const fileBuf = BufferFromFile(filename).Uint8Array(); const header = new DataView(fileBuf.buffer, 0, I_ARENA_START); diff --git a/packages/telemetry/src/make-slog-sender.js b/packages/telemetry/src/make-slog-sender.js index fdb4bd1884f..c95b7c928c9 100644 --- a/packages/telemetry/src/make-slog-sender.js +++ b/packages/telemetry/src/make-slog-sender.js @@ -88,9 +88,11 @@ export const makeSlogSender = async (opts = {}) => { slogSenderModules.map(async moduleIdentifier => import(moduleIdentifier) .then( - /** @param {{ - makeSlogSender: (opts: {}) => Promise; -}} module */ ({ makeSlogSender: maker }) => { + /** + * @param {{ + * makeSlogSender: (opts: {}) => Promise; + * }} module + */ ({ makeSlogSender: maker }) => { if (typeof maker !== 'function') { return Promise.reject( Error(`No 'makeSlogSender' function exported by module`), diff --git a/packages/telemetry/src/slog-sender-pipe-entrypoint.js b/packages/telemetry/src/slog-sender-pipe-entrypoint.js index c42ec46074f..9903e56ba40 100644 --- a/packages/telemetry/src/slog-sender-pipe-entrypoint.js +++ b/packages/telemetry/src/slog-sender-pipe-entrypoint.js @@ -9,9 +9,11 @@ import { makeSlogSender } from './make-slog-sender.js'; const logger = anylogger('slog-sender-pipe-entrypoint'); -/** @type {( - msg: import('./slog-sender-pipe.js').SlogSenderPipeWaitReplies, -) => void} */ +/** + * @type {( + * msg: import('./slog-sender-pipe.js').SlogSenderPipeWaitReplies, + * ) => void} + */ const send = Function.prototype.bind.call(process.send, process); /** diff --git a/packages/telemetry/src/slog-to-otel.js b/packages/telemetry/src/slog-to-otel.js index 819ef618997..685f160bb58 100644 --- a/packages/telemetry/src/slog-to-otel.js +++ b/packages/telemetry/src/slog-to-otel.js @@ -701,9 +701,11 @@ export const makeSlogToOtelKit = (tracer, overrideAttrs = {}) => { if (isReplaying) { break; } - /** @type {{ - ksc: import('@agoric/swingset-vat').KernelSyscallObject; -} & Record} */ + /** + * @type {{ + * ksc: import('@agoric/swingset-vat').KernelSyscallObject; + * } & Record} + */ const { ksc, vsc: _1, ...attrs } = slogAttrs; if (!ksc) { break; diff --git a/packages/vat-data/src/exo-utils.js b/packages/vat-data/src/exo-utils.js index 911f9d9fce6..f6639ab0339 100644 --- a/packages/vat-data/src/exo-utils.js +++ b/packages/vat-data/src/exo-utils.js @@ -9,17 +9,25 @@ import { provide, VatData as globalVatData } from './vat-data-bindings.js'; * @template {Record} [T=Record] * @typedef {import('@endo/patterns').InterfaceGuard} InterfaceGuard */ -/** @template L,R @typedef {import('@endo/eventual-send').RemotableBrand} - RemotableBrand */ +/** + * @template L,R @typedef {import('@endo/eventual-send').RemotableBrand} + * RemotableBrand + */ /** @template T @typedef {import('@endo/far').ERef} ERef */ /** @typedef {import('@agoric/swingset-liveslots').Baggage} Baggage */ -/** @template T @typedef - {import('@agoric/swingset-liveslots').DefineKindOptions} - DefineKindOptions */ -/** @template T @typedef {import('@agoric/swingset-liveslots').KindFacet} - KindFacet */ -/** @template T @typedef {import('@agoric/swingset-liveslots').KindFacets} - KindFacets */ +/** + * @template T @typedef + * {import('@agoric/swingset-liveslots').DefineKindOptions} + * DefineKindOptions + */ +/** + * @template T @typedef {import('@agoric/swingset-liveslots').KindFacet} + * KindFacet + */ +/** + * @template T @typedef {import('@agoric/swingset-liveslots').KindFacets} + * KindFacets + */ /** @typedef {import('@agoric/swingset-liveslots').DurableKindHandle} DurableKindHandle */ /** @typedef {import('@agoric/swingset-liveslots').InterfaceGuardKit} InterfaceGuardKit */ diff --git a/packages/vat-data/src/index.js b/packages/vat-data/src/index.js index c2a8657a64f..e260f74e7aa 100644 --- a/packages/vat-data/src/index.js +++ b/packages/vat-data/src/index.js @@ -43,9 +43,11 @@ export { } from './exo-utils.js'; /** @typedef {import('@agoric/swingset-liveslots').DurableKindHandle} DurableKindHandle */ -/** @template T @typedef - {import('@agoric/swingset-liveslots').DefineKindOptions} - DefineKindOptions */ +/** + * @template T @typedef + * {import('@agoric/swingset-liveslots').DefineKindOptions} + * DefineKindOptions + */ // Copy this type because aliasing it by `import('@agoric/swingset-liveslots').Baggage` // causes this error in typedoc: Expected a symbol for node with kind Identifier diff --git a/packages/vat-data/src/vat-data-bindings.js b/packages/vat-data/src/vat-data-bindings.js index a2961661353..8bf5b064387 100644 --- a/packages/vat-data/src/vat-data-bindings.js +++ b/packages/vat-data/src/vat-data-bindings.js @@ -138,11 +138,13 @@ harden(partialAssign); export const provide = // XXX cast because provideLazy is `any` due to broken type import - /** @type {( - baggage: import('@agoric/swingset-liveslots').Baggage, - key: K, - makeValue: (key: K) => V, -) => V} */ (provideLazy); + /** + * @type {( + * baggage: import('@agoric/swingset-liveslots').Baggage, + * key: K, + * makeValue: (key: K) => V, + * ) => V} + */ (provideLazy); // TODO: Find a good home for this function used by @agoric/vat-data and testing code /** @param {import('@agoric/swingset-liveslots').VatData} VatData */ diff --git a/packages/wallet/api/src/types.js b/packages/wallet/api/src/types.js index a068928444e..86d1a751cf1 100644 --- a/packages/wallet/api/src/types.js +++ b/packages/wallet/api/src/types.js @@ -41,8 +41,8 @@ * (used by existing deploy scripts). * @property {() => Array<[Petname, Purse]>} getPurses Get all the purses (used * by existing deploy scripts). - * @property {(petname: Petname) => Purse} getPurse Get a purse by petname - * (used by existing deploy scripts). + * @property {(petname: Petname) => Purse} getPurse Get a purse by petname (used + * by existing deploy scripts). * @property {() => Marshaller} getMarshaller */ diff --git a/packages/wallet/api/test/test-lib-wallet.js b/packages/wallet/api/test/test-lib-wallet.js index 925a46dd7c8..4ca233f80fc 100644 --- a/packages/wallet/api/test/test-lib-wallet.js +++ b/packages/wallet/api/test/test-lib-wallet.js @@ -978,10 +978,12 @@ test('lib-wallet addOffer for autoswap swap', async t => { ), ); - /** @type {{ - getLiquidityIssuer: () => Issuer<'nat'>; - makeSwapInvitation: () => Invitation; -}} */ + /** + * @type {{ + * getLiquidityIssuer: () => Issuer<'nat'>; + * makeSwapInvitation: () => Invitation; + * }} + */ const publicAPI = await E(t.context.zoe).getPublicFacet( autoswapInstanceHandle, ); @@ -1132,10 +1134,12 @@ test('lib-wallet performAction acceptOffer', async t => { ), ); - /** @type {{ - getLiquidityIssuer: () => Issuer<'nat'>; - makeSwapInvitation: () => Invitation; -}} */ + /** + * @type {{ + * getLiquidityIssuer: () => Issuer<'nat'>; + * makeSwapInvitation: () => Invitation; + * }} + */ const publicAPI = await E(t.context.zoe).getPublicFacet( autoswapInstanceHandle, ); @@ -1274,10 +1278,12 @@ test('addOffer invitationQuery', async t => { ), ); - /** @type {{ - getLiquidityIssuer: () => Issuer<'nat'>; - makeSwapInvitation: () => Invitation; -}} */ + /** + * @type {{ + * getLiquidityIssuer: () => Issuer<'nat'>; + * makeSwapInvitation: () => Invitation; + * }} + */ const publicAPI = await E(t.context.zoe).getPublicFacet( autoswapInstanceHandle, ); @@ -1405,10 +1411,12 @@ test('addOffer offer.invitation', async t => { ), ); - /** @type {{ - getLiquidityIssuer: () => Issuer<'nat'>; - makeSwapInvitation: () => Invitation; -}} */ + /** + * @type {{ + * getLiquidityIssuer: () => Issuer<'nat'>; + * makeSwapInvitation: () => Invitation; + * }} + */ const publicAPI = await E(t.context.zoe).getPublicFacet( autoswapInstanceHandle, ); diff --git a/packages/xsnap/src/avaAssertXS.js b/packages/xsnap/src/avaAssertXS.js index 5a25e9e0e80..7371ab678fe 100644 --- a/packages/xsnap/src/avaAssertXS.js +++ b/packages/xsnap/src/avaAssertXS.js @@ -258,11 +258,13 @@ function makeTester(htest, out) { not(a, b, message = 'should not be identical') { assert(!Object.is(a, b), message); }, - /** @type {( - actual: unknown, - expected: unknown, - message?: string, -) => void} */ + /** + * @type {( + * actual: unknown, + * expected: unknown, + * message?: string, + * ) => void} + */ deepEqual(actual, expected, message = 'should be deep equal') { const delta = deepDifference(actual, expected); assert(delta === null, `${message}: ${JSON.stringify(delta)}`); @@ -276,11 +278,13 @@ function makeTester(htest, out) { like(_a, _b, _message = 'should be like') { throw Error('not implemented'); }, - /** @type {( - fn: () => unknown, - e?: Expectation, - message?: string, -) => void} */ + /** + * @type {( + * fn: () => unknown, + * e?: Expectation, + * message?: string, + * ) => void} + */ throws(fn, expectation, message = `should throw like ${expectation}`) { try { fn(); @@ -300,11 +304,13 @@ function makeTester(htest, out) { } assert(true, message); }, - /** @type {( - thrower: () => Promise, - expectation?: Expectation, - message?: string, -) => Promise} */ + /** + * @type {( + * thrower: () => Promise, + * expectation?: Expectation, + * message?: string, + * ) => Promise} + */ async throwsAsync( thrower, expectation, @@ -319,10 +325,12 @@ function makeTester(htest, out) { assert(!delta, `${message}: ${JSON.stringify(delta)}`); } }, - /** @type {( - thrower: () => Promise, - message?: string, -) => Promise} */ + /** + * @type {( + * thrower: () => Promise, + * message?: string, + * ) => Promise} + */ async notThrowsAsync(nonThrower, message) { await null; try { diff --git a/packages/xsnap/src/avaXS.js b/packages/xsnap/src/avaXS.js index 596da2412a6..f13cfe0baab 100644 --- a/packages/xsnap/src/avaXS.js +++ b/packages/xsnap/src/avaXS.js @@ -20,10 +20,12 @@ import { xsnap } from './xsnap.js'; const avaAssert = `./avaAssertXS.js`; const avaHandler = `./avaHandler.cjs`; -/** @type {( - ref: string, - readFile: typeof import('fs').promises.readFile, -) => Promise} */ +/** + * @type {( + * ref: string, + * readFile: typeof import('fs').promises.readFile, + * ) => Promise} + */ const asset = (ref, readFile) => readFile(new URL(ref, import.meta.url).pathname, 'utf8'); diff --git a/packages/xsnap/src/xsnap.js b/packages/xsnap/src/xsnap.js index 2581123e56a..062a919b9b4 100644 --- a/packages/xsnap/src/xsnap.js +++ b/packages/xsnap/src/xsnap.js @@ -238,17 +238,19 @@ export async function xsnap(options) { throw Error(`${name} exited`); }); - const xsnapProcessStdio = /** @type {[ - undefined, - Readable, - Readable, - Writable, - Readable, - undefined, - undefined, - Readable, - Writable, -]} */ ( + const xsnapProcessStdio = /** + * @type {[ + * undefined, + * Readable, + * Readable, + * Writable, + * Readable, + * undefined, + * undefined, + * Readable, + * Writable, + * ]} + */ ( /** @type {(Readable | Writable | undefined | null)[]} */ ( xsnapProcess.stdio ) diff --git a/packages/zoe/src/contractFacet/zcfMint.js b/packages/zoe/src/contractFacet/zcfMint.js index 08b6f8e6e50..b71c7a69649 100644 --- a/packages/zoe/src/contractFacet/zcfMint.js +++ b/packages/zoe/src/contractFacet/zcfMint.js @@ -79,10 +79,12 @@ export const prepareZcMint = ( getIssuerRecord() { return this.state.mintyIssuerRecord; }, - /** @type {( - gains: Record, - zcfSeat?: ZCFSeat, -) => ZCFSeat} */ + /** + * @type {( + * gains: Record, + * zcfSeat?: ZCFSeat, + * ) => ZCFSeat} + */ mintGains(gains, zcfSeat = makeEmptySeatKit().zcfSeat) { const { mintyIssuerRecord, zoeMint } = this.state; gains = coerceAmountKeywordRecord(gains, getAssetKindByBrand); diff --git a/packages/zoe/src/contractSupport/zoeHelpers.js b/packages/zoe/src/contractSupport/zoeHelpers.js index ef78cef495f..8e94ab87059 100644 --- a/packages/zoe/src/contractSupport/zoeHelpers.js +++ b/packages/zoe/src/contractSupport/zoeHelpers.js @@ -283,8 +283,7 @@ const reverse = (keywordRecord = {}) => { * @param {KeywordKeywordRecord | undefined} keywordMapping Mapping of keywords * used in contractA to keywords to be used in contractB. Note that the * pathway to deposit the payout back to contractA reverses this mapping. - * @param {Proposal} proposal The proposal for the offer to be made to - * contractB + * @param {Proposal} proposal The proposal for the offer to be made to contractB * @param {ZCFSeat} fromSeat The seat in contractA to take the offer payments * from. * @param {ZCFSeat} [toSeat] The seat in contractA to deposit the payout of the diff --git a/packages/zoe/src/zoeService/installationStorage.js b/packages/zoe/src/zoeService/installationStorage.js index eea1be361af..4370476e3f6 100644 --- a/packages/zoe/src/zoeService/installationStorage.js +++ b/packages/zoe/src/zoeService/installationStorage.js @@ -23,10 +23,12 @@ const { Fail, quote: q } = assert; * @param {Baggage} zoeBaggage */ export const makeInstallationStorage = (getBundleCapForID, zoeBaggage) => { - /** @type {WeakMapStore< - Installation, - { bundleCap: BundleCap; bundleID: BundleID } ->} */ + /** + * @type {WeakMapStore< + * Installation, + * { bundleCap: BundleCap; bundleID: BundleID } + * >} + */ const installationsBundleCap = provideDurableWeakMapStore( zoeBaggage, 'installationsBundleCap', @@ -49,10 +51,12 @@ export const makeInstallationStorage = (getBundleCapForID, zoeBaggage) => { }, ); - /** @type {( - bundle: SourceBundle, - bundleLabel?: string, -) => Installation} */ + /** + * @type {( + * bundle: SourceBundle, + * bundleLabel?: string, + * ) => Installation} + */ const makeBundleInstallation = prepareKind( zoeBaggage, 'BundleInstallation', diff --git a/packages/zoe/src/zoeService/types.js b/packages/zoe/src/zoeService/types.js index 48e4c1b7530..eaef53efffc 100644 --- a/packages/zoe/src/zoeService/types.js +++ b/packages/zoe/src/zoeService/types.js @@ -184,9 +184,9 @@ * @template {object} [OR=unknown] * @typedef {object} UserSeat * @property {() => Promise} getProposal - * @property {() => Promise} getPayouts returns a - * promise for a KeywordPaymentRecord containing all the payouts from this - * seat. The promise will resolve after the seat has exited. + * @property {() => Promise} getPayouts returns a promise + * for a KeywordPaymentRecord containing all the payouts from this seat. The + * promise will resolve after the seat has exited. * @property {(keyword: Keyword) => Promise>} getPayout returns a * promise for the Payment corresponding to the indicated keyword. The promise * will resolve after the seat has exited. @@ -205,9 +205,8 @@ * This is numeric to support a planned enhancement called "multiples" which * will allow the return value to be any non-negative number. The promise will * resolve after the seat has exited. - * @property {() => Promise} getFinalAllocation return a promise - * for the final allocation. The promise will resolve after the seat has - * exited. + * @property {() => Promise} getFinalAllocation return a promise for + * the final allocation. The promise will resolve after the seat has exited. * @property {() => Subscriber} getExitSubscriber returns a * subscriber that will be notified when the seat has exited or failed. */ @@ -274,8 +273,8 @@ */ /** - * @typedef {Record} SourceBundle Opaque type for a JSONable - * source bundle + * @typedef {Record} SourceBundle Opaque type for a JSONable source + * bundle */ /** diff --git a/packages/zoe/test/swingsetTests/makeKind/test-makeKind.js b/packages/zoe/test/swingsetTests/makeKind/test-makeKind.js index de42ae9184f..d7d3b7999d2 100644 --- a/packages/zoe/test/swingsetTests/makeKind/test-makeKind.js +++ b/packages/zoe/test/swingsetTests/makeKind/test-makeKind.js @@ -9,9 +9,11 @@ const CONTRACT_FILES = ['minimalMakeKindContract']; const filename = new URL(import.meta.url).pathname; const dirname = path.dirname(filename); -/** @type {import('ava').TestFn<{ - data: { kernelBundles: any; config: any }; -}>} */ +/** + * @type {import('ava').TestFn<{ + * data: { kernelBundles: any; config: any }; + * }>} + */ const test = anyTest; test.before(async t => { diff --git a/packages/zoe/test/swingsetTests/offerArgs/test-offerArgs.js b/packages/zoe/test/swingsetTests/offerArgs/test-offerArgs.js index 0eb9d271abb..3b83beeae52 100644 --- a/packages/zoe/test/swingsetTests/offerArgs/test-offerArgs.js +++ b/packages/zoe/test/swingsetTests/offerArgs/test-offerArgs.js @@ -9,9 +9,11 @@ const CONTRACT_FILES = ['offerArgsUsageContract']; const filename = new URL(import.meta.url).pathname; const dirname = path.dirname(filename); -/** @type {import('ava').TestFn<{ - data: { kernelBundles: any; config: any }; -}>} */ +/** + * @type {import('ava').TestFn<{ + * data: { kernelBundles: any; config: any }; + * }>} + */ const test = anyTest; test.before(async t => { diff --git a/packages/zoe/test/swingsetTests/privateArgs/test-privateArgs.js b/packages/zoe/test/swingsetTests/privateArgs/test-privateArgs.js index ec5f66ce39f..7a3ababdb57 100644 --- a/packages/zoe/test/swingsetTests/privateArgs/test-privateArgs.js +++ b/packages/zoe/test/swingsetTests/privateArgs/test-privateArgs.js @@ -9,9 +9,11 @@ const CONTRACT_FILES = ['privateArgsUsageContract']; const filename = new URL(import.meta.url).pathname; const dirname = path.dirname(filename); -/** @type {import('ava').TestFn<{ - data: { kernelBundles: any; config: any }; -}>} */ +/** + * @type {import('ava').TestFn<{ + * data: { kernelBundles: any; config: any }; + * }>} + */ const test = anyTest; test.before(async t => { diff --git a/packages/zoe/test/swingsetTests/runMint/test-runMint.js b/packages/zoe/test/swingsetTests/runMint/test-runMint.js index 224560b08b3..ce9262d12b1 100644 --- a/packages/zoe/test/swingsetTests/runMint/test-runMint.js +++ b/packages/zoe/test/swingsetTests/runMint/test-runMint.js @@ -12,9 +12,11 @@ const CONTRACT_FILES = ['runMintContract', 'offerArgsUsageContract']; const filename = new URL(import.meta.url).pathname; const dirname = path.dirname(filename); -/** @type {import('ava').TestFn<{ - data: { kernelBundles: any; config: any }; -}>} */ +/** + * @type {import('ava').TestFn<{ + * data: { kernelBundles: any; config: any }; + * }>} + */ const test = anyTest; test.before(async t => { diff --git a/packages/zoe/test/unitTests/contractSupport/test-ratio.js b/packages/zoe/test/unitTests/contractSupport/test-ratio.js index ff5fd726173..ec9f89d3ce6 100644 --- a/packages/zoe/test/unitTests/contractSupport/test-ratio.js +++ b/packages/zoe/test/unitTests/contractSupport/test-ratio.js @@ -487,14 +487,16 @@ test('ratio - oneMinus', t => { const { brand } = makeIssuerKit('moe'); test('ratio - quantize', t => { - /** @type {Array< - [ - numBefore: bigint, - denBefore: bigint, - numAfter: bigint, - denAfter: bigint, - ] ->} */ + /** + * @type {Array< + * [ + * numBefore: bigint, + * denBefore: bigint, + * numAfter: bigint, + * denAfter: bigint, + * ] + * >} + */ const cases = /** @type {const} */ [ [1n, 1n, 1n, 1n], [10n, 10n, 10n, 10n], diff --git a/packages/zoe/test/unitTests/contracts/test-oracle.js b/packages/zoe/test/unitTests/contracts/test-oracle.js index 5bca5c1421f..cb54f32de1e 100644 --- a/packages/zoe/test/unitTests/contracts/test-oracle.js +++ b/packages/zoe/test/unitTests/contracts/test-oracle.js @@ -47,9 +47,11 @@ test.before( // of tests, we can also send the installation to someone // else, and they can use it to create a new contract instance // using the same code. - /** @type {Installation< - import('../../../src/contracts/oracle.js').OracleStart ->} */ + /** + * @type {Installation< + * import('../../../src/contracts/oracle.js').OracleStart + * >} + */ const installation = await E(zoe).installBundleID('b1-oracle'); const feeAmount = AmountMath.make(link.brand, 1000n); diff --git a/packages/zoe/test/unitTests/contracts/test-priceAggregator.js b/packages/zoe/test/unitTests/contracts/test-priceAggregator.js index 1b12d7f685c..818879b95f7 100644 --- a/packages/zoe/test/unitTests/contracts/test-priceAggregator.js +++ b/packages/zoe/test/unitTests/contracts/test-priceAggregator.js @@ -59,9 +59,7 @@ const testStartFn = (zcf, privateArgs) => start(zcf, privateArgs); * @typedef {object} TestContext * @property {ZoeService} zoe * @property {MakeFakePriceOracle} makeFakePriceOracle - * @property {( - * unitValueIn?: bigint, - * ) => Promise< + * @property {(unitValueIn?: bigint) => Promise< * PriceAggregatorKit & { * instance: import('../../../src/zoeService/utils.js').Instance< * typeof testStartFn @@ -117,14 +115,18 @@ test.before('setup aggregator and oracles', async t => { // else, and they can use it to create a new contract instance // using the same code. vatAdminState.installBundle('b1-oracle', oracleBundle); - /** @type {Installation< - import('../../../src/contracts/oracle.js').OracleStart ->} */ + /** + * @type {Installation< + * import('../../../src/contracts/oracle.js').OracleStart + * >} + */ const oracleInstallation = await E(zoe).installBundleID('b1-oracle'); vatAdminState.installBundle('b1-aggregator', aggregatorBundle); - /** @type {Installation< - import('../../../src/contracts/priceAggregator.js').start ->} */ + /** + * @type {Installation< + * import('../../../src/contracts/priceAggregator.js').start + * >} + */ const aggregatorInstallation = await E(zoe).installBundleID('b1-aggregator'); const link = makeIssuerKit('$ATOM'); diff --git a/packages/zoe/test/unitTests/setupBasicMints.js b/packages/zoe/test/unitTests/setupBasicMints.js index cb35e5c1b78..9e5d8ab5ba4 100644 --- a/packages/zoe/test/unitTests/setupBasicMints.js +++ b/packages/zoe/test/unitTests/setupBasicMints.js @@ -22,9 +22,11 @@ export const setup = () => { const { admin: fakeVatAdmin, vatAdminState } = makeFakeVatAdmin(); const zoe = makeZoeForTest(fakeVatAdmin); - /** @type {( - brand: Brand, -) => (value: any) => Amount} */ + /** + * @type {( + * brand: Brand, + * ) => (value: any) => Amount} + */ const makeSimpleMake = brand => value => AmountMath.make(brand, value); const result = { diff --git a/packages/zoe/test/unitTests/test-zoe.js b/packages/zoe/test/unitTests/test-zoe.js index 60ec064900e..66445597e66 100644 --- a/packages/zoe/test/unitTests/test-zoe.js +++ b/packages/zoe/test/unitTests/test-zoe.js @@ -105,9 +105,11 @@ test(`E(zoe).getPublicFacet`, async t => { const contractPath = `${dirname}/../../src/contracts/automaticRefund`; const bundle = await bundleSource(contractPath); vatAdminState.installBundle('b1-refund', bundle); - /** @type {Installation< - import('@agoric/zoe/src/contracts/automaticRefund').start ->} */ + /** + * @type {Installation< + * import('@agoric/zoe/src/contracts/automaticRefund').start + * >} + */ const installation = await E(zoe).installBundleID('b1-refund'); const { publicFacet, instance } = await E(zoe).startInstance(installation); await t.throwsAsync(() => @@ -229,9 +231,11 @@ test(`zoe.getTerms`, async t => { const contractPath = `${dirname}/../../src/contracts/automaticRefund`; const bundle = await bundleSource(contractPath); vatAdminState.installBundle('b1-refund', bundle); - /** @type {Installation< - import('@agoric/zoe/src/contracts/automaticRefund').start ->} */ + /** + * @type {Installation< + * import('@agoric/zoe/src/contracts/automaticRefund').start + * >} + */ const installation = await E(zoe).installBundleID('b1-refund'); const { instance } = await E(zoe).startInstance( installation, diff --git a/packages/zoe/tools/fakePriceAuthority.js b/packages/zoe/tools/fakePriceAuthority.js index 1fe9a00e9cc..80d8ad9c607 100644 --- a/packages/zoe/tools/fakePriceAuthority.js +++ b/packages/zoe/tools/fakePriceAuthority.js @@ -157,10 +157,12 @@ export async function makeFakePriceAuthority(options) { let latestTick; // clients who are waiting for a specific timestamp - /** @type {[ - when: import('@agoric/time').Timestamp, - resolve: (quote: PriceQuote) => void, -][]} */ + /** + * @type {[ + * when: import('@agoric/time').Timestamp, + * resolve: (quote: PriceQuote) => void, + * ][]} + */ let timeClients = []; // Check if a comparison request has been satisfied. diff --git a/packages/zoe/tools/setup-zoe.js b/packages/zoe/tools/setup-zoe.js index e8b303e7d3c..3197959ade7 100644 --- a/packages/zoe/tools/setup-zoe.js +++ b/packages/zoe/tools/setup-zoe.js @@ -38,8 +38,10 @@ export const setUpZoeForTest = async ({ } = {}) => { const { makeFar, makeNear } = makeLoopback('zoeTest'); - /** @type {ReturnType['vatAdminState'] - | undefined} */ + /** + * @type {ReturnType['vatAdminState'] + * | undefined} + */ let vatAdminState; if (!vatAdminSvc) { ({ admin: vatAdminSvc, vatAdminState } = makeFakeVatAdmin( diff --git a/packages/zoe/tools/types-ambient.js b/packages/zoe/tools/types-ambient.js index 88261668749..3da46bda27e 100644 --- a/packages/zoe/tools/types-ambient.js +++ b/packages/zoe/tools/types-ambient.js @@ -2,8 +2,7 @@ /** * @typedef {object} PriceQuote - * @property {Amount<'set'>} quoteAmount Amount whose value is a - * PriceQuoteValue + * @property {Amount<'set'>} quoteAmount Amount whose value is a PriceQuoteValue * @property {ERef>} quotePayment The `quoteAmount` wrapped as a * payment */ @@ -55,8 +54,8 @@ */ /** - * @typedef {object} PriceAuthority An object that mints PriceQuotes and - * handles triggers and notifiers for changes in the price + * @typedef {object} PriceAuthority An object that mints PriceQuotes and handles + * triggers and notifiers for changes in the price * @property {(brandIn: Brand, brandOut: Brand) => ERef>} getQuoteIssuer * Get the ERTP issuer of PriceQuotes for a given brandIn/brandOut pair * @property {( diff --git a/packages/zone/src/virtual.js b/packages/zone/src/virtual.js index d3a9355e2cb..c093e782681 100644 --- a/packages/zone/src/virtual.js +++ b/packages/zone/src/virtual.js @@ -32,10 +32,11 @@ const makeVirtualExo = ( methods, options = undefined, ) => { - const defineKindOptions = - /** @type {import('@agoric/vat-data').DefineKindOptions<{ - self: typeof methods; -}>} */ (options); + const defineKindOptions = /** + * @type {import('@agoric/vat-data').DefineKindOptions<{ + * self: typeof methods; + * }>} + */ (options); const makeInstance = defineVirtualExoClass( label, interfaceGuard,