@junobuild/admin 0.0.58-next-2024-11-25.3 → 0.0.58-next-2024-11-26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
1
  import { UpgradeCodeParams } from '../types/upgrade.types';
2
- export declare const upgrade: ({ wasmModule, canisterId, actor, ...rest }: UpgradeCodeParams) => Promise<void>;
2
+ export declare const upgrade: ({ wasmModule, canisterId, actor, onProgress, ...rest }: UpgradeCodeParams) => Promise<void>;
@@ -21,5 +21,5 @@ export type * from './types/build.types';
21
21
  export type * from './types/controllers.types';
22
22
  export type * from './types/customdomain.types';
23
23
  export type * from './types/releases.types';
24
- export type * from './types/upgrade.types';
24
+ export * from './types/upgrade.types';
25
25
  export * from './utils/crypto.utils';
@@ -1,15 +1,15 @@
1
1
  import type { MissionControlParameters } from '../types/actor.types';
2
+ import { UpgradeCodeParams } from '../types/upgrade.types';
2
3
  /**
3
4
  * Upgrades the Mission Control with the provided WASM module.
4
- * @param {Object} params - The parameters for upgrading Mission Control.
5
- * @param {MissionControlParameters} params.missionControl - The Mission Control parameters.
6
- * @param {Uint8Array} params.wasm_module - The WASM module for the upgrade.
7
- * @param {boolean} [params.preClearChunks] - An optional parameter to force clearing the chunks before uploading the chunked WASM. Apply if WASM > 2Mb.
8
- * @throws Will throw an error if no mission control principal is defined.
9
- * @returns {Promise<void>} A promise that resolves when the upgrade is complete.
5
+ * @param {Object} params - The parameters for upgrading the Mission Control.
6
+ * @param {MissionControlParameters} params.missionControl - The Mission Control parameters, including the actor and mission control ID.
7
+ * @param {Uint8Array} params.wasmModule - The WASM module to be installed during the upgrade.
8
+ * @param {boolean} [params.preClearChunks] - Optional. Whether to force clearing chunks before uploading a chunked WASM module. Recommended if the WASM exceeds 2MB.
9
+ * @param {function} [params.onProgress] - Optional. Callback function to report progress during the upgrade process.
10
+ * @throws {Error} Will throw an error if the mission control principal is not defined.
11
+ * @returns {Promise<void>} Resolves when the upgrade process is complete.
10
12
  */
11
- export declare const upgradeMissionControl: ({ missionControl, wasmModule, preClearChunks }: {
13
+ export declare const upgradeMissionControl: ({ missionControl, ...rest }: {
12
14
  missionControl: MissionControlParameters;
13
- wasmModule: Uint8Array;
14
- preClearChunks?: boolean;
15
- }) => Promise<void>;
15
+ } & Pick<UpgradeCodeParams, "wasmModule" | "preClearChunks" | "onProgress">) => Promise<void>;
@@ -1,20 +1,18 @@
1
- import { Principal } from '@dfinity/principal';
2
1
  import type { OrbiterParameters } from '../types/actor.types';
2
+ import { UpgradeCodeParams } from '../types/upgrade.types';
3
3
  /**
4
4
  * Upgrades the Orbiter with the provided WASM module.
5
5
  * @param {Object} params - The parameters for upgrading the Orbiter.
6
- * @param {OrbiterParameters} params.orbiter - The Orbiter parameters.
7
- * @param {Principal} [params.missionControlId] - The optional Mission Control ID in which the WASM chunks can potentially be stored. Useful to reuse chunks across installations.
8
- * @param {Uint8Array} params.wasm_module - The WASM module for the upgrade.
9
- * @param {boolean} [params.reset=false] - Whether to reset the Orbiter (reinstall) instead of upgrading.
10
- * @param {boolean} [params.preClearChunks] - An optional parameter to force clearing the chunks before uploading the chunked WASM. Apply if WASM > 2Mb.
11
- * @throws Will throw an error if no orbiter principal is defined.
12
- * @returns {Promise<void>} A promise that resolves when the upgrade is complete.
6
+ * @param {OrbiterParameters} params.orbiter - The Orbiter parameters, including the actor and orbiter ID.
7
+ * @param {Principal} [params.missionControlId] - Optional. The Mission Control ID to potentially store WASM chunks, enabling reuse across installations.
8
+ * @param {Uint8Array} params.wasmModule - The WASM module to be installed during the upgrade.
9
+ * @param {boolean} [params.reset=false] - Optional. Indicates whether to reset the Orbiter (reinstall) instead of performing an upgrade. Defaults to `false`.
10
+ * @param {boolean} [params.preClearChunks] - Optional. Forces clearing existing chunks before uploading a chunked WASM module. Recommended if the WASM exceeds 2MB.
11
+ * @param {function} [params.onProgress] - Optional. Callback function to track progress during the upgrade process.
12
+ * @throws {Error} Will throw an error if the Orbiter principal is not defined.
13
+ * @returns {Promise<void>} Resolves when the upgrade process is complete.
13
14
  */
