@milaboratories/pl-drivers 1.11.59 → 1.11.60
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.
- package/dist/_virtual/_rolldown/runtime.cjs +29 -0
- package/dist/clients/constructors.cjs +28 -28
- package/dist/clients/constructors.cjs.map +1 -1
- package/dist/clients/constructors.d.ts +17 -13
- package/dist/clients/constructors.js +28 -26
- package/dist/clients/constructors.js.map +1 -1
- package/dist/clients/crc32c.cjs +8 -13
- package/dist/clients/crc32c.cjs.map +1 -1
- package/dist/clients/crc32c.js +8 -12
- package/dist/clients/crc32c.js.map +1 -1
- package/dist/clients/download.cjs +119 -160
- package/dist/clients/download.cjs.map +1 -1
- package/dist/clients/download.d.ts +45 -41
- package/dist/clients/download.js +115 -137
- package/dist/clients/download.js.map +1 -1
- package/dist/clients/logs.cjs +78 -82
- package/dist/clients/logs.cjs.map +1 -1
- package/dist/clients/logs.d.ts +34 -24
- package/dist/clients/logs.js +77 -80
- package/dist/clients/logs.js.map +1 -1
- package/dist/clients/ls_api.cjs +62 -68
- package/dist/clients/ls_api.cjs.map +1 -1
- package/dist/clients/ls_api.d.ts +15 -11
- package/dist/clients/ls_api.js +61 -66
- package/dist/clients/ls_api.js.map +1 -1
- package/dist/clients/progress.cjs +49 -59
- package/dist/clients/progress.cjs.map +1 -1
- package/dist/clients/progress.d.ts +27 -20
- package/dist/clients/progress.js +48 -57
- package/dist/clients/progress.js.map +1 -1
- package/dist/clients/upload.cjs +189 -250
- package/dist/clients/upload.cjs.map +1 -1
- package/dist/clients/upload.d.ts +44 -34
- package/dist/clients/upload.js +187 -229
- package/dist/clients/upload.js.map +1 -1
- package/dist/drivers/download_blob/blob_key.cjs +9 -26
- package/dist/drivers/download_blob/blob_key.cjs.map +1 -1
- package/dist/drivers/download_blob/blob_key.js +7 -5
- package/dist/drivers/download_blob/blob_key.js.map +1 -1
- package/dist/drivers/download_blob/download_blob.cjs +395 -478
- package/dist/drivers/download_blob/download_blob.cjs.map +1 -1
- package/dist/drivers/download_blob/download_blob.d.ts +102 -100
- package/dist/drivers/download_blob/download_blob.js +388 -453
- package/dist/drivers/download_blob/download_blob.js.map +1 -1
- package/dist/drivers/download_blob/download_blob_task.cjs +128 -163
- package/dist/drivers/download_blob/download_blob_task.cjs.map +1 -1
- package/dist/drivers/download_blob/download_blob_task.js +125 -141
- package/dist/drivers/download_blob/download_blob_task.js.map +1 -1
- package/dist/drivers/download_blob/sparse_cache/cache.cjs +166 -195
- package/dist/drivers/download_blob/sparse_cache/cache.cjs.map +1 -1
- package/dist/drivers/download_blob/sparse_cache/cache.js +164 -193
- package/dist/drivers/download_blob/sparse_cache/cache.js.map +1 -1
- package/dist/drivers/download_blob/sparse_cache/file.cjs +29 -50
- package/dist/drivers/download_blob/sparse_cache/file.cjs.map +1 -1
- package/dist/drivers/download_blob/sparse_cache/file.js +28 -29
- package/dist/drivers/download_blob/sparse_cache/file.js.map +1 -1
- package/dist/drivers/download_blob/sparse_cache/ranges.cjs +48 -76
- package/dist/drivers/download_blob/sparse_cache/ranges.cjs.map +1 -1
- package/dist/drivers/download_blob/sparse_cache/ranges.js +47 -54
- package/dist/drivers/download_blob/sparse_cache/ranges.js.map +1 -1
- package/dist/drivers/download_blob_url/driver.cjs +125 -165
- package/dist/drivers/download_blob_url/driver.cjs.map +1 -1
- package/dist/drivers/download_blob_url/driver.d.ts +45 -42
- package/dist/drivers/download_blob_url/driver.js +123 -144
- package/dist/drivers/download_blob_url/driver.js.map +1 -1
- package/dist/drivers/download_blob_url/driver_id.cjs +4 -4
- package/dist/drivers/download_blob_url/driver_id.cjs.map +1 -1
- package/dist/drivers/download_blob_url/driver_id.js +4 -3
- package/dist/drivers/download_blob_url/driver_id.js.map +1 -1
- package/dist/drivers/download_blob_url/snapshot.cjs +7 -11
- package/dist/drivers/download_blob_url/snapshot.cjs.map +1 -1
- package/dist/drivers/download_blob_url/snapshot.d.ts +10 -5
- package/dist/drivers/download_blob_url/snapshot.js +5 -8
- package/dist/drivers/download_blob_url/snapshot.js.map +1 -1
- package/dist/drivers/download_blob_url/task.cjs +147 -194
- package/dist/drivers/download_blob_url/task.cjs.map +1 -1
- package/dist/drivers/download_blob_url/task.d.ts +55 -57
- package/dist/drivers/download_blob_url/task.js +140 -170
- package/dist/drivers/download_blob_url/task.js.map +1 -1
- package/dist/drivers/download_url/driver.cjs +109 -146
- package/dist/drivers/download_url/driver.cjs.map +1 -1
- package/dist/drivers/download_url/driver.d.ts +59 -57
- package/dist/drivers/download_url/driver.js +107 -125
- package/dist/drivers/download_url/driver.js.map +1 -1
- package/dist/drivers/download_url/task.cjs +104 -137
- package/dist/drivers/download_url/task.cjs.map +1 -1
- package/dist/drivers/download_url/task.d.ts +33 -37
- package/dist/drivers/download_url/task.js +99 -113
- package/dist/drivers/download_url/task.js.map +1 -1
- package/dist/drivers/helpers/download_local_handle.cjs +13 -14
- package/dist/drivers/helpers/download_local_handle.cjs.map +1 -1
- package/dist/drivers/helpers/download_local_handle.js +13 -13
- package/dist/drivers/helpers/download_local_handle.js.map +1 -1
- package/dist/drivers/helpers/download_remote_handle.cjs +23 -24
- package/dist/drivers/helpers/download_remote_handle.cjs.map +1 -1
- package/dist/drivers/helpers/download_remote_handle.js +22 -22
- package/dist/drivers/helpers/download_remote_handle.js.map +1 -1
- package/dist/drivers/helpers/files_cache.cjs +53 -64
- package/dist/drivers/helpers/files_cache.cjs.map +1 -1
- package/dist/drivers/helpers/files_cache.js +52 -62
- package/dist/drivers/helpers/files_cache.js.map +1 -1
- package/dist/drivers/helpers/helpers.cjs +24 -28
- package/dist/drivers/helpers/helpers.cjs.map +1 -1
- package/dist/drivers/helpers/helpers.d.ts +10 -7
- package/dist/drivers/helpers/helpers.js +24 -27
- package/dist/drivers/helpers/helpers.js.map +1 -1
- package/dist/drivers/helpers/logs_handle.cjs +24 -33
- package/dist/drivers/helpers/logs_handle.cjs.map +1 -1
- package/dist/drivers/helpers/logs_handle.js +24 -29
- package/dist/drivers/helpers/logs_handle.js.map +1 -1
- package/dist/drivers/helpers/ls_remote_import_handle.cjs +20 -20
- package/dist/drivers/helpers/ls_remote_import_handle.cjs.map +1 -1
- package/dist/drivers/helpers/ls_remote_import_handle.js +20 -18
- package/dist/drivers/helpers/ls_remote_import_handle.js.map +1 -1
- package/dist/drivers/helpers/ls_storage_entry.cjs +36 -40
- package/dist/drivers/helpers/ls_storage_entry.cjs.map +1 -1
- package/dist/drivers/helpers/ls_storage_entry.js +36 -37
- package/dist/drivers/helpers/ls_storage_entry.js.map +1 -1
- package/dist/drivers/helpers/polling_ops.d.ts +6 -5
- package/dist/drivers/helpers/read_file.cjs +34 -57
- package/dist/drivers/helpers/read_file.cjs.map +1 -1
- package/dist/drivers/helpers/read_file.js +30 -34
- package/dist/drivers/helpers/read_file.js.map +1 -1
- package/dist/drivers/logs.cjs +94 -112
- package/dist/drivers/logs.cjs.map +1 -1
- package/dist/drivers/logs.d.ts +35 -32
- package/dist/drivers/logs.js +93 -110
- package/dist/drivers/logs.js.map +1 -1
- package/dist/drivers/logs_stream.cjs +210 -242
- package/dist/drivers/logs_stream.cjs.map +1 -1
- package/dist/drivers/logs_stream.d.ts +55 -53
- package/dist/drivers/logs_stream.js +209 -240
- package/dist/drivers/logs_stream.js.map +1 -1
- package/dist/drivers/ls.cjs +151 -238
- package/dist/drivers/ls.cjs.map +1 -1
- package/dist/drivers/ls.d.ts +53 -49
- package/dist/drivers/ls.js +148 -216
- package/dist/drivers/ls.js.map +1 -1
- package/dist/drivers/types.cjs +25 -53
- package/dist/drivers/types.cjs.map +1 -1
- package/dist/drivers/types.d.ts +91 -106
- package/dist/drivers/types.js +23 -50
- package/dist/drivers/types.js.map +1 -1
- package/dist/drivers/upload.cjs +127 -153
- package/dist/drivers/upload.cjs.map +1 -1
- package/dist/drivers/upload.d.ts +52 -50
- package/dist/drivers/upload.js +126 -151
- package/dist/drivers/upload.js.map +1 -1
- package/dist/drivers/upload_task.cjs +223 -260
- package/dist/drivers/upload_task.cjs.map +1 -1
- package/dist/drivers/upload_task.d.ts +54 -52
- package/dist/drivers/upload_task.js +221 -258
- package/dist/drivers/upload_task.js.map +1 -1
- package/dist/drivers/urls/url.cjs +30 -35
- package/dist/drivers/urls/url.cjs.map +1 -1
- package/dist/drivers/urls/url.js +28 -33
- package/dist/drivers/urls/url.js.map +1 -1
- package/dist/drivers/virtual_storages.cjs +36 -48
- package/dist/drivers/virtual_storages.cjs.map +1 -1
- package/dist/drivers/virtual_storages.d.ts +6 -2
- package/dist/drivers/virtual_storages.js +32 -46
- package/dist/drivers/virtual_storages.js.map +1 -1
- package/dist/helpers/download.cjs +72 -95
- package/dist/helpers/download.cjs.map +1 -1
- package/dist/helpers/download.d.ts +13 -9
- package/dist/helpers/download.js +71 -93
- package/dist/helpers/download.js.map +1 -1
- package/dist/helpers/download_errors.cjs +28 -27
- package/dist/helpers/download_errors.cjs.map +1 -1
- package/dist/helpers/download_errors.d.ts +16 -13
- package/dist/helpers/download_errors.js +28 -26
- package/dist/helpers/download_errors.js.map +1 -1
- package/dist/helpers/validate.cjs +8 -7
- package/dist/helpers/validate.cjs.map +1 -1
- package/dist/helpers/validate.d.ts +4 -1
- package/dist/helpers/validate.js +6 -5
- package/dist/helpers/validate.js.map +1 -1
- package/dist/index.cjs +75 -79
- package/dist/index.d.ts +22 -22
- package/dist/index.js +22 -21
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.cjs +238 -249
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.cjs.map +1 -1
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.cjs +27 -27
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.cjs.map +1 -1
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.d.ts +25 -23
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.js +26 -25
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.js.map +1 -1
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.d.ts +51 -87
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.js +238 -245
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.js.map +1 -1
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.cjs +295 -289
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.cjs.map +1 -1
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.cjs +30 -30
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.cjs.map +1 -1
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.js +29 -28
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.js.map +1 -1
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.d.ts +86 -150
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.js +295 -285
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.js.map +1 -1
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.cjs +385 -393
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.cjs.map +1 -1
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.cjs +34 -34
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.cjs.map +1 -1
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.d.ts +33 -34
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.js +33 -32
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.js.map +1 -1
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.d.ts +78 -129
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.js +385 -387
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.js.map +1 -1
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.cjs +570 -468
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.cjs.map +1 -1
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.cjs +82 -82
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.cjs.map +1 -1
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.d.ts +109 -112
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.js +81 -80
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.js.map +1 -1
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.d.ts +243 -264
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.js +569 -460
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.js.map +1 -1
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.cjs +751 -729
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.cjs.map +1 -1
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.client.cjs +67 -67
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.client.cjs.map +1 -1
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.client.js +66 -65
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.client.js.map +1 -1
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.d.ts +15 -381
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.js +749 -718
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.js.map +1 -1
- package/dist/proto-grpc/google/protobuf/duration.cjs +92 -100
- package/dist/proto-grpc/google/protobuf/duration.cjs.map +1 -1
- package/dist/proto-grpc/google/protobuf/duration.d.ts +38 -43
- package/dist/proto-grpc/google/protobuf/duration.js +91 -98
- package/dist/proto-grpc/google/protobuf/duration.js.map +1 -1
- package/dist/proto-grpc/google/protobuf/timestamp.cjs +117 -128
- package/dist/proto-grpc/google/protobuf/timestamp.cjs.map +1 -1
- package/dist/proto-grpc/google/protobuf/timestamp.d.ts +50 -55
- package/dist/proto-grpc/google/protobuf/timestamp.js +116 -126
- package/dist/proto-grpc/google/protobuf/timestamp.js.map +1 -1
- package/dist/proto-rest/downloadapi.d.ts +85 -91
- package/dist/proto-rest/index.d.ts +11 -16
- package/dist/proto-rest/progressapi.d.ts +130 -140
- package/dist/proto-rest/streamingapi.d.ts +413 -434
- package/package.json +12 -12
- package/dist/clients/constructors.d.ts.map +0 -1
- package/dist/clients/crc32c.d.ts +0 -2
- package/dist/clients/crc32c.d.ts.map +0 -1
- package/dist/clients/download.d.ts.map +0 -1
- package/dist/clients/logs.d.ts.map +0 -1
- package/dist/clients/ls_api.d.ts.map +0 -1
- package/dist/clients/progress.d.ts.map +0 -1
- package/dist/clients/upload.d.ts.map +0 -1
- package/dist/drivers/download_blob/blob_key.d.ts +0 -5
- package/dist/drivers/download_blob/blob_key.d.ts.map +0 -1
- package/dist/drivers/download_blob/download_blob.d.ts.map +0 -1
- package/dist/drivers/download_blob/download_blob_task.d.ts +0 -56
- package/dist/drivers/download_blob/download_blob_task.d.ts.map +0 -1
- package/dist/drivers/download_blob/sparse_cache/cache.d.ts +0 -82
- package/dist/drivers/download_blob/sparse_cache/cache.d.ts.map +0 -1
- package/dist/drivers/download_blob/sparse_cache/file.d.ts +0 -8
- package/dist/drivers/download_blob/sparse_cache/file.d.ts.map +0 -1
- package/dist/drivers/download_blob/sparse_cache/ranges.d.ts +0 -46
- package/dist/drivers/download_blob/sparse_cache/ranges.d.ts.map +0 -1
- package/dist/drivers/download_blob_url/driver.d.ts.map +0 -1
- package/dist/drivers/download_blob_url/driver_id.d.ts +0 -6
- package/dist/drivers/download_blob_url/driver_id.d.ts.map +0 -1
- package/dist/drivers/download_blob_url/snapshot.d.ts.map +0 -1
- package/dist/drivers/download_blob_url/task.d.ts.map +0 -1
- package/dist/drivers/download_url/driver.d.ts.map +0 -1
- package/dist/drivers/download_url/task.d.ts.map +0 -1
- package/dist/drivers/helpers/download_local_handle.d.ts +0 -11
- package/dist/drivers/helpers/download_local_handle.d.ts.map +0 -1
- package/dist/drivers/helpers/download_remote_handle.d.ts +0 -13
- package/dist/drivers/helpers/download_remote_handle.d.ts.map +0 -1
- package/dist/drivers/helpers/files_cache.d.ts +0 -29
- package/dist/drivers/helpers/files_cache.d.ts.map +0 -1
- package/dist/drivers/helpers/helpers.d.ts.map +0 -1
- package/dist/drivers/helpers/logs_handle.d.ts +0 -15
- package/dist/drivers/helpers/logs_handle.d.ts.map +0 -1
- package/dist/drivers/helpers/ls_remote_import_handle.d.ts +0 -8
- package/dist/drivers/helpers/ls_remote_import_handle.d.ts.map +0 -1
- package/dist/drivers/helpers/ls_storage_entry.d.ts +0 -23
- package/dist/drivers/helpers/ls_storage_entry.d.ts.map +0 -1
- package/dist/drivers/helpers/polling_ops.d.ts.map +0 -1
- package/dist/drivers/helpers/read_file.d.ts +0 -12
- package/dist/drivers/helpers/read_file.d.ts.map +0 -1
- package/dist/drivers/helpers/test_helpers.d.ts +0 -2
- package/dist/drivers/helpers/test_helpers.d.ts.map +0 -1
- package/dist/drivers/logs.d.ts.map +0 -1
- package/dist/drivers/logs_stream.d.ts.map +0 -1
- package/dist/drivers/ls.d.ts.map +0 -1
- package/dist/drivers/types.d.ts.map +0 -1
- package/dist/drivers/upload.d.ts.map +0 -1
- package/dist/drivers/upload_task.d.ts.map +0 -1
- package/dist/drivers/urls/url.d.ts +0 -13
- package/dist/drivers/urls/url.d.ts.map +0 -1
- package/dist/drivers/virtual_storages.d.ts.map +0 -1
- package/dist/helpers/download.d.ts.map +0 -1
- package/dist/helpers/download_errors.d.ts.map +0 -1
- package/dist/helpers/validate.d.ts.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.d.ts.map +0 -1
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.d.ts.map +0 -1
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.d.ts +0 -46
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.d.ts.map +0 -1
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.d.ts.map +0 -1
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.d.ts.map +0 -1
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.d.ts.map +0 -1
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.d.ts.map +0 -1
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.d.ts.map +0 -1
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.client.d.ts +0 -108
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.client.d.ts.map +0 -1
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.d.ts.map +0 -1
- package/dist/proto-grpc/google/api/http.d.ts +0 -460
- package/dist/proto-grpc/google/api/http.d.ts.map +0 -1
- package/dist/proto-grpc/google/protobuf/descriptor.d.ts +0 -2340
- package/dist/proto-grpc/google/protobuf/descriptor.d.ts.map +0 -1
- package/dist/proto-grpc/google/protobuf/duration.d.ts.map +0 -1
- package/dist/proto-grpc/google/protobuf/timestamp.d.ts.map +0 -1
- package/dist/proto-rest/downloadapi.d.ts.map +0 -1
- package/dist/proto-rest/index.d.ts.map +0 -1
- package/dist/proto-rest/lsapi.d.ts +0 -148
- package/dist/proto-rest/lsapi.d.ts.map +0 -1
- package/dist/proto-rest/progressapi.d.ts.map +0 -1
- package/dist/proto-rest/streamingapi.d.ts.map +0 -1
- package/dist/proto-rest/uploadapi.d.ts +0 -355
- package/dist/proto-rest/uploadapi.d.ts.map +0 -1
- package/dist/test_env.d.ts +0 -6
- package/dist/test_env.d.ts.map +0 -1
|
@@ -1,488 +1,405 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if (k !== 'default') {
|
|
33
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
34
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
35
|
-
enumerable: true,
|
|
36
|
-
get: function () { return e[k]; }
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
n.default = e;
|
|
42
|
-
return Object.freeze(n);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
var fs__namespace = /*#__PURE__*/_interopNamespaceDefault(fs);
|
|
46
|
-
var fsp__namespace = /*#__PURE__*/_interopNamespaceDefault(fsp);
|
|
47
|
-
var os__namespace = /*#__PURE__*/_interopNamespaceDefault(os);
|
|
48
|
-
var path__namespace = /*#__PURE__*/_interopNamespaceDefault(path);
|
|
49
|
-
var readline__namespace = /*#__PURE__*/_interopNamespaceDefault(readline);
|
|
1
|
+
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
const require_download_errors = require('../../helpers/download_errors.cjs');
|
|
3
|
+
const require_read_file = require('../helpers/read_file.cjs');
|
|
4
|
+
const require_download_local_handle = require('../helpers/download_local_handle.cjs');
|
|
5
|
+
const require_types = require('../types.cjs');
|
|
6
|
+
const require_download_remote_handle = require('../helpers/download_remote_handle.cjs');
|
|
7
|
+
const require_helpers = require('../helpers/helpers.cjs');
|
|
8
|
+
const require_logs_handle = require('../helpers/logs_handle.cjs');
|
|
9
|
+
const require_blob_key = require('./blob_key.cjs');
|
|
10
|
+
const require_download_blob_task = require('./download_blob_task.cjs');
|
|
11
|
+
const require_files_cache = require('../helpers/files_cache.cjs');
|
|
12
|
+
const require_cache = require('./sparse_cache/cache.cjs');
|
|
13
|
+
let _milaboratories_pl_client = require("@milaboratories/pl-client");
|
|
14
|
+
let node_fs_promises = require("node:fs/promises");
|
|
15
|
+
node_fs_promises = require_runtime.__toESM(node_fs_promises);
|
|
16
|
+
let _milaboratories_ts_helpers = require("@milaboratories/ts-helpers");
|
|
17
|
+
let node_path = require("node:path");
|
|
18
|
+
node_path = require_runtime.__toESM(node_path);
|
|
19
|
+
let node_stream_consumers = require("node:stream/consumers");
|
|
20
|
+
let _milaboratories_computable = require("@milaboratories/computable");
|
|
21
|
+
let _milaboratories_pl_model_common = require("@milaboratories/pl-model-common");
|
|
22
|
+
let _milaboratories_pl_tree = require("@milaboratories/pl-tree");
|
|
23
|
+
let denque = require("denque");
|
|
24
|
+
denque = require_runtime.__toESM(denque);
|
|
25
|
+
let fs = require("fs");
|
|
26
|
+
fs = require_runtime.__toESM(fs);
|
|
27
|
+
let node_crypto = require("node:crypto");
|
|
28
|
+
let node_os = require("node:os");
|
|
29
|
+
node_os = require_runtime.__toESM(node_os);
|
|
30
|
+
let node_readline_promises = require("node:readline/promises");
|
|
31
|
+
node_readline_promises = require_runtime.__toESM(node_readline_promises);
|
|
50
32
|
|
|
33
|
+
//#region src/drivers/download_blob/download_blob.ts
|
|
51
34
|
/** DownloadDriver holds a queue of downloading tasks,
|
|
52
|
-
|
|
53
|
-
class DownloadDriver {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
newOffset: Number(resp.newOffset),
|
|
327
|
-
};
|
|
328
|
-
}
|
|
329
|
-
async releaseBlob(rInfo, callerId) {
|
|
330
|
-
const task = this.keyToDownload.get(blob_key.blobKey(rInfo.id));
|
|
331
|
-
if (task == undefined) {
|
|
332
|
-
return;
|
|
333
|
-
}
|
|
334
|
-
if (this.cache.existsFile(blob_key.blobKey(rInfo.id))) {
|
|
335
|
-
const toDelete = this.cache.removeFile(blob_key.blobKey(rInfo.id), callerId);
|
|
336
|
-
await Promise.all(toDelete.map(async (cachedFile) => {
|
|
337
|
-
await fsp__namespace.rm(cachedFile.path);
|
|
338
|
-
this.cache.removeCache(cachedFile);
|
|
339
|
-
this.removeTask(tsHelpers.mapGet(this.keyToDownload, blob_key.pathToKey(cachedFile.path)), `the task ${plClient.stringifyWithResourceId(cachedFile)} was removed` +
|
|
340
|
-
`from cache along with ${plClient.stringifyWithResourceId(toDelete.map((d) => d.path))}`);
|
|
341
|
-
}));
|
|
342
|
-
}
|
|
343
|
-
else {
|
|
344
|
-
// The task is still in a downloading queue.
|
|
345
|
-
const deleted = task.counter.dec(callerId);
|
|
346
|
-
if (deleted) {
|
|
347
|
-
this.removeTask(task, `the task ${plClient.stringifyWithResourceId(task.info())} was removed from cache`);
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
removeTask(task, reason) {
|
|
352
|
-
task.abort(reason);
|
|
353
|
-
task.change.markChanged(`download task for ${task.path} removed: ${reason}`);
|
|
354
|
-
this.keyToDownload.delete(blob_key.pathToKey(task.path));
|
|
355
|
-
this.idToLastLines.delete(blob_key.blobKey(task.rInfo.id));
|
|
356
|
-
this.idToProgressLog.delete(blob_key.blobKey(task.rInfo.id));
|
|
357
|
-
}
|
|
358
|
-
async releaseOnDemandBlob(blobId, callerId) {
|
|
359
|
-
const deleted = this.keyToOnDemand.get(blob_key.blobKey(blobId))?.release(callerId) ?? false;
|
|
360
|
-
if (deleted)
|
|
361
|
-
this.keyToOnDemand.delete(blob_key.blobKey(blobId));
|
|
362
|
-
}
|
|
363
|
-
/** Removes all files from a hard drive. */
|
|
364
|
-
async releaseAll() {
|
|
365
|
-
this.downloadQueue.stop();
|
|
366
|
-
this.keyToDownload.forEach((task, key) => {
|
|
367
|
-
this.keyToDownload.delete(key);
|
|
368
|
-
task.change.markChanged(`task ${plClient.resourceIdToString(task.rInfo.id)} released`);
|
|
369
|
-
});
|
|
370
|
-
}
|
|
371
|
-
async dispose() {
|
|
372
|
-
await this.rangesCache.dispose();
|
|
373
|
-
}
|
|
374
|
-
async [Symbol.asyncDispose]() {
|
|
375
|
-
await this.dispose();
|
|
376
|
-
}
|
|
377
|
-
}
|
|
35
|
+
* and notifies every watcher when a file were downloaded. */
|
|
36
|
+
var DownloadDriver = class DownloadDriver {
|
|
37
|
+
/** Represents a unique key to the path of a blob as a map. */
|
|
38
|
+
keyToDownload = /* @__PURE__ */ new Map();
|
|
39
|
+
/** Writes and removes files to a hard drive and holds a counter for every
|
|
40
|
+
* file that should be kept. */
|
|
41
|
+
cache;
|
|
42
|
+
rangesCache;
|
|
43
|
+
/** Downloads files and writes them to the local dir. */
|
|
44
|
+
downloadQueue;
|
|
45
|
+
keyToOnDemand = /* @__PURE__ */ new Map();
|
|
46
|
+
idToLastLines = /* @__PURE__ */ new Map();
|
|
47
|
+
idToProgressLog = /* @__PURE__ */ new Map();
|
|
48
|
+
saveDir;
|
|
49
|
+
constructor(logger, clientDownload, clientLogs, saveDir, rangesCacheDir, signer, ops) {
|
|
50
|
+
this.logger = logger;
|
|
51
|
+
this.clientDownload = clientDownload;
|
|
52
|
+
this.clientLogs = clientLogs;
|
|
53
|
+
this.rangesCacheDir = rangesCacheDir;
|
|
54
|
+
this.signer = signer;
|
|
55
|
+
this.ops = ops;
|
|
56
|
+
this.cache = new require_files_cache.FilesCache(this.ops.cacheSoftSizeBytes);
|
|
57
|
+
const fsRanges = new require_cache.SparseCacheFsRanges(this.logger, this.rangesCacheDir);
|
|
58
|
+
const fsStorage = new require_cache.SparseCacheFsFile(this.logger, this.rangesCacheDir);
|
|
59
|
+
this.rangesCache = new require_cache.SparseCache(this.logger, this.ops.rangesCacheMaxSizeBytes, fsRanges, fsStorage);
|
|
60
|
+
this.downloadQueue = new _milaboratories_ts_helpers.TaskProcessor(this.logger, ops.nConcurrentDownloads);
|
|
61
|
+
this.saveDir = node_path.resolve(saveDir);
|
|
62
|
+
}
|
|
63
|
+
static async init(logger, clientDownload, clientLogs, saveDir, rangesCacheDir, signer, ops) {
|
|
64
|
+
const driver = new DownloadDriver(logger, clientDownload, clientLogs, saveDir, rangesCacheDir, signer, ops);
|
|
65
|
+
await driver.rangesCache.reset();
|
|
66
|
+
return driver;
|
|
67
|
+
}
|
|
68
|
+
getDownloadedBlob(res, ctx) {
|
|
69
|
+
if (ctx === void 0) return _milaboratories_computable.Computable.make((ctx) => this.getDownloadedBlob(res, ctx));
|
|
70
|
+
const rInfo = (0, _milaboratories_pl_tree.treeEntryToResourceInfo)(res, ctx);
|
|
71
|
+
const callerId = (0, node_crypto.randomUUID)();
|
|
72
|
+
ctx.addOnDestroy(() => this.releaseBlob(rInfo, callerId));
|
|
73
|
+
const result = this.getDownloadedBlobNoCtx(ctx.watcher, rInfo, callerId);
|
|
74
|
+
if (result == void 0) ctx.markUnstable("download blob is still undefined");
|
|
75
|
+
return result;
|
|
76
|
+
}
|
|
77
|
+
getDownloadedBlobNoCtx(w, rInfo, callerId) {
|
|
78
|
+
validateDownloadableResourceType("getDownloadedBlob", rInfo.type);
|
|
79
|
+
const task = this.getOrSetNewTask(rInfo, callerId);
|
|
80
|
+
task.attach(w, callerId);
|
|
81
|
+
const result = task.getBlob();
|
|
82
|
+
if (!result.done) return;
|
|
83
|
+
if (result.result.ok) return result.result.value;
|
|
84
|
+
throw result.result.error;
|
|
85
|
+
}
|
|
86
|
+
getOrSetNewTask(rInfo, callerId) {
|
|
87
|
+
const key = require_blob_key.blobKey(rInfo.id);
|
|
88
|
+
const inMemoryTask = this.keyToDownload.get(key);
|
|
89
|
+
if (inMemoryTask) return inMemoryTask;
|
|
90
|
+
const fPath = node_path.resolve(this.saveDir, key);
|
|
91
|
+
const newTask = new require_download_blob_task.DownloadBlobTask(this.logger, this.clientDownload, rInfo, require_download_local_handle.newLocalHandle(fPath, this.signer), fPath);
|
|
92
|
+
this.keyToDownload.set(key, newTask);
|
|
93
|
+
this.downloadQueue.push({
|
|
94
|
+
fn: () => this.downloadBlob(newTask, callerId),
|
|
95
|
+
recoverableErrorPredicate: (e) => !require_download_blob_task.nonRecoverableError(e)
|
|
96
|
+
});
|
|
97
|
+
return newTask;
|
|
98
|
+
}
|
|
99
|
+
async downloadBlob(task, callerId) {
|
|
100
|
+
await task.download();
|
|
101
|
+
const blob = task.getBlob();
|
|
102
|
+
if (blob.done && blob.result.ok) this.cache.addCache(task, callerId);
|
|
103
|
+
}
|
|
104
|
+
getOnDemandBlob(res, ctx) {
|
|
105
|
+
if (ctx === void 0) return _milaboratories_computable.Computable.make((ctx) => this.getOnDemandBlob(res, ctx));
|
|
106
|
+
const rInfo = (0, _milaboratories_pl_tree.isPlTreeEntry)(res) ? (0, _milaboratories_pl_tree.makeResourceSnapshot)(res, require_types.OnDemandBlobResourceSnapshot, ctx) : res;
|
|
107
|
+
const callerId = (0, node_crypto.randomUUID)();
|
|
108
|
+
ctx.addOnDestroy(() => this.releaseOnDemandBlob(rInfo.id, callerId));
|
|
109
|
+
return this.getOnDemandBlobNoCtx(rInfo, callerId);
|
|
110
|
+
}
|
|
111
|
+
getOnDemandBlobNoCtx(info, callerId) {
|
|
112
|
+
validateDownloadableResourceType("getOnDemandBlob", info.type);
|
|
113
|
+
let blob = this.keyToOnDemand.get(require_blob_key.blobKey(info.id));
|
|
114
|
+
if (blob === void 0) {
|
|
115
|
+
blob = new OnDemandBlobHolder(require_types.getSize(info), require_download_remote_handle.newRemoteHandle(info, this.signer));
|
|
116
|
+
this.keyToOnDemand.set(require_blob_key.blobKey(info.id), blob);
|
|
117
|
+
}
|
|
118
|
+
blob.attach(callerId);
|
|
119
|
+
return blob.getHandle();
|
|
120
|
+
}
|
|
121
|
+
/** Gets a path from a handle. */
|
|
122
|
+
getLocalPath(handle) {
|
|
123
|
+
const { path } = require_download_local_handle.parseLocalHandle(handle, this.signer);
|
|
124
|
+
return path;
|
|
125
|
+
}
|
|
126
|
+
async getContent(handle, optionsOrRange) {
|
|
127
|
+
let options = {};
|
|
128
|
+
if (typeof optionsOrRange === "object" && optionsOrRange !== null) if ("range" in optionsOrRange) options = optionsOrRange;
|
|
129
|
+
else {
|
|
130
|
+
const range = optionsOrRange;
|
|
131
|
+
(0, _milaboratories_pl_model_common.validateRangeBytes)(range, `getContent`);
|
|
132
|
+
options = { range };
|
|
133
|
+
}
|
|
134
|
+
const request = () => this.withContent(handle, {
|
|
135
|
+
...options,
|
|
136
|
+
handler: async (content) => {
|
|
137
|
+
const chunks = [];
|
|
138
|
+
for await (const chunk of content) {
|
|
139
|
+
options.signal?.throwIfAborted();
|
|
140
|
+
chunks.push(chunk);
|
|
141
|
+
}
|
|
142
|
+
return Buffer.concat(chunks);
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
try {
|
|
146
|
+
return await request();
|
|
147
|
+
} catch (error) {
|
|
148
|
+
if (require_download_errors.isOffByOneError(error)) return await request();
|
|
149
|
+
throw error;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
/** Gets a content stream of a blob by a handle and calls handler with it. */
|
|
153
|
+
async withContent(handle, options) {
|
|
154
|
+
const { range, signal, handler } = options;
|
|
155
|
+
if (require_download_local_handle.isLocalBlobHandle(handle)) return await require_read_file.withFileContent({
|
|
156
|
+
path: this.getLocalPath(handle),
|
|
157
|
+
range,
|
|
158
|
+
signal,
|
|
159
|
+
handler
|
|
160
|
+
});
|
|
161
|
+
if (require_download_remote_handle.isRemoteBlobHandle(handle)) {
|
|
162
|
+
const result = require_download_remote_handle.parseRemoteHandle(handle, this.signer);
|
|
163
|
+
const key = require_blob_key.blobKey(result.info.id);
|
|
164
|
+
const filePath = await this.rangesCache.get(key, range ?? {
|
|
165
|
+
from: 0,
|
|
166
|
+
to: result.size
|
|
167
|
+
});
|
|
168
|
+
signal?.throwIfAborted();
|
|
169
|
+
if (filePath) return await require_read_file.withFileContent({
|
|
170
|
+
path: filePath,
|
|
171
|
+
range,
|
|
172
|
+
signal,
|
|
173
|
+
handler
|
|
174
|
+
});
|
|
175
|
+
return await this.clientDownload.withBlobContent(result.info, { signal }, options, async (content, size) => {
|
|
176
|
+
const [handlerStream, cacheStream] = content.tee();
|
|
177
|
+
const handlerPromise = handler(handlerStream, size);
|
|
178
|
+
(0, node_stream_consumers.buffer)(cacheStream).then((data) => this.rangesCache.set(key, range ?? {
|
|
179
|
+
from: 0,
|
|
180
|
+
to: result.size
|
|
181
|
+
}, data)).catch(() => {});
|
|
182
|
+
return await handlerPromise;
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
throw new Error("Malformed remote handle");
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Creates computable that will return blob content once it is downloaded.
|
|
189
|
+
* Uses downloaded blob handle under the hood, so stores corresponding blob in file system.
|
|
190
|
+
*/
|
|
191
|
+
getComputableContent(res, range) {
|
|
192
|
+
if (range) (0, _milaboratories_pl_model_common.validateRangeBytes)(range, `getComputableContent`);
|
|
193
|
+
return _milaboratories_computable.Computable.make((ctx) => this.getDownloadedBlob(res, ctx), { postprocessValue: (v) => v ? this.getContent(v.handle, { range }) : void 0 }).withStableType();
|
|
194
|
+
}
|
|
195
|
+
getLastLogs(res, lines, ctx) {
|
|
196
|
+
if (ctx == void 0) return _milaboratories_computable.Computable.make((ctx) => this.getLastLogs(res, lines, ctx));
|
|
197
|
+
const r = (0, _milaboratories_pl_tree.treeEntryToResourceInfo)(res, ctx);
|
|
198
|
+
const callerId = (0, node_crypto.randomUUID)();
|
|
199
|
+
ctx.addOnDestroy(() => this.releaseBlob(r, callerId));
|
|
200
|
+
const result = this.getLastLogsNoCtx(ctx.watcher, r, lines, callerId);
|
|
201
|
+
if (result == void 0) ctx.markUnstable("either a file was not downloaded or logs was not read");
|
|
202
|
+
return result;
|
|
203
|
+
}
|
|
204
|
+
getLastLogsNoCtx(w, rInfo, lines, callerId) {
|
|
205
|
+
validateDownloadableResourceType("getLastLogs", rInfo.type);
|
|
206
|
+
const blob = this.getDownloadedBlobNoCtx(w, rInfo, callerId);
|
|
207
|
+
if (blob == void 0) return void 0;
|
|
208
|
+
const { path } = require_download_local_handle.parseLocalHandle(blob.handle, this.signer);
|
|
209
|
+
let logGetter = this.idToLastLines.get(require_blob_key.blobKey(rInfo.id));
|
|
210
|
+
if (logGetter == void 0) {
|
|
211
|
+
const newLogGetter = new LastLinesGetter(path, lines);
|
|
212
|
+
this.idToLastLines.set(require_blob_key.blobKey(rInfo.id), newLogGetter);
|
|
213
|
+
logGetter = newLogGetter;
|
|
214
|
+
}
|
|
215
|
+
const result = logGetter.getOrSchedule(w);
|
|
216
|
+
if (result.error) throw result.error;
|
|
217
|
+
return result.log;
|
|
218
|
+
}
|
|
219
|
+
getProgressLog(res, patternToSearch, ctx) {
|
|
220
|
+
if (ctx == void 0) return _milaboratories_computable.Computable.make((ctx) => this.getProgressLog(res, patternToSearch, ctx));
|
|
221
|
+
const r = (0, _milaboratories_pl_tree.treeEntryToResourceInfo)(res, ctx);
|
|
222
|
+
const callerId = (0, node_crypto.randomUUID)();
|
|
223
|
+
ctx.addOnDestroy(() => this.releaseBlob(r, callerId));
|
|
224
|
+
const result = this.getProgressLogNoCtx(ctx.watcher, r, patternToSearch, callerId);
|
|
225
|
+
if (result === void 0) ctx.markUnstable("either a file was not downloaded or a progress log was not read");
|
|
226
|
+
return result;
|
|
227
|
+
}
|
|
228
|
+
getProgressLogNoCtx(w, rInfo, patternToSearch, callerId) {
|
|
229
|
+
validateDownloadableResourceType("getProgressLog", rInfo.type);
|
|
230
|
+
const blob = this.getDownloadedBlobNoCtx(w, rInfo, callerId);
|
|
231
|
+
if (blob == void 0) return void 0;
|
|
232
|
+
const { path } = require_download_local_handle.parseLocalHandle(blob.handle, this.signer);
|
|
233
|
+
let logGetter = this.idToProgressLog.get(require_blob_key.blobKey(rInfo.id));
|
|
234
|
+
if (logGetter == void 0) {
|
|
235
|
+
const newLogGetter = new LastLinesGetter(path, 1, patternToSearch);
|
|
236
|
+
this.idToProgressLog.set(require_blob_key.blobKey(rInfo.id), newLogGetter);
|
|
237
|
+
logGetter = newLogGetter;
|
|
238
|
+
}
|
|
239
|
+
const result = logGetter.getOrSchedule(w);
|
|
240
|
+
if (result.error) throw result.error;
|
|
241
|
+
return result.log;
|
|
242
|
+
}
|
|
243
|
+
getLogHandle(res, ctx) {
|
|
244
|
+
if (ctx == void 0) return _milaboratories_computable.Computable.make((ctx) => this.getLogHandle(res, ctx));
|
|
245
|
+
const r = (0, _milaboratories_pl_tree.treeEntryToResourceInfo)(res, ctx);
|
|
246
|
+
return this.getLogHandleNoCtx(r);
|
|
247
|
+
}
|
|
248
|
+
getLogHandleNoCtx(rInfo) {
|
|
249
|
+
validateDownloadableResourceType("getLogHandle", rInfo.type);
|
|
250
|
+
return require_logs_handle.newLogHandle(false, rInfo);
|
|
251
|
+
}
|
|
252
|
+
async lastLines(handle, lineCount, offsetBytes, searchStr) {
|
|
253
|
+
const resp = await this.clientLogs.lastLines(require_logs_handle.getResourceInfoFromLogHandle(handle), lineCount, BigInt(offsetBytes ?? 0), searchStr);
|
|
254
|
+
return {
|
|
255
|
+
live: false,
|
|
256
|
+
shouldUpdateHandle: false,
|
|
257
|
+
data: resp.data,
|
|
258
|
+
size: Number(resp.size),
|
|
259
|
+
newOffset: Number(resp.newOffset)
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
async readText(handle, lineCount, offsetBytes, searchStr) {
|
|
263
|
+
const resp = await this.clientLogs.readText(require_logs_handle.getResourceInfoFromLogHandle(handle), lineCount, BigInt(offsetBytes ?? 0), searchStr);
|
|
264
|
+
return {
|
|
265
|
+
live: false,
|
|
266
|
+
shouldUpdateHandle: false,
|
|
267
|
+
data: resp.data,
|
|
268
|
+
size: Number(resp.size),
|
|
269
|
+
newOffset: Number(resp.newOffset)
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
async releaseBlob(rInfo, callerId) {
|
|
273
|
+
const task = this.keyToDownload.get(require_blob_key.blobKey(rInfo.id));
|
|
274
|
+
if (task == void 0) return;
|
|
275
|
+
if (this.cache.existsFile(require_blob_key.blobKey(rInfo.id))) {
|
|
276
|
+
const toDelete = this.cache.removeFile(require_blob_key.blobKey(rInfo.id), callerId);
|
|
277
|
+
await Promise.all(toDelete.map(async (cachedFile) => {
|
|
278
|
+
await node_fs_promises.rm(cachedFile.path);
|
|
279
|
+
this.cache.removeCache(cachedFile);
|
|
280
|
+
this.removeTask((0, _milaboratories_ts_helpers.mapGet)(this.keyToDownload, require_blob_key.pathToKey(cachedFile.path)), `the task ${(0, _milaboratories_pl_client.stringifyWithResourceId)(cachedFile)} was removedfrom cache along with ${(0, _milaboratories_pl_client.stringifyWithResourceId)(toDelete.map((d) => d.path))}`);
|
|
281
|
+
}));
|
|
282
|
+
} else if (task.counter.dec(callerId)) this.removeTask(task, `the task ${(0, _milaboratories_pl_client.stringifyWithResourceId)(task.info())} was removed from cache`);
|
|
283
|
+
}
|
|
284
|
+
removeTask(task, reason) {
|
|
285
|
+
task.abort(reason);
|
|
286
|
+
task.change.markChanged(`download task for ${task.path} removed: ${reason}`);
|
|
287
|
+
this.keyToDownload.delete(require_blob_key.pathToKey(task.path));
|
|
288
|
+
this.idToLastLines.delete(require_blob_key.blobKey(task.rInfo.id));
|
|
289
|
+
this.idToProgressLog.delete(require_blob_key.blobKey(task.rInfo.id));
|
|
290
|
+
}
|
|
291
|
+
async releaseOnDemandBlob(blobId, callerId) {
|
|
292
|
+
if (this.keyToOnDemand.get(require_blob_key.blobKey(blobId))?.release(callerId) ?? false) this.keyToOnDemand.delete(require_blob_key.blobKey(blobId));
|
|
293
|
+
}
|
|
294
|
+
/** Removes all files from a hard drive. */
|
|
295
|
+
async releaseAll() {
|
|
296
|
+
this.downloadQueue.stop();
|
|
297
|
+
this.keyToDownload.forEach((task, key) => {
|
|
298
|
+
this.keyToDownload.delete(key);
|
|
299
|
+
task.change.markChanged(`task ${(0, _milaboratories_pl_client.resourceIdToString)(task.rInfo.id)} released`);
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
async dispose() {
|
|
303
|
+
await this.rangesCache.dispose();
|
|
304
|
+
}
|
|
305
|
+
async [Symbol.asyncDispose]() {
|
|
306
|
+
await this.dispose();
|
|
307
|
+
}
|
|
308
|
+
};
|
|
378
309
|
/** Keeps a counter to the on demand handle. */
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
}
|
|
434
|
-
throw e;
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
}
|
|
310
|
+
var OnDemandBlobHolder = class {
|
|
311
|
+
counter = new _milaboratories_ts_helpers.CallersCounter();
|
|
312
|
+
constructor(size, handle) {
|
|
313
|
+
this.size = size;
|
|
314
|
+
this.handle = handle;
|
|
315
|
+
}
|
|
316
|
+
getHandle() {
|
|
317
|
+
return {
|
|
318
|
+
handle: this.handle,
|
|
319
|
+
size: this.size
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
attach(callerId) {
|
|
323
|
+
this.counter.inc(callerId);
|
|
324
|
+
}
|
|
325
|
+
release(callerId) {
|
|
326
|
+
return this.counter.dec(callerId);
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
var LastLinesGetter = class {
|
|
330
|
+
updater;
|
|
331
|
+
log;
|
|
332
|
+
change = new _milaboratories_computable.ChangeSource();
|
|
333
|
+
error = void 0;
|
|
334
|
+
constructor(path, lines, patternToSearch) {
|
|
335
|
+
this.path = path;
|
|
336
|
+
this.lines = lines;
|
|
337
|
+
this.patternToSearch = patternToSearch;
|
|
338
|
+
this.updater = new require_helpers.Updater(async () => this.update());
|
|
339
|
+
}
|
|
340
|
+
getOrSchedule(w) {
|
|
341
|
+
this.change.attachWatcher(w);
|
|
342
|
+
this.updater.schedule();
|
|
343
|
+
return {
|
|
344
|
+
log: this.log,
|
|
345
|
+
error: this.error
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
async update() {
|
|
349
|
+
try {
|
|
350
|
+
const newLogs = await getLastLines(this.path, this.lines, this.patternToSearch);
|
|
351
|
+
if (this.log != newLogs) this.change.markChanged(`logs for ${this.path} updated`);
|
|
352
|
+
this.log = newLogs;
|
|
353
|
+
} catch (e) {
|
|
354
|
+
if ((0, _milaboratories_pl_client.isNotFoundError)(e)) {
|
|
355
|
+
this.log = "";
|
|
356
|
+
this.error = e;
|
|
357
|
+
this.change.markChanged(`log update for ${this.path} failed, resource not found`);
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
throw e;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
};
|
|
438
364
|
/** Gets last lines from a file by reading the file from the top and keeping
|
|
439
|
-
|
|
365
|
+
* last N lines in a window queue. */
|
|
440
366
|
async function getLastLines(fPath, nLines, patternToSearch) {
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
try {
|
|
469
|
-
if (inStream && !inStream.destroyed) {
|
|
470
|
-
inStream.destroy();
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
catch (cleanupError) {
|
|
474
|
-
console.error("Error destroying read stream:", cleanupError);
|
|
475
|
-
}
|
|
476
|
-
}
|
|
367
|
+
let inStream;
|
|
368
|
+
let rl;
|
|
369
|
+
try {
|
|
370
|
+
inStream = fs.createReadStream(fPath);
|
|
371
|
+
rl = node_readline_promises.createInterface({
|
|
372
|
+
input: inStream,
|
|
373
|
+
crlfDelay: Infinity
|
|
374
|
+
});
|
|
375
|
+
const lines = new denque.default();
|
|
376
|
+
for await (const line of rl) {
|
|
377
|
+
if (patternToSearch != void 0 && !line.includes(patternToSearch)) continue;
|
|
378
|
+
lines.push(line);
|
|
379
|
+
if (lines.length > nLines) lines.shift();
|
|
380
|
+
}
|
|
381
|
+
return lines.toArray().join(node_os.EOL) + node_os.EOL;
|
|
382
|
+
} finally {
|
|
383
|
+
try {
|
|
384
|
+
if (rl) rl.close();
|
|
385
|
+
} catch (cleanupError) {
|
|
386
|
+
console.error("Error closing readline interface:", cleanupError);
|
|
387
|
+
}
|
|
388
|
+
try {
|
|
389
|
+
if (inStream && !inStream.destroyed) inStream.destroy();
|
|
390
|
+
} catch (cleanupError) {
|
|
391
|
+
console.error("Error destroying read stream:", cleanupError);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
477
394
|
}
|
|
478
395
|
function validateDownloadableResourceType(methodName, rType) {
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
}
|
|
396
|
+
if (!rType.name.startsWith("Blob/")) {
|
|
397
|
+
let message = `${methodName}: wrong resource type: ${rType.name}, expected: a resource of type that starts with 'Blob/'.`;
|
|
398
|
+
if (rType.name == "Blob") message += ` If it's called from workflow, should a file be exported with 'file.exportFile' function?`;
|
|
399
|
+
throw new require_helpers.WrongResourceTypeError(message);
|
|
400
|
+
}
|
|
485
401
|
}
|
|
486
402
|
|
|
403
|
+
//#endregion
|
|
487
404
|
exports.DownloadDriver = DownloadDriver;
|
|
488
|
-
//# sourceMappingURL=download_blob.cjs.map
|
|
405
|
+
//# sourceMappingURL=download_blob.cjs.map
|