filemail-sdk 9.3.4 → 9.4.0

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 (231) hide show
  1. package/LICENSE +10 -10
  2. package/dist/src/autoDownloader/autoDownloader.js.map +1 -1
  3. package/dist/src/autoDownloader/autoDownloaderDestroyer.js.map +1 -1
  4. package/dist/src/autoDownloader/autoDownloaderError.js.map +1 -1
  5. package/dist/src/autoDownloader/autoDownloaderEvent.js.map +1 -1
  6. package/dist/src/autoDownloader/autoDownloaderOptions.js.map +1 -1
  7. package/dist/src/autoDownloader/autoDownloaderStateSerializer.js.map +1 -1
  8. package/dist/src/autoDownloader/eventArgs/autoDownloadEventArgs.js.map +1 -1
  9. package/dist/src/autoDownloader/eventArgs/autoDownloadFailedEventArgs.js.map +1 -1
  10. package/dist/src/autoDownloader/eventArgs/autoDownloadProgressedEventArgs.js.map +1 -1
  11. package/dist/src/autoDownloader/eventArgs/autoDownloadStartedEventArgs.js.map +1 -1
  12. package/dist/src/autoDownloader/eventArgs/autoDownloadStartingFailedEventArgs.js.map +1 -1
  13. package/dist/src/autoDownloader/eventArgs/autoDownloadUnhealthyEventArgs.js.map +1 -1
  14. package/dist/src/autoDownloader/eventArgs/checkingForNewTransfersStartedEventArgs.js.map +1 -1
  15. package/dist/src/autoDownloader/eventArgs/newTransfersCheckCompletedEventArgs.js.map +1 -1
  16. package/dist/src/autoDownloader/factory/nodeAutoDownloaderFactory.js.map +1 -1
  17. package/dist/src/autoDownloader/factory/nodeAutoDownloaderFactoryOptions.js.map +1 -1
  18. package/dist/src/autoDownloader/newInboxTransfersRetriever/newInboxTransfer.js.map +1 -1
  19. package/dist/src/autoDownloader/newInboxTransfersRetriever/newInboxTransfersRetriever.js.map +1 -1
  20. package/dist/src/autoDownloader/node/nodeAutoDownloaderStateSerializer.js.map +1 -1
  21. package/dist/src/autoDownloader/node/nodeTransferDownloaderFactory.js.map +1 -1
  22. package/dist/src/autoDownloader/state/autoDownloaderRecoverableState.js.map +1 -1
  23. package/dist/src/autoDownloader/state/autoDownloaderState.js.map +1 -1
  24. package/dist/src/autoDownloader/state/autoDownloaderStateRecoverableTransfer.js.map +1 -1
  25. package/dist/src/autoDownloader/state/autoDownloaderStateRunningTransfer.js.map +1 -1
  26. package/dist/src/autoDownloader/state/autoDownloaderStateSnapshot.js.map +1 -1
  27. package/dist/src/autoDownloader/transferDownloaderFactory.js.map +1 -1
  28. package/dist/src/autoDownloader/transferHandler/autoDownloaderNewTransferHandler.js.map +1 -1
  29. package/dist/src/autoDownloader/transferHandler/autoDownloaderRecoverableTransferHandler.js.map +1 -1
  30. package/dist/src/autoDownloader/transferHandler/autoDownloaderTransferHandlerBase.js.map +1 -1
  31. package/dist/src/client/downloader/downloaderCore.d.ts.map +1 -1
  32. package/dist/src/client/downloader/downloaderCore.js +6 -0
  33. package/dist/src/client/downloader/downloaderCore.js.map +1 -1
  34. package/dist/src/client/downloader/node/nodeTransferDownloader.js.map +1 -1
  35. package/dist/src/client/downloader/transferDownloader.js.map +1 -1
  36. package/dist/src/client/environmentVariables.js.map +1 -1
  37. package/dist/src/client/healthMonitor/events/eventArgs/healthMonitorHealthyEventArgs.js.map +1 -1
  38. package/dist/src/client/healthMonitor/events/eventArgs/healthMonitorUnhealthyEventArgs.js.map +1 -1
  39. package/dist/src/client/healthMonitor/events/transferHealthMonitorEvent.js.map +1 -1
  40. package/dist/src/client/healthMonitor/onlineChecker/nodeOnlineChecker.js.map +1 -1
  41. package/dist/src/client/healthMonitor/onlineChecker/onlineChecker.js.map +1 -1
  42. package/dist/src/client/healthMonitor/onlineChecker/webOnlineChecker.js.map +1 -1
  43. package/dist/src/client/healthMonitor/transferDownloaderHealthMonitor.js.map +1 -1
  44. package/dist/src/client/healthMonitor/transferHealthMonitorBase.js.map +1 -1
  45. package/dist/src/client/healthMonitor/transferUploaderHealthMonitor.js.map +1 -1
  46. package/dist/src/client/loggers/dummyLogger.js.map +1 -1
  47. package/dist/src/client/loggers/logger.js.map +1 -1
  48. package/dist/src/client/loggers/utils/logHealthyStatus.js.map +1 -1
  49. package/dist/src/client/node/nodeFileDetailsProvider.js.map +1 -1
  50. package/dist/src/client/uploader/node/nodeTransferUploader.js.map +1 -1
  51. package/dist/src/client/uploader/transferUploader.js.map +1 -1
  52. package/dist/src/client/uploader/transferUploaderBase.js.map +1 -1
  53. package/dist/src/client/uploader/transferUploaderConfig.js.map +1 -1
  54. package/dist/src/client/uploader/utils/uploaderUtils.js.map +1 -1
  55. package/dist/src/client/uploader/web/webTransferUploader.js.map +1 -1
  56. package/dist/src/downloader/api/fileServerDownloadClient.js.map +1 -1
  57. package/dist/src/downloader/api/node/nodeFileServerDownloadClient.js.map +1 -1
  58. package/dist/src/downloader/chunkDownloader.d.ts.map +1 -1
  59. package/dist/src/downloader/chunkDownloader.js +22 -3
  60. package/dist/src/downloader/chunkDownloader.js.map +1 -1
  61. package/dist/src/downloader/downloadFolderResolver.js.map +1 -1
  62. package/dist/src/downloader/downloadLogger.js.map +1 -1
  63. package/dist/src/downloader/downloadOptions.js.map +1 -1
  64. package/dist/src/downloader/downloadStatus/downloadFileChunkProgress.js.map +1 -1
  65. package/dist/src/downloader/downloadStatus/downloadFileProgress.js.map +1 -1
  66. package/dist/src/downloader/downloadStatus/downloadFilePromise.js.map +1 -1
  67. package/dist/src/downloader/downloadStatus/downloadState.d.ts +1 -0
  68. package/dist/src/downloader/downloadStatus/downloadState.d.ts.map +1 -1
  69. package/dist/src/downloader/downloadStatus/downloadState.js +4 -0
  70. package/dist/src/downloader/downloadStatus/downloadState.js.map +1 -1
  71. package/dist/src/downloader/downloadTracker.d.ts.map +1 -1
  72. package/dist/src/downloader/downloadTracker.js +31 -0
  73. package/dist/src/downloader/downloadTracker.js.map +1 -1
  74. package/dist/src/downloader/dtos/downloadCommand.js.map +1 -1
  75. package/dist/src/downloader/dtos/downloadError.js.map +1 -1
  76. package/dist/src/downloader/dtos/downloadErrorCode.js.map +1 -1
  77. package/dist/src/downloader/dtos/downloadEvent.js.map +1 -1
  78. package/dist/src/downloader/dtos/downloadFileChunkInfo.js.map +1 -1
  79. package/dist/src/downloader/dtos/downloadFileInfo.js.map +1 -1
  80. package/dist/src/downloader/dtos/downloadFilesCommand.js.map +1 -1
  81. package/dist/src/downloader/dtos/downloadInfo.js.map +1 -1
  82. package/dist/src/downloader/dtos/downloadRegistrationMode.js.map +1 -1
  83. package/dist/src/downloader/dtos/downloadTrackerFileInfo.js.map +1 -1
  84. package/dist/src/downloader/dtos/downloadTrackerFileProgressInfo.d.ts +5 -0
  85. package/dist/src/downloader/dtos/downloadTrackerFileProgressInfo.d.ts.map +1 -1
  86. package/dist/src/downloader/dtos/downloadTrackerFileProgressInfo.js.map +1 -1
  87. package/dist/src/downloader/dtos/downloadTrackerProgressInfo.js.map +1 -1
  88. package/dist/src/downloader/dtos/downloadTrackingMetadata.js.map +1 -1
  89. package/dist/src/downloader/dtos/downloaderRestoredState.js.map +1 -1
  90. package/dist/src/downloader/eventArgs/chunkDownloadEventArgs.js.map +1 -1
  91. package/dist/src/downloader/eventArgs/chunkDownloadFailedEventArgs.js.map +1 -1
  92. package/dist/src/downloader/eventArgs/downloadCompletedEventArgs.js.map +1 -1
  93. package/dist/src/downloader/eventArgs/downloadEventArgs.js.map +1 -1
  94. package/dist/src/downloader/eventArgs/downloadMetadataDeterminedEventArgs.js.map +1 -1
  95. package/dist/src/downloader/eventArgs/downloadPauseEventArgs.js.map +1 -1
  96. package/dist/src/downloader/eventArgs/downloadTrackingFailedEventArgs.js.map +1 -1
  97. package/dist/src/downloader/eventArgs/fileDownloadEventArgs.js.map +1 -1
  98. package/dist/src/downloader/eventArgs/fileDownloadFailedEventArgs.js.map +1 -1
  99. package/dist/src/downloader/filesDownloader.d.ts.map +1 -1
  100. package/dist/src/downloader/filesDownloader.js +97 -6
  101. package/dist/src/downloader/filesDownloader.js.map +1 -1
  102. package/dist/src/downloader/filesPreparer.js.map +1 -1
  103. package/dist/src/index.js.map +1 -1
  104. package/dist/src/index.node.js.map +1 -1
  105. package/dist/src/index.web.js.map +1 -1
  106. package/dist/src/uploader/api/dtos/handshakeRequest.js.map +1 -1
  107. package/dist/src/uploader/api/dtos/handshakeResponse.js.map +1 -1
  108. package/dist/src/uploader/api/dtos/pingResponse.js.map +1 -1
  109. package/dist/src/uploader/api/dtos/sendChunkRequest.js.map +1 -1
  110. package/dist/src/uploader/api/fileServerUdpClient.js.map +1 -1
  111. package/dist/src/uploader/api/fileServerUploadClient.js.map +1 -1
  112. package/dist/src/uploader/api/node/nodeFileServerUdpClient.js +8 -8
  113. package/dist/src/uploader/api/node/nodeFileServerUdpClient.js.map +1 -1
  114. package/dist/src/uploader/api/node/nodeFileServerUploadClient.js.map +1 -1
  115. package/dist/src/uploader/api/web/utils/axiosIdleTimeoutManager.js.map +1 -1
  116. package/dist/src/uploader/api/web/webFileServerUploadClient.js.map +1 -1
  117. package/dist/src/uploader/chunkStreamProviderFactory/nodeFileDetailsUploaderChunkStreamProviderFactory.js.map +1 -1
  118. package/dist/src/uploader/chunkStreamProviderFactory/uploaderChunkStreamProviderFactory.js.map +1 -1
  119. package/dist/src/uploader/chunkStreamProviderFactory/webFileDetailsUploaderChunkStreamProviderFactory.js.map +1 -1
  120. package/dist/src/uploader/chunksIterator/chunksIterator.js.map +1 -1
  121. package/dist/src/uploader/eventArgs/fileChunkUploadCompletedEventArgs.js.map +1 -1
  122. package/dist/src/uploader/eventArgs/fileChunkUploadCompletedPartiallyEventArgs.js.map +1 -1
  123. package/dist/src/uploader/eventArgs/fileChunkUploadEventArgs.js.map +1 -1
  124. package/dist/src/uploader/eventArgs/fileChunkUploadFailedEventArgs.js.map +1 -1
  125. package/dist/src/uploader/eventArgs/fileChunkUploadProgressedEventArgs.js.map +1 -1
  126. package/dist/src/uploader/eventArgs/fileUploadEventArgs.js.map +1 -1
  127. package/dist/src/uploader/eventArgs/fileUploadFailedEventArgs.js.map +1 -1
  128. package/dist/src/uploader/eventArgs/transferMetadataDeterminedEventArgs.js.map +1 -1
  129. package/dist/src/uploader/eventArgs/transferUploadCompletedEventArgs.js.map +1 -1
  130. package/dist/src/uploader/eventArgs/transferUploadModeChosenEventArgs.js.map +1 -1
  131. package/dist/src/uploader/eventArgs/transferUploadProgressedEventArgs.js.map +1 -1
  132. package/dist/src/uploader/export/transferUploadExportData.js.map +1 -1
  133. package/dist/src/uploader/export/transferUploadExportState.js.map +1 -1
  134. package/dist/src/uploader/export/transferUploadMetadata.js.map +1 -1
  135. package/dist/src/uploader/optimizer/optimizationValues.js.map +1 -1
  136. package/dist/src/uploader/optimizer/strategies/udpConcurrencyBasedOptimizationStrategy.js.map +1 -1
  137. package/dist/src/uploader/optimizer/strategies/udpSleepBasedOptimizationStrategy.js.map +1 -1
  138. package/dist/src/uploader/optimizer/transferUploadOptimizationStrategy.js.map +1 -1
  139. package/dist/src/uploader/optimizer/transferUploadOptimizer.js.map +1 -1
  140. package/dist/src/uploader/optimizer/uploadOptimizer.js.map +1 -1
  141. package/dist/src/uploader/options/transferUploadAppendInfo.js.map +1 -1
  142. package/dist/src/uploader/options/transferUploadConfig.js.map +1 -1
  143. package/dist/src/uploader/options/transferUploadInfo.js.map +1 -1
  144. package/dist/src/uploader/options/transferUploadInfoBase.js.map +1 -1
  145. package/dist/src/uploader/pauseController.js.map +1 -1
  146. package/dist/src/uploader/state/continuousChunksCalculator.js.map +1 -1
  147. package/dist/src/uploader/state/readonlyTransferUploadStateFile.js.map +1 -1
  148. package/dist/src/uploader/state/readonlyTransferUploadStateFiles.js.map +1 -1
  149. package/dist/src/uploader/state/transferUploadProgressCalculator.js.map +1 -1
  150. package/dist/src/uploader/state/transferUploadState.js.map +1 -1
  151. package/dist/src/uploader/state/transferUploadStateFile.js.map +1 -1
  152. package/dist/src/uploader/state/transferUploadStateFiles.js.map +1 -1
  153. package/dist/src/uploader/transferUpload.js.map +1 -1
  154. package/dist/src/uploader/transferUploadError.js.map +1 -1
  155. package/dist/src/uploader/transferUploadEvent.js.map +1 -1
  156. package/dist/src/utils/api/apiClient.js.map +1 -1
  157. package/dist/src/utils/api/apiClientBase.js.map +1 -1
  158. package/dist/src/utils/api/apiError.js.map +1 -1
  159. package/dist/src/utils/api/apiFilemail449Error.js.map +1 -1
  160. package/dist/src/utils/api/apiFilemailError.js.map +1 -1
  161. package/dist/src/utils/api/dtos/baseResponse.js.map +1 -1
  162. package/dist/src/utils/api/dtos/cancelTransferRequest.js.map +1 -1
  163. package/dist/src/utils/api/dtos/finalizeTransferRequest.js.map +1 -1
  164. package/dist/src/utils/api/dtos/finalizeTransferResponse.js.map +1 -1
  165. package/dist/src/utils/api/dtos/getCompanyResponse.js.map +1 -1
  166. package/dist/src/utils/api/dtos/getCompressedFileMetadataResponse.js.map +1 -1
  167. package/dist/src/utils/api/dtos/getInboxTransfersRequest.js.map +1 -1
  168. package/dist/src/utils/api/dtos/getInboxTransfersResponse.js.map +1 -1
  169. package/dist/src/utils/api/dtos/getRangehashResponse.js.map +1 -1
  170. package/dist/src/utils/api/dtos/getTransferRequest.js.map +1 -1
  171. package/dist/src/utils/api/dtos/getTransferResponse.js.map +1 -1
  172. package/dist/src/utils/api/dtos/initializeTransferRequest.js.map +1 -1
  173. package/dist/src/utils/api/dtos/initializeTransferResponse.js.map +1 -1
  174. package/dist/src/utils/api/dtos/loginRequest.js.map +1 -1
  175. package/dist/src/utils/api/dtos/loginResponse.js.map +1 -1
  176. package/dist/src/utils/api/dtos/registerFileDownloadRequest.js.map +1 -1
  177. package/dist/src/utils/api/dtos/registerTransferDownloadRequest.js.map +1 -1
  178. package/dist/src/utils/api/dtos/resetTransferRequest.js.map +1 -1
  179. package/dist/src/utils/api/dtos/sendFileChunkRequest.js.map +1 -1
  180. package/dist/src/utils/api/dtos/transferCustomFieldDto.js.map +1 -1
  181. package/dist/src/utils/api/dtos/transferFileDto.js.map +1 -1
  182. package/dist/src/utils/api/fileServerClientFactory.js.map +1 -1
  183. package/dist/src/utils/api/node/gotWorkarounds.js.map +1 -1
  184. package/dist/src/utils/api/node/nodeApiClient.js.map +1 -1
  185. package/dist/src/utils/api/node/nodeClientBase.js.map +1 -1
  186. package/dist/src/utils/api/node/nodeFileServerClientFactory.js.map +1 -1
  187. package/dist/src/utils/api/node/nodeFileserverClientBase.js.map +1 -1
  188. package/dist/src/utils/api/urlUtil.js.map +1 -1
  189. package/dist/src/utils/api/web/webApiClient.js.map +1 -1
  190. package/dist/src/utils/api/web/webClientBase.js.map +1 -1
  191. package/dist/src/utils/api/web/webFileServerClientFactory.js.map +1 -1
  192. package/dist/src/utils/api/web/webFileserverClientBase.js.map +1 -1
  193. package/dist/src/utils/concurrencyController/concurrencyController.js.map +1 -1
  194. package/dist/src/utils/concurrencyController/concurrencyReleaser.js.map +1 -1
  195. package/dist/src/utils/concurrencyController/transferConcurrencyController.js.map +1 -1
  196. package/dist/src/utils/crypto/cryptographyProvider.js.map +1 -1
  197. package/dist/src/utils/crypto/node/nodeCryptographyProvider.js.map +1 -1
  198. package/dist/src/utils/crypto/web/webCryptographyProvider.js.map +1 -1
  199. package/dist/src/utils/dateAndTime/simpleDateFormatter.js.map +1 -1
  200. package/dist/src/utils/events/chunkProgressEvent.js.map +1 -1
  201. package/dist/src/utils/events/eventsEngine.js.map +1 -1
  202. package/dist/src/utils/events/node/nodeEventsEngine.js.map +1 -1
  203. package/dist/src/utils/events/web/webEventsEngine.js.map +1 -1
  204. package/dist/src/utils/fileSystem/chunkStreamProvider.js.map +1 -1
  205. package/dist/src/utils/fileSystem/chunkStreamProviderFactory.js.map +1 -1
  206. package/dist/src/utils/fileSystem/fileDetails.js.map +1 -1
  207. package/dist/src/utils/fileSystem/fileSystemService.d.ts +2 -2
  208. package/dist/src/utils/fileSystem/fileSystemService.d.ts.map +1 -1
  209. package/dist/src/utils/fileSystem/fileSystemService.js.map +1 -1
  210. package/dist/src/utils/fileSystem/fsError.js.map +1 -1
  211. package/dist/src/utils/fileSystem/node/nodeChunkStreamProvider.js.map +1 -1
  212. package/dist/src/utils/fileSystem/node/nodeChunkStreamProviderFactory.js.map +1 -1
  213. package/dist/src/utils/fileSystem/node/nodeFileDetails.js.map +1 -1
  214. package/dist/src/utils/fileSystem/node/nodeFileSystemService.d.ts +2 -1
  215. package/dist/src/utils/fileSystem/node/nodeFileSystemService.d.ts.map +1 -1
  216. package/dist/src/utils/fileSystem/node/nodeFileSystemService.js +15 -4
  217. package/dist/src/utils/fileSystem/node/nodeFileSystemService.js.map +1 -1
  218. package/dist/src/utils/fileSystem/parsedPath.js.map +1 -1
  219. package/dist/src/utils/fileSystem/web/chunkStreamProvider/webChunkStreamEncrypter.js.map +1 -1
  220. package/dist/src/utils/fileSystem/web/chunkStreamProvider/webChunkStreamProvider.js.map +1 -1
  221. package/dist/src/utils/fileSystem/web/webChunkStreamProviderFactory.js.map +1 -1
  222. package/dist/src/utils/fileSystem/web/webFileDetails.js.map +1 -1
  223. package/dist/src/utils/jsonParsing.js.map +1 -1
  224. package/dist/src/utils/logging/logEventPropertyNames.js.map +1 -1
  225. package/dist/src/utils/mergeAbortAndPauseSignals.js.map +1 -1
  226. package/dist/src/utils/networking/throttlingOptions.js.map +1 -1
  227. package/dist/src/utils/promiseAll.js.map +1 -1
  228. package/dist/src/utils/types/transferStatus.js.map +1 -1
  229. package/dist/src/utils/uint8ArrayUtils.js.map +1 -1
  230. package/package.json +79 -79
  231. package/readme.md +18 -18
