@milaboratories/pl-drivers 1.11.19 → 1.11.21
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/clients/constructors.cjs +5 -5
- package/dist/clients/constructors.cjs.map +1 -1
- package/dist/clients/constructors.js +5 -5
- package/dist/clients/constructors.js.map +1 -1
- package/dist/clients/download.cjs +29 -5
- package/dist/clients/download.cjs.map +1 -1
- package/dist/clients/download.d.ts +5 -4
- package/dist/clients/download.d.ts.map +1 -1
- package/dist/clients/download.js +30 -6
- package/dist/clients/download.js.map +1 -1
- package/dist/clients/logs.cjs +57 -16
- package/dist/clients/logs.cjs.map +1 -1
- package/dist/clients/logs.d.ts +6 -5
- package/dist/clients/logs.d.ts.map +1 -1
- package/dist/clients/logs.js +58 -17
- package/dist/clients/logs.js.map +1 -1
- package/dist/clients/ls_api.cjs +44 -8
- package/dist/clients/ls_api.cjs.map +1 -1
- package/dist/clients/ls_api.d.ts +4 -4
- package/dist/clients/ls_api.d.ts.map +1 -1
- package/dist/clients/ls_api.js +45 -9
- package/dist/clients/ls_api.js.map +1 -1
- package/dist/clients/progress.cjs +32 -29
- package/dist/clients/progress.cjs.map +1 -1
- package/dist/clients/progress.d.ts +5 -5
- package/dist/clients/progress.d.ts.map +1 -1
- package/dist/clients/progress.js +33 -30
- package/dist/clients/progress.js.map +1 -1
- package/dist/clients/upload.cjs +96 -30
- package/dist/clients/upload.cjs.map +1 -1
- package/dist/clients/upload.d.ts +8 -11
- package/dist/clients/upload.d.ts.map +1 -1
- package/dist/clients/upload.js +97 -31
- package/dist/clients/upload.js.map +1 -1
- package/dist/drivers/download_blob/download_blob.cjs +2 -2
- package/dist/drivers/download_blob/download_blob.cjs.map +1 -1
- package/dist/drivers/download_blob/download_blob.js +1 -1
- package/dist/drivers/download_blob/download_blob.js.map +1 -1
- package/dist/drivers/download_blob/download_blob_task.cjs +5 -5
- package/dist/drivers/download_blob/download_blob_task.cjs.map +1 -1
- package/dist/drivers/download_blob/download_blob_task.js +2 -2
- package/dist/drivers/download_blob/download_blob_task.js.map +1 -1
- package/dist/drivers/download_blob_url/task.cjs +5 -5
- package/dist/drivers/download_blob_url/task.cjs.map +1 -1
- package/dist/drivers/download_blob_url/task.js +2 -2
- package/dist/drivers/download_blob_url/task.js.map +1 -1
- package/dist/drivers/download_url/task.cjs +2 -2
- package/dist/drivers/download_url/task.cjs.map +1 -1
- package/dist/drivers/download_url/task.js +2 -2
- package/dist/drivers/download_url/task.js.map +1 -1
- package/dist/drivers/logs_stream.cjs.map +1 -1
- package/dist/drivers/logs_stream.js.map +1 -1
- package/dist/helpers/download.cjs +5 -24
- package/dist/helpers/download.cjs.map +1 -1
- package/dist/helpers/download.d.ts +0 -13
- package/dist/helpers/download.d.ts.map +1 -1
- package/dist/helpers/download.js +5 -21
- package/dist/helpers/download.js.map +1 -1
- package/dist/helpers/download_errors.cjs +43 -0
- package/dist/helpers/download_errors.cjs.map +1 -0
- package/dist/helpers/download_errors.d.ts +23 -0
- package/dist/helpers/download_errors.d.ts.map +1 -0
- package/dist/helpers/download_errors.js +36 -0
- package/dist/helpers/download_errors.js.map +1 -0
- package/dist/index.cjs +7 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.cjs +2 -2
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.cjs.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.cjs.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.d.ts.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.js.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.d.ts.map +1 -0
- package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.js +2 -2
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.js.map +1 -0
- package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.cjs +2 -2
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.cjs.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.cjs.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.d.ts.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.js.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.d.ts.map +1 -0
- package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.js +2 -2
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.js.map +1 -0
- package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.cjs +3 -3
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.cjs.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.cjs.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.d.ts.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.js.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.d.ts.map +1 -0
- package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.js +3 -3
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.js.map +1 -0
- package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.cjs +6 -6
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.cjs.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.cjs.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.d.ts.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.js.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.d.ts.map +1 -0
- package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.js +6 -6
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.js.map +1 -0
- package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.cjs +84 -84
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.cjs.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.client.cjs.map +1 -0
- package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.client.d.ts +16 -16
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.client.d.ts.map +1 -0
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.client.js.map +1 -0
- package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.d.ts +118 -118
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.d.ts.map +1 -0
- package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.js +76 -76
- package/dist/proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.js.map +1 -0
- package/dist/proto-grpc/google/api/http.d.ts.map +1 -0
- package/dist/{proto → proto-grpc}/google/protobuf/descriptor.d.ts +5 -149
- package/dist/proto-grpc/google/protobuf/descriptor.d.ts.map +1 -0
- package/dist/proto-grpc/google/protobuf/duration.cjs.map +1 -0
- package/dist/proto-grpc/google/protobuf/duration.d.ts.map +1 -0
- package/dist/proto-grpc/google/protobuf/duration.js.map +1 -0
- package/dist/proto-grpc/google/protobuf/timestamp.cjs.map +1 -0
- package/dist/proto-grpc/google/protobuf/timestamp.d.ts.map +1 -0
- package/dist/proto-grpc/google/protobuf/timestamp.js.map +1 -0
- package/dist/proto-rest/downloadapi.d.ts +105 -0
- package/dist/proto-rest/downloadapi.d.ts.map +1 -0
- package/dist/proto-rest/index.d.ts +17 -0
- package/dist/proto-rest/index.d.ts.map +1 -0
- package/dist/proto-rest/lsapi.d.ts +148 -0
- package/dist/proto-rest/lsapi.d.ts.map +1 -0
- package/dist/proto-rest/progressapi.d.ts +159 -0
- package/dist/proto-rest/progressapi.d.ts.map +1 -0
- package/dist/proto-rest/streamingapi.d.ts +469 -0
- package/dist/proto-rest/streamingapi.d.ts.map +1 -0
- package/dist/proto-rest/uploadapi.d.ts +355 -0
- package/dist/proto-rest/uploadapi.d.ts.map +1 -0
- package/package.json +12 -8
- package/src/clients/constructors.ts +11 -11
- package/src/clients/download.ts +34 -11
- package/src/clients/logs.ts +69 -21
- package/src/clients/ls_api.ts +58 -14
- package/src/clients/progress.ts +41 -44
- package/src/clients/upload.ts +117 -53
- package/src/drivers/download_blob/download_blob.ts +1 -1
- package/src/drivers/download_blob/download_blob_task.ts +2 -2
- package/src/drivers/download_blob_url/task.ts +2 -2
- package/src/drivers/download_url/task.ts +2 -2
- package/src/drivers/logs_stream.ts +1 -1
- package/src/drivers/upload.test.ts +6 -25
- package/src/helpers/download.ts +4 -26
- package/src/helpers/download_errors.ts +40 -0
- package/src/index.ts +1 -0
- package/src/{proto → proto-grpc}/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.ts +1 -1
- package/src/{proto → proto-grpc}/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.ts +2 -2
- package/src/{proto → proto-grpc}/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.ts +1 -1
- package/src/{proto → proto-grpc}/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.ts +2 -2
- package/src/{proto → proto-grpc}/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.ts +1 -1
- package/src/{proto → proto-grpc}/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.ts +3 -3
- package/src/{proto → proto-grpc}/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.ts +1 -1
- package/src/{proto → proto-grpc}/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.ts +6 -6
- package/src/{proto → proto-grpc}/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.client.ts +21 -21
- package/src/{proto → proto-grpc}/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.ts +159 -159
- package/src/{proto → proto-grpc}/google/api/http.ts +1 -1
- package/src/{proto → proto-grpc}/google/protobuf/descriptor.ts +9 -217
- package/src/{proto → proto-grpc}/google/protobuf/duration.ts +1 -1
- package/src/{proto → proto-grpc}/google/protobuf/timestamp.ts +1 -1
- package/src/proto-rest/downloadapi.ts +105 -0
- package/src/proto-rest/index.ts +28 -0
- package/src/proto-rest/lsapi.ts +148 -0
- package/src/proto-rest/progressapi.ts +159 -0
- package/src/proto-rest/streamingapi.ts +469 -0
- package/src/proto-rest/uploadapi.ts +355 -0
- package/dist/proto/github.com/googleapis/googleapis/google/rpc/status.d.ts +0 -53
- package/dist/proto/github.com/googleapis/googleapis/google/rpc/status.d.ts.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.cjs.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.cjs.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.d.ts.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.js.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.d.ts.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.js.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.cjs.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.cjs.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.d.ts.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.js.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.d.ts.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.js.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.cjs.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.cjs.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.d.ts.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.js.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.d.ts.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.js.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.cjs.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.cjs.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.d.ts.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.js.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.d.ts.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.js.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.cjs.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.client.cjs.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.client.d.ts.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.client.js.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.d.ts.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.js.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.client.d.ts +0 -329
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.client.d.ts.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.d.ts +0 -5358
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api.d.ts.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api_types.d.ts +0 -537
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/api_types.d.ts.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/base_types.d.ts +0 -87
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/base_types.d.ts.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/import.d.ts +0 -106
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/import.d.ts.map +0 -1
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/resource_types.d.ts +0 -256
- package/dist/proto/github.com/milaboratory/pl/plapi/plapiproto/resource_types.d.ts.map +0 -1
- package/dist/proto/google/api/http.d.ts.map +0 -1
- package/dist/proto/google/protobuf/any.d.ts +0 -181
- package/dist/proto/google/protobuf/any.d.ts.map +0 -1
- package/dist/proto/google/protobuf/descriptor.d.ts.map +0 -1
- package/dist/proto/google/protobuf/duration.cjs.map +0 -1
- package/dist/proto/google/protobuf/duration.d.ts.map +0 -1
- package/dist/proto/google/protobuf/duration.js.map +0 -1
- package/dist/proto/google/protobuf/empty.d.ts +0 -32
- package/dist/proto/google/protobuf/empty.d.ts.map +0 -1
- package/dist/proto/google/protobuf/struct.d.ts +0 -187
- package/dist/proto/google/protobuf/struct.d.ts.map +0 -1
- package/dist/proto/google/protobuf/timestamp.cjs.map +0 -1
- package/dist/proto/google/protobuf/timestamp.d.ts.map +0 -1
- package/dist/proto/google/protobuf/timestamp.js.map +0 -1
- package/dist/proto/google/protobuf/wrappers.d.ts +0 -335
- package/dist/proto/google/protobuf/wrappers.d.ts.map +0 -1
- package/src/proto/github.com/googleapis/googleapis/google/rpc/status.ts +0 -125
- package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/api.client.ts +0 -406
- package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/api.ts +0 -14986
- package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/api_types.ts +0 -1474
- package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/base_types.ts +0 -181
- package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/import.ts +0 -251
- package/src/proto/github.com/milaboratory/pl/plapi/plapiproto/resource_types.ts +0 -693
- package/src/proto/google/protobuf/any.ts +0 -326
- package/src/proto/google/protobuf/empty.ts +0 -94
- package/src/proto/google/protobuf/struct.ts +0 -484
- package/src/proto/google/protobuf/wrappers.ts +0 -785
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.cjs +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.d.ts +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.client.js +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/controllers/shared/grpc/downloadapi/protocol.d.ts +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.cjs +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.d.ts +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client.js +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.d.ts +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.cjs +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.d.ts +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client.js +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.d.ts +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.cjs +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.d.ts +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client.js +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.d.ts +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.client.cjs +0 -0
- /package/dist/{proto → proto-grpc}/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.client.js +0 -0
- /package/dist/{proto → proto-grpc}/google/api/http.d.ts +0 -0
- /package/dist/{proto → proto-grpc}/google/protobuf/duration.cjs +0 -0
- /package/dist/{proto → proto-grpc}/google/protobuf/duration.d.ts +0 -0
- /package/dist/{proto → proto-grpc}/google/protobuf/duration.js +0 -0
- /package/dist/{proto → proto-grpc}/google/protobuf/timestamp.cjs +0 -0
- /package/dist/{proto → proto-grpc}/google/protobuf/timestamp.d.ts +0 -0
- /package/dist/{proto → proto-grpc}/google/protobuf/timestamp.js +0 -0
package/src/clients/logs.ts
CHANGED
|
@@ -1,22 +1,35 @@
|
|
|
1
|
-
import { StreamingClient } from '../proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client';
|
|
2
1
|
import type { RpcOptions } from '@protobuf-ts/runtime-rpc';
|
|
3
2
|
import type { MiLogger } from '@milaboratories/ts-helpers';
|
|
4
3
|
import { notEmpty } from '@milaboratories/ts-helpers';
|
|
5
4
|
import type { Dispatcher } from 'undici';
|
|
6
|
-
import type {
|
|
7
|
-
import { addRTypeToMetadata } from '@milaboratories/pl-client';
|
|
8
|
-
import type { StreamingAPI_Response } from '../proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol';
|
|
5
|
+
import type { WireClientProvider, WireClientProviderFactory } from '@milaboratories/pl-client';
|
|
6
|
+
import { addRTypeToMetadata, createRTypeRoutingHeader, RestAPI } from '@milaboratories/pl-client';
|
|
7
|
+
import type { StreamingAPI_Response } from '../proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol';
|
|
8
|
+
import { StreamingClient } from '../proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol.client';
|
|
9
|
+
import type { StreamingApiPaths, StreamingRestClientType } from '../proto-rest';
|
|
9
10
|
import type { ResourceInfo } from '@milaboratories/pl-tree';
|
|
10
11
|
|
|
11
12
|
export class ClientLogs {
|
|
12
|
-
public readonly
|
|
13
|
+
public readonly wire: WireClientProvider<StreamingRestClientType | StreamingClient>;
|
|
13
14
|
|
|
14
15
|
constructor(
|
|
15
|
-
|
|
16
|
+
wireClientProviderFactory: WireClientProviderFactory,
|
|
16
17
|
public readonly httpClient: Dispatcher,
|
|
17
18
|
public readonly logger: MiLogger,
|
|
18
19
|
) {
|
|
19
|
-
this.
|
|
20
|
+
this.wire = wireClientProviderFactory.createWireClientProvider(
|
|
21
|
+
(wire) => {
|
|
22
|
+
if (wire.type === 'grpc') {
|
|
23
|
+
return new StreamingClient(wire.Transport);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return RestAPI.createClient<StreamingApiPaths>({
|
|
27
|
+
hostAndPort: wire.Config.hostAndPort,
|
|
28
|
+
ssl: wire.Config.ssl,
|
|
29
|
+
dispatcher: wire.Dispatcher,
|
|
30
|
+
middlewares: wire.Middlewares,
|
|
31
|
+
});
|
|
32
|
+
});
|
|
20
33
|
}
|
|
21
34
|
|
|
22
35
|
close() {}
|
|
@@ -31,17 +44,32 @@ export class ClientLogs {
|
|
|
31
44
|
searchStr?: string,
|
|
32
45
|
options?: RpcOptions,
|
|
33
46
|
): Promise<StreamingAPI_Response> {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
lineCount: lineCount,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
47
|
+
const client = this.wire.get();
|
|
48
|
+
if (client instanceof StreamingClient) {
|
|
49
|
+
return (
|
|
50
|
+
await client.lastLines(
|
|
51
|
+
{ resourceId: rId, lineCount: lineCount, offset: offsetBytes, search: searchStr },
|
|
52
|
+
addRTypeToMetadata(rType, options),
|
|
53
|
+
)
|
|
54
|
+
).response;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const resp = (await client.POST('/v1/last-lines', {
|
|
58
|
+
body: {
|
|
59
|
+
resourceId: rId.toString(),
|
|
60
|
+
lineCount: lineCount,
|
|
61
|
+
offset: offsetBytes.toString(),
|
|
62
|
+
search: searchStr ?? '',
|
|
63
|
+
searchRe: '',
|
|
64
|
+
},
|
|
65
|
+
headers: { ...createRTypeRoutingHeader(rType) },
|
|
66
|
+
})).data!;
|
|
67
|
+
|
|
68
|
+
return {
|
|
69
|
+
data: new Uint8Array(Buffer.from(resp.data)),
|
|
70
|
+
size: BigInt(resp.size),
|
|
71
|
+
newOffset: BigInt(resp.newOffset),
|
|
72
|
+
};
|
|
45
73
|
}
|
|
46
74
|
|
|
47
75
|
/** Reads the file forward and returns the text,
|
|
@@ -54,8 +82,10 @@ export class ClientLogs {
|
|
|
54
82
|
searchStr?: string,
|
|
55
83
|
options?: RpcOptions,
|
|
56
84
|
): Promise<StreamingAPI_Response> {
|
|
57
|
-
|
|
58
|
-
|
|
85
|
+
const client = this.wire.get();
|
|
86
|
+
|
|
87
|
+
if (client instanceof StreamingClient) {
|
|
88
|
+
return (await client.readText(
|
|
59
89
|
{
|
|
60
90
|
resourceId: notEmpty(rId),
|
|
61
91
|
readLimit: BigInt(lineCount),
|
|
@@ -64,6 +94,24 @@ export class ClientLogs {
|
|
|
64
94
|
},
|
|
65
95
|
addRTypeToMetadata(rType, options),
|
|
66
96
|
)
|
|
67
|
-
|
|
97
|
+
).response;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const resp = (await client.POST('/v1/read/text', {
|
|
101
|
+
body: {
|
|
102
|
+
resourceId: rId.toString(),
|
|
103
|
+
readLimit: lineCount.toString(),
|
|
104
|
+
offset: offsetBytes.toString(),
|
|
105
|
+
search: searchStr ?? '',
|
|
106
|
+
searchRe: '',
|
|
107
|
+
},
|
|
108
|
+
headers: { ...createRTypeRoutingHeader(rType) },
|
|
109
|
+
})).data!;
|
|
110
|
+
|
|
111
|
+
return {
|
|
112
|
+
data: new Uint8Array(Buffer.from(resp.data)),
|
|
113
|
+
size: BigInt(resp.size),
|
|
114
|
+
newOffset: BigInt(resp.newOffset),
|
|
115
|
+
};
|
|
68
116
|
}
|
|
69
117
|
}
|
package/src/clients/ls_api.ts
CHANGED
|
@@ -1,19 +1,35 @@
|
|
|
1
1
|
import type { MiLogger } from '@milaboratories/ts-helpers';
|
|
2
|
-
import type { LsAPI_List_Response } from '../proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol';
|
|
3
|
-
import { LSClient } from '../proto/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client';
|
|
4
2
|
import type { RpcOptions } from '@protobuf-ts/runtime-rpc';
|
|
5
|
-
import type {
|
|
6
|
-
import {
|
|
3
|
+
import type { WireClientProvider, WireClientProviderFactory } from '@milaboratories/pl-client';
|
|
4
|
+
import { RestAPI } from '@milaboratories/pl-client';
|
|
5
|
+
import { addRTypeToMetadata, createRTypeRoutingHeader } from '@milaboratories/pl-client';
|
|
6
|
+
import type { LsAPI_List_Response, LsAPI_ListItem } from '../proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol';
|
|
7
|
+
import { LSClient } from '../proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/lsapi/protocol.client';
|
|
8
|
+
import type { LsApiPaths, LsRestClientType } from '../proto-rest';
|
|
9
|
+
|
|
7
10
|
import type { ResourceInfo } from '@milaboratories/pl-tree';
|
|
8
11
|
|
|
9
12
|
export class ClientLs {
|
|
10
|
-
private readonly
|
|
13
|
+
private readonly wire: WireClientProvider<LsRestClientType | LSClient>;
|
|
11
14
|
|
|
12
15
|
constructor(
|
|
13
|
-
|
|
16
|
+
wireClientProviderFactory: WireClientProviderFactory,
|
|
14
17
|
private readonly logger: MiLogger,
|
|
15
18
|
) {
|
|
16
|
-
this.
|
|
19
|
+
this.wire = wireClientProviderFactory.createWireClientProvider(
|
|
20
|
+
(wire) => {
|
|
21
|
+
if (wire.type === 'grpc') {
|
|
22
|
+
return new LSClient(wire.Transport);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return RestAPI.createClient<LsApiPaths>({
|
|
26
|
+
hostAndPort: wire.Config.hostAndPort,
|
|
27
|
+
ssl: wire.Config.ssl,
|
|
28
|
+
dispatcher: wire.Dispatcher,
|
|
29
|
+
middlewares: wire.Middlewares,
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
);
|
|
17
33
|
}
|
|
18
34
|
|
|
19
35
|
close() {}
|
|
@@ -23,12 +39,40 @@ export class ClientLs {
|
|
|
23
39
|
path: string,
|
|
24
40
|
options?: RpcOptions,
|
|
25
41
|
): Promise<LsAPI_List_Response> {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
42
|
+
const client = this.wire.get();
|
|
43
|
+
|
|
44
|
+
if (client instanceof LSClient) {
|
|
45
|
+
return await client.list(
|
|
46
|
+
{
|
|
47
|
+
resourceId: rInfo.id,
|
|
48
|
+
location: path,
|
|
49
|
+
},
|
|
50
|
+
addRTypeToMetadata(rInfo.type, options),
|
|
51
|
+
).response;
|
|
52
|
+
} else {
|
|
53
|
+
const resp = (await client.POST('/v1/list', {
|
|
54
|
+
body: {
|
|
55
|
+
resourceId: rInfo.id.toString(),
|
|
56
|
+
location: path,
|
|
57
|
+
},
|
|
58
|
+
headers: { ...createRTypeRoutingHeader(rInfo.type) },
|
|
59
|
+
})).data!;
|
|
60
|
+
|
|
61
|
+
const items: LsAPI_ListItem[] = resp.items.map((item) => ({
|
|
62
|
+
name: item.name,
|
|
63
|
+
size: BigInt(item.size),
|
|
64
|
+
isDir: item.isDir,
|
|
65
|
+
fullName: item.fullName,
|
|
66
|
+
directory: item.directory,
|
|
67
|
+
// TODO: check we get value in a correct way here
|
|
68
|
+
lastModified: { seconds: BigInt(item.lastModified), nanos: 0 },
|
|
69
|
+
version: item.version,
|
|
70
|
+
}));
|
|
71
|
+
|
|
72
|
+
return {
|
|
73
|
+
items,
|
|
74
|
+
delimiter: resp.delimiter,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
33
77
|
}
|
|
34
78
|
}
|
package/src/clients/progress.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { ProgressClient } from '../proto/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client';
|
|
2
1
|
import type { RpcOptions } from '@protobuf-ts/runtime-rpc';
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import { addRTypeToMetadata } from '@milaboratories/pl-client';
|
|
2
|
+
import type { WireClientProvider, WireClientProviderFactory, PlClient } from '@milaboratories/pl-client';
|
|
3
|
+
import { addRTypeToMetadata, createRTypeRoutingHeader, RestAPI } from '@milaboratories/pl-client';
|
|
6
4
|
import type { MiLogger } from '@milaboratories/ts-helpers';
|
|
7
5
|
import { notEmpty } from '@milaboratories/ts-helpers';
|
|
8
6
|
import type { Dispatcher } from 'undici';
|
|
7
|
+
import { ProgressClient } from '../proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol.client';
|
|
8
|
+
import type { ProgressAPI_Report } from '../proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/progressapi/protocol';
|
|
9
|
+
import type { ProgressApiPaths, ProgressRestClientType } from '../proto-rest';
|
|
9
10
|
import type { ResourceInfo } from '@milaboratories/pl-tree';
|
|
10
11
|
|
|
11
12
|
export type ProgressStatus = {
|
|
@@ -20,27 +21,55 @@ export type ProgressStatus = {
|
|
|
20
21
|
// When blobs are transfered, one can got a status of transfering
|
|
21
22
|
// using this API.
|
|
22
23
|
export class ClientProgress {
|
|
23
|
-
public readonly
|
|
24
|
+
public readonly wire: WireClientProvider<ProgressRestClientType | ProgressClient>;
|
|
24
25
|
|
|
25
26
|
constructor(
|
|
26
|
-
|
|
27
|
+
wireClientProviderFactory: WireClientProviderFactory,
|
|
27
28
|
_: Dispatcher,
|
|
28
29
|
public readonly client: PlClient,
|
|
29
30
|
public readonly logger: MiLogger,
|
|
30
31
|
) {
|
|
31
|
-
this.
|
|
32
|
+
this.wire = wireClientProviderFactory.createWireClientProvider(
|
|
33
|
+
(wire) => {
|
|
34
|
+
if (wire.type === 'grpc') {
|
|
35
|
+
return new ProgressClient(wire.Transport);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return RestAPI.createClient<ProgressApiPaths>({
|
|
39
|
+
hostAndPort: wire.Config.hostAndPort,
|
|
40
|
+
ssl: wire.Config.ssl,
|
|
41
|
+
dispatcher: wire.Dispatcher,
|
|
42
|
+
middlewares: wire.Middlewares,
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
);
|
|
32
46
|
}
|
|
33
47
|
|
|
34
48
|
close() {}
|
|
35
49
|
|
|
36
50
|
/** getStatus gets a progress status by given rId and rType. */
|
|
37
51
|
async getStatus({ id, type }: ResourceInfo, options?: RpcOptions): Promise<ProgressStatus> {
|
|
38
|
-
const
|
|
39
|
-
{ resourceId: id },
|
|
40
|
-
addRTypeToMetadata(type, options),
|
|
41
|
-
);
|
|
52
|
+
const client = this.wire.get();
|
|
42
53
|
|
|
43
|
-
|
|
54
|
+
let report: ProgressAPI_Report;
|
|
55
|
+
if (client instanceof ProgressClient) {
|
|
56
|
+
report = notEmpty((await client.getStatus(
|
|
57
|
+
{ resourceId: id },
|
|
58
|
+
addRTypeToMetadata(type, options),
|
|
59
|
+
).response).report);
|
|
60
|
+
} else {
|
|
61
|
+
const resp = (await client.POST('/v1/get-progress', {
|
|
62
|
+
body: { resourceId: id.toString() },
|
|
63
|
+
headers: { ...createRTypeRoutingHeader(type) },
|
|
64
|
+
})).data!.report;
|
|
65
|
+
report = {
|
|
66
|
+
done: resp.done,
|
|
67
|
+
progress: resp.progress,
|
|
68
|
+
bytesProcessed: BigInt(resp.bytesProcessed),
|
|
69
|
+
bytesTotal: BigInt(resp.bytesTotal),
|
|
70
|
+
name: resp.name,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
44
73
|
|
|
45
74
|
return {
|
|
46
75
|
done: report.done,
|
|
@@ -49,36 +78,4 @@ export class ClientProgress {
|
|
|
49
78
|
bytesTotal: String(report.bytesTotal),
|
|
50
79
|
};
|
|
51
80
|
}
|
|
52
|
-
|
|
53
|
-
// realtimeStatus returns a async generator that takes statuses from
|
|
54
|
-
// GRPC stream every updateIntervalMs milliseconds.
|
|
55
|
-
async *realtimeStatus(
|
|
56
|
-
{ id, type }: ResourceInfo,
|
|
57
|
-
updateIntervalMs: number = 100,
|
|
58
|
-
options?: RpcOptions,
|
|
59
|
-
) {
|
|
60
|
-
options = addRTypeToMetadata(type, options);
|
|
61
|
-
|
|
62
|
-
const secs = Math.floor(updateIntervalMs / 1000);
|
|
63
|
-
const nanos = (updateIntervalMs - secs * 1000) * 1000000;
|
|
64
|
-
const updateInterval = Duration.create({
|
|
65
|
-
seconds: BigInt(secs),
|
|
66
|
-
nanos: nanos,
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
try {
|
|
70
|
-
const { responses } = this.grpcClient.get().realtimeStatus(
|
|
71
|
-
{
|
|
72
|
-
resourceId: id,
|
|
73
|
-
updateInterval: updateInterval,
|
|
74
|
-
},
|
|
75
|
-
options,
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
yield * responses;
|
|
79
|
-
} catch (e) {
|
|
80
|
-
this.logger.warn('Failed to get realtime status' + String(e));
|
|
81
|
-
throw e;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
81
|
}
|
package/src/clients/upload.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import { addRTypeToMetadata } from '@milaboratories/pl-client';
|
|
1
|
+
import type { WireClientProvider, WireClientProviderFactory, PlClient } from '@milaboratories/pl-client';
|
|
2
|
+
import { addRTypeToMetadata, createRTypeRoutingHeader, RestAPI } from '@milaboratories/pl-client';
|
|
3
3
|
import type { ResourceInfo } from '@milaboratories/pl-tree';
|
|
4
4
|
import type { MiLogger } from '@milaboratories/ts-helpers';
|
|
5
5
|
import type { RpcOptions } from '@protobuf-ts/runtime-rpc';
|
|
6
6
|
import * as fs from 'node:fs/promises';
|
|
7
7
|
import type { Dispatcher } from 'undici';
|
|
8
8
|
import { request } from 'undici';
|
|
9
|
-
import {
|
|
10
|
-
import { UploadClient } from '../proto/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.client';
|
|
9
|
+
import { UploadAPI_ChecksumAlgorithm, type UploadAPI_GetPartURL_Response } from '../proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol';
|
|
10
|
+
import { UploadClient } from '../proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/uploadapi/protocol.client';
|
|
11
|
+
import type { UploadApiPaths, UploadRestClientType } from '../proto-rest';
|
|
11
12
|
import { crc32c } from './crc32c';
|
|
12
13
|
|
|
13
14
|
import type { IncomingHttpHeaders } from 'undici/types/header';
|
|
@@ -37,15 +38,28 @@ export class BadRequestError extends Error {
|
|
|
37
38
|
* The user should pass here a concrete BlobUpload/<storageId> resource,
|
|
38
39
|
* it can be got from handle field of BlobUpload. */
|
|
39
40
|
export class ClientUpload {
|
|
40
|
-
private readonly
|
|
41
|
+
private readonly wire: WireClientProvider<UploadRestClientType | UploadClient>;
|
|
41
42
|
|
|
42
43
|
constructor(
|
|
43
|
-
|
|
44
|
+
wireClientProviderFactory: WireClientProviderFactory,
|
|
44
45
|
public readonly httpClient: Dispatcher,
|
|
45
46
|
_: PlClient,
|
|
46
47
|
public readonly logger: MiLogger,
|
|
47
48
|
) {
|
|
48
|
-
this.
|
|
49
|
+
this.wire = wireClientProviderFactory.createWireClientProvider(
|
|
50
|
+
(wire) => {
|
|
51
|
+
if (wire.type === 'grpc') {
|
|
52
|
+
return new UploadClient(wire.Transport);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return RestAPI.createClient<UploadApiPaths>({
|
|
56
|
+
hostAndPort: wire.Config.hostAndPort,
|
|
57
|
+
ssl: wire.Config.ssl,
|
|
58
|
+
dispatcher: wire.Dispatcher,
|
|
59
|
+
middlewares: wire.Middlewares,
|
|
60
|
+
});
|
|
61
|
+
},
|
|
62
|
+
);
|
|
49
63
|
}
|
|
50
64
|
|
|
51
65
|
close() {}
|
|
@@ -56,13 +70,33 @@ export class ClientUpload {
|
|
|
56
70
|
): Promise<{
|
|
57
71
|
overall: bigint;
|
|
58
72
|
toUpload: bigint[];
|
|
59
|
-
checksumAlgorithm:
|
|
73
|
+
checksumAlgorithm: UploadAPI_ChecksumAlgorithm;
|
|
60
74
|
checksumHeader: string;
|
|
61
75
|
}> {
|
|
62
|
-
const
|
|
76
|
+
const client = this.wire.get();
|
|
77
|
+
|
|
78
|
+
if (client instanceof UploadClient) {
|
|
79
|
+
const init = (await client.init({ resourceId: id }, addRTypeToMetadata(type, options)))
|
|
80
|
+
.response;
|
|
81
|
+
|
|
82
|
+
return {
|
|
83
|
+
overall: init.partsCount,
|
|
84
|
+
toUpload: this.partsToUpload(init.partsCount, init.uploadedParts),
|
|
85
|
+
checksumAlgorithm: init.checksumAlgorithm,
|
|
86
|
+
checksumHeader: init.checksumHeader,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const init = (await client.POST('/v1/upload/init', {
|
|
91
|
+
body: {
|
|
92
|
+
resourceId: id.toString(),
|
|
93
|
+
},
|
|
94
|
+
headers: { ...createRTypeRoutingHeader(type) },
|
|
95
|
+
})).data!;
|
|
96
|
+
|
|
63
97
|
return {
|
|
64
|
-
overall: init.partsCount,
|
|
65
|
-
toUpload: this.partsToUpload(init.partsCount, init.uploadedParts),
|
|
98
|
+
overall: BigInt(init.partsCount),
|
|
99
|
+
toUpload: this.partsToUpload(BigInt(init.partsCount), init.uploadedParts.map(BigInt)),
|
|
66
100
|
checksumAlgorithm: init.checksumAlgorithm,
|
|
67
101
|
checksumHeader: init.checksumHeader,
|
|
68
102
|
};
|
|
@@ -73,22 +107,50 @@ export class ClientUpload {
|
|
|
73
107
|
path: string,
|
|
74
108
|
expectedMTimeUnix: bigint,
|
|
75
109
|
partNumber: bigint,
|
|
76
|
-
checksumAlgorithm:
|
|
110
|
+
checksumAlgorithm: UploadAPI_ChecksumAlgorithm,
|
|
77
111
|
checksumHeader: string,
|
|
78
112
|
options?: RpcOptions,
|
|
79
113
|
) {
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
114
|
+
const client = this.wire.get();
|
|
115
|
+
|
|
116
|
+
let info: UploadAPI_GetPartURL_Response;
|
|
117
|
+
if (client instanceof UploadClient) {
|
|
118
|
+
// partChecksum isn't used for now but protoc requires it to be set
|
|
119
|
+
info = (await client.getPartURL(
|
|
120
|
+
{
|
|
121
|
+
resourceId: id,
|
|
122
|
+
partNumber,
|
|
123
|
+
uploadedPartSize: 0n,
|
|
124
|
+
isInternalUse: false,
|
|
125
|
+
partChecksum: '',
|
|
126
|
+
},
|
|
127
|
+
addRTypeToMetadata(type, options),
|
|
128
|
+
)).response;
|
|
129
|
+
} else {
|
|
130
|
+
const resp = (await client.POST('/v1/upload/get-part-url', {
|
|
131
|
+
body: {
|
|
132
|
+
resourceId: id.toString(),
|
|
133
|
+
partNumber: partNumber.toString(),
|
|
134
|
+
uploadedPartSize: '0',
|
|
135
|
+
isInternalUse: false,
|
|
136
|
+
partChecksum: '',
|
|
137
|
+
},
|
|
138
|
+
headers: { ...createRTypeRoutingHeader(type) },
|
|
139
|
+
})).data!;
|
|
140
|
+
info = {
|
|
141
|
+
uploadUrl: resp.uploadUrl,
|
|
142
|
+
method: resp.method,
|
|
143
|
+
headers: resp.headers,
|
|
144
|
+
chunkStart: BigInt(resp.chunkStart),
|
|
145
|
+
chunkEnd: BigInt(resp.chunkEnd),
|
|
146
|
+
};
|
|
147
|
+
}
|
|
86
148
|
|
|
87
149
|
const chunk = await readFileChunk(path, info.chunkStart, info.chunkEnd);
|
|
88
150
|
await checkExpectedMTime(path, expectedMTimeUnix);
|
|
89
151
|
|
|
90
152
|
const crc32cChecksum = calculateCrc32cChecksum(chunk);
|
|
91
|
-
if (checksumAlgorithm ===
|
|
153
|
+
if (checksumAlgorithm === UploadAPI_ChecksumAlgorithm.CRC32C) {
|
|
92
154
|
info.headers.push({ name: checksumHeader, value: crc32cChecksum });
|
|
93
155
|
}
|
|
94
156
|
|
|
@@ -136,11 +198,22 @@ export class ClientUpload {
|
|
|
136
198
|
throw new Error(`partUpload: error ${JSON.stringify(e)} happened while trying to do part upload to the url ${info.uploadUrl}, headers: ${JSON.stringify(info.headers)}`);
|
|
137
199
|
}
|
|
138
200
|
|
|
139
|
-
await this.
|
|
201
|
+
await this.updateProgress({ id, type }, BigInt(info.chunkEnd - info.chunkStart), options);
|
|
140
202
|
}
|
|
141
203
|
|
|
142
204
|
public async finalize(info: ResourceInfo, options?: RpcOptions) {
|
|
143
|
-
|
|
205
|
+
const client = this.wire.get();
|
|
206
|
+
|
|
207
|
+
if (client instanceof UploadClient) {
|
|
208
|
+
await client.finalize({ resourceId: info.id }, addRTypeToMetadata(info.type, options));
|
|
209
|
+
} else {
|
|
210
|
+
await client.POST('/v1/upload/finalize', {
|
|
211
|
+
body: {
|
|
212
|
+
resourceId: info.id.toString(),
|
|
213
|
+
},
|
|
214
|
+
headers: { ...createRTypeRoutingHeader(info.type) },
|
|
215
|
+
});
|
|
216
|
+
}
|
|
144
217
|
}
|
|
145
218
|
|
|
146
219
|
/** Calculates parts that need to be uploaded from the parts that were
|
|
@@ -156,41 +229,32 @@ export class ClientUpload {
|
|
|
156
229
|
return toUpload;
|
|
157
230
|
}
|
|
158
231
|
|
|
159
|
-
private async
|
|
160
|
-
return await this.grpcClient.get().init({ resourceId: id }, addRTypeToMetadata(type, options))
|
|
161
|
-
.response;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
private async grpcGetPartUrl(
|
|
165
|
-
{ id, type }: ResourceInfo,
|
|
166
|
-
partNumber: bigint,
|
|
167
|
-
uploadedPartSize: bigint,
|
|
168
|
-
options?: RpcOptions,
|
|
169
|
-
) {
|
|
170
|
-
// partChecksum isn't used for now but protoc requires it to be set
|
|
171
|
-
return await this.grpcClient.get().getPartURL(
|
|
172
|
-
{ resourceId: id, partNumber, uploadedPartSize, isInternalUse: false, partChecksum: '' },
|
|
173
|
-
addRTypeToMetadata(type, options),
|
|
174
|
-
).response;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
private async grpcUpdateProgress(
|
|
232
|
+
private async updateProgress(
|
|
178
233
|
{ id, type }: ResourceInfo,
|
|
179
234
|
bytesProcessed: bigint,
|
|
180
235
|
options?: RpcOptions,
|
|
181
|
-
) {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
236
|
+
): Promise<void> {
|
|
237
|
+
const client = this.wire.get();
|
|
238
|
+
|
|
239
|
+
if (client instanceof UploadClient) {
|
|
240
|
+
await client.updateProgress(
|
|
241
|
+
{
|
|
242
|
+
resourceId: id,
|
|
243
|
+
bytesProcessed,
|
|
244
|
+
},
|
|
245
|
+
addRTypeToMetadata(type, options),
|
|
246
|
+
).response;
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
190
249
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
250
|
+
await client.POST('/v1/upload/update-progress', {
|
|
251
|
+
body: {
|
|
252
|
+
resourceId: id.toString(),
|
|
253
|
+
bytesProcessed: bytesProcessed.toString(),
|
|
254
|
+
},
|
|
255
|
+
headers: { ...createRTypeRoutingHeader(type) },
|
|
256
|
+
});
|
|
257
|
+
return;
|
|
194
258
|
}
|
|
195
259
|
}
|
|
196
260
|
|
|
@@ -243,7 +307,7 @@ function checkStatusCodeOk(
|
|
|
243
307
|
statusCode: number,
|
|
244
308
|
body: string,
|
|
245
309
|
headers: IncomingHttpHeaders,
|
|
246
|
-
info:
|
|
310
|
+
info: UploadAPI_GetPartURL_Response,
|
|
247
311
|
) {
|
|
248
312
|
if (statusCode == 400) {
|
|
249
313
|
throw new BadRequestError(`response is not ok, status code: ${statusCode},`
|
|
@@ -63,7 +63,7 @@ import { blobKey, pathToKey } from './blob_key';
|
|
|
63
63
|
import { DownloadBlobTask, nonRecoverableError } from './download_blob_task';
|
|
64
64
|
import { FilesCache } from '../helpers/files_cache';
|
|
65
65
|
import { SparseCache, SparseCacheFsFile, SparseCacheFsRanges } from './sparse_cache/cache';
|
|
66
|
-
import { isOffByOneError } from '../../helpers/
|
|
66
|
+
import { isOffByOneError } from '../../helpers/download_errors';
|
|
67
67
|
|
|
68
68
|
export type DownloadDriverOps = {
|
|
69
69
|
/**
|
|
@@ -18,7 +18,7 @@ import * as path from 'node:path';
|
|
|
18
18
|
import { Writable } from 'node:stream';
|
|
19
19
|
import type { ClientDownload } from '../../clients/download';
|
|
20
20
|
import { UnknownStorageError, WrongLocalFileUrl } from '../../clients/download';
|
|
21
|
-
import {
|
|
21
|
+
import { isDownloadNetworkError400 } from '../../helpers/download_errors';
|
|
22
22
|
import { resourceIdToString, stringifyWithResourceId } from '@milaboratories/pl-client';
|
|
23
23
|
|
|
24
24
|
/** Downloads a blob and holds callers and watchers for the blob. */
|
|
@@ -155,7 +155,7 @@ export class DownloadBlobTask {
|
|
|
155
155
|
export function nonRecoverableError(e: any) {
|
|
156
156
|
return (
|
|
157
157
|
e instanceof DownloadAborted
|
|
158
|
-
|| e
|
|
158
|
+
|| isDownloadNetworkError400(e)
|
|
159
159
|
|| e instanceof UnknownStorageError
|
|
160
160
|
|| e instanceof WrongLocalFileUrl
|
|
161
161
|
// file that we downloads from was moved or deleted.
|
|
@@ -4,7 +4,7 @@ import * as tar from 'tar-fs';
|
|
|
4
4
|
import path from 'path';
|
|
5
5
|
import fs from 'fs';
|
|
6
6
|
import * as fsp from 'fs/promises';
|
|
7
|
-
import {
|
|
7
|
+
import { isDownloadNetworkError400 } from '../../helpers/download_errors';
|
|
8
8
|
import type { Watcher } from '@milaboratories/computable';
|
|
9
9
|
import { ChangeSource } from '@milaboratories/computable';
|
|
10
10
|
import type { MiLogger, Signer } from '@milaboratories/ts-helpers';
|
|
@@ -224,7 +224,7 @@ class URLAborted extends Error {
|
|
|
224
224
|
export function nonRecoverableError(e: any) {
|
|
225
225
|
return (
|
|
226
226
|
e instanceof URLAborted
|
|
227
|
-
|| e
|
|
227
|
+
|| isDownloadNetworkError400(e)
|
|
228
228
|
|| e instanceof UnknownStorageError
|
|
229
229
|
|| e instanceof WrongLocalFileUrl
|
|
230
230
|
// file that we downloads from was moved or deleted.
|
|
@@ -17,7 +17,7 @@ import { Transform, Writable } from 'node:stream';
|
|
|
17
17
|
import * as zlib from 'node:zlib';
|
|
18
18
|
import * as tar from 'tar-fs';
|
|
19
19
|
import type { RemoteFileDownloader } from '../../helpers/download';
|
|
20
|
-
import {
|
|
20
|
+
import { isDownloadNetworkError400 } from '../../helpers/download_errors';
|
|
21
21
|
import type { UrlResult } from './driver';
|
|
22
22
|
import { newBlockUIURL } from '../urls/url';
|
|
23
23
|
|
|
@@ -59,7 +59,7 @@ export class DownloadByUrlTask {
|
|
|
59
59
|
this.setDone(size);
|
|
60
60
|
this.change.markChanged(`download of ${this.url} finished`);
|
|
61
61
|
} catch (e: unknown) {
|
|
62
|
-
if (e instanceof URLAborted || e
|
|
62
|
+
if (e instanceof URLAborted || isDownloadNetworkError400(e)) {
|
|
63
63
|
this.setError(e);
|
|
64
64
|
this.change.markChanged(`download of ${this.url} failed`);
|
|
65
65
|
// Just in case we were half-way extracting an archive.
|
|
@@ -21,7 +21,7 @@ import { randomUUID } from 'node:crypto';
|
|
|
21
21
|
import type { PlTreeEntry, ResourceInfo } from '@milaboratories/pl-tree';
|
|
22
22
|
import { treeEntryToResourceInfo } from '@milaboratories/pl-tree';
|
|
23
23
|
import { scheduler } from 'node:timers/promises';
|
|
24
|
-
import type { StreamingAPI_Response } from '../proto/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol';
|
|
24
|
+
import type { StreamingAPI_Response } from '../proto-grpc/github.com/milaboratory/pl/controllers/shared/grpc/streamingapi/protocol';
|
|
25
25
|
import type * as sdk from '@milaboratories/pl-model-common';
|
|
26
26
|
import type { PollingOps } from './helpers/polling_ops';
|
|
27
27
|
import type { RpcError } from '@protobuf-ts/runtime-rpc';
|