@junobuild/admin 0.0.58 → 0.0.59-next-2024-11-27

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.
Files changed (41) hide show
  1. package/dist/browser/index.js +7 -7
  2. package/dist/browser/index.js.map +4 -4
  3. package/dist/node/index.mjs +7 -7
  4. package/dist/node/index.mjs.map +4 -4
  5. package/dist/types/api/actor.api.d.ts +0 -2
  6. package/dist/types/api/ic.api.d.ts +32 -2
  7. package/dist/types/constants/upgrade.constants.d.ts +5 -0
  8. package/dist/types/errors/upgrade.errors.d.ts +3 -0
  9. package/dist/types/handlers/upgrade.chunks.handlers.d.ts +2 -0
  10. package/dist/types/handlers/upgrade.handlers.d.ts +4 -0
  11. package/dist/types/handlers/upgrade.single.handlers.d.ts +2 -0
  12. package/dist/types/index.d.ts +20 -4
  13. package/dist/types/services/{mission-control.services.d.ts → mission-control.controllers.services.d.ts} +0 -21
  14. package/dist/types/services/mission-control.upgrade.services.d.ts +15 -0
  15. package/dist/types/services/mission-control.version.services.d.ts +10 -0
  16. package/dist/types/services/module.upgrade.services.d.ts +22 -0
  17. package/dist/types/services/orbiter.controllers.services.d.ts +12 -0
  18. package/dist/types/services/orbiter.memory.services.d.ts +11 -0
  19. package/dist/types/services/orbiter.upgrade.services.d.ts +18 -0
  20. package/dist/types/services/orbiter.version.services.d.ts +10 -0
  21. package/dist/types/services/satellite.assets.services.d.ts +23 -0
  22. package/dist/types/services/satellite.config.services.d.ts +48 -0
  23. package/dist/types/services/satellite.controllers.services.d.ts +25 -0
  24. package/dist/types/services/satellite.docs.services.d.ts +23 -0
  25. package/dist/types/services/satellite.domains.services.d.ts +22 -0
  26. package/dist/types/services/satellite.memory.services.d.ts +11 -0
  27. package/dist/types/services/satellite.rules.services.d.ts +26 -0
  28. package/dist/types/services/satellite.upgrade.services.d.ts +22 -0
  29. package/dist/types/services/satellite.version.services.d.ts +29 -0
  30. package/dist/types/types/actor.types.d.ts +5 -1
  31. package/dist/types/types/upgrade.types.d.ts +24 -0
  32. package/dist/types/utils/actor.utils.d.ts +1 -1
  33. package/dist/types/utils/array.utils.d.ts +1 -0
  34. package/dist/types/utils/crypto.utils.d.ts +2 -0
  35. package/package.json +7 -6
  36. package/dist/declarations/ic/ic.did.d.ts +0 -344
  37. package/dist/declarations/ic/ic.factory.did.js +0 -378
  38. package/dist/declarations/ic/ic.factory.did.mjs +0 -378
  39. package/dist/types/services/orbiter.services.d.ts +0 -45
  40. package/dist/types/services/satellite.services.d.ts +0 -215
  41. package/dist/types/types/ic.types.d.ts +0 -14
@@ -1,5 +1,4 @@
1
1
  import type { IDL } from '@dfinity/candid';
2
- import type { _SERVICE as ICActor } from '../../declarations/ic/ic.did';
3
2
  import type { _SERVICE as MissionControlActor } from '../../declarations/mission_control/mission_control.did';
4
3
  import type { _SERVICE as OrbiterActor } from '../../declarations/orbiter/orbiter.did';
5
4
  import type { _SERVICE as DeprecatedSatelliteNoScopeActor } from '../../declarations/satellite/satellite-deprecated-no-scope.did';
@@ -15,4 +14,3 @@ export declare const getActor: <T>({ canisterId, idlFactory, ...rest }: ActorPar
15
14
  canisterId: string | undefined;
16
15
  idlFactory: IDL.InterfaceFactory;
17
16
  }) => Promise<T>;
18
- export declare const getICActor: (params: ActorParameters) => Promise<ICActor>;
@@ -1,10 +1,40 @@
1
1
  import { CanisterStatus } from '@dfinity/agent';
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';
2
5
  import type { ActorParameters } from '../types/actor.types';