14
- export declare const upgradeOrbiter: ({ orbiter, missionControlId, wasmModule, reset, preClearChunks }: {
15
+ export declare const upgradeOrbiter: ({ orbiter, reset, ...rest }: {
15
16
  orbiter: OrbiterParameters;
16
- missionControlId?: Principal;
17
- wasmModule: Uint8Array;
18
17
  reset?: boolean;
19
- preClearChunks?: boolean;
20
- }) => Promise<void>;
18
+ } & Pick<UpgradeCodeParams, "wasmModule" | "missionControlId" | "preClearChunks" | "onProgress">) => Promise<void>;
@@ -1,23 +1,22 @@
1
- import { Principal } from '@dfinity/principal';
2
1
  import type { SatelliteParameters } from '../types/actor.types';
2
+ import { UpgradeCodeParams } from '../types/upgrade.types';
3
3
  /**
4
- * Upgrades the satellite with the provided WASM module.
4
+ * Upgrades a satellite with the provided WASM module.
5
5
  * @param {Object} params - The parameters for upgrading the satellite.
6
- * @param {SatelliteParameters} params.satellite - The satellite parameters.
7
- * @param {Principal} [params.missionControlId] - The optional Mission Control ID in which the WASM chunks can potentially be stored. Useful to reuse chunks across installations.
8
- * @param {Uint8Array} params.wasm_module - The WASM module for the upgrade.
9
- * @param {boolean} params.deprecated - Whether the upgrade is deprecated.
10
- * @param {boolean} params.deprecatedNoScope - Whether the upgrade is deprecated with no scope.
11
- * @param {boolean} [params.reset=false] - Whether to reset the satellite (reinstall) instead of upgrading.
12
- * @param {boolean} [params.preClearChunks] - An optional parameter to force clearing the chunks before uploading the chunked WASM. Apply if WASM > 2Mb.
13
- * @returns {Promise<void>} A promise that resolves when the upgrade is complete.
6
+ * @param {SatelliteParameters} params.satellite - The satellite parameters, including the actor and satellite ID.
7
+ * @param {Principal} [params.missionControlId] - Optional. The Mission Control ID to potentially store WASM chunks, enabling reuse across installations.
8
+ * @param {Uint8Array} params.wasmModule - The WASM module to be installed during the upgrade.
9
+ * @param {boolean} params.deprecated - Indicates whether the upgrade is deprecated.
10
+ * @param {boolean} params.deprecatedNoScope - Indicates whether the upgrade is deprecated and has no scope.
11
+ * @param {boolean} [params.reset=false] - Optional. Specifies whether to reset the satellite (reinstall) instead of performing an upgrade. Defaults to `false`.
12
+ * @param {boolean} [params.preClearChunks] - Optional. Forces clearing existing chunks before uploading a chunked WASM module. Recommended if the WASM exceeds 2MB.
13
+ * @param {function} [params.onProgress] - Optional. Callback function to track progress during the upgrade process.
14
+ * @throws {Error} Will throw an error if the satellite parameters are invalid or missing required fields.
15
+ * @returns {Promise<void>} Resolves when the upgrade process is complete.
14
16
  */
15
- export declare const upgradeSatellite: ({ satellite, missionControlId, wasmModule, deprecated, deprecatedNoScope, reset, preClearChunks }: {
17
+ export declare const upgradeSatellite: ({ satellite, deprecated, deprecatedNoScope, reset, ...rest }: {
16
18
  satellite: SatelliteParameters;
17
- missionControlId?: Principal;
18
- wasmModule: Uint8Array;
19
19
  deprecated: boolean;
20
20
  deprecatedNoScope: boolean;
21
21
  reset?: boolean;
22
- preClearChunks?: boolean;
23
- }) => Promise<void>;
22
+ } & Pick<UpgradeCodeParams, "wasmModule" | "missionControlId" | "preClearChunks" | "onProgress">) => Promise<void>;
@@ -1,6 +1,12 @@
1
1
  import type { canister_install_mode } from '@dfinity/ic-management';
2
2
  import { Principal } from '@dfinity/principal';
3
3
  import { ActorParameters } from './actor.types';
4
+ export declare enum UpgradeCodeProgress {
5
+ AssertingExistingCode = 0,
6
+ StoppingCanister = 1,
7
+ UpgradingCode = 2,
8
+ RestartingCanister = 3
9
+ }
4
10
  export interface UpgradeCodeParams {
5
11
  actor: ActorParameters;
6
12
  canisterId: Principal;
@@ -9,4 +15,5 @@ export interface UpgradeCodeParams {
9
15
  arg: Uint8Array;
10
16
  mode: canister_install_mode;
11
17
  preClearChunks?: boolean;
18
+ onProgress?: (progress: UpgradeCodeProgress) => void;
12
19
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@junobuild/admin",
3
- "version": "0.0.58-next-2024-11-25.3",
3
+ "version": "0.0.58-next-2024-11-26",
4
4
  "description": "A library for interfacing with admin features of Juno",
5
5
  "author": "David Dal Busco (https://daviddalbusco.com)",
6
6
  "license": "MIT",