@dignetwork/dig-sdk 0.0.1-alpha.8 → 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.
Files changed (64) hide show
  1. package/dist/DataIntegrityTree/DataIntegrityTree.d.ts +5 -2
  2. package/dist/DataIntegrityTree/DataIntegrityTree.d.ts.map +1 -1
  3. package/dist/DataIntegrityTree/DataIntegrityTree.js +93 -34
  4. package/dist/DigNetwork/ContentServer.d.ts +9 -4
  5. package/dist/DigNetwork/ContentServer.d.ts.map +1 -1
  6. package/dist/DigNetwork/ContentServer.js +55 -19
  7. package/dist/DigNetwork/DigNetwork.d.ts +3 -9
  8. package/dist/DigNetwork/DigNetwork.d.ts.map +1 -1
  9. package/dist/DigNetwork/DigNetwork.js +98 -189
  10. package/dist/DigNetwork/DigPeer.d.ts +8 -3
  11. package/dist/DigNetwork/DigPeer.d.ts.map +1 -1
  12. package/dist/DigNetwork/DigPeer.js +65 -114
  13. package/dist/DigNetwork/PropagationServer.d.ts +67 -33
  14. package/dist/DigNetwork/PropagationServer.d.ts.map +1 -1
  15. package/dist/DigNetwork/PropagationServer.js +480 -365
  16. package/dist/blockchain/DataStore.d.ts +17 -6
  17. package/dist/blockchain/DataStore.d.ts.map +1 -1
  18. package/dist/blockchain/DataStore.js +74 -97
  19. package/dist/blockchain/DataStoreSerializer.d.ts +1 -1
  20. package/dist/blockchain/DataStoreSerializer.d.ts.map +1 -1
  21. package/dist/blockchain/FullNodePeer.d.ts +9 -1
  22. package/dist/blockchain/FullNodePeer.d.ts.map +1 -1
  23. package/dist/blockchain/FullNodePeer.js +38 -10
  24. package/dist/blockchain/ServerCoin.d.ts +11 -3
  25. package/dist/blockchain/ServerCoin.d.ts.map +1 -1
  26. package/dist/blockchain/ServerCoin.js +51 -17
  27. package/dist/blockchain/Wallet.d.ts +2 -2
  28. package/dist/blockchain/Wallet.d.ts.map +1 -1
  29. package/dist/blockchain/Wallet.js +2 -2
  30. package/dist/blockchain/coins.d.ts +1 -1
  31. package/dist/blockchain/coins.d.ts.map +1 -1
  32. package/dist/blockchain/coins.js +1 -1
  33. package/dist/types.d.ts +1 -0
  34. package/dist/types.d.ts.map +1 -1
  35. package/dist/utils/ContentScanner.d.ts +63 -0
  36. package/dist/utils/ContentScanner.d.ts.map +1 -0
  37. package/dist/utils/ContentScanner.js +175 -0
  38. package/dist/utils/FileTransfer.d.ts +47 -0
  39. package/dist/utils/FileTransfer.d.ts.map +1 -0
  40. package/dist/utils/FileTransfer.js +209 -0
  41. package/dist/utils/StoreArchiveManager.d.ts +45 -0
  42. package/dist/utils/StoreArchiveManager.d.ts.map +1 -0
  43. package/dist/utils/StoreArchiveManager.js +153 -0
  44. package/dist/utils/asyncPool.d.ts +9 -0
  45. package/dist/utils/asyncPool.d.ts.map +1 -0
  46. package/dist/utils/asyncPool.js +23 -0
  47. package/dist/utils/config.d.ts +1 -1
  48. package/dist/utils/config.d.ts.map +1 -1
  49. package/dist/utils/config.js +2 -3
  50. package/dist/utils/directoryUtils.d.ts +0 -6
  51. package/dist/utils/directoryUtils.d.ts.map +1 -1
  52. package/dist/utils/directoryUtils.js +30 -11
  53. package/dist/utils/index.d.ts +0 -1
  54. package/dist/utils/index.d.ts.map +1 -1
  55. package/dist/utils/index.js +0 -1
  56. package/dist/utils/merkle.d.ts +2 -0
  57. package/dist/utils/merkle.d.ts.map +1 -0
  58. package/dist/utils/merkle.js +28 -0
  59. package/dist/utils/network.d.ts.map +1 -1
  60. package/dist/utils/network.js +0 -1
  61. package/package.json +13 -3
  62. package/dist/utils/deltaUtils.d.ts +0 -2
  63. package/dist/utils/deltaUtils.d.ts.map +0 -1
  64. package/dist/utils/deltaUtils.js +0 -83
