@milaboratories/pl-drivers 1.3.1 → 1.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +5 -3
  2. package/dist/clients/download.d.ts.map +1 -1
  3. package/dist/clients/progress.d.ts.map +1 -1
  4. package/dist/clients/upload.d.ts.map +1 -1
  5. package/dist/drivers/download_and_logs_blob.d.ts.map +1 -1
  6. package/dist/drivers/download_url.d.ts.map +1 -1
  7. package/dist/drivers/helpers/helpers.d.ts.map +1 -1
  8. package/dist/drivers/helpers/test_helpers.d.ts.map +1 -1
  9. package/dist/drivers/logs.d.ts.map +1 -1
  10. package/dist/drivers/logs_stream.d.ts.map +1 -1
  11. package/dist/drivers/ls.d.ts +1 -11
  12. package/dist/drivers/ls.d.ts.map +1 -1
  13. package/dist/drivers/types.d.ts +11 -0
  14. package/dist/drivers/types.d.ts.map +1 -1
  15. package/dist/drivers/virtual_storages.d.ts +10 -0
  16. package/dist/drivers/virtual_storages.d.ts.map +1 -0
  17. package/dist/helpers/download.d.ts.map +1 -1
  18. package/dist/index.d.ts +1 -0
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +2 -1
  21. package/dist/index.js.map +1 -1
  22. package/dist/index.mjs +446 -546
  23. package/dist/index.mjs.map +1 -1
  24. package/package.json +5 -5
  25. package/src/clients/download.test.ts +9 -5
  26. package/src/clients/download.ts +5 -8
  27. package/src/clients/progress.ts +1 -4
  28. package/src/clients/upload.test.ts +2 -5
  29. package/src/clients/upload.ts +10 -44
  30. package/src/drivers/download_and_logs_blob.ts +32 -109
  31. package/src/drivers/download_blob.test.ts +37 -55
  32. package/src/drivers/download_url.test.ts +1 -1
  33. package/src/drivers/download_url.ts +6 -25
  34. package/src/drivers/helpers/helpers.ts +3 -12
  35. package/src/drivers/helpers/test_helpers.ts +1 -3
  36. package/src/drivers/logs.test.ts +27 -65
  37. package/src/drivers/logs.ts +17 -66
  38. package/src/drivers/logs_stream.ts +12 -48
  39. package/src/drivers/ls.test.ts +7 -6
  40. package/src/drivers/ls.ts +33 -42
  41. package/src/drivers/types.ts +15 -0
  42. package/src/drivers/virtual_storages.ts +44 -0
  43. package/src/helpers/download.ts +2 -4
  44. package/src/index.ts +1 -0
