@milaboratories/pl-drivers 1.5.6 → 1.5.7
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/drivers/upload_task.d.ts +3 -0
- package/dist/drivers/upload_task.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +93 -83
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
- package/src/drivers/upload_task.ts +30 -3
package/dist/index.mjs
CHANGED
|
@@ -831,7 +831,7 @@ class zt {
|
|
|
831
831
|
0n,
|
|
832
832
|
// we update progress as a separate call later.
|
|
833
833
|
l
|
|
834
|
-
), c = await
|
|
834
|
+
), c = await xt(r, i.chunkStart, i.chunkEnd);
|
|
835
835
|
await Mt(r, n);
|
|
836
836
|
const {
|
|
837
837
|
body: a,
|
|
@@ -878,11 +878,11 @@ class zt {
|
|
|
878
878
|
return await this.grpcClient.finalize({ resourceId: e }, T(t, r)).response;
|
|
879
879
|
}
|
|
880
880
|
}
|
|
881
|
-
async function
|
|
881
|
+
async function xt(s, e, t) {
|
|
882
882
|
let r;
|
|
883
883
|
try {
|
|
884
884
|
r = await m.open(s);
|
|
885
|
-
const n = Number(t - e), o = Number(e), l = Buffer.alloc(n), i = await
|
|
885
|
+
const n = Number(t - e), o = Number(e), l = Buffer.alloc(n), i = await At(r, l, n, o);
|
|
886
886
|
return l.subarray(0, i);
|
|
887
887
|
} catch (n) {
|
|
888
888
|
throw n.code == "ENOENT" ? new Be(`there is no file ${s} for uploading`) : n;
|
|
@@ -890,7 +890,7 @@ async function At(s, e, t) {
|
|
|
890
890
|
r == null || r.close();
|
|
891
891
|
}
|
|
892
892
|
}
|
|
893
|
-
async function
|
|
893
|
+
async function At(s, e, t, r) {
|
|
894
894
|
let n = 0;
|
|
895
895
|
for (; n < t; ) {
|
|
896
896
|
const { bytesRead: o } = await s.read(
|
|
@@ -1441,7 +1441,7 @@ class tr extends g {
|
|
|
1441
1441
|
), t;
|
|
1442
1442
|
}
|
|
1443
1443
|
}
|
|
1444
|
-
const rr = new tr(),
|
|
1444
|
+
const rr = new tr(), x = new B(
|
|
1445
1445
|
"MiLaboratories.Controller.Shared.Progress",
|
|
1446
1446
|
[
|
|
1447
1447
|
{
|
|
@@ -1463,9 +1463,9 @@ const rr = new tr(), A = new B(
|
|
|
1463
1463
|
);
|
|
1464
1464
|
class nr {
|
|
1465
1465
|
constructor(e) {
|
|
1466
|
-
d(this, "typeName",
|
|
1467
|
-
d(this, "methods",
|
|
1468
|
-
d(this, "options",
|
|
1466
|
+
d(this, "typeName", x.typeName);
|
|
1467
|
+
d(this, "methods", x.methods);
|
|
1468
|
+
d(this, "options", x.options);
|
|
1469
1469
|
this._transport = e;
|
|
1470
1470
|
}
|
|
1471
1471
|
/**
|
|
@@ -1732,7 +1732,7 @@ class dr extends g {
|
|
|
1732
1732
|
), t;
|
|
1733
1733
|
}
|
|
1734
1734
|
}
|
|
1735
|
-
const
|
|
1735
|
+
const A = new dr();
|
|
1736
1736
|
class hr extends g {
|
|
1737
1737
|
constructor() {
|
|
1738
1738
|
super(
|
|
@@ -1750,7 +1750,7 @@ class hr extends g {
|
|
|
1750
1750
|
name: "headers",
|
|
1751
1751
|
kind: "message",
|
|
1752
1752
|
repeat: 1,
|
|
1753
|
-
T: () =>
|
|
1753
|
+
T: () => A
|
|
1754
1754
|
}
|
|
1755
1755
|
]
|
|
1756
1756
|
);
|
|
@@ -1775,7 +1775,7 @@ class hr extends g {
|
|
|
1775
1775
|
case /* repeated MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL.HTTPHeader headers */
|
|
1776
1776
|
2:
|
|
1777
1777
|
o.headers.push(
|
|
1778
|
-
|
|
1778
|
+
A.internalBinaryRead(
|
|
1779
1779
|
e,
|
|
1780
1780
|
e.uint32(),
|
|
1781
1781
|
r
|
|
@@ -1803,7 +1803,7 @@ class hr extends g {
|
|
|
1803
1803
|
internalBinaryWrite(e, t, r) {
|
|
1804
1804
|
e.downloadUrl !== "" && t.tag(1, h.LengthDelimited).string(e.downloadUrl);
|
|
1805
1805
|
for (let o = 0; o < e.headers.length; o++)
|
|
1806
|
-
|
|
1806
|
+
A.internalBinaryWrite(
|
|
1807
1807
|
e.headers[o],
|
|
1808
1808
|
t.tag(2, h.LengthDelimited).fork(),
|
|
1809
1809
|
r
|
|
@@ -2883,8 +2883,8 @@ class zr extends g {
|
|
|
2883
2883
|
), t;
|
|
2884
2884
|
}
|
|
2885
2885
|
}
|
|
2886
|
-
const
|
|
2887
|
-
class
|
|
2886
|
+
const xr = new zr();
|
|
2887
|
+
class Ar extends g {
|
|
2888
2888
|
constructor() {
|
|
2889
2889
|
super("MiLaboratories.Controller.Shared.StreamingAPI.Response", [
|
|
2890
2890
|
{
|
|
@@ -2961,7 +2961,7 @@ class xr extends g {
|
|
|
2961
2961
|
), t;
|
|
2962
2962
|
}
|
|
2963
2963
|
}
|
|
2964
|
-
const U = new
|
|
2964
|
+
const U = new Ar(), V = new B(
|
|
2965
2965
|
"MiLaboratories.Controller.Shared.Streaming",
|
|
2966
2966
|
[
|
|
2967
2967
|
{
|
|
@@ -2993,7 +2993,7 @@ const U = new xr(), V = new B(
|
|
|
2993
2993
|
{
|
|
2994
2994
|
name: "LastLines",
|
|
2995
2995
|
options: {},
|
|
2996
|
-
I:
|
|
2996
|
+
I: xr,
|
|
2997
2997
|
O: U
|
|
2998
2998
|
}
|
|
2999
2999
|
]
|
|
@@ -3133,25 +3133,25 @@ class Hr {
|
|
|
3133
3133
|
)).response;
|
|
3134
3134
|
}
|
|
3135
3135
|
}
|
|
3136
|
-
function
|
|
3136
|
+
function Kn(s, e, t) {
|
|
3137
3137
|
return e.getDriver({
|
|
3138
3138
|
name: "DownloadBlob",
|
|
3139
3139
|
init: (r, n, o) => new gr(n, o, s, t)
|
|
3140
3140
|
});
|
|
3141
3141
|
}
|
|
3142
|
-
function
|
|
3142
|
+
function eo(s, e) {
|
|
3143
3143
|
return s.getDriver({
|
|
3144
3144
|
name: "StreamLogs",
|
|
3145
3145
|
init: (t, r, n) => new Hr(r, n, e)
|
|
3146
3146
|
});
|
|
3147
3147
|
}
|
|
3148
|
-
function
|
|
3148
|
+
function to(s, e) {
|
|
3149
3149
|
return s.getDriver({
|
|
3150
3150
|
name: "UploadProgress",
|
|
3151
3151
|
init: (t, r, n) => new or(r, n, s, e)
|
|
3152
3152
|
});
|
|
3153
3153
|
}
|
|
3154
|
-
function
|
|
3154
|
+
function ro(s, e) {
|
|
3155
3155
|
return s.getDriver({
|
|
3156
3156
|
name: "UploadBlob",
|
|
3157
3157
|
init: (t, r, n) => new zt(r, n, s, e)
|
|
@@ -3312,7 +3312,7 @@ const F = k.object({
|
|
|
3312
3312
|
storageId: k.string(),
|
|
3313
3313
|
/** Path inside storage */
|
|
3314
3314
|
path: k.string()
|
|
3315
|
-
}),
|
|
3315
|
+
}), no = k.union([
|
|
3316
3316
|
F,
|
|
3317
3317
|
We
|
|
3318
3318
|
]), Qr = le({
|
|
@@ -3342,12 +3342,12 @@ function en(s, e) {
|
|
|
3342
3342
|
type: { name: n, version: o }
|
|
3343
3343
|
};
|
|
3344
3344
|
}
|
|
3345
|
-
function
|
|
3345
|
+
function xe(s, e) {
|
|
3346
3346
|
return s ? `log+live://log/${e.type.name}/${e.type.version}/${BigInt(e.id)}` : `log+ready://log/${e.type.name}/${e.type.version}/${BigInt(e.id)}`;
|
|
3347
3347
|
}
|
|
3348
|
-
const
|
|
3348
|
+
const Ae = /^log\+live:\/\/log\/(?<resourceType>.*)\/(?<resourceVersion>.*)\/(?<resourceId>.*)$/;
|
|
3349
3349
|
function C(s) {
|
|
3350
|
-
return
|
|
3350
|
+
return Ae.test(s);
|
|
3351
3351
|
}
|
|
3352
3352
|
const Me = /^log\+ready:\/\/log\/(?<resourceType>.*)\/(?<resourceVersion>.*)\/(?<resourceId>.*)$/;
|
|
3353
3353
|
function tn(s) {
|
|
@@ -3356,7 +3356,7 @@ function tn(s) {
|
|
|
3356
3356
|
function O(s) {
|
|
3357
3357
|
let e;
|
|
3358
3358
|
if (C(s))
|
|
3359
|
-
e = s.match(
|
|
3359
|
+
e = s.match(Ae);
|
|
3360
3360
|
else if (tn(s))
|
|
3361
3361
|
e = s.match(Me);
|
|
3362
3362
|
else throw new Error(`Log handle is malformed: ${s}`);
|
|
@@ -3386,7 +3386,7 @@ class rn {
|
|
|
3386
3386
|
})());
|
|
3387
3387
|
}
|
|
3388
3388
|
}
|
|
3389
|
-
class
|
|
3389
|
+
class oo {
|
|
3390
3390
|
constructor(e, t, r, n, o, l) {
|
|
3391
3391
|
/** Represents a Resource Id to the path of a blob as a map. */
|
|
3392
3392
|
d(this, "idToDownload", /* @__PURE__ */ new Map());
|
|
@@ -3519,7 +3519,7 @@ class no {
|
|
|
3519
3519
|
return this.getLogHandleNoCtx(r);
|
|
3520
3520
|
}
|
|
3521
3521
|
getLogHandleNoCtx(e) {
|
|
3522
|
-
return N("getLogHandle", e.type),
|
|
3522
|
+
return N("getLogHandle", e.type), xe(!1, e);
|
|
3523
3523
|
}
|
|
3524
3524
|
async lastLines(e, t, r, n) {
|
|
3525
3525
|
const o = await this.clientLogs.lastLines(
|
|
@@ -3658,6 +3658,9 @@ class an {
|
|
|
3658
3658
|
d(this, "progress");
|
|
3659
3659
|
/** If failed, then getting a progress is terminally failed. */
|
|
3660
3660
|
d(this, "failed");
|
|
3661
|
+
/** True if the blob was existed.
|
|
3662
|
+
* At this case, the task will show progress == 1.0. */
|
|
3663
|
+
d(this, "alreadyExisted", !1);
|
|
3661
3664
|
this.logger = e, this.clientBlob = t, this.clientProgress = r, this.nConcurrentPartsUpload = n, this.res = l;
|
|
3662
3665
|
const { uploadData: i, progress: c } = ln(l, o);
|
|
3663
3666
|
this.uploadData = i, this.progress = c;
|
|
@@ -3703,8 +3706,8 @@ class an {
|
|
|
3703
3706
|
}
|
|
3704
3707
|
async updateStatus() {
|
|
3705
3708
|
try {
|
|
3706
|
-
const e = await this.clientProgress.getStatus(this.res), t = this.progress.status;
|
|
3707
|
-
this.progress.status =
|
|
3709
|
+
const e = await this.clientProgress.getStatus(this.res), t = this.progress.status, r = pn(this.alreadyExisted, un(e));
|
|
3710
|
+
this.progress.status = r, this.setDone(e.done), (e.done || this.progress.status.progress != (t == null ? void 0 : t.progress)) && this.change.markChanged();
|
|
3708
3711
|
} catch (e) {
|
|
3709
3712
|
if (this.setRetriableError(e), e.name == "RpcError" && e.code == "DEADLINE_EXCEEDED") {
|
|
3710
3713
|
this.logger.warn("deadline exceeded while getting a status of BlobImport");
|
|
@@ -3728,7 +3731,7 @@ class an {
|
|
|
3728
3731
|
this.progress.lastError = String(e), this.progress.done = !1, this.failed = !0;
|
|
3729
3732
|
}
|
|
3730
3733
|
setDoneIfOutputSet(e) {
|
|
3731
|
-
dn(e) && this.setDone(!0);
|
|
3734
|
+
dn(e) && (this.setDone(!0), this.alreadyExisted = !0);
|
|
3732
3735
|
}
|
|
3733
3736
|
setDone(e) {
|
|
3734
3737
|
this.progress.done = e, e && (this.progress.lastError = void 0);
|
|
@@ -3779,17 +3782,24 @@ function un(s) {
|
|
|
3779
3782
|
bytesTotal: Number(s.bytesTotal)
|
|
3780
3783
|
};
|
|
3781
3784
|
}
|
|
3785
|
+
function pn(s, e) {
|
|
3786
|
+
return s && e.bytesTotal != 0 && e.bytesProcessed == 0 ? {
|
|
3787
|
+
progress: 1,
|
|
3788
|
+
bytesProcessed: Number(e.bytesTotal),
|
|
3789
|
+
bytesTotal: Number(e.bytesTotal)
|
|
3790
|
+
} : e;
|
|
3791
|
+
}
|
|
3782
3792
|
function fe(s) {
|
|
3783
3793
|
return s.name == "RpcError" && (s.code == "NOT_FOUND" || s.code == "ABORTED" || s.code == "ALREADY_EXISTS");
|
|
3784
3794
|
}
|
|
3785
3795
|
function He(s) {
|
|
3786
3796
|
return s instanceof Ne || s instanceof De || s instanceof Be;
|
|
3787
3797
|
}
|
|
3788
|
-
function
|
|
3798
|
+
function gn(s, e) {
|
|
3789
3799
|
const t = ce(s) ? e.accessor(s).node() : ot(s) ? s.node() : s;
|
|
3790
3800
|
return t.resourceType.name.startsWith("BlobUpload") ? Y(t, Qr) : Y(t, Xr);
|
|
3791
3801
|
}
|
|
3792
|
-
class
|
|
3802
|
+
class so {
|
|
3793
3803
|
constructor(e, t, r, n, o = {
|
|
3794
3804
|
nConcurrentPartUploads: 10,
|
|
3795
3805
|
nConcurrentGetProgresses: 10,
|
|
@@ -3821,11 +3831,11 @@ class oo {
|
|
|
3821
3831
|
}
|
|
3822
3832
|
getProgressId(e, t) {
|
|
3823
3833
|
if (t == null) return b.make((l) => this.getProgressId(e, l));
|
|
3824
|
-
const r = ce(e) ?
|
|
3834
|
+
const r = ce(e) ? gn(e, t) : e, n = P();
|
|
3825
3835
|
return t.attacheHooks(this.hooks), t.addOnDestroy(() => this.release(r.id, n)), this.getProgressIdNoCtx(t.watcher, r, n);
|
|
3826
3836
|
}
|
|
3827
3837
|
getProgressIdNoCtx(e, t, r) {
|
|
3828
|
-
|
|
3838
|
+
mn("getProgressId", t.type);
|
|
3829
3839
|
const n = this.idToProgress.get(t.id);
|
|
3830
3840
|
if (n != null)
|
|
3831
3841
|
return n.setDoneIfOutputSet(t), n.getProgress(e, r);
|
|
@@ -3881,20 +3891,20 @@ class oo {
|
|
|
3881
3891
|
this.currentLoop = void 0;
|
|
3882
3892
|
}
|
|
3883
3893
|
getAllNotDoneProgresses() {
|
|
3884
|
-
return Array.from(this.idToProgress.entries()).filter(([e, t]) => !
|
|
3894
|
+
return Array.from(this.idToProgress.entries()).filter(([e, t]) => !fn(t.progress)).map(([e, t]) => t);
|
|
3885
3895
|
}
|
|
3886
3896
|
}
|
|
3887
|
-
function
|
|
3897
|
+
function fn(s) {
|
|
3888
3898
|
var e;
|
|
3889
3899
|
return s.done && (((e = s.status) == null ? void 0 : e.progress) ?? 0) >= 1;
|
|
3890
3900
|
}
|
|
3891
|
-
function
|
|
3901
|
+
function mn(s, e) {
|
|
3892
3902
|
if (!e.name.startsWith("BlobUpload") && !e.name.startsWith("BlobIndex"))
|
|
3893
3903
|
throw new he(
|
|
3894
3904
|
`${s}: wrong resource type: ${e.name}, expected: a resource of either type 'BlobUpload' or 'BlobIndex'.`
|
|
3895
3905
|
);
|
|
3896
3906
|
}
|
|
3897
|
-
class
|
|
3907
|
+
class io {
|
|
3898
3908
|
constructor(e, t, r = {
|
|
3899
3909
|
nConcurrentGetLogs: 10,
|
|
3900
3910
|
pollingInterval: 1e3,
|
|
@@ -3967,7 +3977,7 @@ class so {
|
|
|
3967
3977
|
return t.markUnstable(`live_log:${Xe(r.id)}`), n;
|
|
3968
3978
|
}
|
|
3969
3979
|
getLogHandleNoCtx(e) {
|
|
3970
|
-
return J("getLogHandle", e.type),
|
|
3980
|
+
return J("getLogHandle", e.type), xe(!0, e);
|
|
3971
3981
|
}
|
|
3972
3982
|
async lastLines(e, t, r, n) {
|
|
3973
3983
|
return await this.tryWithNotFound(
|
|
@@ -4099,7 +4109,7 @@ function J(s, e) {
|
|
|
4099
4109
|
`${s}: wrong resource type: ${e.name}, expected: a resource of type 'StreamWorkdir'.`
|
|
4100
4110
|
);
|
|
4101
4111
|
}
|
|
4102
|
-
class
|
|
4112
|
+
class ao {
|
|
4103
4113
|
constructor(e, t, r) {
|
|
4104
4114
|
this.logger = e, this.logsStreamDriver = t, this.downloadDriver = r;
|
|
4105
4115
|
}
|
|
@@ -4163,7 +4173,7 @@ function Q(s, e) {
|
|
|
4163
4173
|
var t;
|
|
4164
4174
|
return (t = s.accessor(e).node().traverse("stream")) == null ? void 0 : t.resourceInfo;
|
|
4165
4175
|
}
|
|
4166
|
-
class
|
|
4176
|
+
class lo {
|
|
4167
4177
|
constructor(e, t, r, n = {
|
|
4168
4178
|
cacheSoftSizeBytes: 50 * 1024 * 1024,
|
|
4169
4179
|
withGunzip: !0,
|
|
@@ -4234,7 +4244,7 @@ class ao {
|
|
|
4234
4244
|
);
|
|
4235
4245
|
}
|
|
4236
4246
|
setNewTask(e, t, r) {
|
|
4237
|
-
const n = new
|
|
4247
|
+
const n = new wn(this.logger, this.getFilePath(t), t);
|
|
4238
4248
|
return n.attach(e, r), this.urlToDownload.set(t.toString(), n), n;
|
|
4239
4249
|
}
|
|
4240
4250
|
removeTask(e, t) {
|
|
@@ -4245,7 +4255,7 @@ class ao {
|
|
|
4245
4255
|
return w.join(this.saveDir, t);
|
|
4246
4256
|
}
|
|
4247
4257
|
}
|
|
4248
|
-
class
|
|
4258
|
+
class wn {
|
|
4249
4259
|
constructor(e, t, r) {
|
|
4250
4260
|
d(this, "counter", new v());
|
|
4251
4261
|
d(this, "change", new $());
|
|
@@ -4328,7 +4338,7 @@ function ye(s, e) {
|
|
|
4328
4338
|
path: e
|
|
4329
4339
|
}))}`;
|
|
4330
4340
|
}
|
|
4331
|
-
function
|
|
4341
|
+
function yn(s, e, t, r) {
|
|
4332
4342
|
const n = {
|
|
4333
4343
|
localPath: s,
|
|
4334
4344
|
pathSignature: e.sign(s),
|
|
@@ -4337,31 +4347,31 @@ function wn(s, e, t, r) {
|
|
|
4337
4347
|
};
|
|
4338
4348
|
return `upload://upload/${encodeURIComponent(JSON.stringify(n))}`;
|
|
4339
4349
|
}
|
|
4340
|
-
function
|
|
4350
|
+
function bn(s) {
|
|
4341
4351
|
const e = new URL(s);
|
|
4342
4352
|
return F.parse(
|
|
4343
4353
|
JSON.parse(decodeURIComponent(e.pathname.substring(1)))
|
|
4344
4354
|
);
|
|
4345
4355
|
}
|
|
4346
|
-
function
|
|
4356
|
+
function kn(s) {
|
|
4347
4357
|
const e = new URL(s);
|
|
4348
4358
|
return We.parse(JSON.parse(decodeURIComponent(e.pathname.substring(1))));
|
|
4349
4359
|
}
|
|
4350
|
-
function
|
|
4351
|
-
if (
|
|
4352
|
-
return
|
|
4353
|
-
if (
|
|
4354
|
-
return
|
|
4360
|
+
function Tn(s) {
|
|
4361
|
+
if (Rn(s))
|
|
4362
|
+
return Un(s);
|
|
4363
|
+
if (Ln(s))
|
|
4364
|
+
return In(s);
|
|
4355
4365
|
et(s);
|
|
4356
4366
|
}
|
|
4357
4367
|
const Ge = /^local:\/\/(?<name>.*)\/(?<path>.*)$/;
|
|
4358
|
-
function
|
|
4368
|
+
function Ln(s) {
|
|
4359
4369
|
return Ge.test(s);
|
|
4360
4370
|
}
|
|
4361
|
-
function
|
|
4371
|
+
function Pn(s, e) {
|
|
4362
4372
|
return `local://${s}/${encodeURIComponent(e)}`;
|
|
4363
4373
|
}
|
|
4364
|
-
function
|
|
4374
|
+
function In(s) {
|
|
4365
4375
|
const e = s.match(Ge);
|
|
4366
4376
|
if (e == null) throw new Error(`Local list handle wasn't parsed: ${s}`);
|
|
4367
4377
|
const { name: t, path: r } = e.groups;
|
|
@@ -4372,27 +4382,27 @@ function Pn(s) {
|
|
|
4372
4382
|
};
|
|
4373
4383
|
}
|
|
4374
4384
|
const Ve = /^remote:\/\/(?<name>.*)\/(?<resourceId>.*)$/;
|
|
4375
|
-
function
|
|
4385
|
+
function Rn(s) {
|
|
4376
4386
|
return Ve.test(s);
|
|
4377
4387
|
}
|
|
4378
|
-
function
|
|
4388
|
+
function Sn(s, e) {
|
|
4379
4389
|
return `remote://${s}/${BigInt(e)}`;
|
|
4380
4390
|
}
|
|
4381
|
-
function
|
|
4391
|
+
function Un(s) {
|
|
4382
4392
|
const e = s.match(Ve);
|
|
4383
4393
|
if (e == null) throw new Error(`Remote list handle wasn't parsed: ${s}`);
|
|
4384
4394
|
const { name: t, resourceId: r } = e.groups;
|
|
4385
4395
|
return {
|
|
4386
4396
|
id: te(BigInt(r)),
|
|
4387
|
-
type:
|
|
4397
|
+
type: Nn(t),
|
|
4388
4398
|
name: t,
|
|
4389
4399
|
isRemote: !0
|
|
4390
4400
|
};
|
|
4391
4401
|
}
|
|
4392
|
-
function
|
|
4402
|
+
function Nn(s) {
|
|
4393
4403
|
return { name: `LS/${s}`, version: "1" };
|
|
4394
4404
|
}
|
|
4395
|
-
async function
|
|
4405
|
+
async function Dn() {
|
|
4396
4406
|
const s = at.homedir();
|
|
4397
4407
|
if (X.sep == "/")
|
|
4398
4408
|
return [
|
|
@@ -4458,12 +4468,12 @@ class qe {
|
|
|
4458
4468
|
*/
|
|
4459
4469
|
async tryResolveLocalFileHandle(e) {
|
|
4460
4470
|
if (ut(e)) {
|
|
4461
|
-
const t =
|
|
4471
|
+
const t = kn(e), r = this.localProjectionsMap.get(t.storageId);
|
|
4462
4472
|
if (!r)
|
|
4463
4473
|
throw new Error(`Storage ${t.storageId} is not mounted locally.`);
|
|
4464
4474
|
return w.join(r.localPath, t.path);
|
|
4465
4475
|
} else {
|
|
4466
|
-
const t =
|
|
4476
|
+
const t = bn(e);
|
|
4467
4477
|
this.signer.verify(
|
|
4468
4478
|
t.localPath,
|
|
4469
4479
|
t.pathSignature,
|
|
@@ -4486,7 +4496,7 @@ class qe {
|
|
|
4486
4496
|
);
|
|
4487
4497
|
}
|
|
4488
4498
|
const t = await m.stat(e, { bigint: !0 });
|
|
4489
|
-
return
|
|
4499
|
+
return yn(
|
|
4490
4500
|
e,
|
|
4491
4501
|
this.signer,
|
|
4492
4502
|
t.size,
|
|
@@ -4497,12 +4507,12 @@ class qe {
|
|
|
4497
4507
|
async getStorageList() {
|
|
4498
4508
|
const e = [...this.virtualStoragesMap.values()].map((n) => ({
|
|
4499
4509
|
name: n.name,
|
|
4500
|
-
handle:
|
|
4510
|
+
handle: Pn(n.name, n.root),
|
|
4501
4511
|
initialFullPath: n.initialPath
|
|
4502
4512
|
})), r = Object.entries(this.storageIdToResourceId).map(
|
|
4503
4513
|
([n, o]) => ({
|
|
4504
4514
|
name: n,
|
|
4505
|
-
handle:
|
|
4515
|
+
handle: Sn(n, o),
|
|
4506
4516
|
initialFullPath: "",
|
|
4507
4517
|
// we don't have any additional information from where to start browsing remote storages
|
|
4508
4518
|
isInitialPathHome: !1
|
|
@@ -4511,7 +4521,7 @@ class qe {
|
|
|
4511
4521
|
return [...e, ...r];
|
|
4512
4522
|
}
|
|
4513
4523
|
async listFiles(e, t) {
|
|
4514
|
-
const r =
|
|
4524
|
+
const r = Tn(e);
|
|
4515
4525
|
if (r.isRemote)
|
|
4516
4526
|
return {
|
|
4517
4527
|
entries: (await this.lsClient.list(r, t)).items.map((i) => ({
|
|
@@ -4542,7 +4552,7 @@ class qe {
|
|
|
4542
4552
|
}
|
|
4543
4553
|
static async init(e, t, r, n, o, l) {
|
|
4544
4554
|
const i = jr(t, e);
|
|
4545
|
-
l || (l = await
|
|
4555
|
+
l || (l = await Dn());
|
|
4546
4556
|
for (const p of l) D(p.root);
|
|
4547
4557
|
for (const p of n) p.localPath !== "" && D(p.localPath);
|
|
4548
4558
|
const c = new Map(l.map((p) => [p.name, p])), a = new Map(n.map((p) => [p.storageId, p]));
|
|
@@ -4553,7 +4563,7 @@ class qe {
|
|
|
4553
4563
|
return new qe(
|
|
4554
4564
|
e,
|
|
4555
4565
|
i,
|
|
4556
|
-
await
|
|
4566
|
+
await Bn(t),
|
|
4557
4567
|
r,
|
|
4558
4568
|
c,
|
|
4559
4569
|
a,
|
|
@@ -4561,13 +4571,13 @@ class qe {
|
|
|
4561
4571
|
);
|
|
4562
4572
|
}
|
|
4563
4573
|
}
|
|
4564
|
-
async function
|
|
4574
|
+
async function Bn(s) {
|
|
4565
4575
|
return s.withReadTx("GetAvailableStorageIds", async (e) => {
|
|
4566
4576
|
const t = await e.getResourceByName("LSProvider"), r = await e.getResourceData(t, !0);
|
|
4567
|
-
return
|
|
4577
|
+
return vn(r);
|
|
4568
4578
|
});
|
|
4569
4579
|
}
|
|
4570
|
-
function
|
|
4580
|
+
function vn(s) {
|
|
4571
4581
|
return Object.fromEntries(
|
|
4572
4582
|
s.fields.filter((e) => e.type == "Dynamic" && Ye(e.value)).map((e) => [e.name.substring(8), e.value])
|
|
4573
4583
|
);
|
|
@@ -4578,15 +4588,15 @@ export {
|
|
|
4578
4588
|
Dr as ClientLs,
|
|
4579
4589
|
or as ClientProgress,
|
|
4580
4590
|
zt as ClientUpload,
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4591
|
+
Dn as DefaultVirtualLocalStorages,
|
|
4592
|
+
oo as DownloadDriver,
|
|
4593
|
+
lo as DownloadUrlDriver,
|
|
4594
|
+
no as ImportFileHandleData,
|
|
4585
4595
|
We as ImportFileHandleIndexData,
|
|
4586
4596
|
F as ImportFileHandleUploadData,
|
|
4587
4597
|
Xr as IndexResourceSnapshot,
|
|
4588
|
-
|
|
4589
|
-
|
|
4598
|
+
ao as LogsDriver,
|
|
4599
|
+
io as LogsStreamDriver,
|
|
4590
4600
|
qe as LsDriver,
|
|
4591
4601
|
Ne as MTimeError,
|
|
4592
4602
|
Wt as NetworkError,
|
|
@@ -4595,18 +4605,18 @@ export {
|
|
|
4595
4605
|
De as UnexpectedEOF,
|
|
4596
4606
|
_e as UnknownStorageError,
|
|
4597
4607
|
rn as Updater,
|
|
4598
|
-
|
|
4608
|
+
so as UploadDriver,
|
|
4599
4609
|
Qr as UploadResourceSnapshot,
|
|
4600
4610
|
$e as WrongLocalFileUrl,
|
|
4601
4611
|
he as WrongResourceTypeError,
|
|
4602
|
-
|
|
4603
|
-
|
|
4612
|
+
Kn as createDownloadClient,
|
|
4613
|
+
eo as createLogsClient,
|
|
4604
4614
|
jr as createLsFilesClient,
|
|
4605
|
-
|
|
4606
|
-
|
|
4615
|
+
ro as createUploadBlobClient,
|
|
4616
|
+
to as createUploadProgressClient,
|
|
4607
4617
|
mr as getFullPath,
|
|
4608
4618
|
Zr as getSize,
|
|
4609
|
-
|
|
4619
|
+
gn as makeBlobImportSnapshot,
|
|
4610
4620
|
br as newLocalStorageIdsToRoot,
|
|
4611
4621
|
fr as parseLocalUrl,
|
|
4612
4622
|
D as validateAbsolute
|