@junobuild/admin 0.0.59 → 0.0.61-next-2024-12-20
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.
- package/dist/browser/index.js +1 -13
- package/dist/browser/index.js.map +4 -4
- package/dist/node/index.mjs +1 -13
- package/dist/node/index.mjs.map +4 -4
- package/dist/types/api/ic.api.d.ts +11 -1
- package/dist/types/handlers/upgrade.handlers.d.ts +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/services/mission-control.upgrade.services.d.ts +2 -1
- package/dist/types/services/module.upgrade.services.d.ts +22 -0
- package/dist/types/services/orbiter.upgrade.services.d.ts +2 -1
- package/dist/types/services/satellite.upgrade.services.d.ts +2 -1
- package/dist/types/types/upgrade.types.d.ts +4 -2
- package/package.json +8 -7
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CanisterStatus } from '@dfinity/agent';
|
|
2
|
-
import { type chunk_hash, type InstallChunkedCodeParams, type UploadChunkParams, InstallCodeParams } from '@dfinity/ic-management';
|
|
2
|
+
import { type chunk_hash, type InstallChunkedCodeParams, type UploadChunkParams, InstallCodeParams, list_canister_snapshots_result, snapshot_id } from '@dfinity/ic-management';
|
|
3
|
+
import type { take_canister_snapshot_result } from '@dfinity/ic-management/dist/candid/ic-management';
|
|
3
4
|
import type { CanisterStatusResponse } from '@dfinity/ic-management/dist/types/types/ic-management.responses';
|
|
4
5
|
import { Principal } from '@dfinity/principal';
|
|
5
6
|
import type { ActorParameters } from '../types/actor.types';
|
|
@@ -39,3 +40,12 @@ export declare const canisterMetadata: ({ canisterId, path, ...rest }: ActorPara
|
|
|
39
40
|
canisterId: string | undefined;
|
|
40
41
|
path: string;
|
|
41
42
|
}) => Promise<CanisterStatus.Status | undefined>;
|
|
43
|
+
export declare const listCanisterSnapshots: ({ actor, canisterId }: {
|
|
44
|
+
actor: ActorParameters;
|
|
45
|
+
canisterId: Principal;
|
|
46
|
+
}) => Promise<list_canister_snapshots_result>;
|
|
47
|
+
export declare const takeCanisterSnapshot: ({ actor, ...rest }: {
|
|
48
|
+
actor: ActorParameters;
|
|
49
|
+
canisterId: Principal;
|
|
50
|
+
snapshotId?: snapshot_id;
|
|
51
|
+
}) => Promise<take_canister_snapshot_result>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { UpgradeCodeParams } from '../types/upgrade.types';
|
|
2
|
-
export declare const upgrade: ({ wasmModule, canisterId, actor, onProgress, ...rest }: UpgradeCodeParams & {
|
|
2
|
+
export declare const upgrade: ({ wasmModule, canisterId, actor, onProgress, takeSnapshot, ...rest }: UpgradeCodeParams & {
|
|
3
3
|
reset?: boolean;
|
|
4
4
|
}) => Promise<void>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from './errors/upgrade.errors';
|
|
|
2
2
|
export * from './services/mission-control.controllers.services';
|
|
3
3
|
export * from './services/mission-control.upgrade.services';
|
|
4
4
|
export * from './services/mission-control.version.services';
|
|
5
|
+
export * from './services/module.upgrade.services';
|
|
5
6
|
export * from './services/orbiter.controllers.services';
|
|
6
7
|
export * from './services/orbiter.memory.services';
|
|
7
8
|
export * from './services/orbiter.upgrade.services';
|
|
@@ -6,10 +6,11 @@ import { UpgradeCodeParams } from '../types/upgrade.types';
|
|
|
6
6
|
* @param {MissionControlParameters} params.missionControl - The Mission Control parameters, including the actor and mission control ID.
|
|
7
7
|
* @param {Uint8Array} params.wasmModule - The WASM module to be installed during the upgrade.
|
|
8
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 {boolean} [params.takeSnapshot=true] - Optional. Whether to take a snapshot before performing the upgrade. Defaults to true.
|
|
9
10
|
* @param {function} [params.onProgress] - Optional. Callback function to report progress during the upgrade process.
|
|
10
11
|
* @throws {Error} Will throw an error if the mission control principal is not defined.
|
|
11
12
|
* @returns {Promise<void>} Resolves when the upgrade process is complete.
|
|
12
13
|
*/
|
|
13
14
|
export declare const upgradeMissionControl: ({ missionControl, ...rest }: {
|
|
14
15
|
missionControl: MissionControlParameters;
|
|
15
|
-
} & Pick<UpgradeCodeParams, "wasmModule" | "preClearChunks" | "onProgress">) => Promise<void>;
|
|
16
|
+
} & Pick<UpgradeCodeParams, "wasmModule" | "preClearChunks" | "takeSnapshot" | "onProgress">) => Promise<void>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ActorParameters } from '../types/actor.types';
|
|
2
|
+
import type { UpgradeCodeParams } from '../types/upgrade.types';
|
|
3
|
+
/**
|
|
4
|
+
* Upgrades a module with the provided WASM code and arguments. This generic is notably useful for Juno Docker.
|
|
5
|
+
*
|
|
6
|
+
* @param {Object} params - Parameters for upgrading the module.
|
|
7
|
+
* @param {ActorParameters} params.actor - The actor parameters associated with the module.
|
|
8
|
+
* @param {Principal} params.canisterId - The ID of the canister being upgraded.
|
|
9
|
+
* @param {Principal} [params.missionControlId] - Optional. An ID to store and reuse WASM chunks across installations.
|
|
10
|
+
* @param {Uint8Array} params.wasmModule - The WASM code to be installed during the upgrade.
|
|
11
|
+
* @param {Uint8Array} params.arg - The initialization argument for the module upgrade.
|
|
12
|
+
* @param {canister_install_mode} params.mode - The installation mode, e.g., `upgrade` or `reinstall`.
|
|
13
|
+
* @param {boolean} [params.preClearChunks] - Optional. Forces clearing existing chunks before uploading a chunked WASM module. Recommended for WASM modules larger than 2MB.
|
|
14
|
+
* @param {function} [params.onProgress] - Optional. Callback function to track progress during the upgrade process.
|
|
15
|
+
* @param {boolean} [params.reset=false] - Optional. Specifies whether to reset the module (reinstall) instead of performing an upgrade. Defaults to `false`.
|
|
16
|
+
* @throws {Error} Will throw an error if the parameters are invalid or if the upgrade process fails.
|
|
17
|
+
* @returns {Promise<void>} Resolves when the upgrade process is complete.
|
|
18
|
+
*/
|
|
19
|
+
export declare const upgradeModule: (params: {
|
|
20
|
+
actor: ActorParameters;
|
|
21
|
+
reset?: boolean;
|
|
22
|
+
} & UpgradeCodeParams) => Promise<void>;
|
|
@@ -8,6 +8,7 @@ import { UpgradeCodeParams } from '../types/upgrade.types';
|
|
|
8
8
|
* @param {Uint8Array} params.wasmModule - The WASM module to be installed during the upgrade.
|
|
9
9
|
* @param {boolean} [params.reset=false] - Optional. Indicates whether to reset the Orbiter (reinstall) instead of performing an upgrade. Defaults to `false`.
|
|
10
10
|
* @param {boolean} [params.preClearChunks] - Optional. Forces clearing existing chunks before uploading a chunked WASM module. Recommended if the WASM exceeds 2MB.
|
|
11
|
+
* @param {boolean} [params.takeSnapshot=true] - Optional. Whether to take a snapshot before performing the upgrade. Defaults to true.
|
|
11
12
|
* @param {function} [params.onProgress] - Optional. Callback function to track progress during the upgrade process.
|
|
12
13
|
* @throws {Error} Will throw an error if the Orbiter principal is not defined.
|
|
13
14
|
* @returns {Promise<void>} Resolves when the upgrade process is complete.
|
|
@@ -15,4 +16,4 @@ import { UpgradeCodeParams } from '../types/upgrade.types';
|
|
|
15
16
|
export declare const upgradeOrbiter: ({ orbiter, reset, ...rest }: {
|
|
16
17
|
orbiter: OrbiterParameters;
|
|
17
18
|
reset?: boolean;
|
|
18
|
-
} & Pick<UpgradeCodeParams, "wasmModule" | "missionControlId" | "preClearChunks" | "onProgress">) => Promise<void>;
|
|
19
|
+
} & Pick<UpgradeCodeParams, "wasmModule" | "missionControlId" | "preClearChunks" | "takeSnapshot" | "onProgress">) => Promise<void>;
|
|
@@ -10,6 +10,7 @@ import { UpgradeCodeParams } from '../types/upgrade.types';
|
|
|
10
10
|
* @param {boolean} params.deprecatedNoScope - Indicates whether the upgrade is deprecated and has no scope.
|
|
11
11
|
* @param {boolean} [params.reset=false] - Optional. Specifies whether to reset the satellite (reinstall) instead of performing an upgrade. Defaults to `false`.
|
|
12
12
|
* @param {boolean} [params.preClearChunks] - Optional. Forces clearing existing chunks before uploading a chunked WASM module. Recommended if the WASM exceeds 2MB.
|
|
13
|
+
* @param {boolean} [params.takeSnapshot=true] - Optional. Whether to take a snapshot before performing the upgrade. Defaults to true.
|
|
13
14
|
* @param {function} [params.onProgress] - Optional. Callback function to track progress during the upgrade process.
|
|
14
15
|
* @throws {Error} Will throw an error if the satellite parameters are invalid or missing required fields.
|
|
15
16
|
* @returns {Promise<void>} Resolves when the upgrade process is complete.
|
|
@@ -19,4 +20,4 @@ export declare const upgradeSatellite: ({ satellite, deprecated, deprecatedNoSco
|
|
|
19
20
|
deprecated: boolean;
|
|
20
21
|
deprecatedNoScope: boolean;
|
|
21
22
|
reset?: boolean;
|
|
22
|
-
} & Pick<UpgradeCodeParams, "wasmModule" | "missionControlId" | "preClearChunks" | "onProgress">) => Promise<void>;
|
|
23
|
+
} & Pick<UpgradeCodeParams, "wasmModule" | "missionControlId" | "preClearChunks" | "takeSnapshot" | "onProgress">) => Promise<void>;
|
|
@@ -4,8 +4,9 @@ import { ActorParameters } from './actor.types';
|
|
|
4
4
|
export declare enum UpgradeCodeProgressStep {
|
|
5
5
|
AssertingExistingCode = 0,
|
|
6
6
|
StoppingCanister = 1,
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
TakingSnapshot = 2,
|
|
8
|
+
UpgradingCode = 3,
|
|
9
|
+
RestartingCanister = 4
|
|
9
10
|
}
|
|
10
11
|
export type UpgradeCodeProgressState = 'in_progress' | 'success' | 'error';
|
|
11
12
|
export interface UpgradeCodeProgress {
|
|
@@ -20,5 +21,6 @@ export interface UpgradeCodeParams {
|
|
|
20
21
|
arg: Uint8Array;
|
|
21
22
|
mode: canister_install_mode;
|
|
22
23
|
preClearChunks?: boolean;
|
|
24
|
+
takeSnapshot?: boolean;
|
|
23
25
|
onProgress?: (progress: UpgradeCodeProgress) => void;
|
|
24
26
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@junobuild/admin",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.61-next-2024-12-20",
|
|
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",
|
|
@@ -50,12 +50,13 @@
|
|
|
50
50
|
],
|
|
51
51
|
"homepage": "https://juno.build",
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"@dfinity/agent": "
|
|
54
|
-
"@dfinity/
|
|
55
|
-
"@dfinity/
|
|
56
|
-
"@dfinity/
|
|
53
|
+
"@dfinity/agent": "*",
|
|
54
|
+
"@dfinity/candid": "*",
|
|
55
|
+
"@dfinity/ic-management": "*",
|
|
56
|
+
"@dfinity/identity": "*",
|
|
57
|
+
"@dfinity/principal": "*",
|
|
57
58
|
"@junobuild/config": "*",
|
|
58
59
|
"@junobuild/utils": "*",
|
|
59
|
-
"semver": "
|
|
60
|
+
"semver": "*"
|
|
60
61
|
}
|
|
61
|
-
}
|
|
62
|
+
}
|