@dignetwork/dig-sdk 0.0.1-alpha.80 → 0.0.1-alpha.81

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 +1 @@
1
- {"version":3,"file":"DigNetwork.d.ts","sourceRoot":"","sources":["../../src/DigNetwork/DigNetwork.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AASpC,qBAAa,UAAU;IACrB,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,aAAa,CAA2B;gBAEpC,OAAO,EAAE,MAAM;WAOP,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;WAQhD,oBAAoB,CACtC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,GAAG,CAAC,EAAE,MAAM,EACZ,eAAe,GAAE,MAAM,EAAO,GAC7B,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;WA2DZ,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAO5C,kBAAkB,CAAC,iBAAiB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAoG7D,mBAAmB,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;CAUvD"}
1
+ {"version":3,"file":"DigNetwork.d.ts","sourceRoot":"","sources":["../../src/DigNetwork/DigNetwork.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AASpC,qBAAa,UAAU;IACrB,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,aAAa,CAA2B;gBAEpC,OAAO,EAAE,MAAM;WAOP,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;WAQhD,oBAAoB,CACtC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,GAAG,CAAC,EAAE,MAAM,EACZ,eAAe,GAAE,MAAM,EAAO,GAC7B,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;WA2DZ,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAO5C,kBAAkB,CAAC,iBAAiB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAiG7D,mBAAmB,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;CAUvD"}
@@ -135,20 +135,16 @@ class DigNetwork {
135
135
  peerBlackList.push(selectedPeer.IpAddress); // Blacklist and retry
136
136
  continue;
137
137
  }
138
- try {
139
- // Download the store root and associated data
140
- await selectedPeer.downloadStoreRoot(rootInfo.root_hash);
141
- }
142
- catch (error) {
143
- break;
144
- }
138
+ // Download the store root and associated data
139
+ await selectedPeer.downloadStoreRoot(rootInfo.root_hash);
145
140
  // Clear the blacklist upon successful download
146
141
  peerBlackList = [];
147
142
  // Break after successful download to proceed to next root hash
148
143
  break;
149
144
  }
150
145
  catch (error) {
151
- console.error(`Error downloading from peer ${selectedPeer?.IpAddress}. Retrying with another peer.`, error);
146
+ if (error.message)
147
+ console.error(`Error downloading from peer ${selectedPeer?.IpAddress}. Retrying with another peer.`, error);
152
148
  if (selectedPeer) {
153
149
  peerBlackList.push(selectedPeer.IpAddress); // Blacklist and retry
154
150
  }
@@ -500,13 +500,17 @@ class PropagationServer {
500
500
  fs_1.default.writeFileSync(path_1.default.join(tempDir, storeId, `${rootHash}.dat`), datFileContent);
501
501
  // Integrity check for the downloaded files was done during the download
502
502
  // Here we want to make sure we got all the files or we reject the download session
503
- for (const [fileKey, fileData] of Object.entries(root.files)) {
504
- const dataPath = (0, hashUtils_1.getFilePathFromSha256)(fileData.sha256, "data");
505
- const downloadPath = path_1.default.join(tempDir, storeId, dataPath);
506
- if (!fs_1.default.existsSync(path_1.default.join(downloadPath, dataPath))) {
507
- throw new Error(`Missing file!: ${Buffer.from(fileKey, "utf-8")}, aborting session.`);
508
- }
509
- }
503
+ /*for (const [fileKey, fileData] of Object.entries(root.files)) {
504
+ const dataPath = getFilePathFromSha256(
505
+ (fileData as any).sha256,
506
+ "data"
507
+ );
508
+
509
+ const downloadPath = path.join(tempDir, storeId, dataPath);
510
+ if (!fs.existsSync(path.join(downloadPath, dataPath))) {
511
+ throw new Error(`Missing file!: ${Buffer.from(fileKey, "utf-8")}, aborting session.`);
512
+ }
513
+ }*/
510
514
  // After all downloads are complete, copy from temp directory to the main directory
511
515
  const destinationDir = path_1.default.join(config_1.STORE_PATH, storeId);
512
516
  fs_extra_1.default.copySync(path_1.default.join(tempDir, storeId), destinationDir);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dignetwork/dig-sdk",
3
- "version": "0.0.1-alpha.80",
3
+ "version": "0.0.1-alpha.81",
4
4
  "description": "",
5
5
  "type": "commonjs",
6
6
  "main": "./dist/index.js",