Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
404 changes: 120 additions & 284 deletions package-lock.json

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@
"e2e:playwright:install": "playwright install chromium --with-deps"
},
"dependencies": {
"@dfinity/utils": "^4.0.1",
"@dfinity/zod-schemas": "^3.0.1",
"@icp-sdk/canisters": "^2.0.1",
"@dfinity/utils": "^4.0.2",
"@dfinity/zod-schemas": "^3.0.2",
"@icp-sdk/canisters": "^3.0.0",
"@icp-sdk/core": "^4.2.3",
"@junobuild/admin": "^3.0.3",
"@junobuild/cdn": "^2.0.3",
"@junobuild/admin": "^3.1.0",
"@junobuild/cdn": "^2.1.0",
"@junobuild/cli-tools": "^0.9.4",
"@junobuild/config": "^2.7.0",
"@junobuild/config-loader": "^0.4.6",
"@junobuild/core": "^3.3.0",
"@junobuild/core": "^3.3.1",
"@junobuild/did-tools": "^0.3.6",
"@junobuild/ic-client": "^6.0.0",
"@junobuild/storage": "^2.1.0",
"@junobuild/ic-client": "^7.0.0",
"@junobuild/storage": "^2.1.1",
"@junobuild/utils": "^0.2.3",
"chokidar": "^4.0.3",
"conf": "^14.0.0",
Expand Down
39 changes: 18 additions & 21 deletions src/api/ic.api.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import {
ICManagementCanister,
type list_canister_snapshots_result,
type read_canister_snapshot_data_response,
IcManagementCanister,
type IcManagementDid,
type ReadCanisterSnapshotMetadataParams,
type ReadCanisterSnapshotMetadataResponse,
type snapshot_id,
type SnapshotParams,
type upload_canister_snapshot_metadata_response,
type UploadCanisterSnapshotDataParams,
type UploadCanisterSnapshotMetadataParams
} from '@icp-sdk/canisters/ic-management';
Expand All @@ -16,7 +13,7 @@ import {initAgent} from './agent.api';
export const canisterStop = async ({canisterId}: {canisterId: Principal}): Promise<void> => {
const agent = await initAgent();

const {stopCanister} = ICManagementCanister.create({
const {stopCanister} = IcManagementCanister.create({
agent
});

Expand All @@ -26,7 +23,7 @@ export const canisterStop = async ({canisterId}: {canisterId: Principal}): Promi
export const canisterStart = async ({canisterId}: {canisterId: Principal}): Promise<void> => {
const agent = await initAgent();

const {startCanister} = ICManagementCanister.create({
const {startCanister} = IcManagementCanister.create({
agent
});

Expand All @@ -35,11 +32,11 @@ export const canisterStart = async ({canisterId}: {canisterId: Principal}): Prom

export const takeCanisterSnapshot = async (params: {
canisterId: Principal;
snapshotId?: snapshot_id;
snapshotId?: IcManagementDid.snapshot_id;
}): Promise<void> => {
const agent = await initAgent();

const {takeCanisterSnapshot} = ICManagementCanister.create({
const {takeCanisterSnapshot} = IcManagementCanister.create({
agent
});

Expand All @@ -48,10 +45,10 @@ export const takeCanisterSnapshot = async (params: {

export const listCanisterSnapshots = async (params: {
canisterId: Principal;
}): Promise<list_canister_snapshots_result> => {
}): Promise<IcManagementDid.list_canister_snapshots_result> => {
const agent = await initAgent();

const {listCanisterSnapshots} = ICManagementCanister.create({
const {listCanisterSnapshots} = IcManagementCanister.create({
agent
});

Expand All @@ -60,11 +57,11 @@ export const listCanisterSnapshots = async (params: {

export const loadCanisterSnapshot = async (params: {
canisterId: Principal;
snapshotId: snapshot_id;
snapshotId: IcManagementDid.snapshot_id;
}): Promise<void> => {
const agent = await initAgent();

const {loadCanisterSnapshot} = ICManagementCanister.create({
const {loadCanisterSnapshot} = IcManagementCanister.create({
agent
});

Expand All @@ -73,11 +70,11 @@ export const loadCanisterSnapshot = async (params: {

export const deleteCanisterSnapshot = async (params: {
canisterId: Principal;
snapshotId: snapshot_id;
snapshotId: IcManagementDid.snapshot_id;
}): Promise<void> => {
const agent = await initAgent();

const {deleteCanisterSnapshot} = ICManagementCanister.create({
const {deleteCanisterSnapshot} = IcManagementCanister.create({
agent
});

Expand All @@ -89,7 +86,7 @@ export const readCanisterSnapshotMetadata = async (
): Promise<ReadCanisterSnapshotMetadataResponse> => {
const agent = await initAgent();

const {readCanisterSnapshotMetadata} = ICManagementCanister.create({
const {readCanisterSnapshotMetadata} = IcManagementCanister.create({
agent
});

Expand All @@ -98,10 +95,10 @@ export const readCanisterSnapshotMetadata = async (

export const readCanisterSnapshotData = async (
params: ReadCanisterSnapshotMetadataParams
): Promise<read_canister_snapshot_data_response> => {
): Promise<IcManagementDid.read_canister_snapshot_data_response> => {
const agent = await initAgent();

const {readCanisterSnapshotData} = ICManagementCanister.create({
const {readCanisterSnapshotData} = IcManagementCanister.create({
agent
});

Expand All @@ -110,10 +107,10 @@ export const readCanisterSnapshotData = async (

export const uploadCanisterSnapshotMetadata = async (
params: UploadCanisterSnapshotMetadataParams
): Promise<upload_canister_snapshot_metadata_response> => {
): Promise<IcManagementDid.upload_canister_snapshot_metadata_response> => {
const agent = await initAgent();

const {uploadCanisterSnapshotMetadata} = ICManagementCanister.create({
const {uploadCanisterSnapshotMetadata} = IcManagementCanister.create({
agent
});

Expand All @@ -125,7 +122,7 @@ export const uploadCanisterSnapshotData = async (
): Promise<void> => {
const agent = await initAgent();

const {uploadCanisterSnapshotData} = ICManagementCanister.create({
const {uploadCanisterSnapshotData} = IcManagementCanister.create({
agent
});

Expand Down
6 changes: 3 additions & 3 deletions src/services/config/settings.services.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {isNullish} from '@dfinity/utils';
import {ICManagementCanister, LogVisibility} from '@icp-sdk/canisters/ic-management';
import {IcManagementCanister, LogVisibility} from '@icp-sdk/canisters/ic-management';
import {Principal} from '@icp-sdk/core/principal';
import type {ModuleSettings} from '@junobuild/config';
import {initAgent} from '../../api/agent.api';
Expand All @@ -14,7 +14,7 @@ export const getSettings = async ({

const agent = await initAgent();

const {canisterStatus} = ICManagementCanister.create({
const {canisterStatus} = IcManagementCanister.create({
agent
});

Expand Down Expand Up @@ -59,7 +59,7 @@ export const setSettings = async ({

const agent = await initAgent();

const {updateSettings} = ICManagementCanister.create({
const {updateSettings} = IcManagementCanister.create({
agent
});

Expand Down
8 changes: 4 additions & 4 deletions src/services/modules/snapshot/_snapshot.loader.services.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {isNullish, nonNullish} from '@dfinity/utils';
import type {snapshot_id} from '@icp-sdk/canisters/ic-management';
import type {IcManagementDid} from '@icp-sdk/canisters/ic-management';
import {encodeSnapshotId} from '@icp-sdk/canisters/ic-management';
import {type Principal} from '@icp-sdk/core/principal';
import {red} from 'kleur';
Expand All @@ -13,7 +13,7 @@ const loadSnapshot = async ({
canisterId
}: {
canisterId: Principal;
}): Promise<snapshot_id | undefined> => {
}): Promise<IcManagementDid.snapshot_id | undefined> => {
const spinner = ora('Loading the existing snapshot...').start();

try {
Expand All @@ -33,7 +33,7 @@ export const loadSnapshotAndAssertExist = async ({
}: {
canisterId: Principal;
segment: AssetKey;
}): Promise<{result: 'ok'; snapshotId: snapshot_id} | {result: 'not_found'}> => {
}): Promise<{result: 'ok'; snapshotId: IcManagementDid.snapshot_id} | {result: 'not_found'}> => {
const existingSnapshotId = await loadSnapshot({canisterId});

if (isNullish(existingSnapshotId)) {
Expand All @@ -50,7 +50,7 @@ export const loadSnapshotAndAssertOverwrite = async ({
}: {
canisterId: Principal;
segment: AssetKey;
}): Promise<{snapshotId: snapshot_id | undefined}> => {
}): Promise<{snapshotId: IcManagementDid.snapshot_id | undefined}> => {
const existingSnapshotId = await loadSnapshot({canisterId});

if (nonNullish(existingSnapshotId)) {
Expand Down
8 changes: 4 additions & 4 deletions src/services/modules/snapshot/snapshot.services.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {notEmptyString} from '@dfinity/utils';
import type {snapshot_id} from '@icp-sdk/canisters/ic-management';
import type {IcManagementDid} from '@icp-sdk/canisters/ic-management';
import {encodeSnapshotId} from '@icp-sdk/canisters/ic-management';
import {Principal} from '@icp-sdk/core/principal';
import {nextArg} from '@junobuild/cli-tools';
Expand Down Expand Up @@ -195,7 +195,7 @@ const restoreExistingSnapshot = async ({
...rest
}: {
canisterId: Principal;
snapshotId: snapshot_id;
snapshotId: IcManagementDid.snapshot_id;
segment: AssetKey;
}): Promise<void> => {
const spinner = ora('Restoring the snapshot...').start();
Expand All @@ -214,7 +214,7 @@ const deleteExistingSnapshot = async ({
...rest
}: {
canisterId: Principal;
snapshotId: snapshot_id;
snapshotId: IcManagementDid.snapshot_id;
segment: AssetKey;
}): Promise<void> => {
const spinner = ora('Deleting the snapshot...').start();
Expand All @@ -233,7 +233,7 @@ const takeSnapshot = async ({
...rest
}: {
canisterId: Principal;
snapshotId: snapshot_id | undefined;
snapshotId: IcManagementDid.snapshot_id | undefined;
segment: AssetKey;
}): Promise<void> => {
const spinner = ora('Creating a new snapshot...').start();
Expand Down
4 changes: 2 additions & 2 deletions src/services/modules/snapshot/snapshot.upload.services.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {arrayBufferToUint8Array, isNullish, jsonReviver} from '@dfinity/utils';
import {
encodeSnapshotId,
type snapshot_id,
type IcManagementDid,
type UploadCanisterSnapshotDataKind
} from '@icp-sdk/canisters/ic-management';
import {lstatSync} from 'node:fs';
Expand Down Expand Up @@ -178,7 +178,7 @@ const uploadMetadata = async ({
},
...rest
}: UploadSnapshotParams & {metadata: ReadCanisterSnapshotMetadataResponse} & SnapshotLog): Promise<{
snapshotId: snapshot_id;
snapshotId: IcManagementDid.snapshot_id;
}> => {
log('Uploading snapshot metadata...');

Expand Down
4 changes: 2 additions & 2 deletions src/types/snapshot.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type {snapshot_id} from '@icp-sdk/canisters/ic-management';
import type {IcManagementDid} from '@icp-sdk/canisters/ic-management';
import type {Principal} from '@icp-sdk/core/principal';
import type * as z from 'zod';
import {
Expand All @@ -17,7 +17,7 @@ export type ReadCanisterSnapshotMetadataResponse = z.infer<

export interface DownloadSnapshotParams {
canisterId: Principal;
snapshotId: snapshot_id;
snapshotId: IcManagementDid.snapshot_id;
}

export type UploadSnapshotParams = Omit<DownloadSnapshotParams, 'snapshotId'> &
Expand Down