diff --git a/package-lock.json b/package-lock.json index 9855988..dd13e8a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,10 +12,10 @@ "@dfinity/agent": "^2.1.3", "@dfinity/auth-client": "^2.1.3", "@dfinity/candid": "^2.1.3", - "@dfinity/ic-management": "^5.2.3", + "@dfinity/ic-management": "^5.3.0-next-2024-11-22", "@dfinity/identity": "^2.1.3", "@dfinity/principal": "^2.1.3", - "@junobuild/admin": "^0.0.58", + "@junobuild/admin": "^0.0.58-next-2024-11-22", "@junobuild/cli-tools": "^0.0.16", "@junobuild/config-loader": "^0.0.7", "@junobuild/core-peer": "^0.0.29", @@ -610,15 +610,15 @@ } }, "node_modules/@dfinity/ic-management": { - "version": "5.2.3", - "resolved": "https://registry.npmjs.org/@dfinity/ic-management/-/ic-management-5.2.3.tgz", - "integrity": "sha512-tjZq33m++0D7boHRkVBZvRhsXW3VcZEKZzWws9WAITAwD1DnQXPYDeZHTWCfA4+dlhJ4iUnlKe8s1DOcytw5WQ==", + "version": "5.3.0-next-2024-11-22", + "resolved": "https://registry.npmjs.org/@dfinity/ic-management/-/ic-management-5.3.0-next-2024-11-22.tgz", + "integrity": "sha512-n0O0Hvl7NjTL/KyHzpd9kOSGopn9MyZDOeQKf8ZtbzrM++iRgk7e8UKZaPHevpnxzsm7Xqd0iXvi8a9ZZwBiCA==", "license": "Apache-2.0", "peerDependencies": { - "@dfinity/agent": "^2.0.0", - "@dfinity/candid": "^2.0.0", - "@dfinity/principal": "^2.0.0", - "@dfinity/utils": "^2.6.0" + "@dfinity/agent": "*", + "@dfinity/candid": "*", + "@dfinity/principal": "*", + "@dfinity/utils": "*" } }, "node_modules/@dfinity/identity": { @@ -647,9 +647,9 @@ } }, "node_modules/@dfinity/utils": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/@dfinity/utils/-/utils-2.6.0.tgz", - "integrity": "sha512-HgWi8sUJ8rmNosSTtPunET/t79hdRTSZ/B3+WVBzSkeamlMJcPgPt3cglZzRfLoNYXp0oC8tj38FPCPDtAgTsg==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/@dfinity/utils/-/utils-2.7.0.tgz", + "integrity": "sha512-PPuzoFXwcjPJN0ax9GeKyJaMokq7igDDX8f4YnrBzmYgqhKPntLSg5oBZM/H54mkS/RvZ69+LlxEFSSzULoCKw==", "license": "Apache-2.0", "peer": true, "peerDependencies": { @@ -1316,17 +1316,18 @@ } }, "node_modules/@junobuild/admin": { - "version": "0.0.58", - "resolved": "https://registry.npmjs.org/@junobuild/admin/-/admin-0.0.58.tgz", - "integrity": "sha512-30u877RzZ6MnAUraoNkazn9Ta/T+WfCAKKweoK5QqgoHe566Hi03KOgysR+LxD55shTDcY/mzepxBg6pljZYVQ==", + "version": "0.0.58-next-2024-11-22", + "resolved": "https://registry.npmjs.org/@junobuild/admin/-/admin-0.0.58-next-2024-11-22.tgz", + "integrity": "sha512-uqtRkK/TPr9GqpkUZHX8PGN53T8nRDKtZ5tzJ1je/+vT525MWSAGWC2zVvBu6sGQq4D1TsUmCM1ERLbzcGprqA==", "license": "MIT", "peerDependencies": { - "@dfinity/agent": "^2.1.3", - "@dfinity/identity": "^2.1.3", - "@dfinity/principal": "^2.1.3", + "@dfinity/agent": "*", + "@dfinity/ic-management": "*", + "@dfinity/identity": "*", + "@dfinity/principal": "*", "@junobuild/config": "*", "@junobuild/utils": "*", - "semver": "7.*" + "semver": "*" } }, "node_modules/@junobuild/cli-tools": { @@ -7055,9 +7056,9 @@ "requires": {} }, "@dfinity/ic-management": { - "version": "5.2.3", - "resolved": "https://registry.npmjs.org/@dfinity/ic-management/-/ic-management-5.2.3.tgz", - "integrity": "sha512-tjZq33m++0D7boHRkVBZvRhsXW3VcZEKZzWws9WAITAwD1DnQXPYDeZHTWCfA4+dlhJ4iUnlKe8s1DOcytw5WQ==", + "version": "5.3.0-next-2024-11-22", + "resolved": "https://registry.npmjs.org/@dfinity/ic-management/-/ic-management-5.3.0-next-2024-11-22.tgz", + "integrity": "sha512-n0O0Hvl7NjTL/KyHzpd9kOSGopn9MyZDOeQKf8ZtbzrM++iRgk7e8UKZaPHevpnxzsm7Xqd0iXvi8a9ZZwBiCA==", "requires": {} }, "@dfinity/identity": { @@ -7079,9 +7080,9 @@ } }, "@dfinity/utils": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/@dfinity/utils/-/utils-2.6.0.tgz", - "integrity": "sha512-HgWi8sUJ8rmNosSTtPunET/t79hdRTSZ/B3+WVBzSkeamlMJcPgPt3cglZzRfLoNYXp0oC8tj38FPCPDtAgTsg==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/@dfinity/utils/-/utils-2.7.0.tgz", + "integrity": "sha512-PPuzoFXwcjPJN0ax9GeKyJaMokq7igDDX8f4YnrBzmYgqhKPntLSg5oBZM/H54mkS/RvZ69+LlxEFSSzULoCKw==", "peer": true, "requires": {} }, @@ -7439,9 +7440,9 @@ } }, "@junobuild/admin": { - "version": "0.0.58", - "resolved": "https://registry.npmjs.org/@junobuild/admin/-/admin-0.0.58.tgz", - "integrity": "sha512-30u877RzZ6MnAUraoNkazn9Ta/T+WfCAKKweoK5QqgoHe566Hi03KOgysR+LxD55shTDcY/mzepxBg6pljZYVQ==", + "version": "0.0.58-next-2024-11-22", + "resolved": "https://registry.npmjs.org/@junobuild/admin/-/admin-0.0.58-next-2024-11-22.tgz", + "integrity": "sha512-uqtRkK/TPr9GqpkUZHX8PGN53T8nRDKtZ5tzJ1je/+vT525MWSAGWC2zVvBu6sGQq4D1TsUmCM1ERLbzcGprqA==", "requires": {} }, "@junobuild/cli-tools": { diff --git a/package.json b/package.json index fe595d4..0436fb8 100644 --- a/package.json +++ b/package.json @@ -26,10 +26,10 @@ "@dfinity/agent": "^2.1.3", "@dfinity/auth-client": "^2.1.3", "@dfinity/candid": "^2.1.3", - "@dfinity/ic-management": "^5.2.3", + "@dfinity/ic-management": "^5.3.0-next-2024-11-22", "@dfinity/identity": "^2.1.3", "@dfinity/principal": "^2.1.3", - "@junobuild/admin": "^0.0.58", + "@junobuild/admin": "^0.0.58-next-2024-11-22", "@junobuild/cli-tools": "^0.0.16", "@junobuild/config-loader": "^0.0.7", "@junobuild/core-peer": "^0.0.29", diff --git a/src/services/upgrade/upgrade-assert.services.ts b/src/services/upgrade/upgrade-assert.services.ts index 41ee96d..9a78b1e 100644 --- a/src/services/upgrade/upgrade-assert.services.ts +++ b/src/services/upgrade/upgrade-assert.services.ts @@ -5,8 +5,8 @@ import {cyan, yellow} from 'kleur'; import {type UpgradeWasm, type UpgradeWasmModule} from '../../types/upgrade'; import {NEW_CMD_LINE, confirmAndExit} from '../../utils/prompt.utils'; -const wasmBuildType = async ({wasm_module}: UpgradeWasmModule): Promise => { - const buffer = Buffer.from(wasm_module); +const wasmBuildType = async ({wasmModule}: UpgradeWasmModule): Promise => { + const buffer = Buffer.from(wasmModule); const wasm = isGzip(buffer) ? await gunzipFile({ @@ -28,7 +28,7 @@ const wasmBuildType = async ({wasm_module}: UpgradeWasmModule): Promise { // TODO: Workaround for agent-js. Disable console.warn. // See https://github.com/dfinity/agent-js/issues/843 @@ -37,7 +37,7 @@ export const assertSatelliteBuildType = async ({ globalThis.console.warn = (): null => null; const [wasmTypeResult, satelliteTypeResult] = await Promise.allSettled([ - wasmBuildType({wasm_module}), + wasmBuildType({wasmModule}), satelliteBuildType({ satellite }) diff --git a/src/services/upgrade/upgrade.mission-control.services.ts b/src/services/upgrade/upgrade.mission-control.services.ts index 4d7c47a..5bade65 100644 --- a/src/services/upgrade/upgrade.mission-control.services.ts +++ b/src/services/upgrade/upgrade.mission-control.services.ts @@ -8,6 +8,7 @@ import {isNullish} from '@junobuild/utils'; import {cyan, red} from 'kleur'; import {getCliMissionControl} from '../../configs/cli.config'; import {MISSION_CONTROL_WASM_NAME} from '../../constants/constants'; +import type {UpgradeWasmModule} from '../../types/upgrade'; import {actorParameters} from '../../utils/actor.utils'; import {NEW_CMD_LINE} from '../../utils/prompt.utils'; import {selectVersion, upgradeWasmCdn, upgradeWasmLocal} from './upgrade.services'; @@ -73,10 +74,10 @@ const updateMissionControlRelease = async ({ const nocheck = hasArgs({args, options: ['-n', '--nocheck']}); - const upgradeMissionControlWasm = async ({wasm_module}: {wasm_module: Uint8Array}) => { + const upgradeMissionControlWasm = async (params: UpgradeWasmModule) => { await upgradeMissionControlAdmin({ missionControl: missionControlParameters, - wasm_module + ...params }); }; @@ -104,10 +105,10 @@ const upgradeMissionControlCustom = async ({ const nocheck = hasArgs({args, options: ['-n', '--nocheck']}); - const upgradeMissionControlWasm = async ({wasm_module}: {wasm_module: Uint8Array}) => { + const upgradeMissionControlWasm = async (params: UpgradeWasmModule) => { await upgradeMissionControlAdmin({ missionControl: missionControlParameters, - wasm_module + ...params }); }; diff --git a/src/services/upgrade/upgrade.orbiter.services.ts b/src/services/upgrade/upgrade.orbiter.services.ts index 966c0c3..136d472 100644 --- a/src/services/upgrade/upgrade.orbiter.services.ts +++ b/src/services/upgrade/upgrade.orbiter.services.ts @@ -7,6 +7,7 @@ import {hasArgs, nextArg} from '@junobuild/cli-tools'; import {cyan, red} from 'kleur'; import {getCliOrbiters} from '../../configs/cli.config'; import {ORBITER_WASM_NAME} from '../../constants/constants'; +import type {UpgradeWasmModule} from '../../types/upgrade'; import {actorParameters} from '../../utils/actor.utils'; import {NEW_CMD_LINE} from '../../utils/prompt.utils'; import {orbiterKey} from '../../utils/satellite.utils'; @@ -66,10 +67,10 @@ const upgradeOrbiterCustom = async ({ const nocheck = hasArgs({args, options: ['-n', '--nocheck']}); - const upgradeOrbiterWasm = async ({wasm_module}: {wasm_module: Uint8Array}) => { + const upgradeOrbiterWasm = async (params: UpgradeWasmModule) => { await upgradeOrbiterAdmin({ orbiter: orbiterParameters, - wasm_module, + ...params, ...(reset && {reset}) }); }; @@ -100,10 +101,10 @@ const updateOrbiterRelease = async ({ const reset = await confirmReset({args, assetKey: 'orbiter'}); const nocheck = hasArgs({args, options: ['-n', '--nocheck']}); - const upgradeOrbiterWasm = async ({wasm_module}: {wasm_module: Uint8Array}) => { + const upgradeOrbiterWasm = async (params: UpgradeWasmModule) => { await upgradeOrbiterAdmin({ orbiter: orbiterParameters, - wasm_module, + ...params, ...(reset && {reset}) }); }; diff --git a/src/services/upgrade/upgrade.satellite.services.ts b/src/services/upgrade/upgrade.satellite.services.ts index c6eb650..82fe7d7 100644 --- a/src/services/upgrade/upgrade.satellite.services.ts +++ b/src/services/upgrade/upgrade.satellite.services.ts @@ -137,10 +137,10 @@ const executeUpgradeSatellite = async ({ // Information we want to try to redo once the satellite has been updated and resetted const customDomains = reset ? await listCustomDomains({satellite}) : []; - const upgradeSatelliteWasm = async ({wasm_module}: UpgradeWasmModule) => { + const upgradeSatelliteWasm = async (params: UpgradeWasmModule) => { await upgradeSatelliteAdmin({ satellite, - wasm_module, + ...params, // TODO: option to be removed deprecated: compare(currentVersion, '0.0.7') < 0, deprecatedNoScope: compare(currentVersion, '0.0.9') < 0, diff --git a/src/services/upgrade/upgrade.services.ts b/src/services/upgrade/upgrade.services.ts index 6d8894c..1c95e9a 100644 --- a/src/services/upgrade/upgrade.services.ts +++ b/src/services/upgrade/upgrade.services.ts @@ -27,7 +27,7 @@ const executeUpgradeWasm = async ({ nocheck }: UpgradeWasm) => { if (!nocheck) { - await assert?.({wasm_module: wasm}); + await assert?.({wasmModule: wasm}); await assertUpgradeHash({hash, reset}); } @@ -35,7 +35,7 @@ const executeUpgradeWasm = async ({ try { await upgrade({ - wasm_module: wasm + wasmModule: wasm }); } finally { spinner.stop(); diff --git a/src/types/upgrade.ts b/src/types/upgrade.ts index f6a4507..3c3a56d 100644 --- a/src/types/upgrade.ts +++ b/src/types/upgrade.ts @@ -1,6 +1,6 @@ -export interface UpgradeWasmModule { - wasm_module: Uint8Array; -} +import type {InstallCodeParams} from '@dfinity/ic-management'; + +export type UpgradeWasmModule = Pick; export interface UpgradeWasm { wasm: Buffer;