@milaboratories/pl-drivers 1.2.22 → 1.2.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -10,18 +10,18 @@ import { notEmpty as O, mapGet as oe, mapEntries as Ve, TaskProcessor as X, Call
10
10
  import { Readable as K, Writable as ee, Transform as Ze } from "node:stream";
11
11
  import * as E from "node:fs";
12
12
  import * as m from "node:path";
13
- import { Computable as b, ChangeSource as S, PollingComputableHooks as me } from "@milaboratories/computable";
13
+ import { text as Je, buffer as me } from "node:stream/consumers";
14
+ import { Computable as b, ChangeSource as S, PollingComputableHooks as we } from "@milaboratories/computable";
14
15
  import { scheduler as te } from "node:timers/promises";
15
- import * as Je from "node:readline/promises";
16
- import Qe from "denque";
16
+ import * as Qe from "node:readline/promises";
17
+ import Xe from "denque";
17
18
  import * as se from "node:os";
18
- import { randomUUID as k, createHash as Xe } from "node:crypto";
19
- import { buffer as we } from "node:stream/consumers";
19
+ import { randomUUID as k, createHash as Ye } from "node:crypto";
20
20
  import { rsSchema as ye, treeEntryToResourceInfo as N, isPlTreeEntry as be, makeResourceSnapshot as Te } from "@milaboratories/pl-tree";
21
21
  import { z as L } from "zod";
22
- import * as Ye from "node:zlib";
23
- import * as Ke from "tar-fs";
24
- class et extends g {
22
+ import * as Ke from "node:zlib";
23
+ import * as et from "tar-fs";
24
+ class tt extends g {
25
25
  constructor() {
26
26
  super("MiLaboratories.Controller.Shared.uploadapi", []);
27
27
  }
@@ -41,8 +41,8 @@ class et extends g {
41
41
  ), t;
42
42
  }
43
43
  }
44
- new et();
45
- class tt extends g {
44
+ new tt();
45
+ class rt extends g {
46
46
  constructor() {
47
47
  super("MiLaboratories.Controller.Shared.uploadapi.Init", []);
48
48
  }
@@ -62,8 +62,8 @@ class tt extends g {
62
62
  ), t;
63
63
  }
64
64
  }
65
- new tt();
66
- class rt extends g {
65
+ new rt();
66
+ class nt extends g {
67
67
  constructor() {
68
68
  super("MiLaboratories.Controller.Shared.uploadapi.Init.Request", [
69
69
  {
@@ -117,8 +117,8 @@ class rt extends g {
117
117
  ), t;
118
118
  }
119
119
  }
120
- const nt = new rt();
121
- class ot extends g {
120
+ const ot = new nt();
121
+ class st extends g {
122
122
  constructor() {
123
123
  super("MiLaboratories.Controller.Shared.uploadapi.Init.Response", [
124
124
  {
@@ -193,8 +193,8 @@ class ot extends g {
193
193
  ), t;
194
194
  }
195
195
  }
196
- const st = new ot();
197
- class it extends g {
196
+ const it = new st();
197
+ class at extends g {
198
198
  constructor() {
199
199
  super("MiLaboratories.Controller.Shared.uploadapi.UpdateProgress", []);
200
200
  }
@@ -214,8 +214,8 @@ class it extends g {
214
214
  ), t;
215
215
  }
216
216
  }
217
- new it();
218
- class at extends g {
217
+ new at();
218
+ class lt extends g {
219
219
  constructor() {
220
220
  super("MiLaboratories.Controller.Shared.uploadapi.UpdateProgress.Request", [
221
221
  {
@@ -285,8 +285,8 @@ class at extends g {
285
285
  ), t;
286
286
  }
287
287
  }
288
- const lt = new at();
289
- class ct extends g {
288
+ const ct = new lt();
289
+ class dt extends g {
290
290
  constructor() {
291
291
  super(
292
292
  "MiLaboratories.Controller.Shared.uploadapi.UpdateProgress.Response",
@@ -313,8 +313,8 @@ class ct extends g {
313
313
  ), t;
314
314
  }
315
315
  }
316
- const dt = new ct();
317
- class ht extends g {
316
+ const ht = new dt();
317
+ class ut extends g {
318
318
  constructor() {
319
319
  super("MiLaboratories.Controller.Shared.uploadapi.GetPartURL", []);
320
320
  }
@@ -334,8 +334,8 @@ class ht extends g {
334
334
  ), t;
335
335
  }
336
336
  }
337
- new ht();
338
- class ut extends g {
337
+ new ut();
338
+ class pt extends g {
339
339
  constructor() {
340
340
  super("MiLaboratories.Controller.Shared.uploadapi.GetPartURL.Request", [
341
341
  {
@@ -417,8 +417,8 @@ class ut extends g {
417
417
  ), t;
418
418
  }
419
419
  }
420
- const pt = new ut();
421
- class gt extends g {
420
+ const gt = new pt();
421
+ class ft extends g {
422
422
  constructor() {
423
423
  super("MiLaboratories.Controller.Shared.uploadapi.GetPartURL.HTTPHeader", [
424
424
  {
@@ -488,8 +488,8 @@ class gt extends g {
488
488
  ), t;
489
489
  }
490
490
  }
491
- const F = new gt();
492
- class ft extends g {
491
+ const F = new ft();
492
+ class mt extends g {
493
493
  constructor() {
494
494
  super("MiLaboratories.Controller.Shared.uploadapi.GetPartURL.Response", [
495
495
  {
@@ -605,8 +605,8 @@ class ft extends g {
605
605
  ), t;
606
606
  }
607
607
  }
608
- const mt = new ft();
609
- class wt extends g {
608
+ const wt = new mt();
609
+ class yt extends g {
610
610
  constructor() {
611
611
  super("MiLaboratories.Controller.Shared.uploadapi.Finalize", []);
612
612
  }
@@ -626,8 +626,8 @@ class wt extends g {
626
626
  ), t;
627
627
  }
628
628
  }
629
- new wt();
630
- class yt extends g {
629
+ new yt();
630
+ class bt extends g {
631
631
  constructor() {
632
632
  super("MiLaboratories.Controller.Shared.uploadapi.Finalize.Request", [
633
633
  {
@@ -681,8 +681,8 @@ class yt extends g {
681
681
  ), t;
682
682
  }
683
683
  }
684
- const bt = new yt();
685
- class Tt extends g {
684
+ const Tt = new bt();
685
+ class kt extends g {
686
686
  constructor() {
687
687
  super("MiLaboratories.Controller.Shared.uploadapi.Finalize.Response", []);
688
688
  }
@@ -702,36 +702,36 @@ class Tt extends g {
702
702
  ), t;
703
703
  }
704
704
  }
705
- const kt = new Tt(), W = new v(
705
+ const Lt = new kt(), W = new v(
706
706
  "MiLaboratories.Controller.Shared.Upload",
707
707
  [
708
708
  {
709
709
  name: "Init",
710
710
  options: {},
711
- I: nt,
712
- O: st
711
+ I: ot,
712
+ O: it
713
713
  },
714
714
  {
715
715
  name: "GetPartURL",
716
716
  options: {},
717
- I: pt,
718
- O: mt
717
+ I: gt,
718
+ O: wt
719
719
  },
720
720
  {
721
721
  name: "UpdateProgress",
722
722
  options: {},
723
- I: lt,
724
- O: dt
723
+ I: ct,
724
+ O: ht
725
725
  },
726
726
  {
727
727
  name: "Finalize",
728
728
  options: {},
729
- I: bt,
730
- O: kt
729
+ I: Tt,
730
+ O: Lt
731
731
  }
732
732
  ]
733
733
  );
734
- class Lt {
734
+ class Pt {
735
735
  constructor(e) {
736
736
  d(this, "typeName", W.typeName);
737
737
  d(this, "methods", W.methods);
@@ -796,14 +796,14 @@ class ke extends Error {
796
796
  }
797
797
  class Le extends Error {
798
798
  }
799
- class Pt extends Error {
799
+ class It extends Error {
800
800
  }
801
801
  class Pe extends Error {
802
802
  }
803
- class It {
803
+ class Nt {
804
804
  constructor(e, t, n, r) {
805
805
  d(this, "grpcClient");
806
- this.grpcTransport = e, this.httpClient = t, this.logger = r, this.grpcClient = new Lt(this.grpcTransport);
806
+ this.grpcTransport = e, this.httpClient = t, this.logger = r, this.grpcClient = new Pt(this.grpcTransport);
807
807
  }
808
808
  close() {
809
809
  }
@@ -835,11 +835,11 @@ class It {
835
835
  const P = await fe(
836
836
  l.uploadUrl,
837
837
  this.prepareUploadOpts(l, a)
838
- ), ne = await (await P.body.blob()).text();
838
+ ), ne = await P.body.text();
839
839
  if (this.logger.info(
840
840
  `uploaded chunk ${r} from ${o} of resource: ${e}, response: '${ne.toString()}', status code: ${P.statusCode}`
841
841
  ), P.statusCode != 200)
842
- throw new Pt(
842
+ throw new It(
843
843
  `response is not ok, status code: ${P.statusCode}, body: ${ne}, headers: ${P.headers}, url: ${l.uploadUrl}`
844
844
  );
845
845
  await this.grpcClient.updateProgress(
@@ -906,7 +906,7 @@ class It {
906
906
  };
907
907
  }
908
908
  }
909
- class Nt extends g {
909
+ class Rt extends g {
910
910
  constructor() {
911
911
  super("google.protobuf.Duration", [
912
912
  {
@@ -1010,8 +1010,8 @@ class Nt extends g {
1010
1010
  ), t;
1011
1011
  }
1012
1012
  }
1013
- const _ = new Nt();
1014
- class Rt extends g {
1013
+ const $ = new Rt();
1014
+ class St extends g {
1015
1015
  constructor() {
1016
1016
  super("MiLaboratories.Controller.Shared.ProgressAPI", []);
1017
1017
  }
@@ -1031,8 +1031,8 @@ class Rt extends g {
1031
1031
  ), t;
1032
1032
  }
1033
1033
  }
1034
- new Rt();
1035
- class St extends g {
1034
+ new St();
1035
+ class Ut extends g {
1036
1036
  constructor() {
1037
1037
  super("MiLaboratories.Controller.Shared.ProgressAPI.Report", [
1038
1038
  {
@@ -1131,8 +1131,8 @@ class St extends g {
1131
1131
  ), t;
1132
1132
  }
1133
1133
  }
1134
- const R = new St();
1135
- class Ut extends g {
1134
+ const R = new Ut();
1135
+ class Bt extends g {
1136
1136
  constructor() {
1137
1137
  super("MiLaboratories.Controller.Shared.ProgressAPI.GetStatus", []);
1138
1138
  }
@@ -1152,8 +1152,8 @@ class Ut extends g {
1152
1152
  ), t;
1153
1153
  }
1154
1154
  }
1155
- new Ut();
1156
- class Bt extends g {
1155
+ new Bt();
1156
+ class vt extends g {
1157
1157
  constructor() {
1158
1158
  super("MiLaboratories.Controller.Shared.ProgressAPI.GetStatus.Request", [
1159
1159
  {
@@ -1211,8 +1211,8 @@ class Bt extends g {
1211
1211
  ), t;
1212
1212
  }
1213
1213
  }
1214
- const vt = new Bt();
1215
- class Dt extends g {
1214
+ const Dt = new vt();
1215
+ class $t extends g {
1216
1216
  constructor() {
1217
1217
  super("MiLaboratories.Controller.Shared.ProgressAPI.GetStatus.Response", [
1218
1218
  { no: 1, name: "report", kind: "message", T: () => R }
@@ -1272,8 +1272,8 @@ class Dt extends g {
1272
1272
  ), t;
1273
1273
  }
1274
1274
  }
1275
- const _t = new Dt();
1276
- class $t extends g {
1275
+ const _t = new $t();
1276
+ class Ct extends g {
1277
1277
  constructor() {
1278
1278
  super("MiLaboratories.Controller.Shared.ProgressAPI.RealtimeStatus", []);
1279
1279
  }
@@ -1293,8 +1293,8 @@ class $t extends g {
1293
1293
  ), t;
1294
1294
  }
1295
1295
  }
1296
- new $t();
1297
- class Ct extends g {
1296
+ new Ct();
1297
+ class Ot extends g {
1298
1298
  constructor() {
1299
1299
  super(
1300
1300
  "MiLaboratories.Controller.Shared.ProgressAPI.RealtimeStatus.Request",
@@ -1307,7 +1307,7 @@ class Ct extends g {
1307
1307
  L: 0
1308
1308
  /*LongType.BIGINT*/
1309
1309
  },
1310
- { no: 2, name: "update_interval", kind: "message", T: () => _ }
1310
+ { no: 2, name: "update_interval", kind: "message", T: () => $ }
1311
1311
  ]
1312
1312
  );
1313
1313
  }
@@ -1330,7 +1330,7 @@ class Ct extends g {
1330
1330
  break;
1331
1331
  case /* google.protobuf.Duration update_interval */
1332
1332
  2:
1333
- o.updateInterval = _.internalBinaryRead(
1333
+ o.updateInterval = $.internalBinaryRead(
1334
1334
  e,
1335
1335
  e.uint32(),
1336
1336
  n,
@@ -1356,7 +1356,7 @@ class Ct extends g {
1356
1356
  return o;
1357
1357
  }
1358
1358
  internalBinaryWrite(e, t, n) {
1359
- e.resourceId !== 0n && t.tag(1, h.Varint).uint64(e.resourceId), e.updateInterval && _.internalBinaryWrite(
1359
+ e.resourceId !== 0n && t.tag(1, h.Varint).uint64(e.resourceId), e.updateInterval && $.internalBinaryWrite(
1360
1360
  e.updateInterval,
1361
1361
  t.tag(2, h.LengthDelimited).fork(),
1362
1362
  n
@@ -1369,8 +1369,8 @@ class Ct extends g {
1369
1369
  ), t;
1370
1370
  }
1371
1371
  }
1372
- const Ot = new Ct();
1373
- class Et extends g {
1372
+ const Et = new Ot();
1373
+ class Ft extends g {
1374
1374
  constructor() {
1375
1375
  super(
1376
1376
  "MiLaboratories.Controller.Shared.ProgressAPI.RealtimeStatus.Response",
@@ -1431,7 +1431,7 @@ class Et extends g {
1431
1431
  ), t;
1432
1432
  }
1433
1433
  }
1434
- const Ft = new Et(), A = new v(
1434
+ const Wt = new Ft(), A = new v(
1435
1435
  "MiLaboratories.Controller.Shared.Progress",
1436
1436
  [
1437
1437
  {
@@ -1439,19 +1439,19 @@ const Ft = new Et(), A = new v(
1439
1439
  options: {
1440
1440
  "google.api.http": { get: "/resources/{resource_id}/get-progress" }
1441
1441
  },
1442
- I: vt,
1442
+ I: Dt,
1443
1443
  O: _t
1444
1444
  },
1445
1445
  {
1446
1446
  name: "RealtimeStatus",
1447
1447
  serverStreaming: !0,
1448
1448
  options: {},
1449
- I: Ot,
1450
- O: Ft
1449
+ I: Et,
1450
+ O: Wt
1451
1451
  }
1452
1452
  ]
1453
1453
  );
1454
- class Wt {
1454
+ class At {
1455
1455
  constructor(e) {
1456
1456
  d(this, "typeName", A.typeName);
1457
1457
  d(this, "methods", A.methods);
@@ -1473,10 +1473,10 @@ class Wt {
1473
1473
  return y("serverStreaming", this._transport, n, r, e);
1474
1474
  }
1475
1475
  }
1476
- class At {
1476
+ class zt {
1477
1477
  constructor(e, t, n, r) {
1478
1478
  d(this, "grpcClient");
1479
- this.grpcTransport = e, this.client = n, this.logger = r, this.grpcClient = new Wt(this.grpcTransport);
1479
+ this.grpcTransport = e, this.client = n, this.logger = r, this.grpcClient = new At(this.grpcTransport);
1480
1480
  }
1481
1481
  close() {
1482
1482
  }
@@ -1497,7 +1497,7 @@ class At {
1497
1497
  // GRPC stream every updateIntervalMs milliseconds.
1498
1498
  async *realtimeStatus({ id: e, type: t }, n = 100, r) {
1499
1499
  r = T(t, r);
1500
- const o = Math.floor(n / 1e3), c = (n - o * 1e3) * 1e6, i = _.create({
1500
+ const o = Math.floor(n / 1e3), c = (n - o * 1e3) * 1e6, i = $.create({
1501
1501
  seconds: BigInt(o),
1502
1502
  nanos: c
1503
1503
  });
@@ -1515,7 +1515,7 @@ class At {
1515
1515
  }
1516
1516
  }
1517
1517
  }
1518
- class zt extends g {
1518
+ class xt extends g {
1519
1519
  constructor() {
1520
1520
  super("MiLaboratories.Controller.Shared.DownloadAPI", []);
1521
1521
  }
@@ -1535,8 +1535,8 @@ class zt extends g {
1535
1535
  ), t;
1536
1536
  }
1537
1537
  }
1538
- new zt();
1539
- class xt extends g {
1538
+ new xt();
1539
+ class Mt extends g {
1540
1540
  constructor() {
1541
1541
  super("MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL", []);
1542
1542
  }
@@ -1556,8 +1556,8 @@ class xt extends g {
1556
1556
  ), t;
1557
1557
  }
1558
1558
  }
1559
- new xt();
1560
- class Mt extends g {
1559
+ new Mt();
1560
+ class Ht extends g {
1561
1561
  constructor() {
1562
1562
  super(
1563
1563
  "MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL.Request",
@@ -1618,8 +1618,8 @@ class Mt extends g {
1618
1618
  ), t;
1619
1619
  }
1620
1620
  }
1621
- const Ht = new Mt();
1622
- class jt extends g {
1621
+ const jt = new Ht();
1622
+ class Gt extends g {
1623
1623
  constructor() {
1624
1624
  super(
1625
1625
  "MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL.HTTPHeader",
@@ -1692,8 +1692,8 @@ class jt extends g {
1692
1692
  ), t;
1693
1693
  }
1694
1694
  }
1695
- const z = new jt();
1696
- class Gt extends g {
1695
+ const z = new Gt();
1696
+ class Vt extends g {
1697
1697
  constructor() {
1698
1698
  super(
1699
1699
  "MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL.Response",
@@ -1776,7 +1776,7 @@ class Gt extends g {
1776
1776
  ), t;
1777
1777
  }
1778
1778
  }
1779
- const Vt = new Gt(), x = new v(
1779
+ const qt = new Vt(), x = new v(
1780
1780
  "MiLaboratories.Controller.Shared.Download",
1781
1781
  [
1782
1782
  {
@@ -1784,12 +1784,12 @@ const Vt = new Gt(), x = new v(
1784
1784
  options: {
1785
1785
  "google.api.http": { get: "/resources/{resource_id}/get-download-url" }
1786
1786
  },
1787
- I: Ht,
1788
- O: Vt
1787
+ I: jt,
1788
+ O: qt
1789
1789
  }
1790
1790
  ]
1791
1791
  );
1792
- class qt {
1792
+ class Zt {
1793
1793
  constructor(e) {
1794
1794
  d(this, "typeName", x.typeName);
1795
1795
  d(this, "methods", x.methods);
@@ -1815,32 +1815,32 @@ class Ie {
1815
1815
  dispatcher: this.httpClient,
1816
1816
  headers: t,
1817
1817
  signal: n
1818
- });
1819
- if (400 <= r && r < 500)
1820
- throw new re(
1821
- `Http error: statusCode: ${r} url: ${e.toString()}`
1822
- );
1823
- if (r != 200)
1824
- throw Error(
1818
+ }), i = K.toWeb(o);
1819
+ if (r != 200) {
1820
+ const l = await Je(i), a = l.substring(0, Math.min(l.length, 1e3));
1821
+ throw 400 <= r && r < 500 ? new re(
1822
+ `Http error: statusCode: ${r} url: ${e.toString()}, beginning of body: ${a}`
1823
+ ) : new Error(
1825
1824
  `Http error: statusCode: ${r} url: ${e.toString()}`
1826
1825
  );
1826
+ }
1827
1827
  return {
1828
- content: K.toWeb(o),
1828
+ content: i,
1829
1829
  size: Number(c["content-length"])
1830
1830
  };
1831
1831
  }
1832
1832
  }
1833
- const Zt = "storage://", ie = /storage:\/\/(?<storageId>.*?)\/(?<localPath>.*)/;
1833
+ const Jt = "storage://", ie = /storage:\/\/(?<storageId>.*?)\/(?<localPath>.*)/;
1834
1834
  class Ne extends Error {
1835
1835
  }
1836
1836
  class Re extends Error {
1837
1837
  }
1838
- class Jt {
1838
+ class Qt {
1839
1839
  constructor(e, t, n, r) {
1840
1840
  d(this, "grpcClient");
1841
1841
  d(this, "downloadHelper");
1842
- d(this, "isLocal", (e) => e.startsWith(Zt));
1843
- this.grpcTransport = e, this.httpClient = t, this.logger = n, this.localStorageIdsToRoot = r, this.grpcClient = new qt(this.grpcTransport), this.downloadHelper = new Ie(t);
1842
+ d(this, "isLocal", (e) => e.startsWith(Jt));
1843
+ this.grpcTransport = e, this.httpClient = t, this.logger = n, this.localStorageIdsToRoot = r, this.grpcClient = new Zt(this.grpcTransport), this.downloadHelper = new Ie(t);
1844
1844
  }
1845
1845
  close() {
1846
1846
  }
@@ -1855,7 +1855,7 @@ class Jt {
1855
1855
  const { downloadUrl: r, headers: o } = await this.getUrl(e, t, n);
1856
1856
  return this.logger.info(`download from url ${r}`), this.isLocal(r) ? await this.readLocalFile(r) : await this.downloadHelper.downloadRemoteFile(
1857
1857
  r,
1858
- Qt(o),
1858
+ Xt(o),
1859
1859
  n
1860
1860
  );
1861
1861
  }
@@ -1875,10 +1875,10 @@ class Jt {
1875
1875
  };
1876
1876
  }
1877
1877
  }
1878
- function Qt(s) {
1878
+ function Xt(s) {
1879
1879
  return Object.fromEntries(s.map(({ name: e, value: t }) => [e, t]));
1880
1880
  }
1881
- class Xt extends g {
1881
+ class Yt extends g {
1882
1882
  constructor() {
1883
1883
  super("google.protobuf.Timestamp", [
1884
1884
  {
@@ -2011,8 +2011,8 @@ class Xt extends g {
2011
2011
  ), t;
2012
2012
  }
2013
2013
  }
2014
- const M = new Xt();
2015
- class Yt extends g {
2014
+ const M = new Yt();
2015
+ class Kt extends g {
2016
2016
  constructor() {
2017
2017
  super("MiLaboratories.Controller.Shared.LsAPI", []);
2018
2018
  }
@@ -2032,8 +2032,8 @@ class Yt extends g {
2032
2032
  ), t;
2033
2033
  }
2034
2034
  }
2035
- new Yt();
2036
- class Kt extends g {
2035
+ new Kt();
2036
+ class er extends g {
2037
2037
  constructor() {
2038
2038
  super("MiLaboratories.Controller.Shared.LsAPI.ListItem", [
2039
2039
  {
@@ -2156,8 +2156,8 @@ class Kt extends g {
2156
2156
  ), t;
2157
2157
  }
2158
2158
  }
2159
- const H = new Kt();
2160
- class er extends g {
2159
+ const H = new er();
2160
+ class tr extends g {
2161
2161
  constructor() {
2162
2162
  super("MiLaboratories.Controller.Shared.LsAPI.List", []);
2163
2163
  }
@@ -2177,8 +2177,8 @@ class er extends g {
2177
2177
  ), t;
2178
2178
  }
2179
2179
  }
2180
- new er();
2181
- class tr extends g {
2180
+ new tr();
2181
+ class rr extends g {
2182
2182
  constructor() {
2183
2183
  super("MiLaboratories.Controller.Shared.LsAPI.List.Request", [
2184
2184
  {
@@ -2243,8 +2243,8 @@ class tr extends g {
2243
2243
  ), t;
2244
2244
  }
2245
2245
  }
2246
- const rr = new tr();
2247
- class nr extends g {
2246
+ const nr = new rr();
2247
+ class or extends g {
2248
2248
  constructor() {
2249
2249
  super("MiLaboratories.Controller.Shared.LsAPI.List.Response", [
2250
2250
  {
@@ -2316,10 +2316,10 @@ class nr extends g {
2316
2316
  ), t;
2317
2317
  }
2318
2318
  }
2319
- const or = new nr(), j = new v("MiLaboratories.Controller.Shared.LS", [
2320
- { name: "List", options: {}, I: rr, O: or }
2319
+ const sr = new or(), j = new v("MiLaboratories.Controller.Shared.LS", [
2320
+ { name: "List", options: {}, I: nr, O: sr }
2321
2321
  ]);
2322
- class sr {
2322
+ class ir {
2323
2323
  constructor(e) {
2324
2324
  d(this, "typeName", j.typeName);
2325
2325
  d(this, "methods", j.methods);
@@ -2340,10 +2340,10 @@ class sr {
2340
2340
  );
2341
2341
  }
2342
2342
  }
2343
- class ir {
2343
+ class ar {
2344
2344
  constructor(e, t) {
2345
2345
  d(this, "grpcClient");
2346
- this.logger = t, this.grpcClient = new sr(e);
2346
+ this.logger = t, this.grpcClient = new ir(e);
2347
2347
  }
2348
2348
  close() {
2349
2349
  }
@@ -2357,7 +2357,7 @@ class ir {
2357
2357
  ).response;
2358
2358
  }
2359
2359
  }
2360
- class ar extends g {
2360
+ class lr extends g {
2361
2361
  constructor() {
2362
2362
  super("MiLaboratories.Controller.Shared.StreamingAPI", []);
2363
2363
  }
@@ -2377,8 +2377,8 @@ class ar extends g {
2377
2377
  ), t;
2378
2378
  }
2379
2379
  }
2380
- new ar();
2381
- class lr extends g {
2380
+ new lr();
2381
+ class cr extends g {
2382
2382
  constructor() {
2383
2383
  super("MiLaboratories.Controller.Shared.StreamingAPI.StreamBinary", [
2384
2384
  {
@@ -2469,8 +2469,8 @@ class lr extends g {
2469
2469
  ), t;
2470
2470
  }
2471
2471
  }
2472
- const cr = new lr();
2473
- class dr extends g {
2472
+ const dr = new cr();
2473
+ class hr extends g {
2474
2474
  constructor() {
2475
2475
  super("MiLaboratories.Controller.Shared.StreamingAPI.ReadBinary", [
2476
2476
  {
@@ -2548,8 +2548,8 @@ class dr extends g {
2548
2548
  ), t;
2549
2549
  }
2550
2550
  }
2551
- const hr = new dr();
2552
- class ur extends g {
2551
+ const ur = new hr();
2552
+ class pr extends g {
2553
2553
  constructor() {
2554
2554
  super("MiLaboratories.Controller.Shared.StreamingAPI.StreamText", [
2555
2555
  {
@@ -2652,8 +2652,8 @@ class ur extends g {
2652
2652
  ), t;
2653
2653
  }
2654
2654
  }
2655
- const pr = new ur();
2656
- class gr extends g {
2655
+ const gr = new pr();
2656
+ class fr extends g {
2657
2657
  constructor() {
2658
2658
  super("MiLaboratories.Controller.Shared.StreamingAPI.ReadText", [
2659
2659
  {
@@ -2756,8 +2756,8 @@ class gr extends g {
2756
2756
  ), t;
2757
2757
  }
2758
2758
  }
2759
- const fr = new gr();
2760
- class mr extends g {
2759
+ const mr = new fr();
2760
+ class wr extends g {
2761
2761
  constructor() {
2762
2762
  super("MiLaboratories.Controller.Shared.StreamingAPI.LastLines", [
2763
2763
  {
@@ -2860,8 +2860,8 @@ class mr extends g {
2860
2860
  ), t;
2861
2861
  }
2862
2862
  }
2863
- const wr = new mr();
2864
- class yr extends g {
2863
+ const yr = new wr();
2864
+ class br extends g {
2865
2865
  constructor() {
2866
2866
  super("MiLaboratories.Controller.Shared.StreamingAPI.Response", [
2867
2867
  {
@@ -2938,44 +2938,44 @@ class yr extends g {
2938
2938
  ), t;
2939
2939
  }
2940
2940
  }
2941
- const U = new yr(), G = new v(
2941
+ const U = new br(), G = new v(
2942
2942
  "MiLaboratories.Controller.Shared.Streaming",
2943
2943
  [
2944
2944
  {
2945
2945
  name: "StreamBinary",
2946
2946
  serverStreaming: !0,
2947
2947
  options: {},
2948
- I: cr,
2948
+ I: dr,
2949
2949
  O: U
2950
2950
  },
2951
2951
  {
2952
2952
  name: "ReadBinary",
2953
2953
  options: {},
2954
- I: hr,
2954
+ I: ur,
2955
2955
  O: U
2956
2956
  },
2957
2957
  {
2958
2958
  name: "StreamText",
2959
2959
  serverStreaming: !0,
2960
2960
  options: {},
2961
- I: pr,
2961
+ I: gr,
2962
2962
  O: U
2963
2963
  },
2964
2964
  {
2965
2965
  name: "ReadText",
2966
2966
  options: {},
2967
- I: fr,
2967
+ I: mr,
2968
2968
  O: U
2969
2969
  },
2970
2970
  {
2971
2971
  name: "LastLines",
2972
2972
  options: {},
2973
- I: wr,
2973
+ I: yr,
2974
2974
  O: U
2975
2975
  }
2976
2976
  ]
2977
2977
  );
2978
- class br {
2978
+ class Tr {
2979
2979
  constructor(e) {
2980
2980
  d(this, "typeName", G.typeName);
2981
2981
  d(this, "methods", G.methods);
@@ -3074,10 +3074,10 @@ class br {
3074
3074
  );
3075
3075
  }
3076
3076
  }
3077
- class Tr {
3077
+ class kr {
3078
3078
  constructor(e, t, n) {
3079
3079
  d(this, "grpcClient");
3080
- this.grpcTransport = e, this.httpClient = t, this.logger = n, this.grpcClient = new br(this.grpcTransport);
3080
+ this.grpcTransport = e, this.httpClient = t, this.logger = n, this.grpcClient = new Tr(this.grpcTransport);
3081
3081
  }
3082
3082
  close() {
3083
3083
  }
@@ -3110,13 +3110,13 @@ class Tr {
3110
3110
  )).response;
3111
3111
  }
3112
3112
  }
3113
- const kr = process.env.PL_STORAGE_TO_PATH ? Object.fromEntries(
3113
+ const Lr = process.env.PL_STORAGE_TO_PATH ? Object.fromEntries(
3114
3114
  process.env.PL_STORAGE_TO_PATH.split(";").map((s) => s.split(":"))
3115
3115
  ) : {};
3116
- function Pn(s, e, t) {
3117
- return t === void 0 && (t = kr), e.getDriver({
3116
+ function In(s, e, t) {
3117
+ return t === void 0 && (t = Lr), e.getDriver({
3118
3118
  name: "DownloadBlob",
3119
- init: (r, o, c) => new Jt(
3119
+ init: (r, o, c) => new Qt(
3120
3120
  o,
3121
3121
  c,
3122
3122
  s,
@@ -3124,31 +3124,31 @@ function Pn(s, e, t) {
3124
3124
  )
3125
3125
  });
3126
3126
  }
3127
- function In(s, e) {
3127
+ function Nn(s, e) {
3128
3128
  return s.getDriver({
3129
3129
  name: "StreamLogs",
3130
- init: (t, n, r) => new Tr(n, r, e)
3130
+ init: (t, n, r) => new kr(n, r, e)
3131
3131
  });
3132
3132
  }
3133
- function Nn(s, e) {
3133
+ function Rn(s, e) {
3134
3134
  return s.getDriver({
3135
3135
  name: "UploadProgress",
3136
- init: (t, n, r) => new At(n, r, s, e)
3136
+ init: (t, n, r) => new zt(n, r, s, e)
3137
3137
  });
3138
3138
  }
3139
- function Rn(s, e) {
3139
+ function Sn(s, e) {
3140
3140
  return s.getDriver({
3141
3141
  name: "UploadBlob",
3142
- init: (t, n, r) => new It(n, r, s, e)
3142
+ init: (t, n, r) => new Nt(n, r, s, e)
3143
3143
  });
3144
3144
  }
3145
- function Sn(s, e) {
3145
+ function Un(s, e) {
3146
3146
  return s.getDriver({
3147
3147
  name: "LsFiles",
3148
- init: (t, n, r) => new ir(n, e)
3148
+ init: (t, n, r) => new ar(n, e)
3149
3149
  });
3150
3150
  }
3151
- class Un {
3151
+ class Bn {
3152
3152
  constructor(e, t) {
3153
3153
  d(this, "updater");
3154
3154
  d(this, "schedule", () => this.updater.schedule());
@@ -3177,7 +3177,7 @@ class Se {
3177
3177
  })());
3178
3178
  }
3179
3179
  }
3180
- async function Bn(s, e) {
3180
+ async function vn(s, e) {
3181
3181
  return s.withReadTx("LogsDriverGetStream", async (t) => {
3182
3182
  const n = await t.getResourceData(e, !0), r = await Me(t, He(n, "stream"));
3183
3183
  if (r.error != "")
@@ -3186,9 +3186,9 @@ async function Bn(s, e) {
3186
3186
  return await t.getResourceData(r.valueId, !1);
3187
3187
  });
3188
3188
  }
3189
- const Ue = "8C7#F1328%9E089B3D22", Lr = /(?<stage>.*):\s*(?<progress>[\d.]+%)\s.*(?<eta>ETA:.*)/g;
3190
- function Pr(s) {
3191
- const t = s.replace(Ue, "").match(Lr);
3189
+ const Ue = "8C7#F1328%9E089B3D22", Pr = /(?<stage>.*):\s*(?<progress>[\d.]+%)\s.*(?<eta>ETA:.*)/g;
3190
+ function Ir(s) {
3191
+ const t = s.replace(Ue, "").match(Pr);
3192
3192
  if (t == null || t.length != 4)
3193
3193
  return;
3194
3194
  const [n, r, o, c] = t;
@@ -3201,7 +3201,7 @@ function Pr(s) {
3201
3201
  // ETA: 00:00:07
3202
3202
  };
3203
3203
  }
3204
- async function vn(s, e, t) {
3204
+ async function Dn(s, e, t) {
3205
3205
  const n = await e.lastLines(
3206
3206
  s,
3207
3207
  1,
@@ -3214,7 +3214,7 @@ async function vn(s, e, t) {
3214
3214
  const r = n.data.toString().split(/\r?\n/)[0];
3215
3215
  if (r == null)
3216
3216
  return { found: !1 };
3217
- const o = Pr(r);
3217
+ const o = Ir(r);
3218
3218
  return o === void 0 ? { found: !1 } : { found: !0, ...o };
3219
3219
  }
3220
3220
  class Be {
@@ -3255,7 +3255,7 @@ class Be {
3255
3255
  this.cache.delete(e.path), this.totalSizeBytes -= e.sizeBytes;
3256
3256
  }
3257
3257
  }
3258
- class Dn {
3258
+ class $n {
3259
3259
  constructor(e, t) {
3260
3260
  this.logsStreamDriver = e, this.downloadDriver = t;
3261
3261
  }
@@ -3349,12 +3349,12 @@ function q(s, e) {
3349
3349
  var t;
3350
3350
  return (t = s.accessor(e).node().traverse("stream")) == null ? void 0 : t.resourceInfo;
3351
3351
  }
3352
- function $(s) {
3352
+ function _(s) {
3353
3353
  let e;
3354
3354
  if (C(s))
3355
3355
  e = s.match(De);
3356
- else if (Ir(s))
3357
- e = s.match(_e);
3356
+ else if (Nr(s))
3357
+ e = s.match($e);
3358
3358
  else throw new Error(`Log handle is malformed: ${s}`);
3359
3359
  if (e == null) throw new Error(`Log handle wasn't parsed: ${s}`);
3360
3360
  const { resourceType: t, resourceVersion: n, resourceId: r } = e.groups;
@@ -3370,11 +3370,11 @@ const De = /^log\+live:\/\/log\/(?<resourceType>.*)\/(?<resourceVersion>.*)\/(?<
3370
3370
  function C(s) {
3371
3371
  return De.test(s);
3372
3372
  }
3373
- const _e = /^log\+ready:\/\/log\/(?<resourceType>.*)\/(?<resourceVersion>.*)\/(?<resourceId>.*)$/;
3374
- function Ir(s) {
3375
- return _e.test(s);
3373
+ const $e = /^log\+ready:\/\/log\/(?<resourceType>.*)\/(?<resourceVersion>.*)\/(?<resourceId>.*)$/;
3374
+ function Nr(s) {
3375
+ return $e.test(s);
3376
3376
  }
3377
- const Nr = ye({
3377
+ const Rr = ye({
3378
3378
  kv: {
3379
3379
  "ctl/file/blobInfo": L.object({
3380
3380
  sizeBytes: L.coerce.number()
@@ -3414,17 +3414,17 @@ class _n {
3414
3414
  getOnDemandBlob(e, t) {
3415
3415
  if (t === void 0)
3416
3416
  return b.make((c) => this.getOnDemandBlob(e, c));
3417
- const n = be(e) ? Te(e, Nr, t) : e, r = k();
3417
+ const n = be(e) ? Te(e, Rr, t) : e, r = k();
3418
3418
  return t.addOnDestroy(() => this.releaseOnDemandBlob(n.id, r)), this.getOnDemandBlobNoCtx(t.watcher, n, r);
3419
3419
  }
3420
3420
  getLocalPath(e) {
3421
3421
  return Z(e, this.signer);
3422
3422
  }
3423
3423
  async getContent(e) {
3424
- if (vr(e)) return await Sr(this.getLocalPath(e));
3424
+ if (Dr(e)) return await Ur(this.getLocalPath(e));
3425
3425
  if (!_r(e)) throw new Error("Malformed remote handle");
3426
- const t = $r(e, this.signer), { content: n } = await this.clientDownload.downloadBlob(t);
3427
- return await we(n);
3426
+ const t = Cr(e, this.signer), { content: n } = await this.clientDownload.downloadBlob(t);
3427
+ return await me(n);
3428
3428
  }
3429
3429
  getDownloadedBlobNoCtx(e, t, n) {
3430
3430
  let r = this.idToDownload.get(t.id);
@@ -3443,11 +3443,11 @@ class _n {
3443
3443
  }
3444
3444
  }
3445
3445
  setNewDownloadTask(e, t, n) {
3446
- const r = this.getFilePath(t.id), o = new Br(
3446
+ const r = this.getFilePath(t.id), o = new vr(
3447
3447
  this.clientDownload,
3448
3448
  t,
3449
3449
  r,
3450
- Dr(r, this.signer)
3450
+ $r(r, this.signer)
3451
3451
  );
3452
3452
  return this.idToDownload.set(t.id, o), o;
3453
3453
  }
@@ -3457,9 +3457,9 @@ class _n {
3457
3457
  }
3458
3458
  getOnDemandBlobNoCtx(e, t, n) {
3459
3459
  let r = this.idToOnDemand.get(t.id);
3460
- return r === void 0 && (r = new Rr(
3460
+ return r === void 0 && (r = new Sr(
3461
3461
  t.kv["ctl/file/blobInfo"].sizeBytes,
3462
- Cr(t, this.signer)
3462
+ Or(t, this.signer)
3463
3463
  ), this.idToOnDemand.set(t.id, r)), r.attach(e, n), r.getHandle();
3464
3464
  }
3465
3465
  getLastLogs(e, t, n) {
@@ -3529,7 +3529,7 @@ class _n {
3529
3529
  }
3530
3530
  async lastLines(e, t, n, r) {
3531
3531
  const o = await this.clientLogs.lastLines(
3532
- $(e),
3532
+ _(e),
3533
3533
  t,
3534
3534
  BigInt(n ?? 0),
3535
3535
  r
@@ -3544,7 +3544,7 @@ class _n {
3544
3544
  }
3545
3545
  async readText(e, t, n, r) {
3546
3546
  const o = await this.clientLogs.readText(
3547
- $(e),
3547
+ _(e),
3548
3548
  t,
3549
3549
  BigInt(n ?? 0),
3550
3550
  r
@@ -3590,7 +3590,7 @@ class _n {
3590
3590
  return m.resolve(m.join(this.saveDir, String(BigInt(e))));
3591
3591
  }
3592
3592
  }
3593
- class Rr {
3593
+ class Sr {
3594
3594
  constructor(e, t) {
3595
3595
  d(this, "change", new S());
3596
3596
  d(this, "counter", new D());
@@ -3622,7 +3622,7 @@ class ae {
3622
3622
  }
3623
3623
  async update() {
3624
3624
  try {
3625
- const e = await Ur(
3625
+ const e = await Br(
3626
3626
  this.path,
3627
3627
  this.lines,
3628
3628
  this.patternToSearch
@@ -3644,13 +3644,13 @@ async function le(s) {
3644
3644
  return !1;
3645
3645
  }
3646
3646
  }
3647
- async function Sr(s) {
3648
- return await we(K.toWeb(E.createReadStream(s)));
3647
+ async function Ur(s) {
3648
+ return await me(K.toWeb(E.createReadStream(s)));
3649
3649
  }
3650
- function Ur(s, e, t) {
3650
+ function Br(s, e, t) {
3651
3651
  const n = E.createReadStream(s), r = new ee();
3652
3652
  return new Promise((o, c) => {
3653
- const i = Je.createInterface(n, r), l = new Qe();
3653
+ const i = Qe.createInterface(n, r), l = new Xe();
3654
3654
  i.on("line", function(a) {
3655
3655
  t != null && !a.includes(t) || (l.push(a), l.length > e && l.shift());
3656
3656
  }), i.on("error", c), i.on("close", function() {
@@ -3658,7 +3658,7 @@ function Ur(s, e, t) {
3658
3658
  });
3659
3659
  });
3660
3660
  }
3661
- let Br = class {
3661
+ let vr = class {
3662
3662
  constructor(e, t, n, r) {
3663
3663
  d(this, "counter", new D());
3664
3664
  d(this, "change", new S());
@@ -3676,7 +3676,9 @@ let Br = class {
3676
3676
  const { content: e, size: t } = await this.clientDownload.downloadBlob(
3677
3677
  this.rInfo
3678
3678
  );
3679
- if (await le(m.dirname(this.path)) || w.mkdir(m.dirname(this.path), { recursive: !0 }), !await le(this.path)) {
3679
+ if (await le(m.dirname(this.path)) || w.mkdir(m.dirname(this.path), { recursive: !0 }), await le(this.path))
3680
+ await e.cancel("the file already existed");
3681
+ else {
3680
3682
  const n = ee.toWeb(E.createWriteStream(this.path));
3681
3683
  await e.pipeTo(n);
3682
3684
  }
@@ -3716,12 +3718,12 @@ let Br = class {
3716
3718
  };
3717
3719
  class ce extends Error {
3718
3720
  }
3719
- const $e = /^blob\+local:\/\/download\/(?<path>.*)#(?<signature>.*)$/;
3720
- function vr(s) {
3721
- return !!s.match($e);
3721
+ const _e = /^blob\+local:\/\/download\/(?<path>.*)#(?<signature>.*)$/;
3722
+ function Dr(s) {
3723
+ return !!s.match(_e);
3722
3724
  }
3723
3725
  function Z(s, e) {
3724
- const t = s.match($e);
3726
+ const t = s.match(_e);
3725
3727
  if (t === null)
3726
3728
  throw new Error(`Local handle is malformed: ${s}, matches: ${t}`);
3727
3729
  const { path: n, signature: r } = t.groups;
@@ -3731,14 +3733,14 @@ function Z(s, e) {
3731
3733
  `Signature verification failed for: ${s}`
3732
3734
  ), n;
3733
3735
  }
3734
- function Dr(s, e) {
3736
+ function $r(s, e) {
3735
3737
  return `blob+local://download/${s}#${e.sign(s)}`;
3736
3738
  }
3737
3739
  const Ce = /^blob\+remote:\/\/download\/(?<content>(?<resourceType>.*)\/(?<resourceVersion>.*)\/(?<resourceId>.*))#(?<signature>.*)$/;
3738
3740
  function _r(s) {
3739
3741
  return !!s.match(Ce);
3740
3742
  }
3741
- function $r(s, e) {
3743
+ function Cr(s, e) {
3742
3744
  const t = s.match(Ce);
3743
3745
  if (t === null)
3744
3746
  throw new Error(
@@ -3754,16 +3756,16 @@ function $r(s, e) {
3754
3756
  type: { name: r, version: o }
3755
3757
  };
3756
3758
  }
3757
- function Cr(s, e) {
3759
+ function Or(s, e) {
3758
3760
  const t = `${s.type.name}/${s.type.version}/${BigInt(s.id)}`;
3759
3761
  return `blob+remote://download/${t}#${e.sign(t)}`;
3760
3762
  }
3761
- const Or = L.object({
3763
+ const Er = L.object({
3762
3764
  localPath: L.string(),
3763
3765
  pathSignature: L.string(),
3764
3766
  modificationTime: L.string()
3765
- }), Er = L.union([Or, L.object({})]), Fr = ye({
3766
- data: Er,
3767
+ }), Fr = L.union([Er, L.object({})]), Wr = ye({
3768
+ data: Fr,
3767
3769
  fields: {
3768
3770
  blob: !1,
3769
3771
  // for BlobUpload
@@ -3771,7 +3773,7 @@ const Or = L.object({
3771
3773
  // for BlobIndex
3772
3774
  }
3773
3775
  });
3774
- class Cn {
3776
+ class On {
3775
3777
  constructor(e, t, n, r, o = {
3776
3778
  nConcurrentPartUploads: 10,
3777
3779
  nConcurrentGetProgresses: 10,
@@ -3794,7 +3796,7 @@ class Cn {
3794
3796
  // 15 seconds
3795
3797
  backoffMultiplier: 1.5,
3796
3798
  jitter: 0.5
3797
- }), this.hooks = new me(
3799
+ }), this.hooks = new we(
3798
3800
  () => this.startUpdating(),
3799
3801
  () => this.stopUpdating(),
3800
3802
  { stopDebounce: o.stopPollingDelay },
@@ -3804,7 +3806,7 @@ class Cn {
3804
3806
  getProgressId(e, t) {
3805
3807
  if (t == null)
3806
3808
  return b.make((c) => this.getProgressId(e, c));
3807
- const n = be(e) ? Te(e, Fr, t) : e, r = k();
3809
+ const n = be(e) ? Te(e, Wr, t) : e, r = k();
3808
3810
  t.attacheHooks(this.hooks), t.addOnDestroy(() => this.release(n.id, r));
3809
3811
  const o = this.getProgressIdNoCtx(t.watcher, n, r);
3810
3812
  return de(o) || t.markUnstable(
@@ -3815,7 +3817,7 @@ class Cn {
3815
3817
  const r = t.fields.blob != null || t.fields.incarnation != null, o = this.idToProgress.get(t.id);
3816
3818
  if (o != null)
3817
3819
  return o.attach(e, n), o.mustGetProgress(r);
3818
- const c = new Wr(
3820
+ const c = new Ar(
3819
3821
  this.logger,
3820
3822
  this.clientBlob,
3821
3823
  this.clientProgress,
@@ -3872,7 +3874,7 @@ class Cn {
3872
3874
  return Array.from(this.idToProgress.entries()).filter(([e, t]) => !de(t.progress)).map(([e, t]) => t);
3873
3875
  }
3874
3876
  }
3875
- class Wr {
3877
+ class Ar {
3876
3878
  constructor(e, t, n, r, o, c) {
3877
3879
  d(this, "change", new S());
3878
3880
  d(this, "counter", new D());
@@ -3882,7 +3884,7 @@ class Wr {
3882
3884
  this.logger = e, this.clientBlob = t, this.clientProgress = n, this.nConcurrentPartsUpload = r, this.res = c;
3883
3885
  const i = c.type.name.startsWith("BlobUpload");
3884
3886
  let l;
3885
- i && (this.uploadOpts = Ar(c), l = xr(
3887
+ i && (this.uploadOpts = zr(c), l = Mr(
3886
3888
  o,
3887
3889
  this.uploadOpts.localPath,
3888
3890
  this.uploadOpts.pathSignature
@@ -3946,12 +3948,12 @@ class Wr {
3946
3948
  this.progress.lastError = String(e);
3947
3949
  }
3948
3950
  setDone(e) {
3949
- this.progress.done = e;
3951
+ this.progress.done = e, e && (this.progress.lastError = void 0);
3950
3952
  }
3951
3953
  async updateStatus() {
3952
3954
  try {
3953
3955
  const e = await this.clientProgress.getStatus(this.res), t = this.progress.status;
3954
- this.progress.status = zr(e), this.setDone(e.done), (e.done || e.progress != (t == null ? void 0 : t.progress)) && this.change.markChanged();
3956
+ this.progress.status = xr(e), this.setDone(e.done), (e.done || e.progress != (t == null ? void 0 : t.progress)) && this.change.markChanged();
3955
3957
  } catch (e) {
3956
3958
  if (this.setLastError(e), e.name == "RpcError" && e.code == "DEADLINE_EXCEEDED") {
3957
3959
  this.logger.warn(
@@ -3972,7 +3974,7 @@ class Wr {
3972
3974
  function de(s) {
3973
3975
  return s.done && s.status !== void 0 && s.status !== null && s.status.progress >= 1;
3974
3976
  }
3975
- function Ar(s) {
3977
+ function zr(s) {
3976
3978
  if (s.data == null || !("modificationTime" in s.data))
3977
3979
  throw new Error(
3978
3980
  "no upload options in BlobUpload resource data: " + B(s.data)
@@ -3996,14 +3998,14 @@ function Ar(s) {
3996
3998
  pathSignature: e.pathSignature
3997
3999
  };
3998
4000
  }
3999
- function zr(s) {
4001
+ function xr(s) {
4000
4002
  return {
4001
4003
  progress: s.progress ?? 0,
4002
4004
  bytesProcessed: Number(s.bytesProcessed),
4003
4005
  bytesTotal: Number(s.bytesTotal)
4004
4006
  };
4005
4007
  }
4006
- function xr(s, e, t) {
4008
+ function Mr(s, e, t) {
4007
4009
  try {
4008
4010
  return s.verify(e, t), !0;
4009
4011
  } catch {
@@ -4016,7 +4018,7 @@ function Oe(s) {
4016
4018
  function he(s) {
4017
4019
  return s.name == "RpcError" && (s.code == "NOT_FOUND" || s.code == "ABORTED" || s.code == "ALREADY_EXISTS");
4018
4020
  }
4019
- class On {
4021
+ class En {
4020
4022
  constructor(e, t = {
4021
4023
  nConcurrentGetLogs: 10,
4022
4024
  pollingInterval: 1e3,
@@ -4033,7 +4035,7 @@ class On {
4033
4035
  d(this, "keepRunning", !1);
4034
4036
  /** Actual state of main loop. */
4035
4037
  d(this, "currentLoop");
4036
- this.clientLogs = e, this.opts = t, this.hooks = new me(
4038
+ this.clientLogs = e, this.opts = t, this.hooks = new we(
4037
4039
  () => this.startUpdating(),
4038
4040
  () => this.stopUpdating(),
4039
4041
  { stopDebounce: t.stopPollingDelay },
@@ -4107,7 +4109,7 @@ class On {
4107
4109
  return await this.tryWithNotFound(
4108
4110
  e,
4109
4111
  () => this.clientLogs.lastLines(
4110
- $(e),
4112
+ _(e),
4111
4113
  t,
4112
4114
  BigInt(n ?? 0),
4113
4115
  r
@@ -4118,7 +4120,7 @@ class On {
4118
4120
  return await this.tryWithNotFound(
4119
4121
  e,
4120
4122
  () => this.clientLogs.readText(
4121
- $(e),
4123
+ _(e),
4122
4124
  t,
4123
4125
  BigInt(n ?? 0),
4124
4126
  r
@@ -4230,7 +4232,7 @@ class ue {
4230
4232
  }
4231
4233
  }
4232
4234
  }
4233
- class En {
4235
+ class Fn {
4234
4236
  constructor(e, t, n, r = {
4235
4237
  cacheSoftSizeBytes: 50 * 1024 * 1024,
4236
4238
  withGunzip: !0,
@@ -4304,18 +4306,18 @@ class En {
4304
4306
  );
4305
4307
  }
4306
4308
  setNewTask(e, t, n) {
4307
- const r = new Mr(this.getFilePath(t), t);
4309
+ const r = new Hr(this.getFilePath(t), t);
4308
4310
  return r.attach(e, n), this.urlToDownload.set(t.toString(), r), r;
4309
4311
  }
4310
4312
  removeTask(e, t) {
4311
4313
  e.abort(t), e.change.markChanged(), this.urlToDownload.delete(e.url.toString());
4312
4314
  }
4313
4315
  getFilePath(e) {
4314
- const t = Xe("sha256").update(e.toString()).digest("hex");
4316
+ const t = Ye("sha256").update(e.toString()).digest("hex");
4315
4317
  return m.join(this.saveDir, t);
4316
4318
  }
4317
4319
  }
4318
- class Mr {
4320
+ class Hr {
4319
4321
  constructor(e, t) {
4320
4322
  d(this, "counter", new D());
4321
4323
  d(this, "change", new S());
@@ -4345,7 +4347,7 @@ class Mr {
4345
4347
  }
4346
4348
  }
4347
4349
  async downloadAndUntar(e, t, n) {
4348
- if (await Hr(this.path))
4350
+ if (await jr(this.path))
4349
4351
  return await Ee(this.path);
4350
4352
  const r = await e.downloadRemoteFile(
4351
4353
  this.url.toString(),
@@ -4354,10 +4356,10 @@ class Mr {
4354
4356
  );
4355
4357
  let o = r.content;
4356
4358
  if (t) {
4357
- const i = Ze.toWeb(Ye.createGunzip());
4359
+ const i = Ze.toWeb(Ke.createGunzip());
4358
4360
  o = o.pipeThrough(i, { signal: n });
4359
4361
  }
4360
- const c = ee.toWeb(Ke.extract(this.path));
4362
+ const c = ee.toWeb(et.extract(this.path));
4361
4363
  return await o.pipeTo(c, { signal: n }), r.size;
4362
4364
  }
4363
4365
  getPath() {
@@ -4376,7 +4378,7 @@ class Mr {
4376
4378
  }
4377
4379
  class pe extends Error {
4378
4380
  }
4379
- async function Hr(s) {
4381
+ async function jr(s) {
4380
4382
  try {
4381
4383
  return await w.access(s), !0;
4382
4384
  } catch {
@@ -4395,14 +4397,14 @@ async function Ee(s) {
4395
4397
  async function J(s) {
4396
4398
  await w.rm(s, { recursive: !0, force: !0 });
4397
4399
  }
4398
- function jr(s) {
4400
+ function Gr(s) {
4399
4401
  var t;
4400
4402
  return {
4401
4403
  parent: s.list.items.length > 0 ? (t = s.list.items[0]) == null ? void 0 : t.directory : void 0,
4402
- entries: s.list.items.map((n) => Gr(n, s))
4404
+ entries: s.list.items.map((n) => Vr(n, s))
4403
4405
  };
4404
4406
  }
4405
- function Gr(s, e) {
4407
+ function Vr(s, e) {
4406
4408
  return s.isDir ? {
4407
4409
  type: "dir",
4408
4410
  name: s.name,
@@ -4411,18 +4413,18 @@ function Gr(s, e) {
4411
4413
  type: "file",
4412
4414
  name: s.name,
4413
4415
  fullPath: s.fullName,
4414
- handle: Vr({ item: s, ...e })
4416
+ handle: qr({ item: s, ...e })
4415
4417
  };
4416
4418
  }
4417
- function Vr(s) {
4418
- return s.remote ? qr(s) : Fe(
4419
+ function qr(s) {
4420
+ return s.remote ? Zr(s) : Fe(
4419
4421
  s.item.fullName,
4420
4422
  s.signer,
4421
4423
  s.item.size,
4422
4424
  O(s.item.lastModified).seconds
4423
4425
  );
4424
4426
  }
4425
- function qr(s) {
4427
+ function Zr(s) {
4426
4428
  return `index://index/${encodeURIComponent(
4427
4429
  JSON.stringify({
4428
4430
  storageId: s.storageName,
@@ -4439,7 +4441,7 @@ function Fe(s, e, t, n) {
4439
4441
  };
4440
4442
  return `upload://upload/${encodeURIComponent(JSON.stringify(r))}`;
4441
4443
  }
4442
- function Zr(s, e) {
4444
+ function Jr(s, e) {
4443
4445
  if (!(e.dirent.isFile() || e.dirent.isDirectory())) {
4444
4446
  s.warn(
4445
4447
  `tried to get non-dir and non-file ${e.dirent.name}, skip it`
@@ -4458,32 +4460,32 @@ function Zr(s, e) {
4458
4460
  size: BigInt(e.stat.size)
4459
4461
  };
4460
4462
  }
4461
- function Jr(s, e) {
4462
- const t = Object.entries(s).map(Xr), n = Object.entries(e).map(tn);
4463
+ function Qr(s, e) {
4464
+ const t = Object.entries(s).map(Yr), n = Object.entries(e).map(rn);
4463
4465
  return t.concat(n);
4464
4466
  }
4465
- function Qr(s) {
4466
- if (rn(s))
4467
- return on(s);
4468
- if (Yr(s))
4469
- return en(s);
4467
+ function Xr(s) {
4468
+ if (nn(s))
4469
+ return sn(s);
4470
+ if (Kr(s))
4471
+ return tn(s);
4470
4472
  qe(s);
4471
4473
  }
4472
- function Xr([s, e]) {
4474
+ function Yr([s, e]) {
4473
4475
  return {
4474
4476
  name: s,
4475
- handle: Kr(s, e),
4477
+ handle: en(s, e),
4476
4478
  initialFullPath: e
4477
4479
  };
4478
4480
  }
4479
4481
  const We = /^local:\/\/(?<name>.*)\/(?<path>.*)$/;
4480
- function Yr(s) {
4482
+ function Kr(s) {
4481
4483
  return We.test(s);
4482
4484
  }
4483
- function Kr(s, e) {
4485
+ function en(s, e) {
4484
4486
  return `local://${s}/${encodeURIComponent(e)}`;
4485
4487
  }
4486
- function en(s) {
4488
+ function tn(s) {
4487
4489
  const e = s.match(We);
4488
4490
  if (e == null)
4489
4491
  throw new Error(`Local list handle wasn't parsed: ${s}`);
@@ -4494,36 +4496,36 @@ function en(s) {
4494
4496
  remote: !1
4495
4497
  };
4496
4498
  }
4497
- function tn([s, e]) {
4499
+ function rn([s, e]) {
4498
4500
  return {
4499
4501
  name: s,
4500
- handle: nn(s, e),
4502
+ handle: on(s, e),
4501
4503
  initialFullPath: ""
4502
4504
  };
4503
4505
  }
4504
4506
  const Ae = /^remote:\/\/(?<name>.*)\/(?<resourceId>.*)$/;
4505
- function rn(s) {
4507
+ function nn(s) {
4506
4508
  return Ae.test(s);
4507
4509
  }
4508
- function nn(s, e) {
4510
+ function on(s, e) {
4509
4511
  return `remote://${s}/${BigInt(e)}`;
4510
4512
  }
4511
- function on(s) {
4513
+ function sn(s) {
4512
4514
  const e = s.match(Ae);
4513
4515
  if (e == null)
4514
4516
  throw new Error(`Remote list handle wasn't parsed: ${s}`);
4515
4517
  const { name: t, resourceId: n } = e.groups;
4516
4518
  return {
4517
4519
  id: Q(BigInt(n)),
4518
- type: sn(t),
4520
+ type: an(t),
4519
4521
  name: t,
4520
4522
  remote: !0
4521
4523
  };
4522
4524
  }
4523
- function sn(s) {
4525
+ function an(s) {
4524
4526
  return { name: `LS/${s}`, version: "1" };
4525
4527
  }
4526
- class Fn {
4528
+ class Wn {
4527
4529
  constructor(e, t, n, r, o) {
4528
4530
  d(this, "storageIdToResourceId");
4529
4531
  this.logger = e, this.clientLs = t, this.client = n, this.signer = r, this.localStorageToPath = o;
@@ -4539,15 +4541,15 @@ class Fn {
4539
4541
  );
4540
4542
  }
4541
4543
  async getStorageList() {
4542
- return Jr(
4544
+ return Qr(
4543
4545
  this.localStorageToPath,
4544
4546
  await this.getAvailableStorageIds()
4545
4547
  );
4546
4548
  }
4547
4549
  async listFiles(e, t) {
4548
- const n = Qr(e);
4550
+ const n = Xr(e);
4549
4551
  let r;
4550
- return n.remote ? r = await this.clientLs.list(n, t) : r = await this.getLocalFiles(this.logger, n.path, t), jr({
4552
+ return n.remote ? r = await this.clientLs.list(n, t) : r = await this.getLocalFiles(this.logger, n.path, t), Gr({
4551
4553
  storageName: n.name,
4552
4554
  list: r,
4553
4555
  signer: this.signer,
@@ -4555,7 +4557,7 @@ class Fn {
4555
4557
  });
4556
4558
  }
4557
4559
  async getAvailableStorageIds() {
4558
- return this.storageIdToResourceId == null && (this.storageIdToResourceId = await an(this.client)), this.storageIdToResourceId;
4560
+ return this.storageIdToResourceId == null && (this.storageIdToResourceId = await ln(this.client)), this.storageIdToResourceId;
4559
4561
  }
4560
4562
  async getLocalFiles(e, t, n) {
4561
4563
  const r = m.resolve(t), o = m.isAbsolute(n) ? n : m.resolve(m.join(r, n)), c = await w.opendir(o), i = [];
@@ -4570,58 +4572,58 @@ class Fn {
4570
4572
  }
4571
4573
  return {
4572
4574
  delimiter: m.sep,
4573
- items: i.map((a) => Zr(e, a)).filter((a) => a != null).map((a) => a)
4575
+ items: i.map((a) => Jr(e, a)).filter((a) => a != null).map((a) => a)
4574
4576
  };
4575
4577
  }
4576
4578
  }
4577
- async function an(s) {
4579
+ async function ln(s) {
4578
4580
  return s.withReadTx("GetAvailableStorageIds", async (e) => {
4579
4581
  const t = await e.getResourceByName("LSProvider"), n = await e.getResourceData(t, !0);
4580
- return ln(n);
4582
+ return cn(n);
4581
4583
  });
4582
4584
  }
4583
- function ln(s) {
4585
+ function cn(s) {
4584
4586
  return Object.fromEntries(
4585
4587
  s.fields.filter((e) => e.type == "Dynamic" && Ge(e.value)).map((e) => [e.name.substring(8), e.value])
4586
4588
  );
4587
4589
  }
4588
4590
  export {
4589
- Jt as ClientDownload,
4590
- Tr as ClientLogs,
4591
- ir as ClientLs,
4592
- At as ClientProgress,
4593
- It as ClientUpload,
4594
- Br as Download,
4591
+ Qt as ClientDownload,
4592
+ kr as ClientLogs,
4593
+ ar as ClientLs,
4594
+ zt as ClientProgress,
4595
+ Nt as ClientUpload,
4596
+ vr as Download,
4595
4597
  _n as DownloadDriver,
4596
- En as DownloadUrlDriver,
4597
- Dn as LogsDriver,
4598
- On as LogsStreamDriver,
4599
- Un as LongUpdater,
4600
- Fn as LsDriver,
4598
+ Fn as DownloadUrlDriver,
4599
+ $n as LogsDriver,
4600
+ En as LogsStreamDriver,
4601
+ Bn as LongUpdater,
4602
+ Wn as LsDriver,
4601
4603
  ke as MTimeError,
4602
- Pt as NetworkError,
4604
+ It as NetworkError,
4603
4605
  Pe as NoFileForUploading,
4604
- Nr as OnDemandBlobResourceSnapshot,
4605
- kr as PL_STORAGE_TO_PATH,
4606
+ Rr as OnDemandBlobResourceSnapshot,
4607
+ Lr as PL_STORAGE_TO_PATH,
4606
4608
  Le as UnexpectedEOF,
4607
4609
  Ne as UnknownStorageError,
4608
4610
  Se as Updater,
4609
- Cn as UploadDriver,
4610
- Fr as UploadResourceSnapshot,
4611
+ On as UploadDriver,
4612
+ Wr as UploadResourceSnapshot,
4611
4613
  Re as WrongLocalFileUrl,
4612
- Pn as createDownloadClient,
4613
- In as createLogsClient,
4614
- Sn as createLsFilesClient,
4615
- Rn as createUploadBlobClient,
4616
- Nn as createUploadProgressClient,
4614
+ In as createDownloadClient,
4615
+ Nn as createLogsClient,
4616
+ Un as createLsFilesClient,
4617
+ Sn as createUploadBlobClient,
4618
+ Rn as createUploadProgressClient,
4617
4619
  ve as dataToHandle,
4618
- Bn as getStream,
4619
- $ as handleToData,
4620
- Qt as headersFromProto,
4621
- Ar as importToUploadOpts,
4620
+ vn as getStream,
4621
+ _ as handleToData,
4622
+ Xt as headersFromProto,
4623
+ zr as importToUploadOpts,
4622
4624
  C as isLiveLogHandle,
4623
- Ir as isReadyLogHandle,
4624
- Pr as lineToProgress,
4625
- vn as mixcrProgressFromLogs
4625
+ Nr as isReadyLogHandle,
4626
+ Ir as lineToProgress,
4627
+ Dn as mixcrProgressFromLogs
4626
4628
  };
4627
4629
  //# sourceMappingURL=index.mjs.map