@@ -1,41 +1,75 @@
1
- import { Readable } from "stream";
1
+ import https from "https";
2
2
  export declare class PropagationServer {
3
- private ipAddress;
4
- private storeId;
5
- private static certPath;
6
- private static keyPath;
3
+ storeId: string;
4
+ sessionId: string;
5
+ publicKey: string;
6
+ wallet: any;
7
+ ipAddress: string;
8
+ certPath: string;
9
+ keyPath: string;
10
+ username: string | undefined;
11
+ password: string | undefined;
7
12
  private static readonly port;
8
- private static readonly maxRetries;
9
- private static readonly initialDelay;
10
- private static readonly maxDelay;
11
- private static readonly delayMultiplier;
12
13
  constructor(ipAddress: string, storeId: string);
13
- pushFile(filePath: string, relativePath: string): Promise<void>;
14
- subscribeToStore(): Promise<void>;
15
- unsubscribeFromStore(): Promise<void>;
16
- getStoreStatus(): Promise<any>;
17
- streamStoreData(dataPath: string): Promise<Readable>;
18
- getStoreData(dataPath: string): Promise<string>;
19
- getStatus(): Promise<{
20
- synced: boolean;
14
+ /**
15
+ * Initialize the Wallet instance.
16
+ */
17
+ initializeWallet(): Promise<void>;
18
+ /**
19
+ * Create an Axios HTTPS Agent with self-signed certificate allowance.
20
+ */
21
+ createHttpsAgent(): https.Agent;
22
+ /**
23
+ * Check if the store and optional root hash exist by making a HEAD request.
24
+ */
25
+ checkStoreExists(rootHash?: string): Promise<{
26
+ storeExists: boolean;
27
+ rootHashExists: boolean;
21
28
  }>;
22
- headStore(): Promise<boolean>;
23
- isStoreSynced(): Promise<boolean>;
24
- getUploadDetails(): Promise<{
29
+ /**
30
+ * Start an upload session by sending a POST request with the rootHash.dat file.
31
+ */
32
+ startUploadSession(rootHash: string): Promise<void>;
33
+ /**
34
+ * Request a nonce for a file by sending a HEAD request to the server.
35
+ */
36
+ getFileNonce(filename: string): Promise<{
25
37
  nonce: string;
26
- lastUploadedHash: string;
27
- generationIndex: number;
28
- username: string;
29
- password: string;
38
+ fileExists: boolean;
30
39
  }>;
31
- private postRequest;
32
- private fetchUploadDetails;
33
- private uploadFileDirect;
34
- private retryOperation;
35
- private fetch;
36
- private head;
37
- private fetchJson;
38
- private createReadStreamWithRetries;
39
- private createReadStream;
40
+ /**
41
+ * Upload a file to the server by sending a PUT request.
42
+ * Logs progress using a local cli-progress bar.
43
+ */
44
+ uploadFile(label: string, dataPath: string): Promise<void>;
45
+ /**
46
+ * Commit the upload session by sending a POST request to the server.
47
+ */
48
+ commitUploadSession(): Promise<any>;
49
+ /**
50
+ * Static function to handle the entire upload process for multiple files based on rootHash.
51
+ */
52
+ static uploadStore(storeId: string, rootHash: string, ipAddress: string): Promise<void>;
53
+ /**
54
+ * Fetch a file from the server by sending a GET request and return its content in memory.
55
+ * Logs progress using a local cli-progress bar.
56
+ */
57
+ fetchFile(dataPath: string): Promise<Buffer>;
58
+ /**
59
+ * Get details of a file, including whether it exists and its size.
60
+ */
61
+ getFileDetails(dataPath: string, rootHash: string): Promise<{
62
+ exists: boolean;
63
+ size: number;
64
+ }>;
65
+ /**
66
+ * Download a file from the server by sending a GET request.
67
+ * Logs progress using a local cli-progress bar.
68
+ */
69
+ downloadFile(label: string, dataPath: string, rootHash: string, baseDir: string): Promise<void>;
70
+ /**
71
+ * Static function to handle downloading multiple files from a DataStore based on file paths.
72
+ */
73
+ static downloadStore(storeId: string, rootHash: string, ipAddress: string): Promise<void>;
40
74
  }
41
75
  //# sourceMappingURL=PropagationServer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PropagationServer.d.ts","sourceRoot":"","sources":["../../src/DigNetwork/PropagationServer.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAGlC,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAS;IAChC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAS;IAC/B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAQ;IACpC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAK;IACvC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAQ;IAC5C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAS;IACzC,OAAO,CAAC,MA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