Skip to content

Commit

Permalink
chore(types): correct ManifestBundleRef
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Jun 20, 2023
1 parent 657b621 commit 19f1f60
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { makeHelpers } from '@agoric/deploy-script-support';

/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */
export const defaultProposalBuilder = async ({ publishRef, install }) =>
harden({
sourceSpec: './init-proposal.js',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { makeHelpers } from '@agoric/deploy-script-support';

/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */
export const defaultProposalBuilder = async ({ publishRef, install }) =>
harden({
sourceSpec: './upgrade-proposal.js',
Expand Down
12 changes: 7 additions & 5 deletions packages/deploy-script-support/src/coreProposalBehavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ export const permits = {
* definitions.
*
* @param {object} opts
* @param {{ bundleName: string } | { bundleID: string }} opts.manifestBundleRef
* @param {import('./externalTypes.js').ManifestBundleRef} opts.manifestBundleRef
* @param {[string, ...unknown[]]} opts.getManifestCall
* @param {Record<string, Record<string, unknown>>} [opts.overrideManifest]
* @param {typeof import('@endo/far').E} opts.E
* @param {(...args: unknown[]) => void} [opts.log]
* @param {(ref: unknown) => Promise<unknown>} [opts.restoreRef]
* @param {(ref: import('./externalTypes.js').ManifestBundleRef) => Promise<Installation<unknown>>} [opts.restoreRef]
* @returns {(vatPowers: unknown) => Promise<unknown>}
*/
export const makeCoreProposalBehavior = ({
Expand Down Expand Up @@ -70,13 +70,15 @@ export const makeCoreProposalBehavior = ({
} = allPowers;
const [exportedGetManifest, ...manifestArgs] = getManifestCall;

/** @type {(ref: import('./externalTypes.js').ManifestBundleRef) => Promise<Installation<unknown>>} */
const defaultRestoreRef = async ref => {
// extract-proposal.js creates these records, and bundleName is
// the name under which the bundle was installed into
// config.bundles
const p = ref.bundleName
? E(vatAdminSvc).getBundleIDByName(ref.bundleName)
: ref.bundleID;
const p =
'bundleName' in ref
? E(vatAdminSvc).getBundleIDByName(ref.bundleName)
: ref.bundleID;
const bundleID = await p;
const label = bundleID.slice(0, 8);
return E(zoe).installBundleID(bundleID, label);
Expand Down
9 changes: 4 additions & 5 deletions packages/deploy-script-support/src/externalTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,21 @@ export {};
*/

/**
* @typedef BundleHandle
* @property {string} [bundleName]
* @typedef {{ bundleName: string } | { bundleID: string} } ManifestBundleRef
*/

/**
* @callback PublishBundleRef
* @param {ERef<BundleHandle>} bundle
* @returns {Promise<BundleHandle>}
* @param {ERef<ManifestBundleRef>} bundle
* @returns {Promise<ManifestBundleRef>}
*/

/**
* @callback InstallBundle
* @param {string} srcSpec
* @param {string} bundlePath
* @param {any} [opts]
* @returns {BundleHandle}
* @returns {ManifestBundleRef}
*/

/**
Expand Down

0 comments on commit 19f1f60

Please sign in to comment.