@milaboratories/pl-drivers 1.3.11 → 1.3.12
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/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +41 -31
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/drivers/upload.ts +21 -3
package/dist/index.mjs
CHANGED
|
@@ -12,7 +12,7 @@ import * as O from "node:fs";
|
|
|
12
12
|
import * as w from "node:path";
|
|
13
13
|
import Z from "node:path";
|
|
14
14
|
import { text as et, buffer as Le } from "node:stream/consumers";
|
|
15
|
-
import { Computable as b, ChangeSource as
|
|
15
|
+
import { Computable as b, ChangeSource as U, PollingComputableHooks as Pe } from "@milaboratories/computable";
|
|
16
16
|
import { scheduler as oe } from "node:timers/promises";
|
|
17
17
|
import * as tt from "node:readline/promises";
|
|
18
18
|
import rt from "denque";
|
|
@@ -610,8 +610,8 @@ class St extends g {
|
|
|
610
610
|
), t;
|
|
611
611
|
}
|
|
612
612
|
}
|
|
613
|
-
const
|
|
614
|
-
class
|
|
613
|
+
const Ut = new St();
|
|
614
|
+
class Nt extends g {
|
|
615
615
|
constructor() {
|
|
616
616
|
super("MiLaboratories.Controller.Shared.uploadapi.Finalize", []);
|
|
617
617
|
}
|
|
@@ -631,7 +631,7 @@ class Ut extends g {
|
|
|
631
631
|
), t;
|
|
632
632
|
}
|
|
633
633
|
}
|
|
634
|
-
new
|
|
634
|
+
new Nt();
|
|
635
635
|
class Bt extends g {
|
|
636
636
|
constructor() {
|
|
637
637
|
super("MiLaboratories.Controller.Shared.uploadapi.Finalize.Request", [
|
|
@@ -720,7 +720,7 @@ const $t = new vt(), W = new D(
|
|
|
720
720
|
name: "GetPartURL",
|
|
721
721
|
options: {},
|
|
722
722
|
I: It,
|
|
723
|
-
O:
|
|
723
|
+
O: Ut
|
|
724
724
|
},
|
|
725
725
|
{
|
|
726
726
|
name: "UpdateProgress",
|
|
@@ -1798,7 +1798,7 @@ class or {
|
|
|
1798
1798
|
}
|
|
1799
1799
|
class ae extends Error {
|
|
1800
1800
|
}
|
|
1801
|
-
class
|
|
1801
|
+
class Ue {
|
|
1802
1802
|
constructor(e) {
|
|
1803
1803
|
this.httpClient = e;
|
|
1804
1804
|
}
|
|
@@ -1825,7 +1825,7 @@ function B(s) {
|
|
|
1825
1825
|
return s;
|
|
1826
1826
|
}
|
|
1827
1827
|
const sr = "storage://";
|
|
1828
|
-
class
|
|
1828
|
+
class Ne extends Error {
|
|
1829
1829
|
}
|
|
1830
1830
|
class Be extends Error {
|
|
1831
1831
|
}
|
|
@@ -1837,7 +1837,7 @@ class ir {
|
|
|
1837
1837
|
d(this, "isLocal", (e) => e.startsWith(sr));
|
|
1838
1838
|
this.grpcTransport = e, this.httpClient = t, this.logger = n;
|
|
1839
1839
|
for (const o of r) o.localPath !== "" && B(o.localPath);
|
|
1840
|
-
this.grpcClient = new or(this.grpcTransport), this.downloadHelper = new
|
|
1840
|
+
this.grpcClient = new or(this.grpcTransport), this.downloadHelper = new Ue(t), this.localStorageIdsToRoot = new Map(
|
|
1841
1841
|
r.map((o) => [o.storageId, o.localPath])
|
|
1842
1842
|
);
|
|
1843
1843
|
}
|
|
@@ -1872,7 +1872,7 @@ function ar(s, e) {
|
|
|
1872
1872
|
throw new Be(`url for local filepath ${s} does not match url scheme`);
|
|
1873
1873
|
const n = t.host, r = e.get(n);
|
|
1874
1874
|
if (r === void 0)
|
|
1875
|
-
throw new
|
|
1875
|
+
throw new Ne(`Unknown storage location: ${n}`);
|
|
1876
1876
|
const o = decodeURIComponent(t.pathname.slice(1));
|
|
1877
1877
|
return r === "" ? o : w.join(r, o);
|
|
1878
1878
|
}
|
|
@@ -2757,8 +2757,8 @@ class Sr extends g {
|
|
|
2757
2757
|
), t;
|
|
2758
2758
|
}
|
|
2759
2759
|
}
|
|
2760
|
-
const
|
|
2761
|
-
class
|
|
2760
|
+
const Ur = new Sr();
|
|
2761
|
+
class Nr extends g {
|
|
2762
2762
|
constructor() {
|
|
2763
2763
|
super("MiLaboratories.Controller.Shared.StreamingAPI.LastLines", [
|
|
2764
2764
|
{
|
|
@@ -2861,7 +2861,7 @@ class Ur extends g {
|
|
|
2861
2861
|
), t;
|
|
2862
2862
|
}
|
|
2863
2863
|
}
|
|
2864
|
-
const Br = new
|
|
2864
|
+
const Br = new Nr();
|
|
2865
2865
|
class Dr extends g {
|
|
2866
2866
|
constructor() {
|
|
2867
2867
|
super("MiLaboratories.Controller.Shared.StreamingAPI.Response", [
|
|
@@ -2939,7 +2939,7 @@ class Dr extends g {
|
|
|
2939
2939
|
), t;
|
|
2940
2940
|
}
|
|
2941
2941
|
}
|
|
2942
|
-
const
|
|
2942
|
+
const N = new Dr(), G = new D(
|
|
2943
2943
|
"MiLaboratories.Controller.Shared.Streaming",
|
|
2944
2944
|
[
|
|
2945
2945
|
{
|
|
@@ -2947,32 +2947,32 @@ const U = new Dr(), G = new D(
|
|
|
2947
2947
|
serverStreaming: !0,
|
|
2948
2948
|
options: {},
|
|
2949
2949
|
I: kr,
|
|
2950
|
-
O:
|
|
2950
|
+
O: N
|
|
2951
2951
|
},
|
|
2952
2952
|
{
|
|
2953
2953
|
name: "ReadBinary",
|
|
2954
2954
|
options: {},
|
|
2955
2955
|
I: Pr,
|
|
2956
|
-
O:
|
|
2956
|
+
O: N
|
|
2957
2957
|
},
|
|
2958
2958
|
{
|
|
2959
2959
|
name: "StreamText",
|
|
2960
2960
|
serverStreaming: !0,
|
|
2961
2961
|
options: {},
|
|
2962
2962
|
I: Rr,
|
|
2963
|
-
O:
|
|
2963
|
+
O: N
|
|
2964
2964
|
},
|
|
2965
2965
|
{
|
|
2966
2966
|
name: "ReadText",
|
|
2967
2967
|
options: {},
|
|
2968
|
-
I:
|
|
2969
|
-
O:
|
|
2968
|
+
I: Ur,
|
|
2969
|
+
O: N
|
|
2970
2970
|
},
|
|
2971
2971
|
{
|
|
2972
2972
|
name: "LastLines",
|
|
2973
2973
|
options: {},
|
|
2974
2974
|
I: Br,
|
|
2975
|
-
O:
|
|
2975
|
+
O: N
|
|
2976
2976
|
}
|
|
2977
2977
|
]
|
|
2978
2978
|
);
|
|
@@ -3529,7 +3529,7 @@ class Mn {
|
|
|
3529
3529
|
}
|
|
3530
3530
|
class Wr {
|
|
3531
3531
|
constructor(e, t) {
|
|
3532
|
-
d(this, "change", new
|
|
3532
|
+
d(this, "change", new U());
|
|
3533
3533
|
d(this, "counter", new v());
|
|
3534
3534
|
this.size = e, this.handle = t;
|
|
3535
3535
|
}
|
|
@@ -3547,7 +3547,7 @@ class he {
|
|
|
3547
3547
|
constructor(e, t, n) {
|
|
3548
3548
|
d(this, "updater");
|
|
3549
3549
|
d(this, "log");
|
|
3550
|
-
d(this, "change", new
|
|
3550
|
+
d(this, "change", new U());
|
|
3551
3551
|
d(this, "error");
|
|
3552
3552
|
this.path = e, this.lines = t, this.patternToSearch = n, this.updater = new De(async () => this.update());
|
|
3553
3553
|
}
|
|
@@ -3594,7 +3594,7 @@ function zr(s, e, t) {
|
|
|
3594
3594
|
let xr = class {
|
|
3595
3595
|
constructor(e, t, n, r) {
|
|
3596
3596
|
d(this, "counter", new v());
|
|
3597
|
-
d(this, "change", new
|
|
3597
|
+
d(this, "change", new U());
|
|
3598
3598
|
d(this, "signalCtl", new AbortController());
|
|
3599
3599
|
d(this, "error");
|
|
3600
3600
|
d(this, "done", !1);
|
|
@@ -3615,7 +3615,7 @@ let xr = class {
|
|
|
3615
3615
|
}
|
|
3616
3616
|
this.setDone(t);
|
|
3617
3617
|
} catch (e) {
|
|
3618
|
-
if (e instanceof pe || e instanceof ae || e instanceof
|
|
3618
|
+
if (e instanceof pe || e instanceof ae || e instanceof Ne || e instanceof Be || e.code == "ENOENT") {
|
|
3619
3619
|
this.setError(e), await m.rm(this.path);
|
|
3620
3620
|
return;
|
|
3621
3621
|
}
|
|
@@ -3808,7 +3808,7 @@ class Gn {
|
|
|
3808
3808
|
}
|
|
3809
3809
|
class Qr {
|
|
3810
3810
|
constructor(e, t, n, r, o, a) {
|
|
3811
|
-
d(this, "change", new
|
|
3811
|
+
d(this, "change", new U());
|
|
3812
3812
|
d(this, "counter", new v());
|
|
3813
3813
|
d(this, "progress");
|
|
3814
3814
|
/** If this is upload progress this field will be defined */
|
|
@@ -3830,11 +3830,21 @@ class Qr {
|
|
|
3830
3830
|
};
|
|
3831
3831
|
}
|
|
3832
3832
|
mustGetProgress(e) {
|
|
3833
|
-
|
|
3834
|
-
|
|
3833
|
+
const t = {
|
|
3834
|
+
done: this.progress.done,
|
|
3835
|
+
isUpload: this.progress.isUpload,
|
|
3836
|
+
isUploadSignMatch: this.progress.isUploadSignMatch,
|
|
3837
|
+
lastError: this.progress.lastError
|
|
3838
|
+
};
|
|
3839
|
+
if (this.progress.status && (t.status = {
|
|
3840
|
+
progress: this.progress.status.progress,
|
|
3841
|
+
bytesProcessed: this.progress.status.bytesProcessed,
|
|
3842
|
+
bytesTotal: this.progress.status.bytesTotal
|
|
3843
|
+
}), e)
|
|
3844
|
+
return this.setDone(e), t;
|
|
3835
3845
|
if (this.uploadingTerminallyFailed)
|
|
3836
3846
|
throw this.logger.error(`Uploading terminally failed: ${this.progress.lastError}`), new Error(this.progress.lastError);
|
|
3837
|
-
return
|
|
3847
|
+
return t;
|
|
3838
3848
|
}
|
|
3839
3849
|
attach(e, t) {
|
|
3840
3850
|
this.change.attachWatcher(e), this.counter.inc(t);
|
|
@@ -4076,7 +4086,7 @@ class me {
|
|
|
4076
4086
|
constructor(e, t, n, r, o) {
|
|
4077
4087
|
d(this, "logs");
|
|
4078
4088
|
d(this, "error");
|
|
4079
|
-
d(this, "change", new
|
|
4089
|
+
d(this, "change", new U());
|
|
4080
4090
|
d(this, "counter", new v());
|
|
4081
4091
|
this.logger = e, this.clientLogs = t, this.rInfo = n, this.lines = r, this.patternToSearch = o;
|
|
4082
4092
|
}
|
|
@@ -4125,7 +4135,7 @@ class qn {
|
|
|
4125
4135
|
/** Writes and removes files to a hard drive and holds a counter for every
|
|
4126
4136
|
* file that should be kept. */
|
|
4127
4137
|
d(this, "cache");
|
|
4128
|
-
this.logger = e, this.saveDir = n, this.opts = r, this.downloadQueue = new ee(this.logger, this.opts.nConcurrentDownloads), this.cache = new $e(this.opts.cacheSoftSizeBytes), this.downloadHelper = new
|
|
4138
|
+
this.logger = e, this.saveDir = n, this.opts = r, this.downloadQueue = new ee(this.logger, this.opts.nConcurrentDownloads), this.cache = new $e(this.opts.cacheSoftSizeBytes), this.downloadHelper = new Ue(t);
|
|
4129
4139
|
}
|
|
4130
4140
|
getPath(e, t) {
|
|
4131
4141
|
if (t === void 0) return b.make((o) => this.getPath(e, o));
|
|
@@ -4192,7 +4202,7 @@ class qn {
|
|
|
4192
4202
|
class Kr {
|
|
4193
4203
|
constructor(e, t) {
|
|
4194
4204
|
d(this, "counter", new v());
|
|
4195
|
-
d(this, "change", new
|
|
4205
|
+
d(this, "change", new U());
|
|
4196
4206
|
d(this, "signalCtl", new AbortController());
|
|
4197
4207
|
d(this, "error");
|
|
4198
4208
|
d(this, "done", !1);
|
|
@@ -4528,7 +4538,7 @@ export {
|
|
|
4528
4538
|
Se as NoFileForUploading,
|
|
4529
4539
|
Er as OnDemandBlobResourceSnapshot,
|
|
4530
4540
|
Re as UnexpectedEOF,
|
|
4531
|
-
|
|
4541
|
+
Ne as UnknownStorageError,
|
|
4532
4542
|
De as Updater,
|
|
4533
4543
|
Gn as UploadDriver,
|
|
4534
4544
|
qr as UploadResourceSnapshot,
|