From 5791d499d589418600d5794b5fd6cf1028371420 Mon Sep 17 00:00:00 2001 From: Michael Taylor Date: Tue, 24 Sep 2024 21:14:19 -0400 Subject: [PATCH 1/2] fix: download store --- src/DigNetwork/PropagationServer.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/DigNetwork/PropagationServer.ts b/src/DigNetwork/PropagationServer.ts index b524789..13e20da 100644 --- a/src/DigNetwork/PropagationServer.ts +++ b/src/DigNetwork/PropagationServer.ts @@ -657,7 +657,10 @@ export class PropagationServer { const downloadTasks = []; for (const [fileKey, fileData] of Object.entries(root.files)) { - const dataPath = getFilePathFromSha256((fileData as any).sha256, "data"); + const dataPath = getFilePathFromSha256( + root.files[fileKey].sha256, + "data" + ); const label = Buffer.from(fileKey, "hex").toString("utf-8"); downloadTasks.push({ label, dataPath }); } @@ -687,17 +690,19 @@ export class PropagationServer { // Integrity check for the downloaded files was done during the download // Here we want to make sure we got all the files or we reject the download session - /*for (const [fileKey, fileData] of Object.entries(root.files)) { + for (const [fileKey, fileData] of Object.entries(root.files)) { const dataPath = getFilePathFromSha256( - (fileData as any).sha256, + root.files[fileKey].sha256, "data" ); const downloadPath = path.join(tempDir, storeId, dataPath); if (!fs.existsSync(path.join(downloadPath, dataPath))) { - throw new Error(`Missing file!: ${Buffer.from(fileKey, "utf-8")}, aborting session.`); + throw new Error( + `Missing file: ${Buffer.from(fileKey, "utf-8")}, aborting session.` + ); } - }*/ + } // After all downloads are complete, copy from temp directory to the main directory const destinationDir = path.join(STORE_PATH, storeId); @@ -709,6 +714,8 @@ export class PropagationServer { await dataStore.generateManifestFile(); console.log(green(`✔ All files have been downloaded to ${storeId}.`)); + } catch (error) { + console.log(red("✖ Error downloading files:"), error); } finally { // Clean up the temporary directory fsExtra.removeSync(tempDir); From 485d2a228fa9dd96a23192799e1a6aca0585ebfa Mon Sep 17 00:00:00 2001 From: Michael Taylor Date: Tue, 24 Sep 2024 21:45:17 -0400 Subject: [PATCH 2/2] chore(release): 0.0.1-alpha.82 --- CHANGELOG.md | 7 +++++++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3529a11..d770d2a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [0.0.1-alpha.82](https://github.com/DIG-Network/dig-chia-sdk/compare/v0.0.1-alpha.81...v0.0.1-alpha.82) (2024-09-25) + + +### Bug Fixes + +* download store ([5791d49](https://github.com/DIG-Network/dig-chia-sdk/commit/5791d499d589418600d5794b5fd6cf1028371420)) + ### [0.0.1-alpha.81](https://github.com/DIG-Network/dig-chia-sdk/compare/v0.0.1-alpha.80...v0.0.1-alpha.81) (2024-09-25) diff --git a/package-lock.json b/package-lock.json index 1275d71..e24ef1a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@dignetwork/dig-sdk", - "version": "0.0.1-alpha.81", + "version": "0.0.1-alpha.82", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@dignetwork/dig-sdk", - "version": "0.0.1-alpha.81", + "version": "0.0.1-alpha.82", "license": "ISC", "dependencies": { "@dignetwork/datalayer-driver": "^0.1.25", diff --git a/package.json b/package.json index 07a91ce..416a242 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@dignetwork/dig-sdk", - "version": "0.0.1-alpha.81", + "version": "0.0.1-alpha.82", "description": "", "type": "commonjs", "main": "./dist/index.js",