@junobuild/admin 0.0.58-next-2024-11-22 → 0.0.58-next-2024-11-24

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,10 +1,32 @@
1
1
  import { CanisterStatus } from '@dfinity/agent';
2
- import { InstallCodeParams } from '@dfinity/ic-management';
2
+ import { type chunk_hash, type InstallChunkedCodeParams, type UploadChunkParams, InstallCodeParams } from '@dfinity/ic-management';
3
+ import type { CanisterStatusResponse } from '@dfinity/ic-management/dist/types/types/ic-management.responses';
4
+ import { Principal } from '@dfinity/principal';
3
5
  import type { ActorParameters } from '../types/actor.types';
4
- export declare const upgradeCode: ({ actor, code }: {
6
+ export declare const installCode: ({ actor, code }: {
5
7
  actor: ActorParameters;
6
8
  code: InstallCodeParams;
7
9
  }) => Promise<void>;
10
+ export declare const storedChunks: ({ actor, canisterId }: {
11
+ actor: ActorParameters;
12
+ canisterId: Principal;
13
+ }) => Promise<chunk_hash[]>;
14
+ export declare const clearChunkStore: ({ actor, canisterId }: {
15
+ actor: ActorParameters;
16
+ canisterId: Principal;
17
+ }) => Promise<void>;
18
+ export declare const uploadChunk: ({ actor, chunk }: {
19
+ actor: ActorParameters;
20
+ chunk: UploadChunkParams;
21
+ }) => Promise<chunk_hash>;
22
+ export declare const installChunkedCode: ({ actor, code }: {
23
+ actor: ActorParameters;
24
+ code: InstallChunkedCodeParams;
25
+ }) => Promise<void>;
26
+ export declare const canisterStatus: ({ actor, canisterId }: {
27
+ actor: ActorParameters;
28
+ canisterId: Principal;
29
+ }) => Promise<CanisterStatusResponse>;
8
30
  export declare const canisterMetadata: ({ canisterId, path, ...rest }: ActorParameters & {
9
31
  canisterId: string | undefined;
10
32
  path: string;
@@ -0,0 +1,5 @@
1
+ import type { canister_install_mode } from '@dfinity/ic-management';
2
+ export declare const SIMPLE_INSTALL_MAX_WASM_SIZE = 2000000;
3
+ export declare const INSTALL_MAX_CHUNK_SIZE = 1000000;
4
+ export declare const INSTALL_MODE_RESET: canister_install_mode;
5
+ export declare const INSTALL_MODE_UPGRADE: canister_install_mode;
@@ -0,0 +1,3 @@
1
+ export declare class UpgradeCodeUnchangedError extends Error {
2
+ constructor();
3
+ }
@@ -0,0 +1,2 @@
1
+ import { UpgradeCodeParams } from '../types/upgrade.types';
2
+ export declare const upgradeChunkedCode: ({ actor, canisterId, missionControlId, wasmModule, preClearChunks: userPreClearChunks, ...rest }: UpgradeCodeParams) => Promise<void>;
@@ -0,0 +1,2 @@
1
+ import { UpgradeCodeParams } from '../types/upgrade.types';
2
+ export declare const upgrade: ({ wasmModule, ...rest }: UpgradeCodeParams) => Promise<void>;
@@ -1,3 +1,4 @@
1
+ export * from './errors/upgrade.errors';
1
2
  export * from './services/mission-control.controllers.services';
2
3
  export * from './services/mission-control.upgrade.services';
3
4
  export * from './services/mission-control.version.services';
@@ -20,3 +21,5 @@ export type * from './types/build.types';
20
21
  export type * from './types/controllers.types';
21
22
  export type * from './types/customdomain.types';
22
23
  export type * from './types/releases.types';
24
+ export type * from './types/upgrade.types';
25
+ export * from './utils/crypto.utils';
@@ -4,10 +4,12 @@ import type { MissionControlParameters } from '../types/actor.types';
4
4
  * @param {Object} params - The parameters for upgrading Mission Control.
5
5
  * @param {MissionControlParameters} params.missionControl - The Mission Control parameters.
6
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.
7
8
  * @throws Will throw an error if no mission control principal is defined.
8
9
  * @returns {Promise<void>} A promise that resolves when the upgrade is complete.
9
10
  */
10
- export declare const upgradeMissionControl: ({ missionControl, wasmModule }: {
11
+ export declare const upgradeMissionControl: ({ missionControl, wasmModule, preClearChunks }: {
11
12
  missionControl: MissionControlParameters;
12
13
  wasmModule: Uint8Array;
14
+ preClearChunks?: boolean;
13
15
  }) => Promise<void>;
@@ -1,15 +1,20 @@
1
+ import { Principal } from '@dfinity/principal';
1
2
  import type { OrbiterParameters } from '../types/actor.types';
2
3
  /**
3
4
  * Upgrades the Orbiter with the provided WASM module.
4
5
  * @param {Object} params - The parameters for upgrading the Orbiter.
5
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.
6
8
  * @param {Uint8Array} params.wasm_module - The WASM module for the upgrade.
7
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.
8
11
  * @throws Will throw an error if no orbiter principal is defined.
9
12
  * @returns {Promise<void>} A promise that resolves when the upgrade is complete.
10
13
  */
11
- export declare const upgradeOrbiter: ({ orbiter, wasmModule, reset }: {
14
+ export declare const upgradeOrbiter: ({ orbiter, missionControlId, wasmModule, reset, preClearChunks }: {
12
15
  orbiter: OrbiterParameters;
16
+ missionControlId?: Principal;
13
17
  wasmModule: Uint8Array;
14
18
  reset?: boolean;
19
+ preClearChunks?: boolean;
15
20
  }) => Promise<void>;
@@ -1,18 +1,23 @@
1
+ import { Principal } from '@dfinity/principal';
1
2
  import type { SatelliteParameters } from '../types/actor.types';
2
3
  /**
3
4
  * Upgrades the satellite with the provided WASM module.
4
5
  * @param {Object} params - The parameters for upgrading the satellite.
5
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.
6
8
  * @param {Uint8Array} params.wasm_module - The WASM module for the upgrade.
7
9
  * @param {boolean} params.deprecated - Whether the upgrade is deprecated.
8
10
  * @param {boolean} params.deprecatedNoScope - Whether the upgrade is deprecated with no scope.
9
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.
10
13
  * @returns {Promise<void>} A promise that resolves when the upgrade is complete.
11
14
  */
12
- export declare const upgradeSatellite: ({ satellite, wasmModule, deprecated, deprecatedNoScope, reset }: {
15
+ export declare const upgradeSatellite: ({ satellite, missionControlId, wasmModule, deprecated, deprecatedNoScope, reset, preClearChunks }: {
13
16
  satellite: SatelliteParameters;
17
+ missionControlId?: Principal;
14
18
  wasmModule: Uint8Array;
15
19
  deprecated: boolean;
16
20
  deprecatedNoScope: boolean;
17
21
  reset?: boolean;
22
+ preClearChunks?: boolean;
18
23
  }) => Promise<void>;
@@ -0,0 +1,12 @@
1
+ import type { canister_install_mode } from '@dfinity/ic-management';
2
+ import { Principal } from '@dfinity/principal';
3
+ import { ActorParameters } from './actor.types';
4
+ export interface UpgradeCodeParams {
5
+ actor: ActorParameters;
6
+ canisterId: Principal;
7
+ missionControlId?: Principal;
8
+ wasmModule: Uint8Array;
9
+ arg: Uint8Array;
10
+ mode: canister_install_mode;
11
+ preClearChunks?: boolean;
12
+ }
@@ -0,0 +1 @@
1
+ export declare const uint8ArrayToHexString: (bytes: Uint8Array | number[]) => string;
@@ -0,0 +1,2 @@
1
+ export declare const blobSha256: (blob: Blob) => Promise<string>;
2
+ export declare const uint8ArraySha256: (data: Uint8Array) => Promise<string>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@junobuild/admin",
3
- "version": "0.0.58-next-2024-11-22",
3
+ "version": "0.0.58-next-2024-11-24",
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",