package/dist/index.mjs CHANGED
@@ -1,29 +1,32 @@
1
- var Me = Object.defineProperty;
2
- var He = (s, e, t) => e in s ? Me(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
- var d = (s, e, t) => He(s, typeof e != "symbol" ? e + "" : e, t);
1
+ var He = Object.defineProperty;
2
+ var je = (s, e, t) => e in s ? He(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
+ var d = (s, e, t) => je(s, typeof e != "symbol" ? e + "" : e, t);
4
4
  import * as m from "node:fs/promises";
5
- import { addRTypeToMetadata as k, valErr as je, getField as Ge, isNullResourceId as Ve, bigintToResourceId as Y, stringifyWithResourceId as qe, isNotNullResourceId as Je } from "@milaboratories/pl-client";
5
+ import { addRTypeToMetadata as k, valErr as Ge, getField as Ve, isNullResourceId as qe, bigintToResourceId as Y, stringifyWithResourceId as Je, isNotNullResourceId as Ze } from "@milaboratories/pl-client";
6
6
  import { ServiceType as D, stackIntercept as y } from "@protobuf-ts/runtime-rpc";
7
- import { MessageType as g, reflectionMergePartial as f, UnknownFieldHandler as u, WireType as h, PbLong as I, typeofJsonValue as ye } from "@protobuf-ts/runtime";
8
- import { request as be } from "undici";
9
- import { notEmpty as K, mapGet as ce, mapEntries as Ze, TaskProcessor as ee, CallersCounter as v, asyncPool as te, fileExists as Qe, assertNever as Xe } from "@milaboratories/ts-helpers";
10
- import { Readable as re, Writable as ne, Transform as Ye } from "node:stream";
7
+ import { MessageType as g, reflectionMergePartial as f, UnknownFieldHandler as u, WireType as h, PbLong as I, typeofJsonValue as be } from "@protobuf-ts/runtime";
8
+ import { request as Te } from "undici";
9
+ import { notEmpty as K, mapGet as ce, mapEntries as Qe, TaskProcessor as ee, CallersCounter as v, asyncPool as te, fileExists as Xe, assertNever as Ye } from "@milaboratories/ts-helpers";
10
+ import { Readable as re, Writable as ne, Transform as Ke } from "node:stream";
11
11
  import * as O from "node:fs";
12
12
  import * as w from "node:path";
13
- import Ke from "node:path";
14
- import { text as et, buffer as Te } from "node:stream/consumers";
15
- import { Computable as b, ChangeSource as N, PollingComputableHooks as ke } from "@milaboratories/computable";
13
+ import Z from "node:path";
14
+ import { text as et, buffer as ke } from "node:stream/consumers";
15
+ import { Computable as b, ChangeSource as N, PollingComputableHooks as Le } 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";
19
- import * as Z from "node:os";
20
- import { randomUUID as L, createHash as nt } from "node:crypto";
21
- import { rsSchema as se, treeEntryToResourceInfo as R, isPlTreeEntry as ie, makeResourceSnapshot as Q, isPlTreeEntryAccessor as ot } from "@milaboratories/pl-tree";
19
+ import * as de from "node:os";
20
+ import nt from "node:os";
21
+ import { randomUUID as L, createHash as ot } from "node:crypto";
22
+ import { rsSchema as se, treeEntryToResourceInfo as R, isPlTreeEntry as ie, makeResourceSnapshot as Q, isPlTreeEntryAccessor as st } from "@milaboratories/pl-tree";
22
23
  import { z as T } from "zod";
23
- import * as st from "node:zlib";
24
- import * as it from "tar-fs";
25
- import { isImportFileHandleIndex as at } from "@milaboratories/pl-model-common";
26
- class lt extends g {
24
+ import * as it from "node:zlib";
25
+ import * as at from "tar-fs";
26
+ import { isImportFileHandleIndex as lt } from "@milaboratories/pl-model-common";
27
+ import ct from "node:util";
28
+ import { exec as dt } from "node:child_process";
29
+ class ht extends g {
27
30
  constructor() {
28
31
  super("MiLaboratories.Controller.Shared.uploadapi", []);
29
32
  }
@@ -43,8 +46,8 @@ class lt extends g {
43
46
  ), t;
44
47
  }
45
48
  }
46
- new lt();
47
- class ct extends g {
49
+ new ht();
50
+ class ut extends g {
48
51
  constructor() {
49
52
  super("MiLaboratories.Controller.Shared.uploadapi.Init", []);
50
53
  }
@@ -64,8 +67,8 @@ class ct extends g {
64
67
  ), t;
65
68
  }
66
69
  }
67
- new ct();
68
- class dt extends g {
70
+ new ut();
71
+ class pt extends g {
69
72
  constructor() {
70
73
  super("MiLaboratories.Controller.Shared.uploadapi.Init.Request", [
71
74
  {
@@ -119,8 +122,8 @@ class dt extends g {
119
122
  ), t;
120
123
  }
121
124
  }
122
- const ht = new dt();
123
- class ut extends g {
125
+ const gt = new pt();
126
+ class ft extends g {
124
127
  constructor() {
125
128
  super("MiLaboratories.Controller.Shared.uploadapi.Init.Response", [
126
129
  {
@@ -195,8 +198,8 @@ class ut extends g {
195
198
  ), t;
196
199
  }
197
200
  }
198
- const pt = new ut();
199
- class gt extends g {
201
+ const mt = new ft();
202
+ class wt extends g {
200
203
  constructor() {
201
204
  super("MiLaboratories.Controller.Shared.uploadapi.UpdateProgress", []);
202
205
  }
@@ -216,8 +219,8 @@ class gt extends g {
216
219
  ), t;
217
220
  }
218
221
  }
219
- new gt();
220
- class ft extends g {
222
+ new wt();
223
+ class yt extends g {
221
224
  constructor() {
222
225
  super("MiLaboratories.Controller.Shared.uploadapi.UpdateProgress.Request", [
223
226
  {
@@ -287,8 +290,8 @@ class ft extends g {
287
290
  ), t;
288
291
  }
289
292
  }
290
- const mt = new ft();
291
- class wt extends g {
293
+ const bt = new yt();
294
+ class Tt extends g {
292
295
  constructor() {
293
296
  super(
294
297
  "MiLaboratories.Controller.Shared.uploadapi.UpdateProgress.Response",
@@ -315,8 +318,8 @@ class wt extends g {
315
318
  ), t;
316
319
  }
317
320
  }
318
- const yt = new wt();
319
- class bt extends g {
321
+ const kt = new Tt();
322
+ class Lt extends g {
320
323
  constructor() {
321
324
  super("MiLaboratories.Controller.Shared.uploadapi.GetPartURL", []);
322
325
  }
@@ -336,8 +339,8 @@ class bt extends g {
336
339
  ), t;
337
340
  }
338
341
  }
339
- new bt();
340
- class Tt extends g {
342
+ new Lt();
343
+ class Pt extends g {
341
344
  constructor() {
342
345
  super("MiLaboratories.Controller.Shared.uploadapi.GetPartURL.Request", [
343
346
  {
@@ -419,8 +422,8 @@ class Tt extends g {
419
422
  ), t;
420
423
  }
421
424
  }
422
- const kt = new Tt();
423
- class Lt extends g {
425
+ const It = new Pt();
426
+ class Rt extends g {
424
427
  constructor() {
425
428
  super("MiLaboratories.Controller.Shared.uploadapi.GetPartURL.HTTPHeader", [
426
429
  {
@@ -490,8 +493,8 @@ class Lt extends g {
490
493
  ), t;
491
494
  }
492
495
  }
493
- const E = new Lt();
494
- class Pt extends g {
496
+ const E = new Rt();
497
+ class St extends g {
495
498
  constructor() {
496
499
  super("MiLaboratories.Controller.Shared.uploadapi.GetPartURL.Response", [
497
500
  {
@@ -607,8 +610,8 @@ class Pt extends g {
607
610
  ), t;
608
611
  }
609
612
  }
610
- const It = new Pt();
611
- class Rt extends g {
613
+ const Nt = new St();
614
+ class Ut extends g {
612
615
  constructor() {
613
616
  super("MiLaboratories.Controller.Shared.uploadapi.Finalize", []);
614
617
  }
@@ -628,8 +631,8 @@ class Rt extends g {
628
631
  ), t;
629
632
  }
630
633
  }
631
- new Rt();
632
- class St extends g {
634
+ new Ut();
635
+ class Bt extends g {
633
636
  constructor() {
634
637
  super("MiLaboratories.Controller.Shared.uploadapi.Finalize.Request", [
635
638
  {
@@ -683,8 +686,8 @@ class St extends g {
683
686
  ), t;
684
687
  }
685
688
  }
686
- const Nt = new St();
687
- class Ut extends g {
689
+ const Dt = new Bt();
690
+ class vt extends g {
688
691
  constructor() {
689
692
  super("MiLaboratories.Controller.Shared.uploadapi.Finalize.Response", []);
690
693
  }
@@ -704,36 +707,36 @@ class Ut extends g {
704
707
  ), t;
705
708
  }
706
709
  }
707
- const Bt = new Ut(), W = new D(
710
+ const $t = new vt(), W = new D(
708
711
  "MiLaboratories.Controller.Shared.Upload",
709
712
  [
710
713
  {
711
714
  name: "Init",
712
715
  options: {},
713
- I: ht,
714
- O: pt
716
+ I: gt,
717
+ O: mt
715
718
  },
716
719
  {
717
720
  name: "GetPartURL",
718
721
  options: {},
719
- I: kt,
720
- O: It
722
+ I: It,
723
+ O: Nt
721
724
  },
722
725
  {
723
726
  name: "UpdateProgress",
724
727
  options: {},
725
- I: mt,
726
- O: yt
728
+ I: bt,
729
+ O: kt
727
730
  },
728
731
  {
729
732
  name: "Finalize",
730
733
  options: {},
731
- I: Nt,
732
- O: Bt
734
+ I: Dt,
735
+ O: $t
733
736
  }
734
737
  ]
735
738
  );
736
- class Dt {
739
+ class _t {
737
740
  constructor(e) {
738
741
  d(this, "typeName", W.typeName);
739
742
  d(this, "methods", W.methods);
@@ -794,26 +797,23 @@ class Dt {
794
797
  return y("unary", this._transport, n, r, e);
795
798
  }
796
799
  }
797
- class Le extends Error {
798
- }
799
800
  class Pe extends Error {
800
801
  }
801
- class vt extends Error {
802
- }
803
802
  class Ie extends Error {
804
803
  }
805
- class $t {
804
+ class Ct extends Error {
805
+ }
806
+ class Re extends Error {
807
+ }
808
+ class Ot {
806
809
  constructor(e, t, n, r) {
807
810
  d(this, "grpcClient");
808
- this.grpcTransport = e, this.httpClient = t, this.logger = r, this.grpcClient = new Dt(this.grpcTransport);
811
+ this.grpcTransport = e, this.httpClient = t, this.logger = r, this.grpcClient = new _t(this.grpcTransport);
809
812
  }
810
813
  close() {
811
814
  }
812
815
  async initUpload({ id: e, type: t }, n) {
813
- const r = await this.grpcClient.init(
814
- { resourceId: e },
815
- k(t, n)
816
- );
816
+ const r = await this.grpcClient.init({ resourceId: e }, k(t, n));
817
817
  return this.partsToUpload(r.response);
818
818
  }
819
819
  async partUpload({ id: e, type: t }, n, r, o, c, i) {
@@ -825,23 +825,16 @@ class $t {
825
825
  // we update progress as a separate call later.
826
826
  },
827
827
  k(t, i)
828
- ).response, { chunk: a, mTime: p } = await this.readChunk(
829
- n,
830
- l.chunkStart,
831
- l.chunkEnd
832
- );
828
+ ).response, { chunk: a, mTime: p } = await this.readChunk(n, l.chunkStart, l.chunkEnd);
833
829
  if (p > c)
834
- throw new Le(
830
+ throw new Pe(
835
831
  "file was modified, expected mtime: " + c + ", got: " + p + "."
836
832
  );
837
- const P = await be(
838
- l.uploadUrl,
839
- this.prepareUploadOpts(l, a)
840
- ), le = await P.body.text();
833
+ const P = await Te(l.uploadUrl, this.prepareUploadOpts(l, a)), le = await P.body.text();
841
834
  if (this.logger.info(
842
835
  `uploaded chunk ${r} from ${o} of resource: ${e}, response: '${le.toString()}', status code: ${P.statusCode}`
843
836
  ), P.statusCode != 200)
844
- throw new vt(
837
+ throw new Ct(
845
838
  `response is not ok, status code: ${P.statusCode}, body: ${le}, headers: ${P.headers}, url: ${l.uploadUrl}`
846
839
  );
847
840
  await this.grpcClient.updateProgress(
@@ -853,10 +846,7 @@ class $t {
853
846
  );
854
847
  }
855
848
  async finalizeUpload({ id: e, type: t }, n) {
856
- return await this.grpcClient.finalize(
857
- { resourceId: e },
858
- k(t, n)
859
- );
849
+ return await this.grpcClient.finalize({ resourceId: e }, k(t, n));
860
850
  }
861
851
  async readChunk(e, t, n) {
862
852
  let r;
@@ -868,7 +858,7 @@ class $t {
868
858
  mTime: BigInt(Math.floor(a.mtimeMs / 1e3))
869
859
  };
870
860
  } catch (o) {
871
- throw o.code == "ENOENT" ? new Ie(`there is no file ${e} for uploading`) : o;
861
+ throw o.code == "ENOENT" ? new Re(`there is no file ${e} for uploading`) : o;
872
862
  } finally {
873
863
  r == null || r.close();
874
864
  }
@@ -885,7 +875,7 @@ class $t {
885
875
  r + o
886
876
  );
887
877
  if (c === 0)
888
- throw new Pe("file ended earlier than expected.");
878
+ throw new Ie("file ended earlier than expected.");
889
879
  o += c;
890
880
  }
891
881
  return o;
@@ -908,7 +898,7 @@ class $t {
908
898
  };
909
899
  }
910
900
  }
911
- class _t extends g {
901
+ class Ft extends g {
912
902
  constructor() {
913
903
  super("google.protobuf.Duration", [
914
904
  {
@@ -948,7 +938,7 @@ class _t extends g {
948
938
  internalJsonRead(e, t, n) {
949
939
  if (typeof e != "string")
950
940
  throw new Error(
951
- "Unable to parse Duration from JSON " + ye(e) + ". Expected string."
941
+ "Unable to parse Duration from JSON " + be(e) + ". Expected string."
952
942
  );
953
943
  let r = e.match(/^(-?)([0-9]+)(?:\.([0-9]+))?s/);
954
944
  if (r === null)
@@ -1012,8 +1002,8 @@ class _t extends g {
1012
1002
  ), t;
1013
1003
  }
1014
1004
  }
1015
- const $ = new _t();
1016
- class Ct extends g {
1005
+ const $ = new Ft();
1006
+ class Et extends g {
1017
1007
  constructor() {
1018
1008
  super("MiLaboratories.Controller.Shared.ProgressAPI", []);
1019
1009
  }
@@ -1033,8 +1023,8 @@ class Ct extends g {
1033
1023
  ), t;
1034
1024
  }
1035
1025
  }
1036
- new Ct();
1037
- class Ot extends g {
1026
+ new Et();
1027
+ class Wt extends g {
1038
1028
  constructor() {
1039
1029
  super("MiLaboratories.Controller.Shared.ProgressAPI.Report", [
1040
1030
  {
@@ -1133,8 +1123,8 @@ class Ot extends g {
1133
1123
  ), t;
1134
1124
  }
1135
1125
  }
1136
- const S = new Ot();
1137
- class Ft extends g {
1126
+ const S = new Wt();
1127
+ class At extends g {
1138
1128
  constructor() {
1139
1129
  super("MiLaboratories.Controller.Shared.ProgressAPI.GetStatus", []);
1140
1130
  }
@@ -1154,8 +1144,8 @@ class Ft extends g {
1154
1144
  ), t;
1155
1145
  }
1156
1146
  }
1157
- new Ft();
1158
- class Et extends g {
1147
+ new At();
1148
+ class zt extends g {
1159
1149
  constructor() {
1160
1150
  super("MiLaboratories.Controller.Shared.ProgressAPI.GetStatus.Request", [
1161
1151
  {
@@ -1213,8 +1203,8 @@ class Et extends g {
1213
1203
  ), t;
1214
1204
  }
1215
1205
  }
1216
- const Wt = new Et();
1217
- class zt extends g {
1206
+ const xt = new zt();
1207
+ class Mt extends g {
1218
1208
  constructor() {
1219
1209
  super("MiLaboratories.Controller.Shared.ProgressAPI.GetStatus.Response", [
1220
1210
  { no: 1, name: "report", kind: "message", T: () => S }
@@ -1274,8 +1264,8 @@ class zt extends g {
1274
1264
  ), t;
1275
1265
  }
1276
1266
  }
1277
- const At = new zt();
1278
- class xt extends g {
1267
+ const Ht = new Mt();
1268
+ class jt extends g {
1279
1269
  constructor() {
1280
1270
  super("MiLaboratories.Controller.Shared.ProgressAPI.RealtimeStatus", []);
1281
1271
  }
@@ -1295,8 +1285,8 @@ class xt extends g {
1295
1285
  ), t;
1296
1286
  }
1297
1287
  }
1298
- new xt();
1299
- class Mt extends g {
1288
+ new jt();
1289
+ class Gt extends g {
1300
1290
  constructor() {
1301
1291
  super(
1302
1292
  "MiLaboratories.Controller.Shared.ProgressAPI.RealtimeStatus.Request",
@@ -1371,8 +1361,8 @@ class Mt extends g {
1371
1361
  ), t;
1372
1362
  }
1373
1363
  }
1374
- const Ht = new Mt();
1375
- class jt extends g {
1364
+ const Vt = new Gt();
1365
+ class qt extends g {
1376
1366
  constructor() {
1377
1367
  super(
1378
1368
  "MiLaboratories.Controller.Shared.ProgressAPI.RealtimeStatus.Response",
@@ -1433,7 +1423,7 @@ class jt extends g {
1433
1423
  ), t;
1434
1424
  }
1435
1425
  }
1436
- const Gt = new jt(), z = new D(
1426
+ const Jt = new qt(), A = new D(
1437
1427
  "MiLaboratories.Controller.Shared.Progress",
1438
1428
  [
1439
1429
  {
@@ -1441,23 +1431,23 @@ const Gt = new jt(), z = new D(
1441
1431
  options: {
1442
1432
  "google.api.http": { get: "/resources/{resource_id}/get-progress" }
1443
1433
  },
1444
- I: Wt,
1445
- O: At
1434
+ I: xt,
1435
+ O: Ht
1446
1436
  },
1447
1437
  {
1448
1438
  name: "RealtimeStatus",
1449
1439
  serverStreaming: !0,
1450
1440
  options: {},
1451
- I: Ht,
1452
- O: Gt
1441
+ I: Vt,
1442
+ O: Jt
1453
1443
  }
1454
1444
  ]
1455
1445
  );
1456
- class Vt {
1446
+ class Zt {
1457
1447
  constructor(e) {
1458
- d(this, "typeName", z.typeName);
1459
- d(this, "methods", z.methods);
1460
- d(this, "options", z.options);
1448
+ d(this, "typeName", A.typeName);
1449
+ d(this, "methods", A.methods);
1450
+ d(this, "options", A.options);
1461
1451
  this._transport = e;
1462
1452
  }
1463
1453
  /**
@@ -1475,10 +1465,10 @@ class Vt {
1475
1465
  return y("serverStreaming", this._transport, n, r, e);
1476
1466
  }
1477
1467
  }
1478
- class qt {
1468
+ class Qt {
1479
1469
  constructor(e, t, n, r) {
1480
1470
  d(this, "grpcClient");
1481
- this.grpcTransport = e, this.client = n, this.logger = r, this.grpcClient = new Vt(this.grpcTransport);
1471
+ this.grpcTransport = e, this.client = n, this.logger = r, this.grpcClient = new Zt(this.grpcTransport);
1482
1472
  }
1483
1473
  close() {
1484
1474
  }
@@ -1517,7 +1507,7 @@ class qt {
1517
1507
  }
1518
1508
  }
1519
1509
  }
1520
- class Jt extends g {
1510
+ class Xt extends g {
1521
1511
  constructor() {
1522
1512
  super("MiLaboratories.Controller.Shared.DownloadAPI", []);
1523
1513
  }
@@ -1537,8 +1527,8 @@ class Jt extends g {
1537
1527
  ), t;
1538
1528
  }
1539
1529
  }
1540
- new Jt();
1541
- class Zt extends g {
1530
+ new Xt();
1531
+ class Yt extends g {
1542
1532
  constructor() {
1543
1533
  super("MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL", []);
1544
1534
  }
@@ -1558,8 +1548,8 @@ class Zt extends g {
1558
1548
  ), t;
1559
1549
  }
1560
1550
  }
1561
- new Zt();
1562
- class Qt extends g {
1551
+ new Yt();
1552
+ class Kt extends g {
1563
1553
  constructor() {
1564
1554
  super(
1565
1555
  "MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL.Request",
@@ -1620,8 +1610,8 @@ class Qt extends g {
1620
1610
  ), t;
1621
1611
  }
1622
1612
  }
1623
- const Xt = new Qt();
1624
- class Yt extends g {
1613
+ const er = new Kt();
1614
+ class tr extends g {
1625
1615
  constructor() {
1626
1616
  super(
1627
1617
  "MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL.HTTPHeader",
@@ -1694,8 +1684,8 @@ class Yt extends g {
1694
1684
  ), t;
1695
1685
  }
1696
1686
  }
1697
- const A = new Yt();
1698
- class Kt extends g {
1687
+ const z = new tr();
1688
+ class rr extends g {
1699
1689
  constructor() {
1700
1690
  super(
1701
1691
  "MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL.Response",
@@ -1712,7 +1702,7 @@ class Kt extends g {
1712
1702
  name: "headers",
1713
1703
  kind: "message",
1714
1704
  repeat: 1,
1715
- T: () => A
1705
+ T: () => z
1716
1706
  }
1717
1707
  ]
1718
1708
  );
@@ -1737,7 +1727,7 @@ class Kt extends g {
1737
1727
  case /* repeated MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL.HTTPHeader headers */
1738
1728
  2:
1739
1729
  o.headers.push(
1740
- A.internalBinaryRead(
1730
+ z.internalBinaryRead(
1741
1731
  e,
1742
1732
  e.uint32(),
1743
1733
  n
@@ -1765,7 +1755,7 @@ class Kt extends g {
1765
1755
  internalBinaryWrite(e, t, n) {
1766
1756
  e.downloadUrl !== "" && t.tag(1, h.LengthDelimited).string(e.downloadUrl);
1767
1757
  for (let o = 0; o < e.headers.length; o++)
1768
- A.internalBinaryWrite(
1758
+ z.internalBinaryWrite(
1769
1759
  e.headers[o],
1770
1760
  t.tag(2, h.LengthDelimited).fork(),
1771
1761
  n
@@ -1778,7 +1768,7 @@ class Kt extends g {
1778
1768
  ), t;
1779
1769
  }
1780
1770
  }
1781
- const er = new Kt(), x = new D(
1771
+ const nr = new rr(), x = new D(
1782
1772
  "MiLaboratories.Controller.Shared.Download",
1783
1773
  [
1784
1774
  {
@@ -1786,12 +1776,12 @@ const er = new Kt(), x = new D(
1786
1776
  options: {
1787
1777
  "google.api.http": { get: "/resources/{resource_id}/get-download-url" }
1788
1778
  },
1789
- I: Xt,
1790
- O: er
1779
+ I: er,
1780
+ O: nr
1791
1781
  }
1792
1782
  ]
1793
1783
  );
1794
- class tr {
1784
+ class or {
1795
1785
  constructor(e) {
1796
1786
  d(this, "typeName", x.typeName);
1797
1787
  d(this, "methods", x.methods);
@@ -1808,12 +1798,12 @@ class tr {
1808
1798
  }
1809
1799
  class ae extends Error {
1810
1800
  }
1811
- class Re {
1801
+ class Se {
1812
1802
  constructor(e) {
1813
1803
  this.httpClient = e;
1814
1804
  }
1815
1805
  async downloadRemoteFile(e, t, n) {
1816
- const { statusCode: r, body: o, headers: c } = await be(e, {
1806
+ const { statusCode: r, body: o, headers: c } = await Te(e, {
1817
1807
  dispatcher: this.httpClient,
1818
1808
  headers: t,
1819
1809
  signal: n
@@ -1822,9 +1812,7 @@ class Re {
1822
1812
  const l = await et(i), a = l.substring(0, Math.min(l.length, 1e3));
1823
1813
  throw 400 <= r && r < 500 ? new ae(
1824
1814
  `Http error: statusCode: ${r} url: ${e.toString()}, beginning of body: ${a}`
1825
- ) : new Error(
1826
- `Http error: statusCode: ${r} url: ${e.toString()}`
1827
- );
1815
+ ) : new Error(`Http error: statusCode: ${r} url: ${e.toString()}`);
1828
1816
  }
1829
1817
  return {
1830
1818
  content: i,
@@ -1833,23 +1821,23 @@ class Re {
1833
1821
  }
1834
1822
  }
1835
1823
  function B(s) {
1836
- if (!Ke.isAbsolute(s)) throw new Error(`Path ${s} is not absolute.`);
1824
+ if (!Z.isAbsolute(s)) throw new Error(`Path ${s} is not absolute.`);
1837
1825
  return s;
1838
1826
  }
1839
- const rr = "storage://";
1840
- class Se extends Error {
1841
- }
1827
+ const sr = "storage://";
1842
1828
  class Ne extends Error {
1843
1829
  }
1844
- class nr {
1830
+ class Ue extends Error {
1831
+ }
1832
+ class ir {
1845
1833
  constructor(e, t, n, r) {
1846
1834
  d(this, "grpcClient");
1847
1835
  d(this, "downloadHelper");
1848
1836
  d(this, "localStorageIdsToRoot");
1849
- d(this, "isLocal", (e) => e.startsWith(rr));
1837
+ d(this, "isLocal", (e) => e.startsWith(sr));
1850
1838
  this.grpcTransport = e, this.httpClient = t, this.logger = n;
1851
1839
  for (const o of r) o.localPath !== "" && B(o.localPath);
1852
- this.grpcClient = new tr(this.grpcTransport), this.downloadHelper = new Re(t), this.localStorageIdsToRoot = new Map(
1840
+ this.grpcClient = new or(this.grpcTransport), this.downloadHelper = new Se(t), this.localStorageIdsToRoot = new Map(
1853
1841
  r.map((o) => [o.storageId, o.localPath])
1854
1842
  );
1855
1843
  }
@@ -1866,32 +1854,32 @@ class nr {
1866
1854
  const { downloadUrl: r, headers: o } = await this.getUrl(e, t, n);
1867
1855
  return this.logger.info(`download from url ${r}`), this.isLocal(r) ? await this.readLocalFile(r) : await this.downloadHelper.downloadRemoteFile(
1868
1856
  r,
1869
- sr(o),
1857
+ lr(o),
1870
1858
  n
1871
1859
  );
1872
1860
  }
1873
1861
  async readLocalFile(e) {
1874
- const t = or(e, this.localStorageIdsToRoot), r = (await m.stat(t)).size;
1862
+ const t = ar(e, this.localStorageIdsToRoot), r = (await m.stat(t)).size;
1875
1863
  return {
1876
1864
  content: re.toWeb(O.createReadStream(t)),
1877
1865
  size: r
1878
1866
  };
1879
1867
  }
1880
1868
  }
1881
- function or(s, e) {
1869
+ function ar(s, e) {
1882
1870
  const t = new URL(s);
1883
1871
  if (t.pathname == "")
1884
- throw new Ne(`url for local filepath ${s} does not match url scheme`);
1872
+ throw new Ue(`url for local filepath ${s} does not match url scheme`);
1885
1873
  const n = t.host, r = e.get(n);
1886
1874
  if (r === void 0)
1887
- throw new Se(`Unknown storage location: ${n}`);
1875
+ throw new Ne(`Unknown storage location: ${n}`);
1888
1876
  const o = decodeURIComponent(t.pathname.slice(1));
1889
1877
  return r === "" ? o : w.join(r, o);
1890
1878
  }
1891
- function sr(s) {
1879
+ function lr(s) {
1892
1880
  return Object.fromEntries(s.map(({ name: e, value: t }) => [e, t]));
1893
1881
  }
1894
- class ir extends g {
1882
+ class cr extends g {
1895
1883
  constructor() {
1896
1884
  super("google.protobuf.Timestamp", [
1897
1885
  {
@@ -1961,7 +1949,7 @@ class ir extends g {
1961
1949
  internalJsonRead(e, t, n) {
1962
1950
  if (typeof e != "string")
1963
1951
  throw new Error(
1964
- "Unable to parse Timestamp from JSON " + ye(e) + "."
1952
+ "Unable to parse Timestamp from JSON " + be(e) + "."
1965
1953
  );
1966
1954
  let r = e.match(
1967
1955
  /^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/
@@ -2024,8 +2012,8 @@ class ir extends g {
2024
2012
  ), t;
2025
2013
  }
2026
2014
  }
2027
- const M = new ir();
2028
- class ar extends g {
2015
+ const M = new cr();
2016
+ class dr extends g {
2029
2017
  constructor() {
2030
2018
  super("MiLaboratories.Controller.Shared.LsAPI", []);
2031
2019
  }
@@ -2045,8 +2033,8 @@ class ar extends g {
2045
2033
  ), t;
2046
2034
  }
2047
2035
  }
2048
- new ar();
2049
- class lr extends g {
2036
+ new dr();
2037
+ class hr extends g {
2050
2038
  constructor() {
2051
2039
  super("MiLaboratories.Controller.Shared.LsAPI.ListItem", [
2052
2040
  {
@@ -2169,8 +2157,8 @@ class lr extends g {
2169
2157
  ), t;
2170
2158
  }
2171
2159
  }
2172
- const H = new lr();
2173
- class cr extends g {
2160
+ const H = new hr();
2161
+ class ur extends g {
2174
2162
  constructor() {
2175
2163
  super("MiLaboratories.Controller.Shared.LsAPI.List", []);
2176
2164
  }
@@ -2190,8 +2178,8 @@ class cr extends g {
2190
2178
  ), t;
2191
2179
  }
2192
2180
  }
2193
- new cr();
2194
- class dr extends g {
2181
+ new ur();
2182
+ class pr extends g {
2195
2183
  constructor() {
2196
2184
  super("MiLaboratories.Controller.Shared.LsAPI.List.Request", [
2197
2185
  {
@@ -2256,8 +2244,8 @@ class dr extends g {
2256
2244
  ), t;
2257
2245
  }
2258
2246
  }
2259
- const hr = new dr();
2260
- class ur extends g {
2247
+ const gr = new pr();
2248
+ class fr extends g {
2261
2249
  constructor() {
2262
2250
  super("MiLaboratories.Controller.Shared.LsAPI.List.Response", [
2263
2251
  {
@@ -2329,10 +2317,10 @@ class ur extends g {
2329
2317
  ), t;
2330
2318
  }
2331
2319
  }
2332
- const pr = new ur(), j = new D("MiLaboratories.Controller.Shared.LS", [
2333
- { name: "List", options: {}, I: hr, O: pr }
2320
+ const mr = new fr(), j = new D("MiLaboratories.Controller.Shared.LS", [
2321
+ { name: "List", options: {}, I: gr, O: mr }
2334
2322
  ]);
2335
- class gr {
2323
+ class wr {
2336
2324
  constructor(e) {
2337
2325
  d(this, "typeName", j.typeName);
2338
2326
  d(this, "methods", j.methods);
@@ -2353,10 +2341,10 @@ class gr {
2353
2341
  );
2354
2342
  }
2355
2343
  }
2356
- class fr {
2344
+ class yr {
2357
2345
  constructor(e, t) {
2358
2346
  d(this, "grpcClient");
2359
- this.logger = t, this.grpcClient = new gr(e);
2347
+ this.logger = t, this.grpcClient = new wr(e);
2360
2348
  }
2361
2349
  close() {
2362
2350
  }
@@ -2370,7 +2358,7 @@ class fr {
2370
2358
  ).response;
2371
2359
  }
2372
2360
  }
2373
- class mr extends g {
2361
+ class br extends g {
2374
2362
  constructor() {
2375
2363
  super("MiLaboratories.Controller.Shared.StreamingAPI", []);
2376
2364
  }
@@ -2390,8 +2378,8 @@ class mr extends g {
2390
2378
  ), t;
2391
2379
  }
2392
2380
  }
2393
- new mr();
2394
- class wr extends g {
2381
+ new br();
2382
+ class Tr extends g {
2395
2383
  constructor() {
2396
2384
  super("MiLaboratories.Controller.Shared.StreamingAPI.StreamBinary", [
2397
2385
  {
@@ -2482,8 +2470,8 @@ class wr extends g {
2482
2470
  ), t;
2483
2471
  }
2484
2472
  }
2485
- const yr = new wr();
2486
- class br extends g {
2473
+ const kr = new Tr();
2474
+ class Lr extends g {
2487
2475
  constructor() {
2488
2476
  super("MiLaboratories.Controller.Shared.StreamingAPI.ReadBinary", [
2489
2477
  {
@@ -2561,8 +2549,8 @@ class br extends g {
2561
2549
  ), t;
2562
2550
  }
2563
2551
  }
2564
- const Tr = new br();
2565
- class kr extends g {
2552
+ const Pr = new Lr();
2553
+ class Ir extends g {
2566
2554
  constructor() {
2567
2555
  super("MiLaboratories.Controller.Shared.StreamingAPI.StreamText", [
2568
2556
  {
@@ -2665,8 +2653,8 @@ class kr extends g {
2665
2653
  ), t;
2666
2654
  }
2667
2655
  }
2668
- const Lr = new kr();
2669
- class Pr extends g {
2656
+ const Rr = new Ir();
2657
+ class Sr extends g {
2670
2658
  constructor() {
2671
2659
  super("MiLaboratories.Controller.Shared.StreamingAPI.ReadText", [
2672
2660
  {
@@ -2769,8 +2757,8 @@ class Pr extends g {
2769
2757
  ), t;
2770
2758
  }
2771
2759
  }
2772
- const Ir = new Pr();
2773
- class Rr extends g {
2760
+ const Nr = new Sr();
2761
+ class Ur extends g {
2774
2762
  constructor() {
2775
2763
  super("MiLaboratories.Controller.Shared.StreamingAPI.LastLines", [
2776
2764
  {
@@ -2873,8 +2861,8 @@ class Rr extends g {
2873
2861
  ), t;
2874
2862
  }
2875
2863
  }
2876
- const Sr = new Rr();
2877
- class Nr extends g {
2864
+ const Br = new Ur();
2865
+ class Dr extends g {
2878
2866
  constructor() {
2879
2867
  super("MiLaboratories.Controller.Shared.StreamingAPI.Response", [
2880
2868
  {
@@ -2951,44 +2939,44 @@ class Nr extends g {
2951
2939
  ), t;
2952
2940
  }
2953
2941
  }
2954
- const U = new Nr(), G = new D(
2942
+ const U = new Dr(), G = new D(
2955
2943
  "MiLaboratories.Controller.Shared.Streaming",
2956
2944
  [
2957
2945
  {
2958
2946
  name: "StreamBinary",
2959
2947
  serverStreaming: !0,
2960
2948
  options: {},
2961
- I: yr,
2949
+ I: kr,
2962
2950
  O: U
2963
2951
  },
2964
2952
  {
2965
2953
  name: "ReadBinary",
2966
2954
  options: {},
2967
- I: Tr,
2955
+ I: Pr,
2968
2956
  O: U
2969
2957
  },
2970
2958
  {
2971
2959
  name: "StreamText",
2972
2960
  serverStreaming: !0,
2973
2961
  options: {},
2974
- I: Lr,
2962
+ I: Rr,
2975
2963
  O: U
2976
2964
  },
2977
2965
  {
2978
2966
  name: "ReadText",
2979
2967
  options: {},
2980
- I: Ir,
2968
+ I: Nr,
2981
2969
  O: U
2982
2970
  },
2983
2971
  {
2984
2972
  name: "LastLines",
2985
2973
  options: {},
2986
- I: Sr,
2974
+ I: Br,
2987
2975
  O: U
2988
2976
  }
2989
2977
  ]
2990
2978
  );
2991
- class Ur {
2979
+ class vr {
2992
2980
  constructor(e) {
2993
2981
  d(this, "typeName", G.typeName);
2994
2982
  d(this, "methods", G.methods);
@@ -3087,10 +3075,10 @@ class Ur {
3087
3075
  );
3088
3076
  }
3089
3077
  }
3090
- class Br {
3078
+ class $r {
3091
3079
  constructor(e, t, n) {
3092
3080
  d(this, "grpcClient");
3093
- this.grpcTransport = e, this.httpClient = t, this.logger = n, this.grpcClient = new Ur(this.grpcTransport);
3081
+ this.grpcTransport = e, this.httpClient = t, this.logger = n, this.grpcClient = new vr(this.grpcTransport);
3094
3082
  }
3095
3083
  close() {
3096
3084
  }
@@ -3123,41 +3111,41 @@ class Br {
3123
3111
  )).response;
3124
3112
  }
3125
3113
  }
3126
- function Nn(s, e, t) {
3114
+ function On(s, e, t) {
3127
3115
  return e.getDriver({
3128
3116
  name: "DownloadBlob",
3129
- init: (n, r, o) => new nr(r, o, s, t)
3117
+ init: (n, r, o) => new ir(r, o, s, t)
3130
3118
  });
3131
3119
  }
3132
- function Un(s, e) {
3120
+ function Fn(s, e) {
3133
3121
  return s.getDriver({
3134
3122
  name: "StreamLogs",
3135
- init: (t, n, r) => new Br(n, r, e)
3123
+ init: (t, n, r) => new $r(n, r, e)
3136
3124
  });
3137
3125
  }
3138
- function Bn(s, e) {
3126
+ function En(s, e) {
3139
3127
  return s.getDriver({
3140
3128
  name: "UploadProgress",
3141
- init: (t, n, r) => new qt(n, r, s, e)
3129
+ init: (t, n, r) => new Qt(n, r, s, e)
3142
3130
  });
3143
3131
  }
3144
- function Dn(s, e) {
3132
+ function Wn(s, e) {
3145
3133
  return s.getDriver({
3146
3134
  name: "UploadBlob",
3147
- init: (t, n, r) => new $t(n, r, s, e)
3135
+ init: (t, n, r) => new Ot(n, r, s, e)
3148
3136
  });
3149
3137
  }
3150
- function Dr(s, e) {
3138
+ function _r(s, e) {
3151
3139
  return s.getDriver({
3152
3140
  name: "LsFiles",
3153
- init: (t, n, r) => new fr(n, e)
3141
+ init: (t, n, r) => new yr(n, e)
3154
3142
  });
3155
3143
  }
3156
- class vn {
3144
+ class An {
3157
3145
  constructor(e, t) {
3158
3146
  d(this, "updater");
3159
3147
  d(this, "schedule", () => this.updater.schedule());
3160
- this.onUpdate = e, this.sleepMs = t, this.updater = new Ue(async () => {
3148
+ this.onUpdate = e, this.sleepMs = t, this.updater = new Be(async () => {
3161
3149
  for (; ; ) {
3162
3150
  if (await this.onUpdate()) return;
3163
3151
  await oe.wait(this.sleepMs);
@@ -3165,7 +3153,7 @@ class vn {
3165
3153
  });
3166
3154
  }
3167
3155
  }
3168
- class Ue {
3156
+ class Be {
3169
3157
  constructor(e) {
3170
3158
  d(this, "updating");
3171
3159
  this.onUpdate = e;
@@ -3182,18 +3170,18 @@ class Ue {
3182
3170
  })());
3183
3171
  }
3184
3172
  }
3185
- async function $n(s, e) {
3173
+ async function zn(s, e) {
3186
3174
  return s.withReadTx("LogsDriverGetStream", async (t) => {
3187
- const n = await t.getResourceData(e, !0), r = await je(t, Ge(n, "stream"));
3175
+ const n = await t.getResourceData(e, !0), r = await Ge(t, Ve(n, "stream"));
3188
3176
  if (r.error != "")
3189
3177
  throw new Error(`while getting stream: ${r.error}`);
3190
- if (!Ve(r.valueId))
3178
+ if (!qe(r.valueId))
3191
3179
  return await t.getResourceData(r.valueId, !1);
3192
3180
  });
3193
3181
  }
3194
- const Be = "8C7#F1328%9E089B3D22", vr = /(?<stage>.*):\s*(?<progress>[\d.]+%)\s.*(?<eta>ETA:.*)/g;
3195
- function $r(s) {
3196
- const t = s.replace(Be, "").match(vr);
3182
+ const De = "8C7#F1328%9E089B3D22", Cr = /(?<stage>.*):\s*(?<progress>[\d.]+%)\s.*(?<eta>ETA:.*)/g;
3183
+ function Or(s) {
3184
+ const t = s.replace(De, "").match(Cr);
3197
3185
  if (t == null || t.length != 4)
3198
3186
  return;
3199
3187
  const [n, r, o, c] = t;
@@ -3206,23 +3194,17 @@ function $r(s) {
3206
3194
  // ETA: 00:00:07
3207
3195
  };
3208
3196
  }
3209
- async function _n(s, e, t) {
3210
- const n = await e.lastLines(
3211
- s,
3212
- 1,
3213
- 0n,
3214
- Be,
3215
- t
3216
- );
3197
+ async function xn(s, e, t) {
3198
+ const n = await e.lastLines(s, 1, 0n, De, t);
3217
3199
  if (n.data == null || n.data.length == 0)
3218
3200
  return { found: !1 };
3219
3201
  const r = n.data.toString().split(/\r?\n/)[0];
3220
3202
  if (r == null)
3221
3203
  return { found: !1 };
3222
- const o = $r(r);
3204
+ const o = Or(r);
3223
3205
  return o === void 0 ? { found: !1 } : { found: !0, ...o };
3224
3206
  }
3225
- class De {
3207
+ class ve {
3226
3208
  constructor(e) {
3227
3209
  d(this, "cache", /* @__PURE__ */ new Map());
3228
3210
  d(this, "totalSizeBytes", 0);
@@ -3245,7 +3227,7 @@ class De {
3245
3227
  if (this.totalSizeBytes <= this.softSizeBytes) return [];
3246
3228
  const e = [];
3247
3229
  let t = 0;
3248
- return Ze(this.cache).filter(([n, r]) => r.counter.isZero()).forEach(([n, r]) => {
3230
+ return Qe(this.cache).filter(([n, r]) => r.counter.isZero()).forEach(([n, r]) => {
3249
3231
  if (this.totalSizeBytes - t <= this.softSizeBytes) return;
3250
3232
  const o = ce(this.cache, n);
3251
3233
  t += o.sizeBytes, e.push(o);
@@ -3260,27 +3242,23 @@ class De {
3260
3242
  this.cache.delete(e.path), this.totalSizeBytes -= e.sizeBytes;
3261
3243
  }
3262
3244
  }
3263
- class Cn {
3245
+ class Mn {
3264
3246
  constructor(e, t) {
3265
3247
  this.logsStreamDriver = e, this.downloadDriver = t;
3266
3248
  }
3267
3249
  getLastLogs(e, t, n) {
3268
- if (n === void 0)
3269
- return b.make((o) => this.getLastLogs(e, t, o));
3250
+ if (n === void 0) return b.make((o) => this.getLastLogs(e, t, o));
3270
3251
  const r = q(n, e);
3271
3252
  if (r === void 0) {
3272
3253
  n.markUnstable("no stream in stream manager");
3273
3254
  return;
3274
3255
  }
3275
- if (V(r))
3276
- return this.downloadDriver.getLastLogs(r, t, n);
3256
+ if (V(r)) return this.downloadDriver.getLastLogs(r, t, n);
3277
3257
  try {
3278
3258
  return this.logsStreamDriver.getLastLogs(r, t, n);
3279
3259
  } catch (o) {
3280
3260
  if (o.name == "RpcError" && o.code == "NOT_FOUND") {
3281
- n.markUnstable(
3282
- `NOT_FOUND in logs stream driver while getting last logs: ${o}`
3283
- );
3261
+ n.markUnstable(`NOT_FOUND in logs stream driver while getting last logs: ${o}`);
3284
3262
  return;
3285
3263
  }
3286
3264
  throw o;
@@ -3288,31 +3266,25 @@ class Cn {
3288
3266
  }
3289
3267
  getProgressLog(e, t, n) {
3290
3268
  if (n === void 0)
3291
- return b.make(
3292
- (o) => this.getProgressLog(e, t, o)
3293
- );
3269
+ return b.make((o) => this.getProgressLog(e, t, o));
3294
3270
  const r = q(n, e);
3295
3271
  if (r === void 0) {
3296
3272
  n.markUnstable("no stream in stream manager");
3297
3273
  return;
3298
3274
  }
3299
- if (V(r))
3300
- return this.downloadDriver.getProgressLog(r, t, n);
3275
+ if (V(r)) return this.downloadDriver.getProgressLog(r, t, n);
3301
3276
  try {
3302
3277
  return this.logsStreamDriver.getProgressLog(r, t, n);
3303
3278
  } catch (o) {
3304
3279
  if (o.name == "RpcError" && o.code == "NOT_FOUND") {
3305
- n.markUnstable(
3306
- `NOT_FOUND in logs stream driver while getting a progress log: ${o}`
3307
- );
3280
+ n.markUnstable(`NOT_FOUND in logs stream driver while getting a progress log: ${o}`);
3308
3281
  return;
3309
3282
  }
3310
3283
  throw o;
3311
3284
  }
3312
3285
  }
3313
3286
  getLogHandle(e, t) {
3314
- if (t === void 0)
3315
- return b.make((r) => this.getLogHandle(e, r));
3287
+ if (t === void 0) return b.make((r) => this.getLogHandle(e, r));
3316
3288
  const n = q(t, e);
3317
3289
  if (n === void 0) {
3318
3290
  t.markUnstable("no stream in stream manager");
@@ -3321,30 +3293,10 @@ class Cn {
3321
3293
  return V(n) ? this.downloadDriver.getLogHandle(n, t) : this.logsStreamDriver.getLogHandle(n, t);
3322
3294
  }
3323
3295
  async lastLines(e, t, n, r) {
3324
- return C(e) ? await this.logsStreamDriver.lastLines(
3325
- e,
3326
- t,
3327
- n,
3328
- r
3329
- ) : await this.downloadDriver.lastLines(
3330
- e,
3331
- t,
3332
- n,
3333
- r
3334
- );
3296
+ return C(e) ? await this.logsStreamDriver.lastLines(e, t, n, r) : await this.downloadDriver.lastLines(e, t, n, r);
3335
3297
  }
3336
3298
  async readText(e, t, n, r) {
3337
- return C(e) ? await this.logsStreamDriver.readText(
3338
- e,
3339
- t,
3340
- n,
3341
- r
3342
- ) : await this.downloadDriver.readText(
3343
- e,
3344
- t,
3345
- n,
3346
- r
3347
- );
3299
+ return C(e) ? await this.logsStreamDriver.readText(e, t, n, r) : await this.downloadDriver.readText(e, t, n, r);
3348
3300
  }
3349
3301
  }
3350
3302
  function V(s) {
@@ -3357,9 +3309,9 @@ function q(s, e) {
3357
3309
  function _(s) {
3358
3310
  let e;
3359
3311
  if (C(s))
3360
- e = s.match($e);
3361
- else if (_r(s))
3362
3312
  e = s.match(_e);
3313
+ else if (Fr(s))
3314
+ e = s.match(Ce);
3363
3315
  else throw new Error(`Log handle is malformed: ${s}`);
3364
3316
  if (e == null) throw new Error(`Log handle wasn't parsed: ${s}`);
3365
3317
  const { resourceType: t, resourceVersion: n, resourceId: r } = e.groups;
@@ -3368,25 +3320,25 @@ function _(s) {
3368
3320
  type: { name: t, version: n }
3369
3321
  };
3370
3322
  }
3371
- function ve(s, e) {
3323
+ function $e(s, e) {
3372
3324
  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)}`;
3373
3325
  }
3374
- const $e = /^log\+live:\/\/log\/(?<resourceType>.*)\/(?<resourceVersion>.*)\/(?<resourceId>.*)$/;
3326
+ const _e = /^log\+live:\/\/log\/(?<resourceType>.*)\/(?<resourceVersion>.*)\/(?<resourceId>.*)$/;
3375
3327
  function C(s) {
3376
- return $e.test(s);
3377
- }
3378
- const _e = /^log\+ready:\/\/log\/(?<resourceType>.*)\/(?<resourceVersion>.*)\/(?<resourceId>.*)$/;
3379
- function _r(s) {
3380
3328
  return _e.test(s);
3381
3329
  }
3382
- const Cr = se({
3330
+ const Ce = /^log\+ready:\/\/log\/(?<resourceType>.*)\/(?<resourceVersion>.*)\/(?<resourceId>.*)$/;
3331
+ function Fr(s) {
3332
+ return Ce.test(s);
3333
+ }
3334
+ const Er = se({
3383
3335
  kv: {
3384
3336
  "ctl/file/blobInfo": T.object({
3385
3337
  sizeBytes: T.coerce.number()
3386
3338
  })
3387
3339
  }
3388
3340
  });
3389
- class On {
3341
+ class Hn {
3390
3342
  constructor(e, t, n, r, o, c) {
3391
3343
  /** Represents a Resource Id to the path of a blob as a map. */
3392
3344
  d(this, "idToDownload", /* @__PURE__ */ new Map());
@@ -3399,37 +3351,28 @@ class On {
3399
3351
  d(this, "idToLastLines", /* @__PURE__ */ new Map());
3400
3352
  d(this, "idToProgressLog", /* @__PURE__ */ new Map());
3401
3353
  d(this, "saveDir");
3402
- this.logger = e, this.clientDownload = t, this.clientLogs = n, this.signer = o, this.cache = new De(c.cacheSoftSizeBytes), this.downloadQueue = new ee(
3403
- this.logger,
3404
- c.nConcurrentDownloads
3405
- ), this.saveDir = w.resolve(r);
3354
+ this.logger = e, this.clientDownload = t, this.clientLogs = n, this.signer = o, this.cache = new ve(c.cacheSoftSizeBytes), this.downloadQueue = new ee(this.logger, c.nConcurrentDownloads), this.saveDir = w.resolve(r);
3406
3355
  }
3407
3356
  getDownloadedBlob(e, t) {
3408
- if (t === void 0)
3409
- return b.make((c) => this.getDownloadedBlob(e, c));
3357
+ if (t === void 0) return b.make((c) => this.getDownloadedBlob(e, c));
3410
3358
  const n = R(e, t), r = L();
3411
3359
  t.addOnDestroy(() => this.releaseBlob(n.id, r));
3412
- const o = this.getDownloadedBlobNoCtx(
3413
- t.watcher,
3414
- n,
3415
- r
3416
- );
3360
+ const o = this.getDownloadedBlobNoCtx(t.watcher, n, r);
3417
3361
  return o == null && t.markUnstable("download blob is still undefined"), o;
3418
3362
  }
3419
3363
  getOnDemandBlob(e, t) {
3420
- if (t === void 0)
3421
- return b.make((c) => this.getOnDemandBlob(e, c));
3422
- const n = ie(e) ? Q(e, Cr, t) : e, r = L();
3364
+ if (t === void 0) return b.make((c) => this.getOnDemandBlob(e, c));
3365
+ const n = ie(e) ? Q(e, Er, t) : e, r = L();
3423
3366
  return t.addOnDestroy(() => this.releaseOnDemandBlob(n.id, r)), this.getOnDemandBlobNoCtx(t.watcher, n, r);
3424
3367
  }
3425
3368
  getLocalPath(e) {
3426
3369
  return J(e, this.signer);
3427
3370
  }
3428
3371
  async getContent(e) {
3429
- if (zr(e)) return await Fr(this.getLocalPath(e));
3430
- if (!xr(e)) throw new Error("Malformed remote handle");
3431
- const t = Mr(e, this.signer), { content: n } = await this.clientDownload.downloadBlob(t);
3432
- return await Te(n);
3372
+ if (Mr(e)) return await Ar(this.getLocalPath(e));
3373
+ if (!jr(e)) throw new Error("Malformed remote handle");
3374
+ const t = Gr(e, this.signer), { content: n } = await this.clientDownload.downloadBlob(t);
3375
+ return await ke(n);
3433
3376
  }
3434
3377
  getDownloadedBlobNoCtx(e, t, n) {
3435
3378
  let r = this.idToDownload.get(t.id);
@@ -3448,11 +3391,11 @@ class On {
3448
3391
  }
3449
3392
  }
3450
3393
  setNewDownloadTask(e, t, n) {
3451
- const r = this.getFilePath(t.id), o = new Wr(
3394
+ const r = this.getFilePath(t.id), o = new xr(
3452
3395
  this.clientDownload,
3453
3396
  t,
3454
3397
  r,
3455
- Ar(r, this.signer)
3398
+ Hr(r, this.signer)
3456
3399
  );
3457
3400
  return this.idToDownload.set(t.id, o), o;
3458
3401
  }
@@ -3462,22 +3405,16 @@ class On {
3462
3405
  }
3463
3406
  getOnDemandBlobNoCtx(e, t, n) {
3464
3407
  let r = this.idToOnDemand.get(t.id);
3465
- return r === void 0 && (r = new Or(
3408
+ return r === void 0 && (r = new Wr(
3466
3409
  t.kv["ctl/file/blobInfo"].sizeBytes,
3467
- Hr(t, this.signer)
3410
+ Vr(t, this.signer)
3468
3411
  ), this.idToOnDemand.set(t.id, r)), r.attach(e, n), r.getHandle();
3469
3412
  }
3470
3413
  getLastLogs(e, t, n) {
3471
- if (n == null)
3472
- return b.make((i) => this.getLastLogs(e, t, i));
3414
+ if (n == null) return b.make((i) => this.getLastLogs(e, t, i));
3473
3415
  const r = R(e, n), o = L();
3474
3416
  n.addOnDestroy(() => this.releaseBlob(r.id, o));
3475
- const c = this.getLastLogsNoCtx(
3476
- n.watcher,
3477
- r,
3478
- t,
3479
- o
3480
- );
3417
+ const c = this.getLastLogsNoCtx(n.watcher, r, t, o);
3481
3418
  return c == null && n.markUnstable("either a file was not downloaded or logs was not read"), c;
3482
3419
  }
3483
3420
  getLastLogsNoCtx(e, t, n, r) {
@@ -3486,7 +3423,7 @@ class On {
3486
3423
  const c = J(o.handle, this.signer);
3487
3424
  let i = this.idToLastLines.get(t.id);
3488
3425
  if (i == null) {
3489
- const a = new de(c, n);
3426
+ const a = new he(c, n);
3490
3427
  this.idToLastLines.set(t.id, a), i = a;
3491
3428
  }
3492
3429
  const l = i.getOrSchedule(e);
@@ -3495,9 +3432,7 @@ class On {
3495
3432
  }
3496
3433
  getProgressLog(e, t, n) {
3497
3434
  if (n == null)
3498
- return b.make(
3499
- (i) => this.getProgressLog(e, t, i)
3500
- );
3435
+ return b.make((i) => this.getProgressLog(e, t, i));
3501
3436
  const r = R(e, n), o = L();
3502
3437
  n.addOnDestroy(() => this.releaseBlob(r.id, o));
3503
3438
  const c = this.getProgressLogNoCtx(
@@ -3506,9 +3441,7 @@ class On {
3506
3441
  t,
3507
3442
  o
3508
3443
  );
3509
- return c === void 0 && n.markUnstable(
3510
- "either a file was not downloaded or a progress log was not read"
3511
- ), c;
3444
+ return c === void 0 && n.markUnstable("either a file was not downloaded or a progress log was not read"), c;
3512
3445
  }
3513
3446
  getProgressLogNoCtx(e, t, n, r) {
3514
3447
  const o = this.getDownloadedBlobNoCtx(e, t, r);
@@ -3516,7 +3449,7 @@ class On {
3516
3449
  const c = J(o.handle, this.signer);
3517
3450
  let i = this.idToProgressLog.get(t.id);
3518
3451
  if (i == null) {
3519
- const a = new de(c, 1, n);
3452
+ const a = new he(c, 1, n);
3520
3453
  this.idToProgressLog.set(t.id, a), i = a;
3521
3454
  }
3522
3455
  const l = i.getOrSchedule(e);
@@ -3524,13 +3457,12 @@ class On {
3524
3457
  return l.log;
3525
3458
  }
3526
3459
  getLogHandle(e, t) {
3527
- if (t == null)
3528
- return b.make((r) => this.getLogHandle(e, r));
3460
+ if (t == null) return b.make((r) => this.getLogHandle(e, r));
3529
3461
  const n = R(e, t);
3530
3462
  return this.getLogHandleNoCtx(n);
3531
3463
  }
3532
3464
  getLogHandleNoCtx(e) {
3533
- return ve(!1, e);
3465
+ return $e(!1, e);
3534
3466
  }
3535
3467
  async lastLines(e, t, n, r) {
3536
3468
  const o = await this.clientLogs.lastLines(
@@ -3595,7 +3527,7 @@ class On {
3595
3527
  return w.resolve(w.join(this.saveDir, String(BigInt(e))));
3596
3528
  }
3597
3529
  }
3598
- class Or {
3530
+ class Wr {
3599
3531
  constructor(e, t) {
3600
3532
  d(this, "change", new N());
3601
3533
  d(this, "counter", new v());
@@ -3611,13 +3543,13 @@ class Or {
3611
3543
  return this.counter.dec(e);
3612
3544
  }
3613
3545
  }
3614
- class de {
3546
+ class he {
3615
3547
  constructor(e, t, n) {
3616
3548
  d(this, "updater");
3617
3549
  d(this, "log");
3618
3550
  d(this, "change", new N());
3619
3551
  d(this, "error");
3620
- this.path = e, this.lines = t, this.patternToSearch = n, this.updater = new Ue(async () => this.update());
3552
+ this.path = e, this.lines = t, this.patternToSearch = n, this.updater = new Be(async () => this.update());
3621
3553
  }
3622
3554
  getOrSchedule(e) {
3623
3555
  return this.change.attachWatcher(e), this.updater.schedule(), {
@@ -3627,11 +3559,7 @@ class de {
3627
3559
  }
3628
3560
  async update() {
3629
3561
  try {
3630
- const e = await Er(
3631
- this.path,
3632
- this.lines,
3633
- this.patternToSearch
3634
- );
3562
+ const e = await zr(this.path, this.lines, this.patternToSearch);
3635
3563
  this.log != e && this.change.markChanged(), this.log = e;
3636
3564
  } catch (e) {
3637
3565
  if (e.name == "RpcError" && e.code == "NOT_FOUND") {
@@ -3642,28 +3570,28 @@ class de {
3642
3570
  }
3643
3571
  }
3644
3572
  }
3645
- async function he(s) {
3573
+ async function ue(s) {
3646
3574
  try {
3647
3575
  return await m.access(s), !0;
3648
3576
  } catch {
3649
3577
  return !1;
3650
3578
  }
3651
3579
  }
3652
- async function Fr(s) {
3653
- return await Te(re.toWeb(O.createReadStream(s)));
3580
+ async function Ar(s) {
3581
+ return await ke(re.toWeb(O.createReadStream(s)));
3654
3582
  }
3655
- function Er(s, e, t) {
3583
+ function zr(s, e, t) {
3656
3584
  const n = O.createReadStream(s), r = new ne();
3657
3585
  return new Promise((o, c) => {
3658
3586
  const i = tt.createInterface(n, r), l = new rt();
3659
3587
  i.on("line", function(a) {
3660
3588
  t != null && !a.includes(t) || (l.push(a), l.length > e && l.shift());
3661
3589
  }), i.on("error", c), i.on("close", function() {
3662
- o(l.toArray().join(Z.EOL) + Z.EOL);
3590
+ o(l.toArray().join(de.EOL) + de.EOL);
3663
3591
  });
3664
3592
  });
3665
3593
  }
3666
- let Wr = class {
3594
+ let xr = class {
3667
3595
  constructor(e, t, n, r) {
3668
3596
  d(this, "counter", new v());
3669
3597
  d(this, "change", new N());
@@ -3678,10 +3606,8 @@ let Wr = class {
3678
3606
  }
3679
3607
  async download() {
3680
3608
  try {
3681
- const { content: e, size: t } = await this.clientDownload.downloadBlob(
3682
- this.rInfo
3683
- );
3684
- if (await he(w.dirname(this.path)) || await m.mkdir(w.dirname(this.path), { recursive: !0 }), await he(this.path))
3609
+ const { content: e, size: t } = await this.clientDownload.downloadBlob(this.rInfo);
3610
+ if (await ue(w.dirname(this.path)) || await m.mkdir(w.dirname(this.path), { recursive: !0 }), await ue(this.path))
3685
3611
  await e.cancel("the file already existed");
3686
3612
  else {
3687
3613
  const n = ne.toWeb(O.createWriteStream(this.path));
@@ -3689,7 +3615,7 @@ let Wr = class {
3689
3615
  }
3690
3616
  this.setDone(t);
3691
3617
  } catch (e) {
3692
- if (e instanceof ue || e instanceof ae || e instanceof Se || e instanceof Ne || e.code == "ENOENT") {
3618
+ if (e instanceof pe || e instanceof ae || e instanceof Ne || e instanceof Ue || e.code == "ENOENT") {
3693
3619
  this.setError(e), await m.rm(this.path);
3694
3620
  return;
3695
3621
  }
@@ -3715,53 +3641,41 @@ let Wr = class {
3715
3641
  this.done = !0, this.sizeBytes = e, this.change.markChanged();
3716
3642
  }
3717
3643
  abort(e) {
3718
- this.signalCtl.abort(new ue(e));
3644
+ this.signalCtl.abort(new pe(e));
3719
3645
  }
3720
3646
  setError(e) {
3721
3647
  this.error = e, this.change.markChanged();
3722
3648
  }
3723
3649
  };
3724
- class ue extends Error {
3650
+ class pe extends Error {
3725
3651
  }
3726
- const Ce = /^blob\+local:\/\/download\/(?<path>.*)#(?<signature>.*)$/;
3727
- function zr(s) {
3728
- return !!s.match(Ce);
3652
+ const Oe = /^blob\+local:\/\/download\/(?<path>.*)#(?<signature>.*)$/;
3653
+ function Mr(s) {
3654
+ return !!s.match(Oe);
3729
3655
  }
3730
3656
  function J(s, e) {
3731
- const t = s.match(Ce);
3732
- if (t === null)
3733
- throw new Error(`Local handle is malformed: ${s}, matches: ${t}`);
3657
+ const t = s.match(Oe);
3658
+ if (t === null) throw new Error(`Local handle is malformed: ${s}, matches: ${t}`);
3734
3659
  const { path: n, signature: r } = t.groups;
3735
- return e.verify(
3736
- n,
3737
- r,
3738
- `Signature verification failed for: ${s}`
3739
- ), n;
3660
+ return e.verify(n, r, `Signature verification failed for: ${s}`), n;
3740
3661
  }
3741
- function Ar(s, e) {
3662
+ function Hr(s, e) {
3742
3663
  return `blob+local://download/${s}#${e.sign(s)}`;
3743
3664
  }
3744
- const Oe = /^blob\+remote:\/\/download\/(?<content>(?<resourceType>.*)\/(?<resourceVersion>.*)\/(?<resourceId>.*))#(?<signature>.*)$/;
3745
- function xr(s) {
3746
- return !!s.match(Oe);
3665
+ const Fe = /^blob\+remote:\/\/download\/(?<content>(?<resourceType>.*)\/(?<resourceVersion>.*)\/(?<resourceId>.*))#(?<signature>.*)$/;
3666
+ function jr(s) {
3667
+ return !!s.match(Fe);
3747
3668
  }
3748
- function Mr(s, e) {
3749
- const t = s.match(Oe);
3750
- if (t === null)
3751
- throw new Error(
3752
- `Remote handle is malformed: ${s}, matches: ${t}`
3753
- );
3669
+ function Gr(s, e) {
3670
+ const t = s.match(Fe);
3671
+ if (t === null) throw new Error(`Remote handle is malformed: ${s}, matches: ${t}`);
3754
3672
  const { content: n, resourceType: r, resourceVersion: o, resourceId: c, signature: i } = t.groups;
3755
- return e.verify(
3756
- n,
3757
- i,
3758
- `Signature verification failed for ${s}`
3759
- ), {
3673
+ return e.verify(n, i, `Signature verification failed for ${s}`), {
3760
3674
  id: Y(BigInt(c)),
3761
3675
  type: { name: r, version: o }
3762
3676
  };
3763
3677
  }
3764
- function Hr(s, e) {
3678
+ function Vr(s, e) {
3765
3679
  const t = `${s.type.name}/${s.type.version}/${BigInt(s.id)}`;
3766
3680
  return `blob+remote://download/${t}#${e.sign(t)}`;
3767
3681
  }
@@ -3774,29 +3688,29 @@ const F = T.object({
3774
3688
  sizeBytes: T.string(),
3775
3689
  /** Modification time unix timestamp in seconds */
3776
3690
  modificationTime: T.string()
3777
- }), Fe = T.object({
3691
+ }), Ee = T.object({
3778
3692
  /** Pl storage id */
3779
3693
  storageId: T.string(),
3780
3694
  /** Path inside storage */
3781
3695
  path: T.string()
3782
- }), En = T.union([
3696
+ }), Gn = T.union([
3783
3697
  F,
3784
- Fe
3785
- ]), jr = se({
3698
+ Ee
3699
+ ]), qr = se({
3786
3700
  data: F,
3787
3701
  fields: {
3788
3702
  blob: !1
3789
3703
  }
3790
- }), Gr = se({
3704
+ }), Jr = se({
3791
3705
  fields: {
3792
3706
  incarnation: !1
3793
3707
  }
3794
3708
  });
3795
- function Vr(s, e) {
3796
- const t = ie(s) ? e.accessor(s).node() : ot(s) ? s.node() : s;
3797
- return t.resourceType.name.startsWith("BlobUpload") ? Q(t, jr) : Q(t, Gr);
3709
+ function Zr(s, e) {
3710
+ const t = ie(s) ? e.accessor(s).node() : st(s) ? s.node() : s;
3711
+ return t.resourceType.name.startsWith("BlobUpload") ? Q(t, qr) : Q(t, Jr);
3798
3712
  }
3799
- class Wn {
3713
+ class Vn {
3800
3714
  constructor(e, t, n, r, o = {
3801
3715
  nConcurrentPartUploads: 10,
3802
3716
  nConcurrentGetProgresses: 10,
@@ -3819,7 +3733,7 @@ class Wn {
3819
3733
  // 15 seconds
3820
3734
  backoffMultiplier: 1.5,
3821
3735
  jitter: 0.5
3822
- }), this.hooks = new ke(
3736
+ }), this.hooks = new Le(
3823
3737
  () => this.startUpdating(),
3824
3738
  () => this.stopUpdating(),
3825
3739
  { stopDebounce: o.stopPollingDelay },
@@ -3828,16 +3742,16 @@ class Wn {
3828
3742
  }
3829
3743
  getProgressId(e, t) {
3830
3744
  if (t == null) return b.make((c) => this.getProgressId(e, c));
3831
- const n = ie(e) ? Vr(e, t) : e, r = L();
3745
+ const n = ie(e) ? Zr(e, t) : e, r = L();
3832
3746
  t.attacheHooks(this.hooks), t.addOnDestroy(() => this.release(n.id, r));
3833
3747
  const o = this.getProgressIdNoCtx(t.watcher, n, r);
3834
- return pe(o) || t.markUnstable(`upload/index progress was got, but it's not stable: ${o}`), o;
3748
+ return ge(o) || t.markUnstable(`upload/index progress was got, but it's not stable: ${o}`), o;
3835
3749
  }
3836
3750
  getProgressIdNoCtx(e, t, n) {
3837
3751
  const r = "blob" in t.fields ? t.fields.blob !== void 0 : t.fields.incarnation !== void 0, o = this.idToProgress.get(t.id);
3838
3752
  if (o != null)
3839
3753
  return o.attach(e, n), o.mustGetProgress(r);
3840
- const c = new qr(
3754
+ const c = new Qr(
3841
3755
  this.logger,
3842
3756
  this.clientBlob,
3843
3757
  this.clientProgress,
@@ -3847,7 +3761,7 @@ class Wn {
3847
3761
  );
3848
3762
  return this.idToProgress.set(t.id, c), c.attach(e, n), c.progress.isUpload && c.progress.isUploadSignMatch && this.uploadQueue.push({
3849
3763
  fn: () => c.uploadBlobTask(),
3850
- recoverableErrorPredicate: (i) => !Ee(i)
3764
+ recoverableErrorPredicate: (i) => !We(i)
3851
3765
  }), c.mustGetProgress(r);
3852
3766
  }
3853
3767
  /** Decrement counters for the file and remove an uploading if counter == 0. */
@@ -3889,10 +3803,10 @@ class Wn {
3889
3803
  this.currentLoop = void 0;
3890
3804
  }
3891
3805
  getAllNotDoneProgresses() {
3892
- return Array.from(this.idToProgress.entries()).filter(([e, t]) => !pe(t.progress)).map(([e, t]) => t);
3806
+ return Array.from(this.idToProgress.entries()).filter(([e, t]) => !ge(t.progress)).map(([e, t]) => t);
3893
3807
  }
3894
3808
  }
3895
- class qr {
3809
+ class Qr {
3896
3810
  constructor(e, t, n, r, o, c) {
3897
3811
  d(this, "change", new N());
3898
3812
  d(this, "counter", new v());
@@ -3903,7 +3817,7 @@ class qr {
3903
3817
  this.logger = e, this.clientBlob = t, this.clientProgress = n, this.nConcurrentPartsUpload = r, this.res = c;
3904
3818
  const i = c.type.name.startsWith("BlobUpload");
3905
3819
  let l;
3906
- i && (this.uploadData = F.parse(c.data), l = Zr(
3820
+ i && (this.uploadData = F.parse(c.data), l = Yr(
3907
3821
  o,
3908
3822
  this.uploadData.localPath,
3909
3823
  this.uploadData.pathSignature
@@ -3933,11 +3847,11 @@ class qr {
3933
3847
  try {
3934
3848
  await this.uploadBlob();
3935
3849
  } catch (e) {
3936
- if (this.setLastError(e), ge(e)) {
3850
+ if (this.setLastError(e), fe(e)) {
3937
3851
  this.logger.warn(`resource was deleted while uploading a blob: ${e}`), this.change.markChanged(), this.setDone(!0);
3938
3852
  return;
3939
3853
  }
3940
- throw this.logger.error(`error while uploading a blob: ${e}`), this.change.markChanged(), Ee(e) && this.terminateWithError(e), e;
3854
+ throw this.logger.error(`error while uploading a blob: ${e}`), this.change.markChanged(), We(e) && this.terminateWithError(e), e;
3941
3855
  }
3942
3856
  }
3943
3857
  /** Uploads a blob using client. */
@@ -3968,15 +3882,15 @@ class qr {
3968
3882
  async updateStatus() {
3969
3883
  try {
3970
3884
  const e = await this.clientProgress.getStatus(this.res), t = this.progress.status;
3971
- this.progress.status = Jr(e), this.setDone(e.done), (e.done || e.progress != (t == null ? void 0 : t.progress)) && this.change.markChanged();
3885
+ this.progress.status = Xr(e), this.setDone(e.done), (e.done || e.progress != (t == null ? void 0 : t.progress)) && this.change.markChanged();
3972
3886
  } catch (e) {
3973
3887
  if (this.setLastError(e), e.name == "RpcError" && e.code == "DEADLINE_EXCEEDED") {
3974
3888
  this.logger.warn("deadline exceeded while getting a status of BlobImport");
3975
3889
  return;
3976
3890
  }
3977
- if (ge(e)) {
3891
+ if (fe(e)) {
3978
3892
  this.logger.warn(
3979
- `resource was not found while updating a status of BlobImport: ${e}, ${qe(this.res)}`
3893
+ `resource was not found while updating a status of BlobImport: ${e}, ${Je(this.res)}`
3980
3894
  ), this.change.markChanged(), this.setDone(!0);
3981
3895
  return;
3982
3896
  }
@@ -3984,30 +3898,30 @@ class qr {
3984
3898
  }
3985
3899
  }
3986
3900
  }
3987
- function pe(s) {
3901
+ function ge(s) {
3988
3902
  return s.done && s.status !== void 0 && s.status !== null && s.status.progress >= 1;
3989
3903
  }
3990
- function Jr(s) {
3904
+ function Xr(s) {
3991
3905
  return {
3992
3906
  progress: s.progress ?? 0,
3993
3907
  bytesProcessed: Number(s.bytesProcessed),
3994
3908
  bytesTotal: Number(s.bytesTotal)
3995
3909
  };
3996
3910
  }
3997
- function Zr(s, e, t) {
3911
+ function Yr(s, e, t) {
3998
3912
  try {
3999
3913
  return s.verify(e, t), !0;
4000
3914
  } catch {
4001
3915
  return !1;
4002
3916
  }
4003
3917
  }
4004
- function Ee(s) {
4005
- return s instanceof Le || s instanceof Pe || s instanceof Ie;
3918
+ function We(s) {
3919
+ return s instanceof Pe || s instanceof Ie || s instanceof Re;
4006
3920
  }
4007
- function ge(s) {
3921
+ function fe(s) {
4008
3922
  return s.name == "RpcError" && (s.code == "NOT_FOUND" || s.code == "ABORTED" || s.code == "ALREADY_EXISTS");
4009
3923
  }
4010
- class zn {
3924
+ class qn {
4011
3925
  constructor(e, t = {
4012
3926
  nConcurrentGetLogs: 10,
4013
3927
  pollingInterval: 1e3,
@@ -4024,7 +3938,7 @@ class zn {
4024
3938
  d(this, "keepRunning", !1);
4025
3939
  /** Actual state of main loop. */
4026
3940
  d(this, "currentLoop");
4027
- this.clientLogs = e, this.opts = t, this.hooks = new ke(
3941
+ this.clientLogs = e, this.opts = t, this.hooks = new Le(
4028
3942
  () => this.startUpdating(),
4029
3943
  () => this.stopUpdating(),
4030
3944
  { stopDebounce: t.stopPollingDelay },
@@ -4032,8 +3946,7 @@ class zn {
4032
3946
  );
4033
3947
  }
4034
3948
  getLastLogs(e, t, n) {
4035
- if (n == null)
4036
- return b.make((i) => this.getLastLogs(e, t, i));
3949
+ if (n == null) return b.make((i) => this.getLastLogs(e, t, i));
4037
3950
  const r = R(e, n), o = L();
4038
3951
  n.attacheHooks(this.hooks), n.addOnDestroy(() => this.releaseLastLogs(r.id, o));
4039
3952
  const c = this.getLastLogsNoCtx(n.watcher, r, t, o);
@@ -4044,7 +3957,7 @@ class zn {
4044
3957
  getLastLogsNoCtx(e, t, n, r) {
4045
3958
  let o = this.idToLastLines.get(t.id);
4046
3959
  if (o == null) {
4047
- const i = new fe(this.clientLogs, t, n);
3960
+ const i = new me(this.clientLogs, t, n);
4048
3961
  this.idToLastLines.set(t.id, i), o = i;
4049
3962
  }
4050
3963
  o.attach(e, r);
@@ -4054,17 +3967,10 @@ class zn {
4054
3967
  }
4055
3968
  getProgressLog(e, t, n) {
4056
3969
  if (n == null)
4057
- return b.make(
4058
- (i) => this.getProgressLog(e, t, i)
4059
- );
3970
+ return b.make((i) => this.getProgressLog(e, t, i));
4060
3971
  const r = R(e, n), o = L();
4061
3972
  n.attacheHooks(this.hooks), n.addOnDestroy(() => this.releaseProgressLog(r.id, o));
4062
- const c = this.getProgressLogNoCtx(
4063
- n.watcher,
4064
- r,
4065
- t,
4066
- o
4067
- );
3973
+ const c = this.getProgressLogNoCtx(n.watcher, r, t, o);
4068
3974
  return n.markUnstable(
4069
3975
  "The progress log is from the stream, so we consider it unstable. Final value will be got from blobs."
4070
3976
  ), c;
@@ -4072,12 +3978,7 @@ class zn {
4072
3978
  getProgressLogNoCtx(e, t, n, r) {
4073
3979
  let o = this.idToProgressLog.get(t.id);
4074
3980
  if (o == null) {
4075
- const i = new fe(
4076
- this.clientLogs,
4077
- t,
4078
- 1,
4079
- n
4080
- );
3981
+ const i = new me(this.clientLogs, t, 1, n);
4081
3982
  this.idToProgressLog.set(t.id, i), o = i;
4082
3983
  }
4083
3984
  o.attach(e, r);
@@ -4086,13 +3987,12 @@ class zn {
4086
3987
  return c.log;
4087
3988
  }
4088
3989
  getLogHandle(e, t) {
4089
- if (t == null)
4090
- return b.make((o) => this.getLogHandle(e, o));
3990
+ if (t == null) return b.make((o) => this.getLogHandle(e, o));
4091
3991
  const n = R(e, t), r = this.getLogHandleNoCtx(n);
4092
3992
  return t.markUnstable(), r;
4093
3993
  }
4094
3994
  getLogHandleNoCtx(e) {
4095
- return ve(!0, e);
3995
+ return $e(!0, e);
4096
3996
  }
4097
3997
  async lastLines(e, t, n, r) {
4098
3998
  return await this.tryWithNotFound(
@@ -4108,19 +4008,12 @@ class zn {
4108
4008
  async readText(e, t, n, r) {
4109
4009
  return await this.tryWithNotFound(
4110
4010
  e,
4111
- () => this.clientLogs.readText(
4112
- _(e),
4113
- t,
4114
- BigInt(n ?? 0),
4115
- r
4116
- )
4011
+ () => this.clientLogs.readText(_(e), t, BigInt(n ?? 0), r)
4117
4012
  );
4118
4013
  }
4119
4014
  async tryWithNotFound(e, t) {
4120
4015
  if (!C(e))
4121
- throw new Error(
4122
- `Not live log handle was passed to live log driver, handle: ${e}`
4123
- );
4016
+ throw new Error(`Not live log handle was passed to live log driver, handle: ${e}`);
4124
4017
  try {
4125
4018
  const n = await t();
4126
4019
  return {
@@ -4164,9 +4057,7 @@ class zn {
4164
4057
  try {
4165
4058
  await te(
4166
4059
  this.opts.nConcurrentGetLogs,
4167
- this.getAllNotDoneLogs().map(
4168
- (t) => async () => await t.update()
4169
- )
4060
+ this.getAllNotDoneLogs().map((t) => async () => await t.update())
4170
4061
  ), e.forEach((t) => t.resolve());
4171
4062
  } catch (t) {
4172
4063
  console.error(t), e.forEach((n) => n.reject(t));
@@ -4180,7 +4071,7 @@ class zn {
4180
4071
  return Array.from(this.idToLastLines.entries()).concat(Array.from(this.idToProgressLog.entries())).filter(([e, t]) => !t.getLog().done).map(([e, t]) => t);
4181
4072
  }
4182
4073
  }
4183
- class fe {
4074
+ class me {
4184
4075
  constructor(e, t, n, r) {
4185
4076
  d(this, "logs");
4186
4077
  d(this, "error");
@@ -4221,7 +4112,7 @@ class fe {
4221
4112
  }
4222
4113
  }
4223
4114
  }
4224
- class An {
4115
+ class Jn {
4225
4116
  constructor(e, t, n, r = {
4226
4117
  cacheSoftSizeBytes: 50 * 1024 * 1024,
4227
4118
  withGunzip: !0,
@@ -4233,10 +4124,7 @@ class An {
4233
4124
  /** Writes and removes files to a hard drive and holds a counter for every
4234
4125
  * file that should be kept. */
4235
4126
  d(this, "cache");
4236
- this.logger = e, this.saveDir = n, this.opts = r, this.downloadQueue = new ee(
4237
- this.logger,
4238
- this.opts.nConcurrentDownloads
4239
- ), this.cache = new De(this.opts.cacheSoftSizeBytes), this.downloadHelper = new Re(t);
4127
+ this.logger = e, this.saveDir = n, this.opts = r, this.downloadQueue = new ee(this.logger, this.opts.nConcurrentDownloads), this.cache = new ve(this.opts.cacheSoftSizeBytes), this.downloadHelper = new Se(t);
4240
4128
  }
4241
4129
  getPath(e, t) {
4242
4130
  if (t === void 0) return b.make((o) => this.getPath(e, o));
@@ -4278,35 +4166,29 @@ class An {
4278
4166
  })
4279
4167
  );
4280
4168
  } else
4281
- r.counter.dec(t) && this.removeTask(
4282
- r,
4283
- `the task ${JSON.stringify(r)} was removed from cache`
4284
- );
4169
+ r.counter.dec(t) && this.removeTask(r, `the task ${JSON.stringify(r)} was removed from cache`);
4285
4170
  }
4286
4171
  /** Removes all files from a hard drive. */
4287
4172
  async releaseAll() {
4288
4173
  this.downloadQueue.stop(), await Promise.all(
4289
4174
  Array.from(this.urlToDownload.entries()).map(async ([e, t]) => {
4290
- await X(t.path), this.cache.removeCache(t), this.removeTask(
4291
- t,
4292
- `the task ${t} was released when the driver was closed`
4293
- );
4175
+ await X(t.path), this.cache.removeCache(t), this.removeTask(t, `the task ${t} was released when the driver was closed`);
4294
4176
  })
4295
4177
  );
4296
4178
  }
4297
4179
  setNewTask(e, t, n) {
4298
- const r = new Qr(this.getFilePath(t), t);
4180
+ const r = new Kr(this.getFilePath(t), t);
4299
4181
  return r.attach(e, n), this.urlToDownload.set(t.toString(), r), r;
4300
4182
  }
4301
4183
  removeTask(e, t) {
4302
4184
  e.abort(t), e.change.markChanged(), this.urlToDownload.delete(e.url.toString());
4303
4185
  }
4304
4186
  getFilePath(e) {
4305
- const t = nt("sha256").update(e.toString()).digest("hex");
4187
+ const t = ot("sha256").update(e.toString()).digest("hex");
4306
4188
  return w.join(this.saveDir, t);
4307
4189
  }
4308
4190
  }
4309
- class Qr {
4191
+ class Kr {
4310
4192
  constructor(e, t) {
4311
4193
  d(this, "counter", new v());
4312
4194
  d(this, "change", new N());
@@ -4328,7 +4210,7 @@ class Qr {
4328
4210
  );
4329
4211
  this.setDone(n);
4330
4212
  } catch (n) {
4331
- if (n instanceof me || n instanceof ae) {
4213
+ if (n instanceof we || n instanceof ae) {
4332
4214
  this.setError(n), await X(this.path);
4333
4215
  return;
4334
4216
  }
@@ -4336,19 +4218,15 @@ class Qr {
4336
4218
  }
4337
4219
  }
4338
4220
  async downloadAndUntar(e, t, n) {
4339
- if (await Qe(this.path))
4340
- return await We(this.path);
4341
- const r = await e.downloadRemoteFile(
4342
- this.url.toString(),
4343
- {},
4344
- n
4345
- );
4221
+ if (await Xe(this.path))
4222
+ return await Ae(this.path);
4223
+ const r = await e.downloadRemoteFile(this.url.toString(), {}, n);
4346
4224
  let o = r.content;
4347
4225
  if (t) {
4348
- const i = Ye.toWeb(st.createGunzip());
4226
+ const i = Ke.toWeb(it.createGunzip());
4349
4227
  o = o.pipeThrough(i, { signal: n });
4350
4228
  }
4351
- const c = ne.toWeb(it.extract(this.path));
4229
+ const c = ne.toWeb(at.extract(this.path));
4352
4230
  return await o.pipeTo(c, { signal: n }), r.size;
4353
4231
  }
4354
4232
  getPath() {
@@ -4359,33 +4237,33 @@ class Qr {
4359
4237
  this.done = !0, this.sizeBytes = e, this.change.markChanged();
4360
4238
  }
4361
4239
  abort(e) {
4362
- this.signalCtl.abort(new me(e));
4240
+ this.signalCtl.abort(new we(e));
4363
4241
  }
4364
4242
  setError(e) {
4365
4243
  this.error = String(e), this.change.markChanged();
4366
4244
  }
4367
4245
  }
4368
- class me extends Error {
4246
+ class we extends Error {
4369
4247
  }
4370
- async function We(s) {
4248
+ async function Ae(s) {
4371
4249
  const e = await m.readdir(s, { withFileTypes: !0 });
4372
4250
  return (await Promise.all(
4373
4251
  e.map(async (n) => {
4374
4252
  const r = w.join(s, n.name);
4375
- return n.isDirectory() ? await We(r) : (await m.stat(r)).size;
4253
+ return n.isDirectory() ? await Ae(r) : (await m.stat(r)).size;
4376
4254
  })
4377
4255
  )).reduce((n, r) => n + r, 0);
4378
4256
  }
4379
4257
  async function X(s) {
4380
4258
  await m.rm(s, { recursive: !0, force: !0 });
4381
4259
  }
4382
- function we(s, e) {
4260
+ function ye(s, e) {
4383
4261
  return `index://index/${encodeURIComponent(JSON.stringify({
4384
4262
  storageId: s,
4385
4263
  path: e
4386
4264
  }))}`;
4387
4265
  }
4388
- function Xr(s, e, t, n) {
4266
+ function en(s, e, t, n) {
4389
4267
  const r = {
4390
4268
  localPath: s,
4391
4269
  pathSignature: e.sign(s),
@@ -4394,31 +4272,31 @@ function Xr(s, e, t, n) {
4394
4272
  };
4395
4273
  return `upload://upload/${encodeURIComponent(JSON.stringify(r))}`;
4396
4274
  }
4397
- function Yr(s) {
4275
+ function tn(s) {
4398
4276
  const e = new URL(s);
4399
4277
  return F.parse(
4400
4278
  JSON.parse(decodeURIComponent(e.pathname.substring(1)))
4401
4279
  );
4402
4280
  }
4403
- function Kr(s) {
4281
+ function rn(s) {
4404
4282
  const e = new URL(s);
4405
- return Fe.parse(JSON.parse(decodeURIComponent(e.pathname.substring(1))));
4283
+ return Ee.parse(JSON.parse(decodeURIComponent(e.pathname.substring(1))));
4406
4284
  }
4407
- function en(s) {
4285
+ function nn(s) {
4286
+ if (ln(s))
4287
+ return dn(s);
4408
4288
  if (on(s))
4409
4289
  return an(s);
4410
- if (tn(s))
4411
- return nn(s);
4412
- Xe(s);
4290
+ Ye(s);
4413
4291
  }
4414
4292
  const ze = /^local:\/\/(?<name>.*)\/(?<path>.*)$/;
4415
- function tn(s) {
4293
+ function on(s) {
4416
4294
  return ze.test(s);
4417
4295
  }
4418
- function rn(s, e) {
4296
+ function sn(s, e) {
4419
4297
  return `local://${s}/${encodeURIComponent(e)}`;
4420
4298
  }
4421
- function nn(s) {
4299
+ function an(s) {
4422
4300
  const e = s.match(ze);
4423
4301
  if (e == null) throw new Error(`Local list handle wasn't parsed: ${s}`);
4424
4302
  const { name: t, path: n } = e.groups;
@@ -4428,39 +4306,28 @@ function nn(s) {
4428
4306
  isRemote: !1
4429
4307
  };
4430
4308
  }
4431
- const Ae = /^remote:\/\/(?<name>.*)\/(?<resourceId>.*)$/;
4432
- function on(s) {
4433
- return Ae.test(s);
4309
+ const xe = /^remote:\/\/(?<name>.*)\/(?<resourceId>.*)$/;
4310
+ function ln(s) {
4311
+ return xe.test(s);
4434
4312
  }
4435
- function sn(s, e) {
4313
+ function cn(s, e) {
4436
4314
  return `remote://${s}/${BigInt(e)}`;
4437
4315
  }
4438
- function an(s) {
4439
- const e = s.match(Ae);
4316
+ function dn(s) {
4317
+ const e = s.match(xe);
4440
4318
  if (e == null) throw new Error(`Remote list handle wasn't parsed: ${s}`);
4441
4319
  const { name: t, resourceId: n } = e.groups;
4442
4320
  return {
4443
4321
  id: Y(BigInt(n)),
4444
- type: ln(t),
4322
+ type: hn(t),
4445
4323
  name: t,
4446
4324
  isRemote: !0
4447
4325
  };
4448
4326
  }
4449
- function ln(s) {
4327
+ function hn(s) {
4450
4328
  return { name: `LS/${s}`, version: "1" };
4451
4329
  }
4452
- function xn() {
4453
- const s = Z.homedir();
4454
- return w.sep === "/" ? [{ name: "local", root: "/", initialPath: s }] : [
4455
- {
4456
- name: "local",
4457
- root: w.parse(s).root,
4458
- // disk where home directory resides
4459
- initialPath: s
4460
- }
4461
- ];
4462
- }
4463
- class xe {
4330
+ class Me {
4464
4331
  constructor(e, t, n, r, o, c, i) {
4465
4332
  this.logger = e, this.lsClient = t, this.storageIdToResourceId = n, this.signer = r, this.virtualStoragesMap = o, this.localProjectionsMap = c, this.openFileDialogCallback = i;
4466
4333
  }
@@ -4492,13 +4359,13 @@ class xe {
4492
4359
  * @private
4493
4360
  */
4494
4361
  async tryResolveLocalFileHandle(e) {
4495
- if (at(e)) {
4496
- const t = Kr(e), n = this.localProjectionsMap.get(t.storageId);
4362
+ if (lt(e)) {
4363
+ const t = rn(e), n = this.localProjectionsMap.get(t.storageId);
4497
4364
  if (!n)
4498
4365
  throw new Error(`Storage ${t.storageId} is not mounted locally.`);
4499
4366
  return w.join(n.localPath, t.path);
4500
4367
  } else {
4501
- const t = Yr(e);
4368
+ const t = tn(e);
4502
4369
  this.signer.verify(
4503
4370
  t.localPath,
4504
4371
  t.pathSignature,
@@ -4515,13 +4382,13 @@ class xe {
4515
4382
  for (const n of this.localProjectionsMap.values())
4516
4383
  if (e.startsWith(n.localPath)) {
4517
4384
  const r = n.localPath === "" ? e : w.relative(n.localPath, e);
4518
- return we(
4385
+ return ye(
4519
4386
  n.storageId,
4520
4387
  r
4521
4388
  );
4522
4389
  }
4523
4390
  const t = await m.stat(e, { bigint: !0 });
4524
- return Xr(
4391
+ return en(
4525
4392
  e,
4526
4393
  this.signer,
4527
4394
  t.size,
@@ -4530,34 +4397,36 @@ class xe {
4530
4397
  );
4531
4398
  }
4532
4399
  async getStorageList() {
4533
- return [
4534
- ...[...this.virtualStoragesMap.values()].map((e) => ({
4535
- name: e.name,
4536
- handle: rn(e.name, e.root),
4537
- initialFullPath: e.initialPath
4538
- })),
4539
- ...Object.entries(this.storageIdToResourceId).map(([e, t]) => ({
4540
- name: e,
4541
- handle: sn(e, t),
4542
- initialFullPath: ""
4400
+ const e = [...this.virtualStoragesMap.values()].map((r) => ({
4401
+ name: r.name,
4402
+ handle: sn(r.name, r.root),
4403
+ initialFullPath: r.initialPath,
4404
+ isInitialPathHome: r.isInitialPathHome
4405
+ })), n = Object.entries(this.storageIdToResourceId).map(
4406
+ ([r, o]) => ({
4407
+ name: r,
4408
+ handle: cn(r, o),
4409
+ initialFullPath: "",
4543
4410
  // we don't have any additional information from where to start browsing remote storages
4544
- }))
4545
- ];
4411
+ isInitialPathHome: !1
4412
+ })
4413
+ ).filter((r) => r.name !== "root");
4414
+ return [...e, ...n];
4546
4415
  }
4547
4416
  async listFiles(e, t) {
4548
- const n = en(e);
4417
+ const n = nn(e);
4549
4418
  if (n.isRemote)
4550
4419
  return {
4551
4420
  entries: (await this.lsClient.list(n, t)).items.map((o) => ({
4552
4421
  type: o.isDir ? "dir" : "file",
4553
4422
  name: o.name,
4554
4423
  fullPath: o.fullName,
4555
- handle: we(n.name, o.fullName)
4424
+ handle: ye(n.name, o.fullName)
4556
4425
  }))
4557
4426
  };
4558
4427
  {
4559
- w.sep === "/" && t === "" && (t = "/");
4560
- const r = n.rootPath === "" ? B(t) : w.join(n.rootPath, t), o = [];
4428
+ w.sep === "/" && t === "" && (t = "/"), n.rootPath === "" && B(t);
4429
+ const r = w.isAbsolute(t) ? t : w.join(n.rootPath, t), o = [];
4561
4430
  for await (const c of await m.opendir(r)) {
4562
4431
  if (!c.isFile() && !c.isDirectory()) continue;
4563
4432
  const i = w.join(r, c.name);
@@ -4572,7 +4441,7 @@ class xe {
4572
4441
  }
4573
4442
  }
4574
4443
  static async init(e, t, n, r, o, c) {
4575
- const i = Dr(t, e);
4444
+ const i = _r(t, e);
4576
4445
  for (const p of r) B(p.root);
4577
4446
  for (const p of o) p.localPath !== "" && B(p.localPath);
4578
4447
  const l = new Map(r.map((p) => [p.name, p])), a = new Map(o.map((p) => [p.storageId, p]));
@@ -4580,10 +4449,10 @@ class xe {
4580
4449
  throw new Error(
4581
4450
  "Intersection between local projection storage ids and virtual storages names detected."
4582
4451
  );
4583
- return new xe(
4452
+ return new Me(
4584
4453
  e,
4585
4454
  i,
4586
- await cn(t),
4455
+ await un(t),
4587
4456
  n,
4588
4457
  l,
4589
4458
  a,
@@ -4591,60 +4460,91 @@ class xe {
4591
4460
  );
4592
4461
  }
4593
4462
  }
4594
- async function cn(s) {
4463
+ async function un(s) {
4595
4464
  return s.withReadTx("GetAvailableStorageIds", async (e) => {
4596
4465
  const t = await e.getResourceByName("LSProvider"), n = await e.getResourceData(t, !0);
4597
- return dn(n);
4466
+ return pn(n);
4598
4467
  });
4599
4468
  }
4600
- function dn(s) {
4469
+ function pn(s) {
4601
4470
  return Object.fromEntries(
4602
- s.fields.filter((e) => e.type == "Dynamic" && Je(e.value)).map((e) => [e.name.substring(8), e.value])
4471
+ s.fields.filter((e) => e.type == "Dynamic" && Ze(e.value)).map((e) => [e.name.substring(8), e.value])
4603
4472
  );
4604
4473
  }
4474
+ async function Zn() {
4475
+ const s = nt.homedir();
4476
+ if (Z.sep == "/")
4477
+ return [
4478
+ {
4479
+ name: "local",
4480
+ root: "/",
4481
+ initialPath: s,
4482
+ isInitialPathHome: !0
4483
+ }
4484
+ ];
4485
+ const t = Z.parse(s).root.replaceAll(":\\", ""), n = await ct.promisify(dt)("wmic logicaldisk get name"), r = gn(n.stdout);
4486
+ return fn(r, t, s);
4487
+ }
4488
+ function gn(s) {
4489
+ return s.split(`\r
4490
+ `).filter((e) => e.includes(":")).map((e) => e.trim().replaceAll(":", ""));
4491
+ }
4492
+ function fn(s, e, t) {
4493
+ return s.map((n) => {
4494
+ const r = n == e;
4495
+ return {
4496
+ name: `local_disk_${n}`,
4497
+ root: `${n}:\\`,
4498
+ initialPath: r ? t : `${n}:\\`,
4499
+ isInitialPathHome: r
4500
+ };
4501
+ });
4502
+ }
4605
4503
  export {
4606
- nr as ClientDownload,
4607
- Br as ClientLogs,
4608
- fr as ClientLs,
4609
- qt as ClientProgress,
4610
- $t as ClientUpload,
4611
- xn as DefaultVirtualLocalStorages,
4612
- Wr as Download,
4613
- On as DownloadDriver,
4614
- An as DownloadUrlDriver,
4615
- En as ImportFileHandleData,
4616
- Fe as ImportFileHandleIndexData,
4504
+ ir as ClientDownload,
4505
+ $r as ClientLogs,
4506
+ yr as ClientLs,
4507
+ Qt as ClientProgress,
4508
+ Ot as ClientUpload,
4509
+ Zn as DefaultVirtualLocalStorages,
4510
+ xr as Download,
4511
+ Hn as DownloadDriver,
4512
+ Jn as DownloadUrlDriver,
4513
+ Gn as ImportFileHandleData,
4514
+ Ee as ImportFileHandleIndexData,
4617
4515
  F as ImportFileHandleUploadData,
4618
- Gr as IndexResourceSnapshot,
4619
- Cn as LogsDriver,
4620
- zn as LogsStreamDriver,
4621
- vn as LongUpdater,
4622
- xe as LsDriver,
4623
- Le as MTimeError,
4624
- vt as NetworkError,
4625
- Ie as NoFileForUploading,
4626
- Cr as OnDemandBlobResourceSnapshot,
4627
- Pe as UnexpectedEOF,
4628
- Se as UnknownStorageError,
4629
- Ue as Updater,
4630
- Wn as UploadDriver,
4631
- jr as UploadResourceSnapshot,
4632
- Ne as WrongLocalFileUrl,
4633
- Nn as createDownloadClient,
4634
- Un as createLogsClient,
4635
- Dr as createLsFilesClient,
4636
- Dn as createUploadBlobClient,
4637
- Bn as createUploadProgressClient,
4638
- ve as dataToHandle,
4639
- $n as getStream,
4516
+ Jr as IndexResourceSnapshot,
4517
+ Mn as LogsDriver,
4518
+ qn as LogsStreamDriver,
4519
+ An as LongUpdater,
4520
+ Me as LsDriver,
4521
+ Pe as MTimeError,
4522
+ Ct as NetworkError,
4523
+ Re as NoFileForUploading,
4524
+ Er as OnDemandBlobResourceSnapshot,
4525
+ Ie as UnexpectedEOF,
4526
+ Ne as UnknownStorageError,
4527
+ Be as Updater,
4528
+ Vn as UploadDriver,
4529
+ qr as UploadResourceSnapshot,
4530
+ Ue as WrongLocalFileUrl,
4531
+ On as createDownloadClient,
4532
+ Fn as createLogsClient,
4533
+ _r as createLsFilesClient,
4534
+ Wn as createUploadBlobClient,
4535
+ En as createUploadProgressClient,
4536
+ $e as dataToHandle,
4537
+ zn as getStream,
4640
4538
  _ as handleToData,
4641
- sr as headersFromProto,
4539
+ lr as headersFromProto,
4642
4540
  C as isLiveLogHandle,
4643
- _r as isReadyLogHandle,
4644
- $r as lineToProgress,
4645
- Vr as makeBlobImportSnapshot,
4646
- _n as mixcrProgressFromLogs,
4647
- or as parseLocalFileUrl,
4648
- B as validateAbsolute
4541
+ Fr as isReadyLogHandle,
4542
+ Or as lineToProgress,
4543
+ Zr as makeBlobImportSnapshot,
4544
+ xn as mixcrProgressFromLogs,
4545
+ ar as parseLocalFileUrl,
4546
+ B as validateAbsolute,
4547
+ gn as windowsDrives,
4548
+ fn as windowsStorages
4649
4549
  };
4650
4550
  //# sourceMappingURL=index.mjs.map