@@ -1 +1 @@
1
- {"version":3,"file":"downloadTracker.js","sourceRoot":"","sources":["../../../src/downloader/downloadTracker.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,OAAO,aAAa,MAAM,yBAAyB,CAAC;AACpD,OAAO,iBAAiB,MAAM,6BAA6B,CAAC;AAC5D,OAAO,qBAAqB,MAAM,yBAAyB,CAAC;AAC5D,OAAO,qBAAqB,MAAM,iCAAiC,CAAC;AACpE,OAAO,gBAAgB,MAAM,4BAA4B,CAAC;AAC1D,OAAO,cAAc,MAAM,kCAAkC,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EAAE,KAAK,EAAE,GAAY,EAAE,EAAE,iBAAiB,CAAC,wBAAwB,CAAC,CAAC;QACrK,CAAC;IACL,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,4BAA4B,CAAC,UAAkB,EAAE,0BAAkC,EAAE,UAA6B;QAC3H,MAAM,UAAU,GAAG,IAAI,KAAK,EAAE,CAAC;QAC/B,MAAM,YAAY,GAAG,EAAe,CAAC,eAAe,CAAC,UAAU,EAAE,0BAA0B,EAAE,UAAU,CAAC,CAAC;QAEzG,MAAM,UAAU,CAAC,YAAY,CAAC,KAAK,IAAI,EAAE;YACrC,IAAI,CAAC;gBACD,MAAM,UAAU,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;YAChD,CAAC;YACD,OAAO,GAAG,EAAE,CAAC;gBACT,MAAM,IAAI,aAAa,CAAC,sCAAsC,UAAU,MAAM,YAAY,EAAE,EAAE,EAAE,KAAK,EAAE,GAAY,EAAE,EAAE,iBAAiB,CAAC,qBAAqB,CAAC,CAAC;YACpK,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;IAED,KAAK,CAAC,SAAS;QACX,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAClC,CAAC;CACJ;;eAzboB,eAAe","sourcesContent":["import { Mutex } from \"async-mutex\";\r\n\r\nimport DownloadError from \"./dtos/downloadError.js\";\r\nimport DownloadErrorCode from \"./dtos/downloadErrorCode.js\";\r\nimport TransferDownloadEvent from \"./dtos/downloadEvent.js\";\r\nimport DownloadFileChunkInfo from \"./dtos/downloadFileChunkInfo.js\";\r\nimport DownloadFileInfo from \"./dtos/downloadFileInfo.js\";\r\nimport TransferStatus from \"../utils/types/transferStatus.js\";\r\n\r\nimport type EventsEngine from \"../utils/events/eventsEngine.js\";\r\nimport type FileSystemService from \"../utils/fileSystem/fileSystemService.js\";\r\nimport type DownloadOptions from \"./downloadOptions.js\";\r\nimport type DownloaderRestoredState from \"./dtos/downloaderRestoredState.js\";\r\nimport type DownloadTrackerFileInfo from \"./dtos/downloadTrackerFileInfo.js\";\r\nimport type DownloadTrackerProgressInfo from \"./dtos/downloadTrackerProgressInfo.js\";\r\nimport type ChunkDownloadEventArgs from \"./eventArgs/chunkDownloadEventArgs.js\";\r\nimport type DownloadPauseEventArgs from \"./eventArgs/downloadPauseEventArgs.js\";\r\nimport type FileDownloadEventArgs from \"./eventArgs/fileDownloadEventArgs.js\";\r\nimport type FileDownloadFailedEventArgs from \"./eventArgs/fileDownloadFailedEventArgs.js\";\r\nimport type DownloadTrackingFailedEventArgs from \"./eventArgs/downloadTrackingFailedEventArgs.js\";\r\nimport type DownloadCompletedEventArgs from \"./eventArgs/downloadCompletedEventArgs.js\";\r\nimport type DownloadTrackerFileProgressInfo from \"./dtos/downloadTrackerFileProgressInfo.js\";\r\nimport type DownloadTrackingMetadata from \"./dtos/downloadTrackingMetadata.js\";\r\nimport type { DownloadCommandE2eeData } from \"./dtos/downloadCommand.js\";\r\n\r\nexport default class DownloadTracker {\r\n readonly #downloadId: string;\r\n readonly #fileSystem: FileSystemService;\r\n readonly #trackingPath: string;\r\n readonly #eventsEngine: EventsEngine;\r\n readonly #options: DownloadOptions;\r\n readonly #metadata: DownloadTrackingMetadata;\r\n readonly #filesMutex: Mutex;\r\n\r\n #progressIntervalTimer: ReturnType<typeof setInterval> | null = null;\r\n #allFiles: Record<string, DownloadTrackerFileInfo> = {};\r\n #progress: DownloadTrackerProgressInfo = { activeTime: 0, trackedFiles: {} };\r\n #running = false;\r\n #restored = false;\r\n #filesChanged = false;\r\n #progressChanged = false;\r\n #canTrack = false;\r\n\r\n constructor(downloadId: string, options: DownloadOptions, fileSystem: FileSystemService, eventsEngine: EventsEngine, e2eeData?: DownloadCommandE2eeData, region?: string) {\r\n if (!options.downloadTrackingBaseFolder)\r\n throw new DownloadError(`Download tracker cannot be created - tracking folder is not specified`);\r\n\r\n this.#downloadId = downloadId;\r\n this.#options = options;\r\n this.#metadata = this.createMetadata(region, e2eeData);\r\n this.#fileSystem = fileSystem;\r\n this.#eventsEngine = eventsEngine;\r\n this.#trackingPath = DownloadTracker.getTrackingPath(downloadId, options.downloadTrackingBaseFolder, fileSystem);\r\n this.#filesMutex = new Mutex();\r\n }\r\n\r\n private createMetadata(region: string | undefined, e2eeData?: DownloadCommandE2eeData): DownloadTrackingMetadata {\r\n if (!e2eeData)\r\n return { region };\r\n\r\n return {\r\n region,\r\n e2eeData:\r\n {\r\n ivAsHex: e2eeData.iv.toString(`hex`),\r\n keyAsHex: e2eeData.key.toString(`hex`),\r\n },\r\n };\r\n }\r\n\r\n private static getTrackingPath(downloadId: string, downloadTrackingBaseFolder: string, fileSystem: FileSystemService) {\r\n return fileSystem.pathJoin(downloadTrackingBaseFolder, downloadId);\r\n }\r\n\r\n get #filesPath(): string {\r\n return this.#fileSystem.pathJoin(this.#trackingPath, `files.json`);\r\n }\r\n\r\n get #filesPathTemp(): string {\r\n return this.#fileSystem.pathJoin(this.#trackingPath, `files.tmp`);\r\n }\r\n\r\n get #optionsFilePath(): string {\r\n return this.#fileSystem.pathJoin(this.#trackingPath, `options.json`);\r\n }\r\n\r\n private static getMetadataFilePath(downloadId: string, downloadTrackingBaseFolder: string, fileSystem: FileSystemService): string {\r\n const trackingPath = DownloadTracker.getTrackingPath(downloadId, downloadTrackingBaseFolder, fileSystem);\r\n return fileSystem.pathJoin(trackingPath, `metadata.json`);\r\n }\r\n\r\n get #metadataFilePath(): string {\r\n return this.#fileSystem.pathJoin(this.#trackingPath, `metadata.json`);\r\n }\r\n\r\n get #progressPath(): string {\r\n return this.#fileSystem.pathJoin(this.#trackingPath, `progress.json`);\r\n }\r\n\r\n get #progressPathTemp(): string {\r\n return this.#fileSystem.pathJoin(this.#trackingPath, `progress.tmp`);\r\n }\r\n\r\n #addEventListeners() {\r\n this.#eventsEngine.addEventListener(TransferDownloadEvent.FileCreated, this.#onFileCreated);\r\n this.#eventsEngine.addEventListener(TransferDownloadEvent.FileDownloadStarting, this.#onFileStarting);\r\n this.#eventsEngine.addEventListener(TransferDownloadEvent.FileDownloadCompleted, this.#onFileCompleted);\r\n this.#eventsEngine.addEventListener(TransferDownloadEvent.FileDownloadFailed, this.#onFileFailed);\r\n this.#eventsEngine.addEventListener(TransferDownloadEvent.ChunkDownloadCompleted, this.#onChunkCompleted);\r\n this.#eventsEngine.addEventListener(TransferDownloadEvent.Paused, this.#onPaused);\r\n this.#eventsEngine.addEventListener(TransferDownloadEvent.Aborted, this.#onAborted);\r\n this.#eventsEngine.addEventListener(TransferDownloadEvent.DownloadCompleted, this.#onCompleted);\r\n }\r\n\r\n #removeEventListeners() {\r\n this.#eventsEngine.removeEventListener(TransferDownloadEvent.FileCreated, this.#onFileCreated);\r\n this.#eventsEngine.removeEventListener(TransferDownloadEvent.FileDownloadStarting, this.#onFileStarting);\r\n this.#eventsEngine.removeEventListener(TransferDownloadEvent.FileDownloadCompleted, this.#onFileCompleted);\r\n this.#eventsEngine.removeEventListener(TransferDownloadEvent.FileDownloadFailed, this.#onFileFailed);\r\n this.#eventsEngine.removeEventListener(TransferDownloadEvent.ChunkDownloadCompleted, this.#onChunkCompleted);\r\n this.#eventsEngine.removeEventListener(TransferDownloadEvent.Paused, this.#onPaused);\r\n this.#eventsEngine.removeEventListener(TransferDownloadEvent.Aborted, this.#onAborted);\r\n this.#eventsEngine.removeEventListener(TransferDownloadEvent.DownloadCompleted, this.#onCompleted);\r\n }\r\n\r\n #onFileCreated = async (args: FileDownloadEventArgs) => {\r\n const file = this.#allFiles[args.file.id]!;\r\n if (file.tdp !== args.file.temporaryDownloadPath) {\r\n file.tdp = args.file.temporaryDownloadPath;\r\n this.#filesChanged = true;\r\n }\r\n };\r\n\r\n #onFileStarting = async (args: FileDownloadEventArgs) => {\r\n const pendingFile = this.#progress.trackedFiles[args.file.id]!;\r\n if (pendingFile.wr === false) {\r\n pendingFile.wr = true;\r\n this.#progress.activeTime = args.activeTime;\r\n this.#progressChanged = true;\r\n }\r\n };\r\n\r\n #onFileCompleted = async (args: FileDownloadEventArgs) => {\r\n const pendingFile = this.#progress.trackedFiles[args.file.id]!;\r\n pendingFile.c = args.file.completed;\r\n pendingFile.er = args.file.failed;\r\n pendingFile.ok = args.file.lastOkChunk;\r\n this.#progress.activeTime = args.activeTime;\r\n this.#progressChanged = true;\r\n\r\n const file = this.#allFiles[args.file.id]!;\r\n if (file.dp !== args.file.downloadPath) {\r\n file.dp = args.file.downloadPath;\r\n this.#filesChanged = true;\r\n }\r\n };\r\n\r\n #onFileFailed = async (args: FileDownloadFailedEventArgs) => {\r\n const pendingFile = this.#progress.trackedFiles[args.file.id]!;\r\n pendingFile.c = args.file.completed;\r\n pendingFile.er = args.file.failed;\r\n pendingFile.ok = args.file.lastOkChunk;\r\n this.#progress.activeTime = args.activeTime;\r\n this.#progressChanged = true;\r\n };\r\n\r\n #onChunkCompleted = async (args: ChunkDownloadEventArgs) => {\r\n const pendingFile = this.#progress.trackedFiles[args.file.id]!;\r\n pendingFile.c = args.file.completed;\r\n pendingFile.er = args.file.failed;\r\n pendingFile.ok = args.file.lastOkChunk;\r\n this.#progress.activeTime = args.activeTime;\r\n this.#progressChanged = true;\r\n };\r\n\r\n #onPaused = async (args: DownloadPauseEventArgs) => {\r\n this.#progress.activeTime = args.activeTimeMillis;\r\n this.#progressChanged = true;\r\n };\r\n\r\n #onAborted = async () => {\r\n await this.#cleanUp(true);\r\n };\r\n\r\n #onCompleted = async (args: DownloadCompletedEventArgs) => {\r\n const removeTracking = args.status === TransferStatus.Completed;\r\n await this.#cleanUp(removeTracking);\r\n };\r\n\r\n async #cleanUp(removeTracking: boolean) {\r\n this.#running = false;\r\n this.#progressChanged = false;\r\n this.#filesChanged = false;\r\n if (this.#progressIntervalTimer !== null) {\r\n clearInterval(this.#progressIntervalTimer);\r\n this.#progressIntervalTimer = null;\r\n }\r\n this.#removeEventListeners();\r\n this.#allFiles = {};\r\n this.#progress = { activeTime: 0, trackedFiles: {} };\r\n\r\n if (removeTracking)\r\n await DownloadTracker.removeDownloadTrackingFolder(this.#downloadId, this.#options.downloadTrackingBaseFolder!, this.#fileSystem);\r\n }\r\n\r\n async #dumpOptions() {\r\n await this.#fileSystem.writeFile(this.#optionsFilePath, JSON.stringify(this.#options));\r\n }\r\n\r\n async #dumpMetadata() {\r\n await this.#fileSystem.writeFile(this.#metadataFilePath, JSON.stringify(this.#metadata));\r\n }\r\n\r\n async #dumpDownloaderFiles() {\r\n // write to disk - then rename: rename will be much faster than write (potentially few/few dozens MB) - minimizing risk of getting corrupt progress file on disk\r\n await this.#fileSystem.writeFile(this.#filesPathTemp, JSON.stringify(this.#allFiles));\r\n await this.#fileSystem.renameFile(this.#filesPathTemp, this.#filesPath);\r\n }\r\n\r\n async #dumpDownloaderProgress() {\r\n // write to disk - then rename: rename will be much faster than write (potentially few/few dozens MB) - minimizing risk of getting corrupt progress file on disk\r\n await this.#fileSystem.writeFile(this.#progressPathTemp, JSON.stringify(this.#progress));\r\n await this.#fileSystem.renameFile(this.#progressPathTemp, this.#progressPath);\r\n }\r\n\r\n #throwIfRunning() {\r\n if (this.#running)\r\n throw new DownloadError(`This download tracker is already running. Please create a new one.`);\r\n }\r\n\r\n private static async throwIfPathDoesntExist(path: string, reason: string, errorCode: DownloadErrorCode, fileSystem: FileSystemService) {\r\n if ((await fileSystem.pathExists(path)) === false)\r\n throw new DownloadError(reason, undefined, errorCode);\r\n }\r\n\r\n async #dumpAllProgress(): Promise<void> {\r\n await this.#filesMutex.runExclusive(async () => {\r\n try {\r\n if (this.#progressChanged) {\r\n this.#progressChanged = false;\r\n await this.#dumpDownloaderProgress();\r\n }\r\n if (this.#filesChanged) {\r\n this.#filesChanged = false;\r\n await this.#dumpDownloaderFiles();\r\n }\r\n }\r\n catch (err) {\r\n // When this event is emitted it means for the the caller that restoring interrupted download won't be able to recover\r\n // all downloaded data - but only some part of it. In general it is safe to continue after this event,\r\n // just keep in mind tracking data is not up-to-date.\r\n // Also note: in many cases tracking data will not be used at all (only when download was interrupted - by app restart, pc reboot etc.).\r\n const args: DownloadTrackingFailedEventArgs = {\r\n reason: `Could not update tracking data - recovering this transfer may re-download more data than needed ${this.#downloadId} @ ${this.#trackingPath}`,\r\n error: err as Error,\r\n errorCode: DownloadErrorCode.TrackingDataOutdated,\r\n downloadId: this.#downloadId,\r\n };\r\n this.#eventsEngine.emit(TransferDownloadEvent.DownloadTrackingFailed, args);\r\n }\r\n });\r\n }\r\n\r\n #setupProgressTimer() {\r\n this.#progressIntervalTimer = setInterval(async () => {\r\n await this.#dumpAllProgress();\r\n }, this.#options.downloadTrackingIntervalMillis);\r\n }\r\n\r\n async #shouldPendingFileBeRestarted(file: DownloadFileInfo) {\r\n return file.wasEverWritten\r\n && (!file.temporaryDownloadPath || (await this.#fileSystem.pathExists(file.temporaryDownloadPath!)) === false);\r\n }\r\n\r\n async #restoreSingleFile(restoredFileId: string, restoredFile: DownloadTrackerFileInfo) {\r\n const fileTrack = this.#progress.trackedFiles[restoredFileId]!;\r\n const file = new DownloadFileInfo(restoredFileId, restoredFile.u, restoredFile.n, restoredFile.s, restoredFile.dp, restoredFile.cc, restoredFile.tdp);\r\n let fileWasReset = false;\r\n\r\n file.wasEverWritten = fileTrack.wr;\r\n file.isCompleted = fileTrack.c;\r\n file.isFailed = fileTrack.er;\r\n file.lastSuccessfulChunkNumber = fileTrack.ok;\r\n\r\n if (file.isCompleted || file.isFailed)\r\n // let's save some cpu time on restoring chunk collection for file which will never be picked up\r\n file.downloadedBytes_bank = file.sizeInBytes;\r\n else {\r\n const shouldFileBeReset = await this.#shouldPendingFileBeRestarted(file);\r\n\r\n if (shouldFileBeReset) {\r\n // it maye happen that disk state is de-synced from the progress tracking file (the file.temporaryDownloadPath is gone)\r\n // in this case we want to simply re-start the file\r\n fileTrack.wr = false;\r\n fileTrack.ok = null;\r\n fileWasReset = true;\r\n\r\n file.wasEverWritten = false;\r\n file.lastSuccessfulChunkNumber = null;\r\n }\r\n\r\n for (let chunkIndex = 0; chunkIndex < file.chunkCount; chunkIndex++) {\r\n const chunk = this.#restoreSingleChunkInfo(file, chunkIndex, fileTrack);\r\n file.chunks.push(chunk);\r\n if (chunk.isCompleted)\r\n file.downloadedBytes_bank += chunk.chunkSize;\r\n }\r\n }\r\n\r\n // this method will update file.downloadedBytes properly based on file.downloadedBytes_bank\r\n // (and theoretically also based on file.#pendingChunks - but when restoring state #pendingChunks is always empty)\r\n file.updateProgress();\r\n\r\n return { file, fileWasReset };\r\n }\r\n\r\n #restoreSingleChunkInfo(file: DownloadFileInfo, chunkIndex: number, fileTrack: DownloadTrackerFileProgressInfo) {\r\n const chunk = new DownloadFileChunkInfo(file, chunkIndex, this.#options.maxChunkSize ?? null);\r\n chunk.isCompleted = fileTrack.ok !== null && chunkIndex <= fileTrack.ok;\r\n if (chunk.isCompleted)\r\n chunk.setProgress(chunk.chunkSize);\r\n return chunk;\r\n }\r\n\r\n async start(allFiles: Array<DownloadFileInfo>) {\r\n this.#throwIfRunning();\r\n\r\n this.#running = true;\r\n\r\n if (this.#restored === false) {\r\n for (const file of allFiles) {\r\n this.#progress.trackedFiles[file.externalId] = {\r\n c: file.isCompleted,\r\n er: file.isFailed,\r\n ok: file.lastSuccessfulChunkNumber,\r\n wr: file.wasEverWritten,\r\n };\r\n this.#allFiles[file.externalId] = {\r\n u: file.url,\r\n s: file.sizeInBytes,\r\n n: file.name,\r\n dp: file.downloadPath,\r\n tdp: file.temporaryDownloadPath,\r\n cc: file.chunkCount,\r\n };\r\n }\r\n await this.#filesMutex.runExclusive(async () => {\r\n try {\r\n await this.#fileSystem.createFolder(this.#trackingPath);\r\n await this.#dumpOptions();\r\n await this.#dumpMetadata();\r\n await this.#dumpDownloaderFiles();\r\n await this.#dumpDownloaderProgress();\r\n this.#canTrack = true;\r\n }\r\n catch (err) {\r\n throw new DownloadError(`Could not create tracking folder - recovering this transfer will not be possible ${this.#downloadId} @ ${this.#trackingPath}`, { cause: err as Error }, DownloadErrorCode.TrackingNotAvailable);\r\n }\r\n });\r\n }\r\n else\r\n this.#canTrack = true;\r\n\r\n if (this.#canTrack) {\r\n this.#addEventListeners();\r\n this.#setupProgressTimer();\r\n }\r\n }\r\n\r\n async restoreDownloadOptions() {\r\n await DownloadTracker.throwIfPathDoesntExist(this.#optionsFilePath, `Options file \"${this.#optionsFilePath}\" does not exist`, DownloadErrorCode.TrackingDataParsingError, this.#fileSystem);\r\n try {\r\n const optionsFile = await this.#fileSystem.readFileAsString(this.#optionsFilePath);\r\n const options: DownloadOptions = JSON.parse(optionsFile);\r\n return options;\r\n }\r\n catch (err) {\r\n throw new DownloadError(`Could not read download options information ${this.#downloadId} @ ${this.#optionsFilePath}`, { cause: err as Error }, DownloadErrorCode.TrackingDataParsingError);\r\n }\r\n }\r\n\r\n static async restoreDownloadMetadata(downloadId: string, downloadTrackingBaseFolder: string, fileSystem: FileSystemService): Promise<DownloadTrackingMetadata> {\r\n const metadataFilePath = this.getMetadataFilePath(downloadId, downloadTrackingBaseFolder, fileSystem);\r\n\r\n await this.throwIfPathDoesntExist(metadataFilePath, `Metadata file \"${metadataFilePath}\" does not exist`, DownloadErrorCode.TrackingDataParsingError, fileSystem);\r\n\r\n try {\r\n const metadataFile = await fileSystem.readFileAsString(metadataFilePath);\r\n return JSON.parse(metadataFile);\r\n }\r\n catch (err) {\r\n throw new DownloadError(`Could not read download metadata information ${downloadId} @ ${metadataFilePath}`, { cause: err as Error }, DownloadErrorCode.TrackingDataParsingError);\r\n }\r\n }\r\n\r\n async restoreDownloaderState(): Promise<{ state: DownloaderRestoredState, files: Array<DownloadFileInfo> }> {\r\n await DownloadTracker.throwIfPathDoesntExist(this.#filesPath, `Filesinfo file \"${this.#filesPath}\" does not exist`, DownloadErrorCode.TrackingDataParsingError, this.#fileSystem);\r\n await DownloadTracker.throwIfPathDoesntExist(this.#progressPath, `Tracking file \"${this.#progressPath}\" does not exist`, DownloadErrorCode.TrackingDataParsingError, this.#fileSystem);\r\n\r\n try {\r\n this.#allFiles = JSON.parse(await this.#fileSystem.readFileAsString(this.#filesPath));\r\n this.#progress = JSON.parse(await this.#fileSystem.readFileAsString(this.#progressPath));\r\n this.#restored = true;\r\n\r\n let totalSize = 0;\r\n let downloadedBytes = 0;\r\n let downloadedBytesBank = 0;\r\n let repeatProgressDump = false;\r\n const files: Array<DownloadFileInfo> = [];\r\n\r\n for (const [restoredFileId, restoredFile] of Object.entries(this.#allFiles)) {\r\n // eslint-disable-next-line no-await-in-loop\r\n const { file, fileWasReset } = await this.#restoreSingleFile(restoredFileId, restoredFile);\r\n\r\n if (fileWasReset)\r\n repeatProgressDump = true;\r\n\r\n downloadedBytes += file.downloadedBytes;\r\n\r\n if (file.isCompleted)\r\n downloadedBytesBank += file.sizeInBytes;\r\n\r\n files.push(file);\r\n totalSize += file.sizeInBytes;\r\n }\r\n\r\n if (repeatProgressDump) {\r\n // some tracking info might have been updated (corrected) in above loop\r\n // persisting this makes sure we have most correct state in the progress tracking file\r\n // (e.g. some unconfirmed pending files might be deleted by end users etc.)\r\n await this.#dumpDownloaderProgress();\r\n }\r\n\r\n return {\r\n files,\r\n state: {\r\n activeTime: this.#progress.activeTime,\r\n downloadedBytes,\r\n downloadedBytesBank,\r\n totalSize,\r\n percent: totalSize === 0 ? 100 : ((100 * downloadedBytes) / totalSize),\r\n },\r\n };\r\n }\r\n catch (err) {\r\n throw new DownloadError(`Could not read download tracking information ${this.#downloadId}`, { cause: err as Error }, DownloadErrorCode.TrackingDataParsingError);\r\n }\r\n }\r\n\r\n static async removeDownloadTrackingFolder(downloadId: string, downloadTrackingBaseFolder: string, fileSystem: FileSystemService) {\r\n const filesMutex = new Mutex();\r\n const trackingPath = DownloadTracker.getTrackingPath(downloadId, downloadTrackingBaseFolder, fileSystem);\r\n\r\n await filesMutex.runExclusive(async () => {\r\n try {\r\n await fileSystem.deleteFolder(trackingPath);\r\n }\r\n catch (err) {\r\n throw new DownloadError(`Could not remove tracking folder - ${downloadId} @ ${trackingPath}`, { cause: err as Error }, DownloadErrorCode.TrackingCleanupFailed);\r\n }\r\n });\r\n }\r\n\r\n async saveState(): Promise<void> {\r\n await this.#dumpAllProgress();\r\n }\r\n}"]}
1
+ {"version":3,"file":"downloadTracker.js","sourceRoot":"","sources":["../../../src/downloader/downloadTracker.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,OAAO,aAAa,MAAM,yBAAyB,CAAC;AACpD,OAAO,iBAAiB,MAAM,6BAA6B,CAAC;AAC5D,OAAO,qBAAqB,MAAM,yBAAyB,CAAC;AAC5D,OAAO,qBAAqB,MAAM,iCAAiC,CAAC;AACpE,OAAO,gBAAgB,MAAM,4BAA4B,CAAC;AAC1D,OAAO,cAAc,MAAM,kCAAkC,CAAC;AAkB9D,MAAqB,eAAe;IACvB,WAAW,CAAS;IACpB,WAAW,CAAoB;IAC/B,aAAa,CAAS;IACtB,aAAa,CAAe;IAC5B,QAAQ,CAAkB;IAC1B,SAAS,CAA2B;IACpC,WAAW,CAAQ;IAE5B,sBAAsB,GAA0C,IAAI,CAAC;IACrE,SAAS,GAA4C,EAAE,CAAC;IACxD,SAAS,GAAgC,EAAE,UAAU,EAAE,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC;IAC7E,QAAQ,GAAG,KAAK,CAAC;IACjB,SAAS,GAAG,KAAK,CAAC;IAClB,aAAa,GAAG,KAAK,CAAC;IACtB,gBAAgB,GAAG,KAAK,CAAC;IACzB,SAAS,GAAG,KAAK,CAAC;IAElB,YAAY,UAAkB,EAAE,OAAwB,EAAE,UAA6B,EAAE,YAA0B,EAAE,QAAkC,EAAE,MAAe;QACpK,IAAI,CAAC,OAAO,CAAC,0BAA0B;YACnC,MAAM,IAAI,aAAa,CAAC,uEAAuE,CAAC,CAAC;QAErG,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QACv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Error.js\";\nimport DownloadErrorCode from \"./dtos/downloadErrorCode.js\";\nimport TransferDownloadEvent from \"./dtos/downloadEvent.js\";\nimport DownloadFileChunkInfo from \"./dtos/downloadFileChunkInfo.js\";\nimport DownloadFileInfo from \"./dtos/downloadFileInfo.js\";\nimport TransferStatus from \"../utils/types/transferStatus.js\";\n\nimport type EventsEngine from \"../utils/events/eventsEngine.js\";\nimport type FileSystemService from \"../utils/fileSystem/fileSystemService.js\";\nimport type DownloadOptions from \"./downloadOptions.js\";\nimport type DownloaderRestoredState from \"./dtos/downloaderRestoredState.js\";\nimport type DownloadTrackerFileInfo from \"./dtos/downloadTrackerFileInfo.js\";\nimport type DownloadTrackerProgressInfo from \"./dtos/downloadTrackerProgressInfo.js\";\nimport type ChunkDownloadEventArgs from \"./eventArgs/chunkDownloadEventArgs.js\";\nimport type DownloadPauseEventArgs from \"./eventArgs/downloadPauseEventArgs.js\";\nimport type FileDownloadEventArgs from \"./eventArgs/fileDownloadEventArgs.js\";\nimport type FileDownloadFailedEventArgs from \"./eventArgs/fileDownloadFailedEventArgs.js\";\nimport type DownloadTrackingFailedEventArgs from \"./eventArgs/downloadTrackingFailedEventArgs.js\";\nimport type DownloadCompletedEventArgs from \"./eventArgs/downloadCompletedEventArgs.js\";\nimport type DownloadTrackerFileProgressInfo from \"./dtos/downloadTrackerFileProgressInfo.js\";\nimport type DownloadTrackingMetadata from \"./dtos/downloadTrackingMetadata.js\";\nimport type { DownloadCommandE2eeData } from \"./dtos/downloadCommand.js\";\n\nexport default class DownloadTracker {\n readonly #downloadId: string;\n readonly #fileSystem: FileSystemService;\n readonly #trackingPath: string;\n readonly #eventsEngine: EventsEngine;\n readonly #options: DownloadOptions;\n readonly #metadata: DownloadTrackingMetadata;\n readonly #filesMutex: Mutex;\n\n #progressIntervalTimer: ReturnType<typeof setInterval> | null = null;\n #allFiles: Record<string, DownloadTrackerFileInfo> = {};\n #progress: DownloadTrackerProgressInfo = { activeTime: 0, trackedFiles: {} };\n #running = false;\n #restored = false;\n #filesChanged = false;\n #progressChanged = false;\n #canTrack = false;\n\n constructor(downloadId: string, options: DownloadOptions, fileSystem: FileSystemService, eventsEngine: EventsEngine, e2eeData?: DownloadCommandE2eeData, region?: string) {\n if (!options.downloadTrackingBaseFolder)\n throw new DownloadError(`Download tracker cannot be created - tracking folder is not specified`);\n\n this.#downloadId = downloadId;\n this.#options = options;\n this.#metadata = this.createMetadata(region, e2eeData);\n this.#fileSystem = fileSystem;\n this.#eventsEngine = eventsEngine;\n this.#trackingPath = DownloadTracker.getTrackingPath(downloadId, options.downloadTrackingBaseFolder, fileSystem);\n this.#filesMutex = new Mutex();\n }\n\n private createMetadata(region: string | undefined, e2eeData?: DownloadCommandE2eeData): DownloadTrackingMetadata {\n if (!e2eeData)\n return { region };\n\n return {\n region,\n e2eeData:\n {\n ivAsHex: e2eeData.iv.toString(`hex`),\n keyAsHex: e2eeData.key.toString(`hex`),\n },\n };\n }\n\n private static getTrackingPath(downloadId: string, downloadTrackingBaseFolder: string, fileSystem: FileSystemService) {\n return fileSystem.pathJoin(downloadTrackingBaseFolder, downloadId);\n }\n\n get #filesPath(): string {\n return this.#fileSystem.pathJoin(this.#trackingPath, `files.json`);\n }\n\n get #filesPathTemp(): string {\n return this.#fileSystem.pathJoin(this.#trackingPath, `files.tmp`);\n }\n\n get #optionsFilePath(): string {\n return this.#fileSystem.pathJoin(this.#trackingPath, `options.json`);\n }\n\n private static getMetadataFilePath(downloadId: string, downloadTrackingBaseFolder: string, fileSystem: FileSystemService): string {\n const trackingPath = DownloadTracker.getTrackingPath(downloadId, downloadTrackingBaseFolder, fileSystem);\n return fileSystem.pathJoin(trackingPath, `metadata.json`);\n }\n\n get #metadataFilePath(): string {\n return this.#fileSystem.pathJoin(this.#trackingPath, `metadata.json`);\n }\n\n get #progressPath(): string {\n return this.#fileSystem.pathJoin(this.#trackingPath, `progress.json`);\n }\n\n get #progressPathTemp(): string {\n return this.#fileSystem.pathJoin(this.#trackingPath, `progress.tmp`);\n }\n\n #addEventListeners() {\n this.#eventsEngine.addEventListener(TransferDownloadEvent.FileCreated, this.#onFileCreated);\n this.#eventsEngine.addEventListener(TransferDownloadEvent.FileDownloadStarting, this.#onFileStarting);\n this.#eventsEngine.addEventListener(TransferDownloadEvent.FileDownloadCompleted, this.#onFileCompleted);\n this.#eventsEngine.addEventListener(TransferDownloadEvent.FileDownloadFailed, this.#onFileFailed);\n this.#eventsEngine.addEventListener(TransferDownloadEvent.ChunkDownloadCompleted, this.#onChunkCompleted);\n this.#eventsEngine.addEventListener(TransferDownloadEvent.Paused, this.#onPaused);\n this.#eventsEngine.addEventListener(TransferDownloadEvent.Aborted, this.#onAborted);\n this.#eventsEngine.addEventListener(TransferDownloadEvent.DownloadCompleted, this.#onCompleted);\n }\n\n #removeEventListeners() {\n this.#eventsEngine.removeEventListener(TransferDownloadEvent.FileCreated, this.#onFileCreated);\n this.#eventsEngine.removeEventListener(TransferDownloadEvent.FileDownloadStarting, this.#onFileStarting);\n this.#eventsEngine.removeEventListener(TransferDownloadEvent.FileDownloadCompleted, this.#onFileCompleted);\n this.#eventsEngine.removeEventListener(TransferDownloadEvent.FileDownloadFailed, this.#onFileFailed);\n this.#eventsEngine.removeEventListener(TransferDownloadEvent.ChunkDownloadCompleted, this.#onChunkCompleted);\n this.#eventsEngine.removeEventListener(TransferDownloadEvent.Paused, this.#onPaused);\n this.#eventsEngine.removeEventListener(TransferDownloadEvent.Aborted, this.#onAborted);\n this.#eventsEngine.removeEventListener(TransferDownloadEvent.DownloadCompleted, this.#onCompleted);\n }\n\n #onFileCreated = async (args: FileDownloadEventArgs) => {\n const file = this.#allFiles[args.file.id]!;\n if (file.tdp !== args.file.temporaryDownloadPath) {\n file.tdp = args.file.temporaryDownloadPath;\n this.#filesChanged = true;\n }\n };\n\n #onFileStarting = async (args: FileDownloadEventArgs) => {\n const pendingFile = this.#progress.trackedFiles[args.file.id]!;\n if (pendingFile.wr === false) {\n pendingFile.wr = true;\n this.#progress.activeTime = args.activeTime;\n this.#progressChanged = true;\n }\n };\n\n #onFileCompleted = async (args: FileDownloadEventArgs) => {\n const pendingFile = this.#progress.trackedFiles[args.file.id]!;\n pendingFile.c = args.file.completed;\n pendingFile.er = args.file.failed;\n pendingFile.ok = args.file.lastOkChunk;\n pendingFile.ec = null;\n this.#progress.activeTime = args.activeTime;\n this.#progressChanged = true;\n\n const file = this.#allFiles[args.file.id]!;\n if (file.dp !== args.file.downloadPath) {\n file.dp = args.file.downloadPath;\n this.#filesChanged = true;\n }\n };\n\n #onFileFailed = async (args: FileDownloadFailedEventArgs) => {\n const pendingFile = this.#progress.trackedFiles[args.file.id]!;\n pendingFile.c = args.file.completed;\n pendingFile.er = args.file.failed;\n pendingFile.ok = args.file.lastOkChunk;\n pendingFile.ec = this.#toTrackedFailureCode(args.reason);\n this.#progress.activeTime = args.activeTime;\n this.#progressChanged = true;\n };\n\n #onChunkCompleted = async (args: ChunkDownloadEventArgs) => {\n const pendingFile = this.#progress.trackedFiles[args.file.id]!;\n pendingFile.c = args.file.completed;\n pendingFile.er = args.file.failed;\n pendingFile.ok = args.file.lastOkChunk;\n pendingFile.ec = null;\n this.#progress.activeTime = args.activeTime;\n this.#progressChanged = true;\n };\n\n #onPaused = async (args: DownloadPauseEventArgs) => {\n this.#progress.activeTime = args.activeTimeMillis;\n this.#progressChanged = true;\n };\n\n #onAborted = async () => {\n await this.#cleanUp(true);\n };\n\n #onCompleted = async (args: DownloadCompletedEventArgs) => {\n const removeTracking = args.status === TransferStatus.Completed;\n\n if (!removeTracking)\n await this.#dumpAllProgress();\n\n await this.#cleanUp(removeTracking);\n };\n\n #toTrackedFailureCode(error: DownloadError): DownloadErrorCode | null {\n if (error.errorCode !== null)\n return error.errorCode;\n\n if (DownloadTracker.#extractErrorCode(error) === `ENOSPC`)\n return DownloadErrorCode.DiskFull;\n\n return null;\n }\n\n static #extractErrorCode(error: unknown): string | undefined {\n let current = error as { code?: string, cause?: unknown } | undefined;\n\n for (let depth = 0; depth < 8 && current; depth++) {\n if (typeof current.code === `string`)\n return current.code;\n\n current = current.cause as { code?: string, cause?: unknown } | undefined;\n }\n\n return undefined;\n }\n\n async #cleanUp(removeTracking: boolean) {\n this.#running = false;\n this.#progressChanged = false;\n this.#filesChanged = false;\n if (this.#progressIntervalTimer !== null) {\n clearInterval(this.#progressIntervalTimer);\n this.#progressIntervalTimer = null;\n }\n this.#removeEventListeners();\n this.#allFiles = {};\n this.#progress = { activeTime: 0, trackedFiles: {} };\n\n if (removeTracking)\n await DownloadTracker.removeDownloadTrackingFolder(this.#downloadId, this.#options.downloadTrackingBaseFolder!, this.#fileSystem);\n }\n\n async #dumpOptions() {\n await this.#fileSystem.writeFile(this.#optionsFilePath, JSON.stringify(this.#options));\n }\n\n async #dumpMetadata() {\n await this.#fileSystem.writeFile(this.#metadataFilePath, JSON.stringify(this.#metadata));\n }\n\n async #dumpDownloaderFiles() {\n // write to disk - then rename: rename will be much faster than write (potentially few/few dozens MB) - minimizing risk of getting corrupt progress file on disk\n await this.#fileSystem.writeFile(this.#filesPathTemp, JSON.stringify(this.#allFiles));\n await this.#fileSystem.renameFile(this.#filesPathTemp, this.#filesPath);\n }\n\n async #dumpDownloaderProgress() {\n // write to disk - then rename: rename will be much faster than write (potentially few/few dozens MB) - minimizing risk of getting corrupt progress file on disk\n await this.#fileSystem.writeFile(this.#progressPathTemp, JSON.stringify(this.#progress));\n await this.#fileSystem.renameFile(this.#progressPathTemp, this.#progressPath);\n }\n\n #throwIfRunning() {\n if (this.#running)\n throw new DownloadError(`This download tracker is already running. Please create a new one.`);\n }\n\n private static async throwIfPathDoesntExist(path: string, reason: string, errorCode: DownloadErrorCode, fileSystem: FileSystemService) {\n if ((await fileSystem.pathExists(path)) === false)\n throw new DownloadError(reason, undefined, errorCode);\n }\n\n async #dumpAllProgress(): Promise<void> {\n await this.#filesMutex.runExclusive(async () => {\n try {\n if (this.#progressChanged) {\n this.#progressChanged = false;\n await this.#dumpDownloaderProgress();\n }\n if (this.#filesChanged) {\n this.#filesChanged = false;\n await this.#dumpDownloaderFiles();\n }\n }\n catch (err) {\n // When this event is emitted it means for the the caller that restoring interrupted download won't be able to recover\n // all downloaded data - but only some part of it. In general it is safe to continue after this event,\n // just keep in mind tracking data is not up-to-date.\n // Also note: in many cases tracking data will not be used at all (only when download was interrupted - by app restart, pc reboot etc.).\n const args: DownloadTrackingFailedEventArgs = {\n reason: `Could not update tracking data - recovering this transfer may re-download more data than needed ${this.#downloadId} @ ${this.#trackingPath}`,\n error: err as Error,\n errorCode: DownloadErrorCode.TrackingDataOutdated,\n downloadId: this.#downloadId,\n };\n this.#eventsEngine.emit(TransferDownloadEvent.DownloadTrackingFailed, args);\n }\n });\n }\n\n #setupProgressTimer() {\n this.#progressIntervalTimer = setInterval(async () => {\n await this.#dumpAllProgress();\n }, this.#options.downloadTrackingIntervalMillis);\n }\n\n async #shouldPendingFileBeRestarted(file: DownloadFileInfo) {\n return file.wasEverWritten\n && (!file.temporaryDownloadPath || (await this.#fileSystem.pathExists(file.temporaryDownloadPath!)) === false);\n }\n\n async #restoreSingleFile(restoredFileId: string, restoredFile: DownloadTrackerFileInfo) {\n const fileTrack = this.#progress.trackedFiles[restoredFileId]!;\n const file = new DownloadFileInfo(restoredFileId, restoredFile.u, restoredFile.n, restoredFile.s, restoredFile.dp, restoredFile.cc, restoredFile.tdp);\n let fileWasReset = false;\n\n file.wasEverWritten = fileTrack.wr;\n file.isCompleted = fileTrack.c;\n file.isFailed = fileTrack.er;\n file.lastSuccessfulChunkNumber = fileTrack.ok;\n\n if (this.#shouldRetryFailedFile(fileTrack)) {\n fileTrack.er = false;\n fileTrack.ec = null;\n file.isFailed = false;\n fileWasReset = true;\n }\n\n if (file.isCompleted || file.isFailed)\n // let's save some cpu time on restoring chunk collection for file which will never be picked up\n file.downloadedBytes_bank = file.sizeInBytes;\n else {\n const shouldFileBeReset = await this.#shouldPendingFileBeRestarted(file);\n\n if (shouldFileBeReset) {\n // it maye happen that disk state is de-synced from the progress tracking file (the file.temporaryDownloadPath is gone)\n // in this case we want to simply re-start the file\n fileTrack.wr = false;\n fileTrack.ok = null;\n fileWasReset = true;\n\n file.wasEverWritten = false;\n file.lastSuccessfulChunkNumber = null;\n }\n\n for (let chunkIndex = 0; chunkIndex < file.chunkCount; chunkIndex++) {\n const chunk = this.#restoreSingleChunkInfo(file, chunkIndex, fileTrack);\n file.chunks.push(chunk);\n if (chunk.isCompleted)\n file.downloadedBytes_bank += chunk.chunkSize;\n }\n }\n\n // this method will update file.downloadedBytes properly based on file.downloadedBytes_bank\n // (and theoretically also based on file.#pendingChunks - but when restoring state #pendingChunks is always empty)\n file.updateProgress();\n\n return { file, fileWasReset };\n }\n\n #restoreSingleChunkInfo(file: DownloadFileInfo, chunkIndex: number, fileTrack: DownloadTrackerFileProgressInfo) {\n const chunk = new DownloadFileChunkInfo(file, chunkIndex, this.#options.maxChunkSize ?? null);\n chunk.isCompleted = fileTrack.ok !== null && chunkIndex <= fileTrack.ok;\n if (chunk.isCompleted)\n chunk.setProgress(chunk.chunkSize);\n return chunk;\n }\n\n #shouldRetryFailedFile(fileTrack: DownloadTrackerFileProgressInfo): boolean {\n return fileTrack.er === true && fileTrack.c === false;\n }\n\n async start(allFiles: Array<DownloadFileInfo>) {\n this.#throwIfRunning();\n\n this.#running = true;\n\n if (this.#restored === false) {\n for (const file of allFiles) {\n this.#progress.trackedFiles[file.externalId] = {\n c: file.isCompleted,\n er: file.isFailed,\n ok: file.lastSuccessfulChunkNumber,\n wr: file.wasEverWritten,\n ec: null,\n };\n this.#allFiles[file.externalId] = {\n u: file.url,\n s: file.sizeInBytes,\n n: file.name,\n dp: file.downloadPath,\n tdp: file.temporaryDownloadPath,\n cc: file.chunkCount,\n };\n }\n await this.#filesMutex.runExclusive(async () => {\n try {\n await this.#fileSystem.createFolder(this.#trackingPath);\n await this.#dumpOptions();\n await this.#dumpMetadata();\n await this.#dumpDownloaderFiles();\n await this.#dumpDownloaderProgress();\n this.#canTrack = true;\n }\n catch (err) {\n throw new DownloadError(`Could not create tracking folder - recovering this transfer will not be possible ${this.#downloadId} @ ${this.#trackingPath}`, { cause: err as Error }, DownloadErrorCode.TrackingNotAvailable);\n }\n });\n }\n else\n this.#canTrack = true;\n\n if (this.#canTrack) {\n this.#addEventListeners();\n this.#setupProgressTimer();\n }\n }\n\n async restoreDownloadOptions() {\n await DownloadTracker.throwIfPathDoesntExist(this.#optionsFilePath, `Options file \"${this.#optionsFilePath}\" does not exist`, DownloadErrorCode.TrackingDataParsingError, this.#fileSystem);\n try {\n const optionsFile = await this.#fileSystem.readFileAsString(this.#optionsFilePath);\n const options: DownloadOptions = JSON.parse(optionsFile);\n return options;\n }\n catch (err) {\n throw new DownloadError(`Could not read download options information ${this.#downloadId} @ ${this.#optionsFilePath}`, { cause: err as Error }, DownloadErrorCode.TrackingDataParsingError);\n }\n }\n\n static async restoreDownloadMetadata(downloadId: string, downloadTrackingBaseFolder: string, fileSystem: FileSystemService): Promise<DownloadTrackingMetadata> {\n const metadataFilePath = this.getMetadataFilePath(downloadId, downloadTrackingBaseFolder, fileSystem);\n\n await this.throwIfPathDoesntExist(metadataFilePath, `Metadata file \"${metadataFilePath}\" does not exist`, DownloadErrorCode.TrackingDataParsingError, fileSystem);\n\n try {\n const metadataFile = await fileSystem.readFileAsString(metadataFilePath);\n return JSON.parse(metadataFile);\n }\n catch (err) {\n throw new DownloadError(`Could not read download metadata information ${downloadId} @ ${metadataFilePath}`, { cause: err as Error }, DownloadErrorCode.TrackingDataParsingError);\n }\n }\n\n async restoreDownloaderState(): Promise<{ state: DownloaderRestoredState, files: Array<DownloadFileInfo> }> {\n await DownloadTracker.throwIfPathDoesntExist(this.#filesPath, `Filesinfo file \"${this.#filesPath}\" does not exist`, DownloadErrorCode.TrackingDataParsingError, this.#fileSystem);\n await DownloadTracker.throwIfPathDoesntExist(this.#progressPath, `Tracking file \"${this.#progressPath}\" does not exist`, DownloadErrorCode.TrackingDataParsingError, this.#fileSystem);\n\n try {\n this.#allFiles = JSON.parse(await this.#fileSystem.readFileAsString(this.#filesPath));\n this.#progress = JSON.parse(await this.#fileSystem.readFileAsString(this.#progressPath));\n this.#restored = true;\n\n let totalSize = 0;\n let downloadedBytes = 0;\n let downloadedBytesBank = 0;\n let repeatProgressDump = false;\n const files: Array<DownloadFileInfo> = [];\n\n for (const [restoredFileId, restoredFile] of Object.entries(this.#allFiles)) {\n // eslint-disable-next-line no-await-in-loop\n const { file, fileWasReset } = await this.#restoreSingleFile(restoredFileId, restoredFile);\n\n if (fileWasReset)\n repeatProgressDump = true;\n\n downloadedBytes += file.downloadedBytes;\n\n if (file.isCompleted)\n downloadedBytesBank += file.sizeInBytes;\n\n files.push(file);\n totalSize += file.sizeInBytes;\n }\n\n if (repeatProgressDump) {\n // some tracking info might have been updated (corrected) in above loop\n // persisting this makes sure we have most correct state in the progress tracking file\n // (e.g. some unconfirmed pending files might be deleted by end users etc.)\n await this.#dumpDownloaderProgress();\n }\n\n return {\n files,\n state: {\n activeTime: this.#progress.activeTime,\n downloadedBytes,\n downloadedBytesBank,\n totalSize,\n percent: totalSize === 0 ? 100 : ((100 * downloadedBytes) / totalSize),\n },\n };\n }\n catch (err) {\n throw new DownloadError(`Could not read download tracking information ${this.#downloadId}`, { cause: err as Error }, DownloadErrorCode.TrackingDataParsingError);\n }\n }\n\n static async removeDownloadTrackingFolder(downloadId: string, downloadTrackingBaseFolder: string, fileSystem: FileSystemService) {\n const filesMutex = new Mutex();\n const trackingPath = DownloadTracker.getTrackingPath(downloadId, downloadTrackingBaseFolder, fileSystem);\n\n await filesMutex.runExclusive(async () => {\n try {\n await fileSystem.deleteFolder(trackingPath);\n }\n catch (err) {\n throw new DownloadError(`Could not remove tracking folder - ${downloadId} @ ${trackingPath}`, { cause: err as Error }, DownloadErrorCode.TrackingCleanupFailed);\n }\n });\n }\n\n async saveState(): Promise<void> {\n await this.#dumpAllProgress();\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"downloadCommand.js","sourceRoot":"","sources":["../../../../src/downloader/dtos/downloadCommand.ts"],"names":[],"mappings":"","sourcesContent":["import type GetCompanyResponse from \"../../utils/api/dtos/getCompanyResponse.js\";\r\n\r\ninterface DownloadCommand {\r\n transfer?: string | undefined,\r\n trackId?: string | undefined,\r\n password?: string | undefined,\r\n e2eeDataOrTextKey?: DownloadCommandE2eeData | string,\r\n company?: GetCompanyResponse | undefined,\r\n checkLogintoken?: boolean | undefined,\r\n}\r\n\r\nexport default DownloadCommand;\r\n\r\nexport type DownloadCommandE2eeData = {\r\n iv: Buffer,\r\n key: Buffer,\r\n}"]}
1
+ {"version":3,"file":"downloadCommand.js","sourceRoot":"","sources":["../../../../src/downloader/dtos/downloadCommand.ts"],"names":[],"mappings":"","sourcesContent":["import type GetCompanyResponse from \"../../utils/api/dtos/getCompanyResponse.js\";\n\ninterface DownloadCommand {\n transfer?: string | undefined,\n trackId?: string | undefined,\n password?: string | undefined,\n e2eeDataOrTextKey?: DownloadCommandE2eeData | string,\n company?: GetCompanyResponse | undefined,\n checkLogintoken?: boolean | undefined,\n}\n\nexport default DownloadCommand;\n\nexport type DownloadCommandE2eeData = {\n iv: Buffer,\n key: Buffer,\n}"]}
@@ -1 +1 @@
1
- {"version":3,"file":"downloadError.js","sourceRoot":"","sources":["../../../../src/downloader/dtos/downloadError.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,KAAK;IACnC,SAAS,CAA2B;IAE7C,YAAY,OAAgB,EAAE,OAAsB,EAAE,IAAwB;QAC1E,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,CAAC,SAAS,GAAG,IAAI,IAAI,IAAI,CAAC;IAClC,CAAC;IAED,MAAM;QACF,OAAO;YACH,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC;SACtC,CAAC;IACN,CAAC;IAEO,WAAW,CAAC,UAAmB;QACnC,IAAI,CAAC,UAAU;YACX,OAAO,SAAS,CAAC;QAErB,IAAI,OAAQ,UAAkB,CAAC,MAAM,KAAK,UAAU;YAChD,OAAQ,UAAkB,CAAC,MAAM,EAAE,CAAC;QAExC,IAAI,UAAU,YAAY,KAAK,EAAE,CAAC;YAC9B,OAAO;gBACH,IAAI,EAAE,UAAU,CAAC,IAAI;gBACrB,OAAO,EAAE,UAAU,CAAC,OAAO;gBAC3B,KAAK,EAAE,UAAU,CAAC,KAAK;gBACvB,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,KAAK,CAAC;aAC5C,CAAC;QACN,CAAC;QAED,OAAO,UAAU,CAAC;IACtB,CAAC;CACJ","sourcesContent":["import type DownloadErrorCode from \"./downloadErrorCode.js\";\r\n\r\nexport default class DownloadError extends Error {\r\n readonly errorCode: DownloadErrorCode | null;\r\n\r\n constructor(message?: string, options?: ErrorOptions, code?: DownloadErrorCode) {\r\n super(message, options);\r\n this.name = `DownloadError`;\r\n this.errorCode = code || null;\r\n }\r\n\r\n toJSON() {\r\n return {\r\n name: this.name,\r\n message: this.message,\r\n stack: this.stack,\r\n errorCode: this.errorCode,\r\n cause: this.causeToJSON(this.cause),\r\n };\r\n }\r\n\r\n private causeToJSON(innerError: unknown): unknown {\r\n if (!innerError)\r\n return undefined;\r\n\r\n if (typeof (innerError as any).toJSON === `function`)\r\n return (innerError as any).toJSON();\r\n\r\n if (innerError instanceof Error) {\r\n return {\r\n name: innerError.name,\r\n message: innerError.message,\r\n stack: innerError.stack,\r\n cause: this.causeToJSON(innerError.cause),\r\n };\r\n }\r\n\r\n return innerError;\r\n }\r\n}"]}
1
+ {"version":3,"file":"downloadError.js","sourceRoot":"","sources":["../../../../src/downloader/dtos/downloadError.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,KAAK;IACnC,SAAS,CAA2B;IAE7C,YAAY,OAAgB,EAAE,OAAsB,EAAE,IAAwB;QAC1E,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,CAAC,SAAS,GAAG,IAAI,IAAI,IAAI,CAAC;IAClC,CAAC;IAED,MAAM;QACF,OAAO;YACH,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC;SACtC,CAAC;IACN,CAAC;IAEO,WAAW,CAAC,UAAmB;QACnC,IAAI,CAAC,UAAU;YACX,OAAO,SAAS,CAAC;QAErB,IAAI,OAAQ,UAAkB,CAAC,MAAM,KAAK,UAAU;YAChD,OAAQ,UAAkB,CAAC,MAAM,EAAE,CAAC;QAExC,IAAI,UAAU,YAAY,KAAK,EAAE,CAAC;YAC9B,OAAO;gBACH,IAAI,EAAE,UAAU,CAAC,IAAI;gBACrB,OAAO,EAAE,UAAU,CAAC,OAAO;gBAC3B,KAAK,EAAE,UAAU,CAAC,KAAK;gBACvB,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,KAAK,CAAC;aAC5C,CAAC;QACN,CAAC;QAED,OAAO,UAAU,CAAC;IACtB,CAAC;CACJ","sourcesContent":["import type DownloadErrorCode from \"./downloadErrorCode.js\";\n\nexport default class DownloadError extends Error {\n readonly errorCode: DownloadErrorCode | null;\n\n constructor(message?: string, options?: ErrorOptions, code?: DownloadErrorCode) {\n super(message, options);\n this.name = `DownloadError`;\n this.errorCode = code || null;\n }\n\n toJSON() {\n return {\n name: this.name,\n message: this.message,\n stack: this.stack,\n errorCode: this.errorCode,\n cause: this.causeToJSON(this.cause),\n };\n }\n\n private causeToJSON(innerError: unknown): unknown {\n if (!innerError)\n return undefined;\n\n if (typeof (innerError as any).toJSON === `function`)\n return (innerError as any).toJSON();\n\n if (innerError instanceof Error) {\n return {\n name: innerError.name,\n message: innerError.message,\n stack: innerError.stack,\n cause: this.causeToJSON(innerError.cause),\n };\n }\n\n return innerError;\n }\n}"]}
@@ -1 +1 @@
1
- {"version":3,"file":"downloadErrorCode.js","sourceRoot":"","sources":["../../../../src/downloader/dtos/downloadErrorCode.ts"],"names":[],"mappings":"AAAA,IAAK,iBAiBJ;AAjBD,WAAK,iBAAiB;IAClB,iGAAwB,CAAA;IACxB,iEAAQ,CAAA;IACR,+FAAuB,CAAA;IACvB,iFAAgB,CAAA;IAChB,mFAAiB,CAAA;IACjB,+EAAe,CAAA;IACf,mFAAiB,CAAA;IACjB,yFAAoB,CAAA;IACpB,uFAAmB,CAAA;IACnB,uGAA2B,CAAA;IAC3B,0FAAoB,CAAA;IACpB,4FAAqB,CAAA;IACrB,0FAAoB,CAAA;IACpB,oGAAyB,CAAA;IACzB,wGAA2B,CAAA;IAC3B,oIAAyC,CAAA;AAC7C,CAAC,EAjBI,iBAAiB,KAAjB,iBAAiB,QAiBrB;AAED,eAAe,iBAAiB,CAAC","sourcesContent":["enum DownloadErrorCode {\r\n TrackingDataParsingError,\r\n DiskFull,\r\n InvalidTransferPassword,\r\n TransferNotFound,\r\n DownloadsDisabled,\r\n TransferExpired,\r\n NoFilesToDownload,\r\n TransferInvalidState,\r\n ResumedFileNotFound,\r\n ResumedFilePathNotSpecified,\r\n TrackingNotAvailable,\r\n TrackingCleanupFailed,\r\n TrackingDataOutdated,\r\n TooManyFileRenameAttempts,\r\n FileserverResponseWrongSize,\r\n RenameFromTemporaryFilenameToFinalFailure\r\n}\r\n\r\nexport default DownloadErrorCode;"]}
1
+ {"version":3,"file":"downloadErrorCode.js","sourceRoot":"","sources":["../../../../src/downloader/dtos/downloadErrorCode.ts"],"names":[],"mappings":"AAAA,IAAK,iBAiBJ;AAjBD,WAAK,iBAAiB;IAClB,iGAAwB,CAAA;IACxB,iEAAQ,CAAA;IACR,+FAAuB,CAAA;IACvB,iFAAgB,CAAA;IAChB,mFAAiB,CAAA;IACjB,+EAAe,CAAA;IACf,mFAAiB,CAAA;IACjB,yFAAoB,CAAA;IACpB,uFAAmB,CAAA;IACnB,uGAA2B,CAAA;IAC3B,0FAAoB,CAAA;IACpB,4FAAqB,CAAA;IACrB,0FAAoB,CAAA;IACpB,oGAAyB,CAAA;IACzB,wGAA2B,CAAA;IAC3B,oIAAyC,CAAA;AAC7C,CAAC,EAjBI,iBAAiB,KAAjB,iBAAiB,QAiBrB;AAED,eAAe,iBAAiB,CAAC","sourcesContent":["enum DownloadErrorCode {\n TrackingDataParsingError,\n DiskFull,\n InvalidTransferPassword,\n TransferNotFound,\n DownloadsDisabled,\n TransferExpired,\n NoFilesToDownload,\n TransferInvalidState,\n ResumedFileNotFound,\n ResumedFilePathNotSpecified,\n TrackingNotAvailable,\n TrackingCleanupFailed,\n TrackingDataOutdated,\n TooManyFileRenameAttempts,\n FileserverResponseWrongSize,\n RenameFromTemporaryFilenameToFinalFailure\n}\n\nexport default DownloadErrorCode;"]}
@@ -1 +1 @@
1
- {"version":3,"file":"downloadEvent.js","sourceRoot":"","sources":["../../../../src/downloader/dtos/downloadEvent.ts"],"names":[],"mappings":"AAAA,IAAK,qBA8BJ;AA9BD,WAAK,qBAAqB;IACtB,4DAAmC,CAAA;IACnC,kEAAyC,CAAA;IACzC,gEAAuC,CAAA;IACvC,wFAA+D,CAAA;IAC/D,sDAA6B,CAAA;IAC7B,oDAA2B,CAAA;IAC3B,sEAA6C,CAAA;IAC7C,oEAA2C,CAAA;IAC3C,0EAAiD,CAAA;IACjD,wEAA+C,CAAA;IAC/C,0EAAiD,CAAA;IACjD,kEAAyC,CAAA;IACzC,gGAAuE,CAAA;IACvE,sEAA6C,CAAA;IAC7C,4EAAmD,CAAA;IACnD,0EAAiD,CAAA;IACjD,oEAA2C,CAAA;IAC3C,oEAA2C,CAAA;IAC3C,8CAAqB,CAAA;IACrB,4CAAmB,CAAA;IACnB,4CAAmB,CAAA;IACnB,4CAAmB,CAAA;IACnB,0CAAiB,CAAA;IACjB,0DAAiC,CAAA;IACjC,gDAAuB,CAAA;IACvB,0EAAiD,CAAA;IACjD,sFAA6D,CAAA;IAC7D,0EAAiD,CAAA;IACjD,kFAAyD,CAAA;AAC7D,CAAC,EA9BI,qBAAqB,KAArB,qBAAqB,QA8BzB;AAED,eAAe,qBAAqB,CAAC","sourcesContent":["enum TransferDownloadEvent {\r\n DownloadStarted = `DownloadStarted`,\r\n DownloadProgressed = `DownloadProgressed`,\r\n DownloadCompleted = `DownloadCompleted`,\r\n DownloadRegistrationTriggered = `DownloadRegistrationTriggered`,\r\n FileCreating = `FileCreating`,\r\n FileCreated = `FileCreated`,\r\n FileDownloadStarting = `FileDownloadStarting`,\r\n FileDownloadStarted = `FileDownloadStarted`,\r\n FileDownloadCompleting = `FileDownloadCompleting`,\r\n FileDownloadCompleted = `FileDownloadCompleted`,\r\n FileDownloadProgressed = `FileDownloadProgressed`,\r\n FileDownloadFailed = `FileDownloadFailed`,\r\n FileDownloadRegistrationTriggered = `FileDownloadRegistrationTriggered`,\r\n ChunkDownloadStarted = `ChunkDownloadStarted`,\r\n ChunkDownloadProgressed = `ChunkDownloadProgressed`,\r\n ChunkDownloadCompleted = `ChunkDownloadCompleted`,\r\n ChunkDownloadFailed = `ChunkDownloadFailed`,\r\n ConfigureThrottling = `ConfigureThrottling`,\r\n Aborting = `Aborting`,\r\n Aborted = `Aborted`,\r\n Resumed = `Resumed`,\r\n Pausing = `Pausing`,\r\n Paused = `Paused`,\r\n NetworkFailure = `NetworkFailure`,\r\n NetworkOk = `NetworkOk`,\r\n PossibleSupersizedFile = `PossibleSupersizedFile`,\r\n RecoveredInterruptedDownload = `RecoveredInterruptedDownload`,\r\n DownloadTrackingFailed = `DownloadTrackingFailed`,\r\n TransferMetadataDetermined = `TransferMetadataDetermined`,\r\n}\r\n\r\nexport default TransferDownloadEvent;"]}
1
+ {"version":3,"file":"downloadEvent.js","sourceRoot":"","sources":["../../../../src/downloader/dtos/downloadEvent.ts"],"names":[],"mappings":"AAAA,IAAK,qBA8BJ;AA9BD,WAAK,qBAAqB;IACtB,4DAAmC,CAAA;IACnC,kEAAyC,CAAA;IACzC,gEAAuC,CAAA;IACvC,wFAA+D,CAAA;IAC/D,sDAA6B,CAAA;IAC7B,oDAA2B,CAAA;IAC3B,sEAA6C,CAAA;IAC7C,oEAA2C,CAAA;IAC3C,0EAAiD,CAAA;IACjD,wEAA+C,CAAA;IAC/C,0EAAiD,CAAA;IACjD,kEAAyC,CAAA;IACzC,gGAAuE,CAAA;IACvE,sEAA6C,CAAA;IAC7C,4EAAmD,CAAA;IACnD,0EAAiD,CAAA;IACjD,oEAA2C,CAAA;IAC3C,oEAA2C,CAAA;IAC3C,8CAAqB,CAAA;IACrB,4CAAmB,CAAA;IACnB,4CAAmB,CAAA;IACnB,4CAAmB,CAAA;IACnB,0CAAiB,CAAA;IACjB,0DAAiC,CAAA;IACjC,gDAAuB,CAAA;IACvB,0EAAiD,CAAA;IACjD,sFAA6D,CAAA;IAC7D,0EAAiD,CAAA;IACjD,kFAAyD,CAAA;AAC7D,CAAC,EA9BI,qBAAqB,KAArB,qBAAqB,QA8BzB;AAED,eAAe,qBAAqB,CAAC","sourcesContent":["enum TransferDownloadEvent {\n DownloadStarted = `DownloadStarted`,\n DownloadProgressed = `DownloadProgressed`,\n DownloadCompleted = `DownloadCompleted`,\n DownloadRegistrationTriggered = `DownloadRegistrationTriggered`,\n FileCreating = `FileCreating`,\n FileCreated = `FileCreated`,\n FileDownloadStarting = `FileDownloadStarting`,\n FileDownloadStarted = `FileDownloadStarted`,\n FileDownloadCompleting = `FileDownloadCompleting`,\n FileDownloadCompleted = `FileDownloadCompleted`,\n FileDownloadProgressed = `FileDownloadProgressed`,\n FileDownloadFailed = `FileDownloadFailed`,\n FileDownloadRegistrationTriggered = `FileDownloadRegistrationTriggered`,\n ChunkDownloadStarted = `ChunkDownloadStarted`,\n ChunkDownloadProgressed = `ChunkDownloadProgressed`,\n ChunkDownloadCompleted = `ChunkDownloadCompleted`,\n ChunkDownloadFailed = `ChunkDownloadFailed`,\n ConfigureThrottling = `ConfigureThrottling`,\n Aborting = `Aborting`,\n Aborted = `Aborted`,\n Resumed = `Resumed`,\n Pausing = `Pausing`,\n Paused = `Paused`,\n NetworkFailure = `NetworkFailure`,\n NetworkOk = `NetworkOk`,\n PossibleSupersizedFile = `PossibleSupersizedFile`,\n RecoveredInterruptedDownload = `RecoveredInterruptedDownload`,\n DownloadTrackingFailed = `DownloadTrackingFailed`,\n TransferMetadataDetermined = `TransferMetadataDetermined`,\n}\n\nexport default TransferDownloadEvent;"]}
@@ -1 +1 @@
1
- {"version":3,"file":"downloadFileChunkInfo.js","sourceRoot":"","sources":["../../../../src/downloader/dtos/downloadFileChunkInfo.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,OAAO,qBAAqB;IAC7B,EAAE,CAAS;IACX,IAAI,CAAmB;IAEhC;;OAEG;IACM,KAAK,CAAgB;IAC9B;;OAEG;IACM,GAAG,CAAgB;IAC5B;;OAEG;IACM,WAAW,CAAS;IAC7B;;;OAGG;IACM,SAAS,CAAS;IAE3B,WAAW,GAAG,KAAK,CAAC;IACpB,QAAQ,GAAG,KAAK,CAAC;IACjB,OAAO,GAAyB,IAAI,CAAC;IACrC,eAAe,GAAG,CAAC,CAAC;IACpB,OAAO,GAAG,CAAC,CAAC;IAEZ,YAAY,IAAsB,EAAE,WAAmB,EAAE,YAA2B;QAChF,IAAI,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,UAAU,IAAI,WAAW,EAAE,CAAC;QAC9C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,YAAY,KAAK,IAAI,EAAE,CAAC;YACxB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;YAClB,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;YAChB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,WAAW,CAAC;QACtC,CAAC;aACI,CAAC;YACF,IAAI,CAAC,KAAK,GAAG,WAAW,GAAG,YAAa,CAAC;YACzC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,GAAG,CAAC,EAAE,IAAI,CAAC,KAAK,GAAG,YAAa,GAAG,CAAC,CAAC,CAAC;YAC1E,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;QAC/C,CAAC;IACL,CAAC;IAED,IAAI,CAAC,MAAqB;QACtB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IAC1B,CAAC;IAED,QAAQ;QACJ,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;IAC1B,CAAC;IAED,WAAW,CAAC,eAAuB;QAC/B,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,IAAI,CAAC,SAAS,KAAK,CAAC;YACpB,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC;;YAEnB,IAAI,CAAC,OAAO,GAAG,CAAC,GAAG,GAAG,eAAe,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC;IAChE,CAAC;CACJ","sourcesContent":["import type DownloadError from \"./downloadError.js\";\r\nimport type DownloadFileInfo from \"./downloadFileInfo.js\";\r\n\r\nexport default class DownloadFileChunkInfo {\r\n readonly id: string;\r\n readonly file: DownloadFileInfo;\r\n\r\n /**\r\n * Zero-based index of first byte of this chunk within a file.\r\n */\r\n readonly start: number | null;\r\n /**\r\n * Zero-based index of last byte of this chunk within a file.\r\n */\r\n readonly end: number | null;\r\n /**\r\n * Zero-based index of the chunk within a file.\r\n */\r\n readonly chunkNumber: number;\r\n /**\r\n * The real chunk size in bytes (no matter of downloader chunkSize setting). For unspecified downloader chunkSize\r\n * this will equal to file size. Otherwise it is calculated as end-start+1\r\n */\r\n readonly chunkSize: number;\r\n\r\n isCompleted = false;\r\n isFailed = false;\r\n failure: DownloadError | null = null;\r\n downloadedBytes = 0;\r\n percent = 0;\r\n\r\n constructor(file: DownloadFileInfo, chunkNumber: number, maxChunkSize: number | null) {\r\n this.id = `${file.externalId}_${chunkNumber}`;\r\n this.file = file;\r\n this.chunkNumber = chunkNumber;\r\n if (maxChunkSize === null) {\r\n this.start = null;\r\n this.end = null;\r\n this.chunkSize = file.sizeInBytes;\r\n }\r\n else {\r\n this.start = chunkNumber * maxChunkSize!;\r\n this.end = Math.min(file.sizeInBytes - 1, this.start + maxChunkSize! - 1);\r\n this.chunkSize = this.end - this.start + 1;\r\n }\r\n }\r\n\r\n fail(reason: DownloadError): void {\r\n this.isCompleted = false;\r\n this.isFailed = true;\r\n this.failure = reason;\r\n }\r\n\r\n complete(): void {\r\n this.isCompleted = true;\r\n this.isFailed = false;\r\n }\r\n\r\n setProgress(downloadedBytes: number): void {\r\n this.downloadedBytes = downloadedBytes;\r\n if (this.chunkSize === 0)\r\n this.percent = 100;\r\n else\r\n this.percent = (100 * downloadedBytes) / this.chunkSize;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"downloadFileChunkInfo.js","sourceRoot":"","sources":["../../../../src/downloader/dtos/downloadFileChunkInfo.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,OAAO,qBAAqB;IAC7B,EAAE,CAAS;IACX,IAAI,CAAmB;IAEhC;;OAEG;IACM,KAAK,CAAgB;IAC9B;;OAEG;IACM,GAAG,CAAgB;IAC5B;;OAEG;IACM,WAAW,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,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,IAAI,CAAC,SAAS,KAAK,CAAC;YACpB,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC;;YAEnB,IAAI,CAAC,OAAO,GAAG,CAAC,GAAG,GAAG,eAAe,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC;IAChE,CAAC;CACJ","sourcesContent":["import type DownloadError from \"./downloadError.js\";\nimport type DownloadFileInfo from \"./downloadFileInfo.js\";\n\nexport default class DownloadFileChunkInfo {\n readonly id: string;\n readonly file: DownloadFileInfo;\n\n /**\n * Zero-based index of first byte of this chunk within a file.\n */\n readonly start: number | null;\n /**\n * Zero-based index of last byte of this chunk within a file.\n */\n readonly end: number | null;\n /**\n * Zero-based index of the chunk within a file.\n */\n readonly chunkNumber: number;\n /**\n * The real chunk size in bytes (no matter of downloader chunkSize setting). For unspecified downloader chunkSize\n * this will equal to file size. Otherwise it is calculated as end-start+1\n */\n readonly chunkSize: number;\n\n isCompleted = false;\n isFailed = false;\n failure: DownloadError | null = null;\n downloadedBytes = 0;\n percent = 0;\n\n constructor(file: DownloadFileInfo, chunkNumber: number, maxChunkSize: number | null) {\n this.id = `${file.externalId}_${chunkNumber}`;\n this.file = file;\n this.chunkNumber = chunkNumber;\n if (maxChunkSize === null) {\n this.start = null;\n this.end = null;\n this.chunkSize = file.sizeInBytes;\n }\n else {\n this.start = chunkNumber * maxChunkSize!;\n this.end = Math.min(file.sizeInBytes - 1, this.start + maxChunkSize! - 1);\n this.chunkSize = this.end - this.start + 1;\n }\n }\n\n fail(reason: DownloadError): void {\n this.isCompleted = false;\n this.isFailed = true;\n this.failure = reason;\n }\n\n complete(): void {\n this.isCompleted = true;\n this.isFailed = false;\n }\n\n setProgress(downloadedBytes: number): void {\n this.downloadedBytes = downloadedBytes;\n if (this.chunkSize === 0)\n this.percent = 100;\n else\n this.percent = (100 * downloadedBytes) / this.chunkSize;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"down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";\r\nimport type DownloadFileChunkInfo from \"./downloadFileChunkInfo.js\";\r\n\r\nexport default class DownloadFileInfo {\r\n #lastProgressTick: number | null = null;\r\n #downloadPath: string | null = null;\r\n #pendingChunks: Set<DownloadFileChunkInfo> = new Set<DownloadFileChunkInfo>();\r\n #completedChunkNumbers: Array<number> = [];\r\n\r\n readonly externalId: string;\r\n readonly url: string;\r\n readonly name: string;\r\n readonly sizeInBytes: number;\r\n\r\n wasEverWritten = false;\r\n isStarted = false;\r\n isCompleted = false;\r\n isFailed = false;\r\n lastSuccessfulChunkNumber: number | null = null;\r\n temporaryDownloadPath: string | null = null;\r\n\r\n /**\r\n * How many bytes have been downloaded counting only completed chunks.\r\n */\r\n downloadedBytes_bank = 0;\r\n /**\r\n * How many bytes have been downloaded: including completed chunks and pending chunks.\r\n * This value may go back and forward in case of a stop/resume flow or when there are retries of failed chunks.\r\n */\r\n downloadedBytes = 0;\r\n\r\n percent = 0;\r\n chunkCount = 0;\r\n chunks = new Array<DownloadFileChunkInfo>();\r\n failures = new Array<DownloadError>();\r\n\r\n /**\r\n * @param externalId ID of the file - returned in Filemail web API transfer response.\r\n * @param url Absolute url to the file on Fileserver.\r\n * @param name File name as it is returned from Filemail web API (relative to transfer folder, / is the path separator - api convention).\r\n * @param sizeInBytes Size of the file - obtained from Filemail web API transfer response.\r\n * @param downloadPath Optional: absolute download path where the file should be saved. This param is also used when restoring interrupted download.\r\n * When this parameter is null it will be set automatically by the downloader based on download folder (configured in the downloader) + {@link name}.\r\n * @param chunkCount How many chunks this file contains. Note: zero-byte (empty) files have 1 chunk.\r\n * @param temporaryDownloadPath Temporary download path - where the file is physically download until it is complete (and then renamed to {@link downloadPath}).\r\n */\r\n constructor(\r\n externalId: string,\r\n url: string,\r\n name: string,\r\n sizeInBytes: number,\r\n downloadPath: string | null = null,\r\n chunkCount: number | null = null,\r\n temporaryDownloadPath: string | null = null,\r\n ) {\r\n this.externalId = externalId;\r\n this.url = url;\r\n this.name = name;\r\n this.sizeInBytes = sizeInBytes;\r\n this.#downloadPath = downloadPath;\r\n this.temporaryDownloadPath = temporaryDownloadPath;\r\n if (chunkCount !== null)\r\n this.chunkCount = chunkCount;\r\n }\r\n\r\n start() {\r\n this.isStarted = true;\r\n }\r\n\r\n starting() {\r\n this.wasEverWritten = true;\r\n }\r\n\r\n fail(reason: DownloadError) {\r\n this.isFailed = true;\r\n this.failures.push(reason);\r\n }\r\n\r\n complete(finalDownloadPath: string) {\r\n this.downloadPath = finalDownloadPath;\r\n this.isFailed = false;\r\n this.isCompleted = true;\r\n }\r\n\r\n chunkStarted(chunk: DownloadFileChunkInfo) {\r\n this.#pendingChunks.add(chunk);\r\n }\r\n\r\n chunkCompleted(chunk: DownloadFileChunkInfo) {\r\n const removed = this.#pendingChunks.delete(chunk);\r\n if (removed) {\r\n this.downloadedBytes_bank += chunk.chunkSize;\r\n\r\n if (this.#completedChunkNumbers.indexOf(chunk.chunkNumber) === -1) {\r\n this.#completedChunkNumbers.push(chunk.chunkNumber);\r\n this.#completedChunkNumbers.sort((a, b) => a - b);\r\n }\r\n\r\n let minSuccessfulChunkNumber = this.lastSuccessfulChunkNumber ?? -1;\r\n while (this.#completedChunkNumbers.length > 0 && this.#completedChunkNumbers[0] === minSuccessfulChunkNumber + 1)\r\n minSuccessfulChunkNumber = this.#completedChunkNumbers.shift()!;\r\n\r\n if (minSuccessfulChunkNumber > -1)\r\n this.lastSuccessfulChunkNumber = minSuccessfulChunkNumber;\r\n }\r\n }\r\n\r\n chunkFailed(chunk: DownloadFileChunkInfo) {\r\n this.#pendingChunks.delete(chunk);\r\n }\r\n\r\n /**\r\n * Updates file's {@link downloadedBytes} by adding number of downloaded bytes of every pending chunk to {@link downloadedBytes_bank}.\r\n * Once {@link downloadedBytes} is updated - progress in percent is updated too ({@link percent}).\r\n */\r\n updateProgress() {\r\n this.#lastProgressTick = new Date().getTime();\r\n\r\n let downloaded = this.downloadedBytes_bank;\r\n\r\n for (const chunk of this.#pendingChunks)\r\n downloaded += chunk.downloadedBytes;\r\n\r\n this.downloadedBytes = downloaded;\r\n\r\n if (this.sizeInBytes > 0)\r\n this.percent = Math.min(100, (100 * this.downloadedBytes) / this.sizeInBytes);\r\n else\r\n this.percent = 100;\r\n }\r\n\r\n get lastProgressTick() {\r\n return this.#lastProgressTick;\r\n }\r\n\r\n get hasDownloadPath(): boolean {\r\n return !!this.#downloadPath;\r\n }\r\n\r\n get downloadPath(): string {\r\n if (!this.#downloadPath)\r\n throw new Error(`Download path not initialized!`);\r\n\r\n return this.#downloadPath;\r\n }\r\n\r\n set downloadPath(value: string) {\r\n this.#downloadPath = value;\r\n }\r\n}"]}
1
+ {"version":3,"file":"downloadFileInfo.js","sourceRoot":"","sources":["../../../../src/downloader/dtos/downloadFileInfo.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,OAAO,gBAAgB;IACjC,iBAAiB,GAAkB,IAAI,CAAC;IACxC,aAAa,GAAkB,IAAI,CAAC;IACpC,cAAc,GAA+B,IAAI,GAAG,EAAyB,CAAC;IAC9E,sBAAsB,GAAkB,EAAE,CAAC;IAElC,UAAU,CAAS;IACnB,GAAG,CAAS;IACZ,IAAI,CAAS;IACb,WAAW,CAAS;IAE7B,cAAc,GAAG,KAAK,CAAC;IACvB,SAAS,GAAG,KAAK,CAAC;IAClB,WAAW,GAAG,KAAK,CAAC;IACpB,QAAQ,GAAG,KAAK,CAAC;IACjB,yBAAyB,GAAkB,IAAI,CAAC;IAChD,qBAAqB,GAAkB,IAAI,CAAC;IAE5C;;MAEE;IACF,oBAAoB,GAAG,CAAC,CAAC;IACzB;;;MAGE;IACF,eAAe,GAAG,CAAC,CAAC;IAEpB,OAAO,GAAG,CAAC,CAAC;IACZ,UAAU,GAAG,CAAC,CAAC;IACf,MAAM,GAAG,IAAI,KAAK,EAAyB,CAAC;IAC5C,QAAQ,GAAG,IAAI,KAAK,EAAiB,CAAC;IAEtC;;;;;;;;;OASG;IACH,YACI,UAAkB,EAClB,GAAW,EACX,I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ED,IAAI,gBAAgB;QAChB,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAClC,CAAC;IAED,IAAI,eAAe;QACf,OAAO,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC;IAChC,CAAC;IAED,IAAI,YAAY;QACZ,IAAI,CAAC,IAAI,CAAC,aAAa;YACnB,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;QAEtD,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IAED,IAAI,YAAY,CAAC,KAAa;QAC1B,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;IAC/B,CAAC;CACJ","sourcesContent":["import type DownloadError from \"./downloadError.js\";\nimport type DownloadFileChunkInfo from \"./downloadFileChunkInfo.js\";\n\nexport default class DownloadFileInfo {\n #lastProgressTick: number | null = null;\n #downloadPath: string | null = null;\n #pendingChunks: Set<DownloadFileChunkInfo> = new Set<DownloadFileChunkInfo>();\n #completedChunkNumbers: Array<number> = [];\n\n readonly externalId: string;\n readonly url: string;\n readonly name: string;\n readonly sizeInBytes: number;\n\n wasEverWritten = false;\n isStarted = false;\n isCompleted = false;\n isFailed = false;\n lastSuccessfulChunkNumber: number | null = null;\n temporaryDownloadPath: string | null = null;\n\n /**\n * How many bytes have been downloaded counting only completed chunks.\n */\n downloadedBytes_bank = 0;\n /**\n * How many bytes have been downloaded: including completed chunks and pending chunks.\n * This value may go back and forward in case of a stop/resume flow or when there are retries of failed chunks.\n */\n downloadedBytes = 0;\n\n percent = 0;\n chunkCount = 0;\n chunks = new Array<DownloadFileChunkInfo>();\n failures = new Array<DownloadError>();\n\n /**\n * @param externalId ID of the file - returned in Filemail web API transfer response.\n * @param url Absolute url to the file on Fileserver.\n * @param name File name as it is returned from Filemail web API (relative to transfer folder, / is the path separator - api convention).\n * @param sizeInBytes Size of the file - obtained from Filemail web API transfer response.\n * @param downloadPath Optional: absolute download path where the file should be saved. This param is also used when restoring interrupted download.\n * When this parameter is null it will be set automatically by the downloader based on download folder (configured in the downloader) + {@link name}.\n * @param chunkCount How many chunks this file contains. Note: zero-byte (empty) files have 1 chunk.\n * @param temporaryDownloadPath Temporary download path - where the file is physically download until it is complete (and then renamed to {@link downloadPath}).\n */\n constructor(\n externalId: string,\n url: string,\n name: string,\n sizeInBytes: number,\n downloadPath: string | null = null,\n chunkCount: number | null = null,\n temporaryDownloadPath: string | null = null,\n ) {\n this.externalId = externalId;\n this.url = url;\n this.name = name;\n this.sizeInBytes = sizeInBytes;\n this.#downloadPath = downloadPath;\n this.temporaryDownloadPath = temporaryDownloadPath;\n if (chunkCount !== null)\n this.chunkCount = chunkCount;\n }\n\n start() {\n this.isStarted = true;\n }\n\n starting() {\n this.wasEverWritten = true;\n }\n\n fail(reason: DownloadError) {\n this.isFailed = true;\n this.failures.push(reason);\n }\n\n complete(finalDownloadPath: string) {\n this.downloadPath = finalDownloadPath;\n this.isFailed = false;\n this.isCompleted = true;\n }\n\n chunkStarted(chunk: DownloadFileChunkInfo) {\n this.#pendingChunks.add(chunk);\n }\n\n chunkCompleted(chunk: DownloadFileChunkInfo) {\n const removed = this.#pendingChunks.delete(chunk);\n if (removed) {\n this.downloadedBytes_bank += chunk.chunkSize;\n\n if (this.#completedChunkNumbers.indexOf(chunk.chunkNumber) === -1) {\n this.#completedChunkNumbers.push(chunk.chunkNumber);\n this.#completedChunkNumbers.sort((a, b) => a - b);\n }\n\n let minSuccessfulChunkNumber = this.lastSuccessfulChunkNumber ?? -1;\n while (this.#completedChunkNumbers.length > 0 && this.#completedChunkNumbers[0] === minSuccessfulChunkNumber + 1)\n minSuccessfulChunkNumber = this.#completedChunkNumbers.shift()!;\n\n if (minSuccessfulChunkNumber > -1)\n this.lastSuccessfulChunkNumber = minSuccessfulChunkNumber;\n }\n }\n\n chunkFailed(chunk: DownloadFileChunkInfo) {\n this.#pendingChunks.delete(chunk);\n }\n\n /**\n * Updates file's {@link downloadedBytes} by adding number of downloaded bytes of every pending chunk to {@link downloadedBytes_bank}.\n * Once {@link downloadedBytes} is updated - progress in percent is updated too ({@link percent}).\n */\n updateProgress() {\n this.#lastProgressTick = new Date().getTime();\n\n let downloaded = this.downloadedBytes_bank;\n\n for (const chunk of this.#pendingChunks)\n downloaded += chunk.downloadedBytes;\n\n this.downloadedBytes = downloaded;\n\n if (this.sizeInBytes > 0)\n this.percent = Math.min(100, (100 * this.downloadedBytes) / this.sizeInBytes);\n else\n this.percent = 100;\n }\n\n get lastProgressTick() {\n return this.#lastProgressTick;\n }\n\n get hasDownloadPath(): boolean {\n return !!this.#downloadPath;\n }\n\n get downloadPath(): string {\n if (!this.#downloadPath)\n throw new Error(`Download path not initialized!`);\n\n return this.#downloadPath;\n }\n\n set downloadPath(value: string) {\n this.#downloadPath = value;\n }\n}"]}
@@ -1 +1 @@
1
- {"version":3,"file":"downloadFilesCommand.js","sourceRoot":"","sources":["../../../../src/downloader/dtos/downloadFilesCommand.ts"],"names":[],"mappings":"","sourcesContent":["import type TransferFileDto from \"../../utils/api/dtos/transferFileDto.js\";\r\nimport type DownloadCommand from \"./downloadCommand.js\";\r\n\r\ninterface DownloadFilesCommand extends DownloadCommand\r\n{\r\n files: Array<TransferFileDto>\r\n}\r\n\r\nexport default DownloadFilesCommand;"]}
1
+ {"version":3,"file":"downloadFilesCommand.js","sourceRoot":"","sources":["../../../../src/downloader/dtos/downloadFilesCommand.ts"],"names":[],"mappings":"","sourcesContent":["import type TransferFileDto from \"../../utils/api/dtos/transferFileDto.js\";\nimport type DownloadCommand from \"./downloadCommand.js\";\n\ninterface DownloadFilesCommand extends DownloadCommand\n{\n files: Array<TransferFileDto>\n}\n\nexport default DownloadFilesCommand;"]}
@@ -1 +1 @@
1
- {"version":3,"file":"downloadInfo.js","sourceRoot":"","sources":["../../../../src/downloader/dtos/downloadInfo.ts"],"names":[],"mappings":"","sourcesContent":["import type DownloadEventArgs from \"../eventArgs/downloadEventArgs.js\";\r\n\r\ninterface DownloadInfo {\r\n downloadId: string;\r\n transferId: string;\r\n initialState: DownloadEventArgs;\r\n completion: Promise<DownloadEventArgs>;\r\n}\r\n\r\nexport default DownloadInfo;"]}
1
+ {"version":3,"file":"downloadInfo.js","sourceRoot":"","sources":["../../../../src/downloader/dtos/downloadInfo.ts"],"names":[],"mappings":"","sourcesContent":["import type DownloadEventArgs from \"../eventArgs/downloadEventArgs.js\";\n\ninterface DownloadInfo {\n downloadId: string;\n transferId: string;\n initialState: DownloadEventArgs;\n completion: Promise<DownloadEventArgs>;\n}\n\nexport default DownloadInfo;"]}
@@ -1 +1 @@
1
- {"version":3,"file":"downloadRegistrationMode.js","sourceRoot":"","sources":["../../../../src/downloader/dtos/downloadRegistrationMode.ts"],"names":[],"mappings":"AAAA,IAAK,wBAIJ;AAJD,WAAK,wBAAwB;IACzB,iDAAqB,CAAA;IACrB,+DAAmC,CAAA;IACnC,2DAA+B,CAAA;AACnC,CAAC,EAJI,wBAAwB,KAAxB,wBAAwB,QAI5B;AAED,eAAe,wBAAwB,CAAC","sourcesContent":["enum DownloadRegistrationMode {\r\n Transfer = `Transfer`,\r\n EverySingleFile = `EverySingleFile`,\r\n MultipleFiles = `MultipleFiles`, // for future use with new endpoint - see FILEMAIL-4034\r\n}\r\n\r\nexport default DownloadRegistrationMode;"]}
1
+ {"version":3,"file":"downloadRegistrationMode.js","sourceRoot":"","sources":["../../../../src/downloader/dtos/downloadRegistrationMode.ts"],"names":[],"mappings":"AAAA,IAAK,wBAIJ;AAJD,WAAK,wBAAwB;IACzB,iDAAqB,CAAA;IACrB,+DAAmC,CAAA;IACnC,2DAA+B,CAAA;AACnC,CAAC,EAJI,wBAAwB,KAAxB,wBAAwB,QAI5B;AAED,eAAe,wBAAwB,CAAC","sourcesContent":["enum DownloadRegistrationMode {\n Transfer = `Transfer`,\n EverySingleFile = `EverySingleFile`,\n MultipleFiles = `MultipleFiles`, // for future use with new endpoint - see FILEMAIL-4034\n}\n\nexport default DownloadRegistrationMode;"]}
@@ -1 +1 @@
1
- {"version":3,"file":"downloadTrackerFileInfo.js","sourceRoot":"","sources":["../../../../src/downloader/dtos/downloadTrackerFileInfo.ts"],"names":[],"mappings":"","sourcesContent":["/**\r\n * Note: this is a JSON DTO interface - short property names are to minimize state size on disk in case there are downloads with lots of files.\r\n */\r\ninterface DownloadTrackerFileInfo {\r\n /**\r\n * Download url.\r\n */\r\n u: string,\r\n /**\r\n * Size in bytes.\r\n */\r\n s: number;\r\n /**\r\n * File name (as it came from api, so potentially including folders, separator is always a forward slash). E.g. /some/folder/file.txt\r\n */\r\n n: string,\r\n /**\r\n * Absolute download path - final file download download path. E.g. C:\\downloads\\file.txt\r\n */\r\n dp: string,\r\n /**\r\n * Temporary download path - physical file download download path until it is complete. Ee.g. C:\\downloads\\unconfiormed_123456.fmdownload\r\n * Allows avoiding naming conflicts and indicating to end users that file is in progress.\r\n */\r\n tdp: string | null,\r\n /**\r\n * Number of chunks.\r\n */\r\n cc: number,\r\n}\r\n\r\nexport default DownloadTrackerFileInfo;"]}
1
+ {"version":3,"file":"downloadTrackerFileInfo.js","sourceRoot":"","sources":["../../../../src/downloader/dtos/downloadTrackerFileInfo.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Note: this is a JSON DTO interface - short property names are to minimize state size on disk in case there are downloads with lots of files.\n */\ninterface DownloadTrackerFileInfo {\n /**\n * Download url.\n */\n u: string,\n /**\n * Size in bytes.\n */\n s: number;\n /**\n * File name (as it came from api, so potentially including folders, separator is always a forward slash). E.g. /some/folder/file.txt\n */\n n: string,\n /**\n * Absolute download path - final file download download path. E.g. C:\\downloads\\file.txt\n */\n dp: string,\n /**\n * Temporary download path - physical file download download path until it is complete. Ee.g. C:\\downloads\\unconfiormed_123456.fmdownload\n * Allows avoiding naming conflicts and indicating to end users that file is in progress.\n */\n tdp: string | null,\n /**\n * Number of chunks.\n */\n cc: number,\n}\n\nexport default DownloadTrackerFileInfo;"]}
@@ -1,3 +1,4 @@
1
+ import type DownloadErrorCode from "./downloadErrorCode.js";
1
2
  /**
2
3
  * Note: this is a JSON DTO interface - short property names are to minimize state size on disk in case there are downloads with lots of files.
3
4
  */
@@ -18,6 +19,10 @@ interface DownloadTrackerFileProgressInfo {
18
19
  * Was this file ever written?
19
20
  */
20
21
  wr: boolean;
22
+ /**
23
+ * Last failure code for this file.
24
+ */
25
+ ec?: DownloadErrorCode | null;
21
26
  }
22
27
  export default DownloadTrackerFileProgressInfo;
23
28
  //# sourceMappingURL=downloadTrackerFileProgressInfo.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"downloadTrackerFileProgressInfo.d.ts","sourceRoot":"","sources":["../../../../src/downloader/dtos/downloadTrackerFileProgressInfo.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,UAAU,+BAA+B;IACrC;;OAEG;IACH,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB;;OAEG;IACH,EAAE,EAAE,OAAO,CAAC;IACZ;;OAEG;IACH,CAAC,EAAE,OAAO,CAAC;IACX;;OAEG;IACH,EAAE,EAAE,OAAO,CAAA;CACd;AAED,eAAe,+BAA+B,CAAC"}
1
+ {"version":3,"file":"downloadTrackerFileProgressInfo.d.ts","sourceRoot":"","sources":["../../../../src/downloader/dtos/downloadTrackerFileProgressInfo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,iBAAiB,MAAM,wBAAwB,CAAC;AAE5D;;GAEG;AACH,UAAU,+BAA+B;IACrC;;OAEG;IACH,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB;;OAEG;IACH,EAAE,EAAE,OAAO,CAAC;IACZ;;OAEG;IACH,CAAC,EAAE,OAAO,CAAC;IACX;;OAEG;IACH,EAAE,EAAE,OAAO,CAAC;IACZ;;OAEG;IACH,EAAE,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAA;CAChC;AAED,eAAe,+BAA+B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"downloadTrackerFileProgressInfo.js","sourceRoot":"","sources":["../../../../src/downloader/dtos/downloadTrackerFileProgressInfo.ts"],"names":[],"mappings":"","sourcesContent":["/**\r\n * Note: this is a JSON DTO interface - short property names are to minimize state size on disk in case there are downloads with lots of files.\r\n */\r\ninterface DownloadTrackerFileProgressInfo {\r\n /**\r\n * Number of last successful chunk (only consecutive chunks count).\r\n */\r\n ok: number | null,\r\n /**\r\n * Is this file in \"failed\" state?\r\n */\r\n er: boolean,\r\n /**\r\n * Is this file in \"completed\" state?\r\n */\r\n c: boolean,\r\n /**\r\n * Was this file ever written?\r\n */\r\n wr: boolean\r\n}\r\n\r\nexport default DownloadTrackerFileProgressInfo;"]}
1
+ {"version":3,"file":"downloadTrackerFileProgressInfo.js","sourceRoot":"","sources":["../../../../src/downloader/dtos/downloadTrackerFileProgressInfo.ts"],"names":[],"mappings":"","sourcesContent":["import type DownloadErrorCode from \"./downloadErrorCode.js\";\n\n/**\n * Note: this is a JSON DTO interface - short property names are to minimize state size on disk in case there are downloads with lots of files.\n */\ninterface DownloadTrackerFileProgressInfo {\n /**\n * Number of last successful chunk (only consecutive chunks count).\n */\n ok: number | null,\n /**\n * Is this file in \"failed\" state?\n */\n er: boolean,\n /**\n * Is this file in \"completed\" state?\n */\n c: boolean,\n /**\n * Was this file ever written?\n */\n wr: boolean,\n /**\n * Last failure code for this file.\n */\n ec?: DownloadErrorCode | null\n}\n\nexport default DownloadTrackerFileProgressInfo;"]}
@@ -1 +1 @@
1
- {"version":3,"file":"downloadTrackerProgressInfo.js","sourceRoot":"","sources":["../../../../src/downloader/dtos/downloadTrackerProgressInfo.ts"],"names":[],"mappings":"","sourcesContent":["import type DownloadTrackerFileProgressInfo from \"./downloadTrackerFileProgressInfo.js\";\r\n\r\ninterface DownloadTrackerProgressInfo {\r\n trackedFiles: Record<string, DownloadTrackerFileProgressInfo>;\r\n activeTime: number;\r\n}\r\n\r\nexport default DownloadTrackerProgressInfo;"]}
1
+ {"version":3,"file":"downloadTrackerProgressInfo.js","sourceRoot":"","sources":["../../../../src/downloader/dtos/downloadTrackerProgressInfo.ts"],"names":[],"mappings":"","sourcesContent":["import type DownloadTrackerFileProgressInfo from \"./downloadTrackerFileProgressInfo.js\";\n\ninterface DownloadTrackerProgressInfo {\n trackedFiles: Record<string, DownloadTrackerFileProgressInfo>;\n activeTime: number;\n}\n\nexport default DownloadTrackerProgressInfo;"]}
@@ -1 +1 @@
1
- {"version":3,"file":"downloadTrackingMetadata.js","sourceRoot":"","sources":["../../../../src/downloader/dtos/downloadTrackingMetadata.ts"],"names":[],"mappings":"","sourcesContent":["interface DownloadTrackingMetadata {\r\n region?: string,\r\n e2eeData?: DownloadTrackingMetadataE2eeData,\r\n}\r\n\r\nexport default DownloadTrackingMetadata;\r\n\r\nexport type DownloadTrackingMetadataE2eeData = {\r\n ivAsHex: string,\r\n keyAsHex: string,\r\n}"]}
1
+ {"version":3,"file":"downloadTrackingMetadata.js","sourceRoot":"","sources":["../../../../src/downloader/dtos/downloadTrackingMetadata.ts"],"names":[],"mappings":"","sourcesContent":["interface DownloadTrackingMetadata {\n region?: string,\n e2eeData?: DownloadTrackingMetadataE2eeData,\n}\n\nexport default DownloadTrackingMetadata;\n\nexport type DownloadTrackingMetadataE2eeData = {\n ivAsHex: string,\n keyAsHex: string,\n}"]}
@@ -1 +1 @@
1
- {"version":3,"file":"downloaderRestoredState.js","sourceRoot":"","sources":["../../../../src/downloader/dtos/downloaderRestoredState.ts"],"names":[],"mappings":"","sourcesContent":["interface DownloaderRestoredState {\r\n activeTime: number;\r\n downloadedBytes: number;\r\n downloadedBytesBank: number;\r\n totalSize: number;\r\n percent: number;\r\n}\r\n\r\nexport default DownloaderRestoredState;"]}
1
+ {"version":3,"file":"downloaderRestoredState.js","sourceRoot":"","sources":["../../../../src/downloader/dtos/downloaderRestoredState.ts"],"names":[],"mappings":"","sourcesContent":["interface DownloaderRestoredState {\n activeTime: number;\n downloadedBytes: number;\n downloadedBytesBank: number;\n totalSize: number;\n percent: number;\n}\n\nexport default DownloaderRestoredState;"]}
@@ -1 +1 @@
1
- {"version":3,"file":"chunkDownloadEventArgs.js","sourceRoot":"","sources":["../../../../src/downloader/eventArgs/chunkDownloadEventArgs.ts"],"names":[],"mappings":"","sourcesContent":["import type DownloadFileChunkProgress from \"../downloadStatus/downloadFileChunkProgress.js\";\r\nimport type DownloadFileProgress from \"../downloadStatus/downloadFileProgress.js\";\r\n\r\ninterface ChunkDownloadEventArgs {\r\n transferId: string;\r\n file: DownloadFileProgress;\r\n chunk: DownloadFileChunkProgress;\r\n activeTime: number;\r\n}\r\n\r\nexport default ChunkDownloadEventArgs;"]}
1
+ {"version":3,"file":"chunkDownloadEventArgs.js","sourceRoot":"","sources":["../../../../src/downloader/eventArgs/chunkDownloadEventArgs.ts"],"names":[],"mappings":"","sourcesContent":["import type DownloadFileChunkProgress from \"../downloadStatus/downloadFileChunkProgress.js\";\nimport type DownloadFileProgress from \"../downloadStatus/downloadFileProgress.js\";\n\ninterface ChunkDownloadEventArgs {\n transferId: string;\n file: DownloadFileProgress;\n chunk: DownloadFileChunkProgress;\n activeTime: number;\n}\n\nexport default ChunkDownloadEventArgs;"]}
@@ -1 +1 @@
1
- {"version":3,"file":"chunkDownloadFailedEventArgs.js","sourceRoot":"","sources":["../../../../src/downloader/eventArgs/chunkDownloadFailedEventArgs.ts"],"names":[],"mappings":"","sourcesContent":["import type DownloadError from \"../dtos/downloadError.js\";\r\nimport type ChunkDownloadEventArgs from \"./chunkDownloadEventArgs.js\";\r\n\r\ninterface ChunkDownloadFailedEventArgs extends ChunkDownloadEventArgs {\r\n reason: DownloadError;\r\n}\r\n\r\nexport default ChunkDownloadFailedEventArgs;"]}
1
+ {"version":3,"file":"chunkDownloadFailedEventArgs.js","sourceRoot":"","sources":["../../../../src/downloader/eventArgs/chunkDownloadFailedEventArgs.ts"],"names":[],"mappings":"","sourcesContent":["import type DownloadError from \"../dtos/downloadError.js\";\nimport type ChunkDownloadEventArgs from \"./chunkDownloadEventArgs.js\";\n\ninterface ChunkDownloadFailedEventArgs extends ChunkDownloadEventArgs {\n reason: DownloadError;\n}\n\nexport default ChunkDownloadFailedEventArgs;"]}
@@ -1 +1 @@
1
- {"version":3,"file":"downloadCompletedEventArgs.js","sourceRoot":"","sources":["../../../../src/downloader/eventArgs/downloadCompletedEventArgs.ts"],"names":[],"mappings":"","sourcesContent":["import type DownloadFileProgress from \"../downloadStatus/downloadFileProgress.js\";\r\nimport type DownloadEventArgs from \"./downloadEventArgs.js\";\r\n\r\ninterface DownloadCompletedEventArgs extends DownloadEventArgs {\r\n downloadError: Error | undefined;\r\n failedFiles: Array<DownloadFileProgress>; // if this array has any items - it means transfer completed but not all files were downloaded (after all possible retries have been performed)\r\n}\r\n\r\nexport default DownloadCompletedEventArgs;"]}
1
+ {"version":3,"file":"downloadCompletedEventArgs.js","sourceRoot":"","sources":["../../../../src/downloader/eventArgs/downloadCompletedEventArgs.ts"],"names":[],"mappings":"","sourcesContent":["import type DownloadFileProgress from \"../downloadStatus/downloadFileProgress.js\";\nimport type DownloadEventArgs from \"./downloadEventArgs.js\";\n\ninterface DownloadCompletedEventArgs extends DownloadEventArgs {\n downloadError: Error | undefined;\n failedFiles: Array<DownloadFileProgress>; // if this array has any items - it means transfer completed but not all files were downloaded (after all possible retries have been performed)\n}\n\nexport default DownloadCompletedEventArgs;"]}
@@ -1 +1 @@
1
- {"version":3,"file":"downloadEventArgs.js","sourceRoot":"","sources":["../../../../src/downloader/eventArgs/downloadEventArgs.ts"],"names":[],"mappings":"","sourcesContent":["import type TransferStatus from \"../../utils/types/transferStatus.js\";\r\nimport type DownloadFileProgress from \"../downloadStatus/downloadFileProgress.js\";\r\n\r\ninterface DownloadEventArgs {\r\n status: TransferStatus;\r\n downloadId: string;\r\n transferId: string;\r\n activeTimeMillis: number;\r\n totalTimeMillis: number;\r\n progressPercent: number;\r\n bytesPerSecondAverage: number;\r\n bytesPerSecondCurrent: number;\r\n estimatedRemainingTimeSeconds: number | null;\r\n totalSize: number;\r\n downloadedBytes: number;\r\n files: Array<DownloadFileProgress> | null;\r\n downloadBaseFolder: string;\r\n}\r\n\r\nexport default DownloadEventArgs;"]}
1
+ {"version":3,"file":"downloadEventArgs.js","sourceRoot":"","sources":["../../../../src/downloader/eventArgs/downloadEventArgs.ts"],"names":[],"mappings":"","sourcesContent":["import type TransferStatus from \"../../utils/types/transferStatus.js\";\nimport type DownloadFileProgress from \"../downloadStatus/downloadFileProgress.js\";\n\ninterface DownloadEventArgs {\n status: TransferStatus;\n downloadId: string;\n transferId: string;\n activeTimeMillis: number;\n totalTimeMillis: number;\n progressPercent: number;\n bytesPerSecondAverage: number;\n bytesPerSecondCurrent: number;\n estimatedRemainingTimeSeconds: number | null;\n totalSize: number;\n downloadedBytes: number;\n files: Array<DownloadFileProgress> | null;\n downloadBaseFolder: string;\n}\n\nexport default DownloadEventArgs;"]}
@@ -1 +1 @@
1
- {"version":3,"file":"downloadMetadataDeterminedEventArgs.js","sourceRoot":"","sources":["../../../../src/downloader/eventArgs/downloadMetadataDeterminedEventArgs.ts"],"names":[],"mappings":"","sourcesContent":["import type DownloadEventArgs from \"./downloadEventArgs.js\";\r\n\r\ninterface DownloadMetadataDeterminedEventArgs extends DownloadEventArgs {\r\n region?: string;\r\n fileServerUrl: string;\r\n}\r\n\r\nexport default DownloadMetadataDeterminedEventArgs;"]}
1
+ {"version":3,"file":"downloadMetadataDeterminedEventArgs.js","sourceRoot":"","sources":["../../../../src/downloader/eventArgs/downloadMetadataDeterminedEventArgs.ts"],"names":[],"mappings":"","sourcesContent":["import type DownloadEventArgs from \"./downloadEventArgs.js\";\n\ninterface DownloadMetadataDeterminedEventArgs extends DownloadEventArgs {\n region?: string;\n fileServerUrl: string;\n}\n\nexport default DownloadMetadataDeterminedEventArgs;"]}
@@ -1 +1 @@
1
- {"version":3,"file":"downloadPauseEventArgs.js","sourceRoot":"","sources":["../../../../src/downloader/eventArgs/downloadPauseEventArgs.ts"],"names":[],"mappings":"","sourcesContent":["import type DownloadEventArgs from \"./downloadEventArgs.js\";\r\n\r\ninterface DownloadPauseEventArgs extends DownloadEventArgs {\r\n interruptPendingChunks: boolean;\r\n}\r\n\r\nexport default DownloadPauseEventArgs;"]}
1
+ {"version":3,"file":"downloadPauseEventArgs.js","sourceRoot":"","sources":["../../../../src/downloader/eventArgs/downloadPauseEventArgs.ts"],"names":[],"mappings":"","sourcesContent":["import type DownloadEventArgs from \"./downloadEventArgs.js\";\n\ninterface DownloadPauseEventArgs extends DownloadEventArgs {\n interruptPendingChunks: boolean;\n}\n\nexport default DownloadPauseEventArgs;"]}
@@ -1 +1 @@
1
- {"version":3,"file":"downloadTrackingFailedEventArgs.js","sourceRoot":"","sources":["../../../../src/downloader/eventArgs/downloadTrackingFailedEventArgs.ts"],"names":[],"mappings":"","sourcesContent":["import type DownloadErrorCode from \"../dtos/downloadErrorCode.js\";\r\n\r\ninterface DownloadTrackingFailedEventArgs {\r\n downloadId: string;\r\n reason: string;\r\n errorCode: DownloadErrorCode;\r\n error: Error | null;\r\n}\r\n\r\nexport default DownloadTrackingFailedEventArgs;"]}
1
+ {"version":3,"file":"downloadTrackingFailedEventArgs.js","sourceRoot":"","sources":["../../../../src/downloader/eventArgs/downloadTrackingFailedEventArgs.ts"],"names":[],"mappings":"","sourcesContent":["import type DownloadErrorCode from \"../dtos/downloadErrorCode.js\";\n\ninterface DownloadTrackingFailedEventArgs {\n downloadId: string;\n reason: string;\n errorCode: DownloadErrorCode;\n error: Error | null;\n}\n\nexport default DownloadTrackingFailedEventArgs;"]}
@@ -1 +1 @@
1
- {"version":3,"file":"fileDownloadEventArgs.js","sourceRoot":"","sources":["../../../../src/downloader/eventArgs/fileDownloadEventArgs.ts"],"names":[],"mappings":"","sourcesContent":["import type DownloadFileProgress from \"../downloadStatus/downloadFileProgress.js\";\r\n\r\ninterface FileDownloadEventArgs {\r\n transferId: string;\r\n file: DownloadFileProgress;\r\n activeTime: number;\r\n}\r\n\r\nexport default FileDownloadEventArgs;"]}
1
+ {"version":3,"file":"fileDownloadEventArgs.js","sourceRoot":"","sources":["../../../../src/downloader/eventArgs/fileDownloadEventArgs.ts"],"names":[],"mappings":"","sourcesContent":["import type DownloadFileProgress from \"../downloadStatus/downloadFileProgress.js\";\n\ninterface FileDownloadEventArgs {\n transferId: string;\n file: DownloadFileProgress;\n activeTime: number;\n}\n\nexport default FileDownloadEventArgs;"]}
@@ -1 +1 @@
1
- {"version":3,"file":"fileDownloadFailedEventArgs.js","sourceRoot":"","sources":["../../../../src/downloader/eventArgs/fileDownloadFailedEventArgs.ts"],"names":[],"mappings":"","sourcesContent":["import type DownloadError from \"../dtos/downloadError.js\";\r\nimport type FileDownloadEventArgs from \"./fileDownloadEventArgs.js\";\r\n\r\ninterface FileDownloadFailedEventArgs extends FileDownloadEventArgs {\r\n reason: DownloadError;\r\n}\r\n\r\nexport default FileDownloadFailedEventArgs;"]}
1
+ {"version":3,"file":"fileDownloadFailedEventArgs.js","sourceRoot":"","sources":["../../../../src/downloader/eventArgs/fileDownloadFailedEventArgs.ts"],"names":[],"mappings":"","sourcesContent":["import type DownloadError from \"../dtos/downloadError.js\";\nimport type FileDownloadEventArgs from \"./fileDownloadEventArgs.js\";\n\ninterface FileDownloadFailedEventArgs extends FileDownloadEventArgs {\n reason: DownloadError;\n}\n\nexport default FileDownloadFailedEventArgs;"]}
@@ -1 +1 @@
1
- {"version":3,"file":"filesDownloader.d.ts","sourceRoot":"","sources":["../../../src/downloader/filesDownloader.ts"],"names":[],"mappings":"AAGA,OAAO,gBAAgB,MAAM,4BAA4B,CAAC;AAK1D,OAAO,cAAc,MAAM,kCAAkC,CAAC;AAE9D,OAAO,wBAAwB,MAAM,oCAAoC,CAAC;AAG1E,OAAO,KAAK,iBAAiB,MAAM,0CAA0C,CAAC;AAC9E,OAAO,KAAK,eAAe,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,qBAAqB,MAAM,yDAAyD,CAAC;AACjG,OAAO,KAAK,uBAAuB,MAAM,mCAAmC,CAAC;AAC7E,OAAO,KAAK,uBAAuB,MAAM,yCAAyC,CAAC;AACnF,OAAO,KAAK,0BAA0B,MAAM,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