3
- import type { InstallCodeParams } from '../types/ic.types';
4
- export declare const upgradeCode: ({ actor, code }: {
6
+ export declare const canisterStop: ({ canisterId, actor }: {
7
+ canisterId: Principal;
8
+ actor: ActorParameters;
9
+ }) => Promise<void>;
10
+ export declare const canisterStart: ({ canisterId, actor }: {
11
+ canisterId: Principal;
12
+ actor: ActorParameters;
13
+ }) => Promise<void>;
14
+ export declare const installCode: ({ actor, code }: {
5
15
  actor: ActorParameters;
6
16
  code: InstallCodeParams;
7
17
  }) => Promise<void>;
18
+ export declare const storedChunks: ({ actor, canisterId }: {
19
+ actor: ActorParameters;
20
+ canisterId: Principal;
21
+ }) => Promise<chunk_hash[]>;
22
+ export declare const clearChunkStore: ({ actor, canisterId }: {
23
+ actor: ActorParameters;
24
+ canisterId: Principal;
25
+ }) => Promise<void>;
26
+ export declare const uploadChunk: ({ actor, chunk }: {
27
+ actor: ActorParameters;
28
+ chunk: UploadChunkParams;
29
+ }) => Promise<chunk_hash>;
30
+ export declare const installChunkedCode: ({ actor, code }: {
31
+ actor: ActorParameters;
32
+ code: InstallChunkedCodeParams;
33
+ }) => Promise<void>;
34
+ export declare const canisterStatus: ({ actor, canisterId }: {
35
+ actor: ActorParameters;
36
+ canisterId: Principal;
37
+ }) => Promise<CanisterStatusResponse>;
8
38
  export declare const canisterMetadata: ({ canisterId, path, ...rest }: ActorParameters & {
9
39
  canisterId: string | undefined;
10
40
  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,4 @@
1
+ import { UpgradeCodeParams } from '../types/upgrade.types';
2
+ export declare const upgrade: ({ wasmModule, canisterId, actor, onProgress, ...rest }: UpgradeCodeParams & {
3
+ reset?: boolean;
4
+ }) => Promise<void>;
@@ -0,0 +1,2 @@
1
+ import { UpgradeCodeParams } from '../types/upgrade.types';
2
+ export declare const upgradeSingleChunkCode: ({ actor, ...rest }: UpgradeCodeParams) => Promise<void>;
@@ -1,10 +1,26 @@
1
- export * from './services/mission-control.services';
2
- export * from './services/orbiter.services';
1
+ export * from './errors/upgrade.errors';
2
+ export * from './services/mission-control.controllers.services';
3
+ export * from './services/mission-control.upgrade.services';
4
+ export * from './services/mission-control.version.services';
5
+ export * from './services/module.upgrade.services';
6
+ export * from './services/orbiter.controllers.services';
7
+ export * from './services/orbiter.memory.services';
8
+ export * from './services/orbiter.upgrade.services';
9
+ export * from './services/orbiter.version.services';
3
10
  export * from './services/releases.services';
4
- export * from './services/satellite.services';
11
+ export * from './services/satellite.assets.services';
12
+ export * from './services/satellite.config.services';
13
+ export * from './services/satellite.controllers.services';
14
+ export * from './services/satellite.docs.services';
15
+ export * from './services/satellite.domains.services';
16
+ export * from './services/satellite.memory.services';
17
+ export * from './services/satellite.rules.services';
18
+ export * from './services/satellite.upgrade.services';
19
+ export * from './services/satellite.version.services';
5
20
  export type * from './types/actor.types';
6
21
  export type * from './types/build.types';
7
22
  export type * from './types/controllers.types';
8
23
  export type * from './types/customdomain.types';
9
- export type * from './types/ic.types';
10
24
  export type * from './types/releases.types';
25
+ export * from './types/upgrade.types';
26
+ export * from './utils/crypto.utils';
@@ -2,27 +2,6 @@ import { Principal } from '@dfinity/principal';
2
2
  import type { Controller } from '../../declarations/mission_control/mission_control.did';
3
3
  import type { MissionControlParameters } from '../types/actor.types';
4
4
  import type { SetControllerParams } from '../types/controllers.types';
5
- /**
6
- * Retrieves the version of Mission Control.
7
- * @param {Object} params - The parameters for Mission Control.
8
- * @param {MissionControlParameters} params.missionControl - The Mission Control parameters.
9
- * @returns {Promise<string>} A promise that resolves to the version of Mission Control.
10
- */
11
- export declare const missionControlVersion: (params: {
12
- missionControl: MissionControlParameters;
13
- }) => Promise<string>;
14
- /**
15
- * Upgrades the Mission Control with the provided WASM module.
16
- * @param {Object} params - The parameters for upgrading Mission Control.
17
- * @param {MissionControlParameters} params.missionControl - The Mission Control parameters.
18
- * @param {Uint8Array} params.wasm_module - The WASM module for the upgrade.
19
- * @throws Will throw an error if no mission control principal is defined.
20
- * @returns {Promise<void>} A promise that resolves when the upgrade is complete.
21
- */
22
- export declare const upgradeMissionControl: ({ missionControl, wasm_module }: {
23
- missionControl: MissionControlParameters;
24
- wasm_module: Uint8Array;
25
- }) => Promise<void>;
26
5
  /**
27
6
  * Sets the controller for the specified satellites.
28
7
  * @param {Object} params - The parameters for setting the satellites controller.
@@ -0,0 +1,15 @@
1
+ import type { MissionControlParameters } from '../types/actor.types';
2
+ import { UpgradeCodeParams } from '../types/upgrade.types';
3
+ /**
4
+ * Upgrades the Mission Control with the provided WASM module.
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.
12
+ */
13
+ export declare const upgradeMissionControl: ({ missionControl, ...rest }: {
14
+ missionControl: MissionControlParameters;
15
+ } & Pick<UpgradeCodeParams, "wasmModule" | "preClearChunks" | "onProgress">) => Promise<void>;
@@ -0,0 +1,10 @@
1
+ import type { MissionControlParameters } from '../types/actor.types';
2
+ /**
3
+ * Retrieves the version of Mission Control.
4
+ * @param {Object} params - The parameters for Mission Control.
5
+ * @param {MissionControlParameters} params.missionControl - The Mission Control parameters.
6
+ * @returns {Promise<string>} A promise that resolves to the version of Mission Control.
7
+ */
8
+ export declare const missionControlVersion: (params: {
9
+ missionControl: MissionControlParameters;
10
+ }) => Promise<string>;
@@ -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>;
@@ -0,0 +1,12 @@
1
+ import { Principal } from '@dfinity/principal';
2
+ import type { Controller } from '../../declarations/mission_control/mission_control.did';
3
+ import type { OrbiterParameters } from '../types/actor.types';
4
+ /**
5
+ * Lists the controllers of the Orbiter.
6
+ * @param {Object} params - The parameters for listing the controllers.
7
+ * @param {OrbiterParameters} params.orbiter - The Orbiter parameters.
8
+ * @returns {Promise<[Principal, Controller][]>} A promise that resolves to a list of controllers.
9
+ */
10
+ export declare const listOrbiterControllers: (params: {
11
+ orbiter: OrbiterParameters;
12
+ }) => Promise<[Principal, Controller][]>;
@@ -0,0 +1,11 @@
1
+ import type { MemorySize } from '../../declarations/orbiter/orbiter.did';
2
+ import type { OrbiterParameters } from '../types/actor.types';
3
+ /**
4
+ * Retrieves the memory size of the Orbiter.
5
+ * @param {Object} params - The parameters for the Orbiter.
6
+ * @param {OrbiterParameters} params.orbiter - The Orbiter parameters.
7
+ * @returns {Promise<MemorySize>} A promise that resolves to the memory size of the Orbiter.
8
+ */
9
+ export declare const orbiterMemorySize: (params: {
10
+ orbiter: OrbiterParameters;
11
+ }) => Promise<MemorySize>;
@@ -0,0 +1,18 @@
1
+ import type { OrbiterParameters } from '../types/actor.types';
2
+ import { UpgradeCodeParams } from '../types/upgrade.types';
3
+ /**
4
+ * Upgrades the Orbiter with the provided WASM module.
5
+ * @param {Object} params - The parameters for upgrading the Orbiter.
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.
14
+ */
15
+ export declare const upgradeOrbiter: ({ orbiter, reset, ...rest }: {
16
+ orbiter: OrbiterParameters;
17
+ reset?: boolean;
18
+ } & Pick<UpgradeCodeParams, "wasmModule" | "missionControlId" | "preClearChunks" | "onProgress">) => Promise<void>;
@@ -0,0 +1,10 @@
1
+ import type { OrbiterParameters } from '../types/actor.types';
2
+ /**
3
+ * Retrieves the version of the Orbiter.
4
+ * @param {Object} params - The parameters for the Orbiter.
5
+ * @param {OrbiterParameters} params.orbiter - The Orbiter parameters.
6
+ * @returns {Promise<string>} A promise that resolves to the version of the Orbiter.
7
+ */
8
+ export declare const orbiterVersion: (params: {
9
+ orbiter: OrbiterParameters;
10
+ }) => Promise<string>;
@@ -0,0 +1,23 @@
1
+ import type { SatelliteParameters } from '../types/actor.types';
2
+ /**
3
+ * Counts the assets in a collection.
4
+ * @param {Object} params - The parameters for counting the assets.
5
+ * @param {string} params.collection - The name of the collection.
6
+ * @param {SatelliteParameters} params.satellite - The satellite parameters.
7
+ * @returns {Promise<bigint>} A promise that resolves to the number of assets in the collection.
8
+ */
9
+ export declare const countAssets: (params: {
10
+ collection: string;
11
+ satellite: SatelliteParameters;
12
+ }) => Promise<bigint>;
13
+ /**
14
+ * Deletes the assets in a collection.
15
+ * @param {Object} params - The parameters for deleting the assets.
16
+ * @param {string} params.collection - The name of the collection.
17
+ * @param {SatelliteParameters} params.satellite - The satellite parameters.
18
+ * @returns {Promise<void>} A promise that resolves when the assets are deleted.
19
+ */
20
+ export declare const deleteAssets: (params: {
21
+ collection: string;
22
+ satellite: SatelliteParameters;
23
+ }) => Promise<void>;
@@ -0,0 +1,48 @@
1
+ import type { AuthenticationConfig, DatastoreConfig, StorageConfig } from '@junobuild/config';
2
+ import type { SatelliteParameters } from '../types/actor.types';
3
+ /**
4
+ * Sets the configuration for the Storage of a Satellite.
5
+ * @param {Object} params - The parameters for setting the configuration.
6
+ * @param {Object} params.config - The storage configuration.
7
+ * @param {Array<StorageConfigHeader>} params.config.headers - The headers configuration.
8
+ * @param {Array<StorageConfigRewrite>} params.config.rewrites - The rewrites configuration.
9
+ * @param {Array<StorageConfigRedirect>} params.config.redirects - The redirects configuration.
10
+ * @param {string} params.config.iframe - The iframe configuration.
11
+ * @param {SatelliteParameters} params.satellite - The satellite parameters.
12
+ * @returns {Promise<void>} A promise that resolves when the configuration is set.
13
+ */
14
+ export declare const setStorageConfig: ({ config: { headers: configHeaders, rewrites: configRewrites, redirects: configRedirects, iframe: configIFrame, rawAccess: configRawAccess, maxMemorySize: configMaxMemorySize }, satellite }: {
15
+ config: StorageConfig;
16
+ satellite: SatelliteParameters;
17
+ }) => Promise<void>;
18
+ /**
19
+ * Sets the datastore configuration for a satellite.
20
+ * @param {Object} params - The parameters for setting the authentication configuration.
21
+ * @param {Object} params.config - The datastore configuration.
22
+ * @param {SatelliteParameters} params.satellite - The satellite parameters.
23
+ * @returns {Promise<void>} A promise that resolves when the datastore configuration is set.
24
+ */
25
+ export declare const setDatastoreConfig: ({ config: { maxMemorySize }, ...rest }: {
26
+ config: DatastoreConfig;
27
+ satellite: SatelliteParameters;
28
+ }) => Promise<void>;
29
+ /**
30
+ * Sets the authentication configuration for a satellite.
31
+ * @param {Object} params - The parameters for setting the authentication configuration.
32
+ * @param {Object} params.config - The authentication configuration.
33
+ * @param {SatelliteParameters} params.satellite - The satellite parameters.
34
+ * @returns {Promise<void>} A promise that resolves when the authentication configuration is set.
35
+ */
36
+ export declare const setAuthConfig: ({ config: { internetIdentity }, ...rest }: {
37
+ config: AuthenticationConfig;
38
+ satellite: SatelliteParameters;
39
+ }) => Promise<void>;
40
+ /**
41
+ * Gets the authentication configuration for a satellite.
42
+ * @param {Object} params - The parameters for getting the authentication configuration.
43
+ * @param {SatelliteParameters} params.satellite - The satellite parameters.
44
+ * @returns {Promise<AuthenticationConfig | undefined>} A promise that resolves to the authentication configuration or undefined if not found.
45
+ */
46
+ export declare const getAuthConfig: ({ satellite }: {
47
+ satellite: SatelliteParameters;
48
+ }) => Promise<AuthenticationConfig | undefined>;
@@ -0,0 +1,25 @@
1
+ import { Principal } from '@dfinity/principal';
2
+ import type { Controller, SetControllersArgs } from '../../declarations/satellite/satellite.did';
3
+ import type { SatelliteParameters } from '../types/actor.types';
4
+ /**
5
+ * Lists the controllers of a satellite.
6
+ * @param {Object} params - The parameters for listing the controllers.
7
+ * @param {SatelliteParameters} params.satellite - The satellite parameters.
8
+ * @param {boolean} [params.deprecatedNoScope] - Whether to list deprecated no-scope controllers.
9
+ * @returns {Promise<[Principal, Controller][]>} A promise that resolves to a list of controllers.
10
+ */
11
+ export declare const listSatelliteControllers: ({ deprecatedNoScope, ...params }: {
12
+ satellite: SatelliteParameters;
13
+ deprecatedNoScope?: boolean;
14
+ }) => Promise<[Principal, Controller][]>;
15
+ /**
16
+ * Sets the controllers of a satellite.
17
+ * @param {Object} params - The parameters for setting the controllers.
18
+ * @param {SatelliteParameters} params.satellite - The satellite parameters.
19
+ * @param {SetControllersArgs} params.args - The arguments for setting the controllers.
20
+ * @returns {Promise<[Principal, Controller][]>} A promise that resolves to a list of controllers.
21
+ */
22
+ export declare const setSatelliteControllers: (params: {
23
+ satellite: SatelliteParameters;
24
+ args: SetControllersArgs;
25
+ }) => Promise<[Principal, Controller][]>;
@@ -0,0 +1,23 @@
1
+ import type { SatelliteParameters } from '../types/actor.types';
2
+ /**
3
+ * Counts the documents in a collection.
4
+ * @param {Object} params - The parameters for counting the documents.
5
+ * @param {string} params.collection - The name of the collection.
6
+ * @param {SatelliteParameters} params.satellite - The satellite parameters.
7
+ * @returns {Promise<bigint>} A promise that resolves to the number of documents in the collection.
8
+ */
9
+ export declare const countDocs: (params: {
10
+ collection: string;
11
+ satellite: SatelliteParameters;
12
+ }) => Promise<bigint>;
13
+ /**
14
+ * Deletes the documents in a collection.
15
+ * @param {Object} params - The parameters for deleting the documents.
16
+ * @param {string} params.collection - The name of the collection.
17
+ * @param {SatelliteParameters} params.satellite - The satellite parameters.
18
+ * @returns {Promise<void>} A promise that resolves when the documents are deleted.
19
+ */
20
+ export declare const deleteDocs: (params: {
21
+ collection: string;
22
+ satellite: SatelliteParameters;
23
+ }) => Promise<void>;
@@ -0,0 +1,22 @@
1
+ import type { SatelliteParameters } from '../types/actor.types';
2
+ import type { CustomDomain } from '../types/customdomain.types';
3
+ /**
4
+ * Lists the custom domains for a satellite.
5
+ * @param {Object} params - The parameters for listing the custom domains.
6
+ * @param {SatelliteParameters} params.satellite - The satellite parameters.
7
+ * @returns {Promise<CustomDomain[]>} A promise that resolves to an array of custom domains.
8
+ */
9
+ export declare const listCustomDomains: ({ satellite }: {
10
+ satellite: SatelliteParameters;
11
+ }) => Promise<CustomDomain[]>;
12
+ /**
13
+ * Sets the custom domains for a satellite.
14
+ * @param {Object} params - The parameters for setting the custom domains.
15
+ * @param {SatelliteParameters} params.satellite - The satellite parameters.
16
+ * @param {CustomDomain[]} params.domains - The custom domains to set.
17
+ * @returns {Promise<void[]>} A promise that resolves when the custom domains are set.
18
+ */
19
+ export declare const setCustomDomains: ({ satellite, domains }: {
20
+ satellite: SatelliteParameters;
21
+ domains: CustomDomain[];
22
+ }) => Promise<void[]>;
@@ -0,0 +1,11 @@
1
+ import type { MemorySize } from '../../declarations/satellite/satellite.did';
2
+ import type { SatelliteParameters } from '../types/actor.types';
3
+ /**
4
+ * Retrieves the memory size of a satellite.
5
+ * @param {Object} params - The parameters for retrieving the memory size.
6
+ * @param {SatelliteParameters} params.satellite - The satellite parameters.
7
+ * @returns {Promise<MemorySize>} A promise that resolves to the memory size of the satellite.
8
+ */
9
+ export declare const satelliteMemorySize: (params: {
10
+ satellite: SatelliteParameters;
11
+ }) => Promise<MemorySize>;
@@ -0,0 +1,26 @@
1
+ import type { Rule, RulesType } from '@junobuild/config';
2
+ import type { SatelliteParameters } from '../types/actor.types';
3
+ /**
4
+ * Lists the rules for a satellite.
5
+ * @param {Object} params - The parameters for listing the rules.
6
+ * @param {RulesType} params.type - The type of rules to list.
7
+ * @param {SatelliteParameters} params.satellite - The satellite parameters.
8
+ * @returns {Promise<Rule[]>} A promise that resolves to an array of rules.
9
+ */
10
+ export declare const listRules: ({ type, satellite }: {
11
+ type: RulesType;
12
+ satellite: SatelliteParameters;
13
+ }) => Promise<Rule[]>;
14
+ /**
15
+ * Sets a rule for a satellite.
16
+ * @param {Object} params - The parameters for setting the rule.
17
+ * @param {Rule} params.rule - The rule to set.
18
+ * @param {RulesType} params.type - The type of rule.
19
+ * @param {SatelliteParameters} params.satellite - The satellite parameters.
20
+ * @returns {Promise<void>} A promise that resolves when the rule is set.
21
+ */
22
+ export declare const setRule: ({ rule: { collection, ...rest }, type, satellite }: {
23
+ rule: Rule;
24
+ type: RulesType;
25
+ satellite: SatelliteParameters;
26
+ }) => Promise<void>;
@@ -0,0 +1,22 @@
1
+ import type { SatelliteParameters } from '../types/actor.types';
2
+ import { UpgradeCodeParams } from '../types/upgrade.types';
3
+ /**
4
+ * Upgrades a satellite with the provided WASM module.
5
+ * @param {Object} params - The parameters for upgrading the satellite.
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.
16
+ */
17
+ export declare const upgradeSatellite: ({ satellite, deprecated, deprecatedNoScope, reset, ...rest }: {
18
+ satellite: SatelliteParameters;
19
+ deprecated: boolean;
20
+ deprecatedNoScope: boolean;
21
+ reset?: boolean;
22
+ } & Pick<UpgradeCodeParams, "wasmModule" | "missionControlId" | "preClearChunks" | "onProgress">) => Promise<void>;
@@ -0,0 +1,29 @@
1
+ import type { SatelliteParameters } from '../types/actor.types';
2
+ import type { BuildType } from '../types/build.types';
3
+ /**
4
+ * Retrieves the version of the satellite.
5
+ * @param {Object} params - The parameters for retrieving the version.
6
+ * @param {SatelliteParameters} params.satellite - The satellite parameters.
7
+ * @returns {Promise<string>} A promise that resolves to the version of the satellite.
8
+ */
9
+ export declare const satelliteVersion: (params: {
10
+ satellite: SatelliteParameters;
11
+ }) => Promise<string>;
12
+ /**
13
+ * Retrieves the build version of the satellite.
14
+ * @param {Object} params - The parameters for retrieving the build version.
15
+ * @param {SatelliteParameters} params.satellite - The satellite parameters.
16
+ * @returns {Promise<string>} A promise that resolves to the build version of the satellite.
17
+ */
18
+ export declare const satelliteBuildVersion: (params: {
19
+ satellite: SatelliteParameters;
20
+ }) => Promise<string>;
21
+ /**
22
+ * Retrieves the build type of the satellite.
23
+ * @param {Object} params - The parameters for retrieving the build type.
24
+ * @param {SatelliteParameters} params.satellite - The satellite parameters.
25
+ * @returns {Promise<BuildType | undefined>} A promise that resolves to the build type of the satellite or undefined if not found.
26
+ */
27
+ export declare const satelliteBuildType: ({ satellite: { satelliteId, ...rest } }: {
28
+ satellite: SatelliteParameters;
29
+ }) => Promise<BuildType | undefined>;
@@ -1,4 +1,4 @@
1
- import type { Identity } from '@dfinity/agent';
1
+ import type { HttpAgent, Identity } from '@dfinity/agent';
2
2
  /**
3
3
  * Represents the parameters for an actor.
4
4
  * @interface
@@ -21,6 +21,10 @@ export interface ActorParameters {
21
21
  * @optional
22
22
  */
23
23
  container?: boolean | string;
24
+ /**
25
+ * An optional HttpAgent. If none is provided, a new agent will automatically be created to execute calls.
26
+ */
27
+ agent?: HttpAgent;
24
28
  }
25
29
  /**
26
30
  * Represents the parameters for a satellite actor.
@@ -0,0 +1,24 @@
1
+ import type { canister_install_mode } from '@dfinity/ic-management';
2
+ import { Principal } from '@dfinity/principal';
3
+ import { ActorParameters } from './actor.types';
4
+ export declare enum UpgradeCodeProgressStep {
5
+ AssertingExistingCode = 0,
6
+ StoppingCanister = 1,
7
+ UpgradingCode = 2,
8
+ RestartingCanister = 3
9
+ }
10
+ export type UpgradeCodeProgressState = 'in_progress' | 'success' | 'error';
11
+ export interface UpgradeCodeProgress {
12
+ step: UpgradeCodeProgressStep;
13
+ state: UpgradeCodeProgressState;
14
+ }
15
+ export interface UpgradeCodeParams {
16
+ actor: ActorParameters;
17
+ canisterId: Principal;
18
+ missionControlId?: Principal;
19
+ wasmModule: Uint8Array;
20
+ arg: Uint8Array;
21
+ mode: canister_install_mode;
22
+ preClearChunks?: boolean;
23
+ onProgress?: (progress: UpgradeCodeProgress) => void;
24
+ }
@@ -6,4 +6,4 @@ export declare const createActor: <T = Record<string, ActorMethod<unknown[], unk
6
6
  canisterId: string;
7
7
  config?: Pick<ActorConfig, "callTransform" | "queryTransform">;
8
8
  } & ActorParameters) => Promise<ActorSubclass<T>>;
9
- export declare const initAgent: ({ identity, fetch, container }: ActorParameters) => Promise<HttpAgent>;
9
+ export declare const useOrInitAgent: ({ agent, ...rest }: ActorParameters) => Promise<HttpAgent>;
@@ -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",
3
+ "version": "0.0.59-next-2024-11-27",
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,11 +50,12 @@
50
50
  ],
51
51
  "homepage": "https://juno.build",
52
52
  "peerDependencies": {
53
- "@dfinity/agent": "^2.1.3",
54
- "@dfinity/identity": "^2.1.3",
55
- "@dfinity/principal": "^2.1.3",
53
+ "@dfinity/agent": "*",
54
+ "@dfinity/ic-management": "*",
55
+ "@dfinity/identity": "*",
56
+ "@dfinity/principal": "*",
56
57
  "@junobuild/config": "*",
57
58
  "@junobuild/utils": "*",
58
- "semver": "7.*"
59
+ "semver": "*"
59
60
  }
60
- }
61
+ }