@milaboratories/pl-drivers 1.2.23 → 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
  }
@@ -839,7 +839,7 @@ class It {
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,34 +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 o.on("error", (i) => {
1821
- }).destroy(), new re(
1822
- `Http error: statusCode: ${r} url: ${e.toString()}`
1823
- );
1824
- if (r != 200)
1825
- throw o.on("error", (i) => {
1826
- }).destroy(), new 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(
1827
1824
  `Http error: statusCode: ${r} url: ${e.toString()}`
1828
1825
  );
1826
+ }
1829
1827
  return {
1830
- content: K.toWeb(o),
1828
+ content: i,
1831
1829
  size: Number(c["content-length"])
1832
1830
  };
1833
1831
  }
1834
1832
  }
1835
- const Zt = "storage://", ie = /storage:\/\/(?<storageId>.*?)\/(?<localPath>.*)/;
1833
+ const Jt = "storage://", ie = /storage:\/\/(?<storageId>.*?)\/(?<localPath>.*)/;
1836
1834
  class Ne extends Error {
1837
1835
  }
1838
1836
  class Re extends Error {
1839
1837
  }
1840
- class Jt {
1838
+ class Qt {
1841
1839
  constructor(e, t, n, r) {
1842
1840
  d(this, "grpcClient");
1843
1841
  d(this, "downloadHelper");
1844
- d(this, "isLocal", (e) => e.startsWith(Zt));
1845
- 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);
1846
1844
  }
1847
1845
  close() {
1848
1846
  }
@@ -1857,7 +1855,7 @@ class Jt {
1857
1855
  const { downloadUrl: r, headers: o } = await this.getUrl(e, t, n);
1858
1856
  return this.logger.info(`download from url ${r}`), this.isLocal(r) ? await this.readLocalFile(r) : await this.downloadHelper.downloadRemoteFile(
1859
1857
  r,
1860
- Qt(o),
1858
+ Xt(o),
1861
1859
  n
1862
1860
  );
1863
1861
  }
@@ -1877,10 +1875,10 @@ class Jt {
1877
1875
  };
1878
1876
  }
1879
1877
  }
1880
- function Qt(s) {
1878
+ function Xt(s) {
1881
1879
  return Object.fromEntries(s.map(({ name: e, value: t }) => [e, t]));
1882
1880
  }
1883
- class Xt extends g {
1881
+ class Yt extends g {
1884
1882
  constructor() {
1885
1883
  super("google.protobuf.Timestamp", [
1886
1884
  {
@@ -2013,8 +2011,8 @@ class Xt extends g {
2013
2011
  ), t;
2014
2012
  }
2015
2013
  }
2016
- const M = new Xt();
2017
- class Yt extends g {
2014
+ const M = new Yt();
2015
+ class Kt extends g {
2018
2016
  constructor() {
2019
2017
  super("MiLaboratories.Controller.Shared.LsAPI", []);
2020
2018
  }
@@ -2034,8 +2032,8 @@ class Yt extends g {
2034
2032
  ), t;
2035
2033
  }
2036
2034
  }
2037
- new Yt();
2038
- class Kt extends g {
2035
+ new Kt();
2036
+ class er extends g {
2039
2037
  constructor() {
2040
2038
  super("MiLaboratories.Controller.Shared.LsAPI.ListItem", [
2041
2039
  {
@@ -2158,8 +2156,8 @@ class Kt extends g {
2158
2156
  ), t;
2159
2157
  }
2160
2158
  }
2161
- const H = new Kt();
2162
- class er extends g {
2159
+ const H = new er();
2160
+ class tr extends g {
2163
2161
  constructor() {
2164
2162
  super("MiLaboratories.Controller.Shared.LsAPI.List", []);
2165
2163
  }
@@ -2179,8 +2177,8 @@ class er extends g {
2179
2177
  ), t;
2180
2178
  }
2181
2179
  }
2182
- new er();
2183
- class tr extends g {
2180
+ new tr();
2181
+ class rr extends g {
2184
2182
  constructor() {
2185
2183
  super("MiLaboratories.Controller.Shared.LsAPI.List.Request", [
2186
2184
  {
@@ -2245,8 +2243,8 @@ class tr extends g {
2245
2243
  ), t;
2246
2244
  }
2247
2245
  }
2248
- const rr = new tr();
2249
- class nr extends g {
2246
+ const nr = new rr();
2247
+ class or extends g {
2250
2248
  constructor() {
2251
2249
  super("MiLaboratories.Controller.Shared.LsAPI.List.Response", [
2252
2250
  {
@@ -2318,10 +2316,10 @@ class nr extends g {
2318
2316
  ), t;
2319
2317
  }
2320
2318
  }
2321
- const or = new nr(), j = new v("MiLaboratories.Controller.Shared.LS", [
2322
- { 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 }
2323
2321
  ]);
2324
- class sr {
2322
+ class ir {
2325
2323
  constructor(e) {
2326
2324
  d(this, "typeName", j.typeName);
2327
2325
  d(this, "methods", j.methods);
@@ -2342,10 +2340,10 @@ class sr {
2342
2340
  );
2343
2341
  }
2344
2342
  }
2345
- class ir {
2343
+ class ar {
2346
2344
  constructor(e, t) {
2347
2345
  d(this, "grpcClient");
2348
- this.logger = t, this.grpcClient = new sr(e);
2346
+ this.logger = t, this.grpcClient = new ir(e);
2349
2347
  }
2350
2348
  close() {
2351
2349
  }
@@ -2359,7 +2357,7 @@ class ir {
2359
2357
  ).response;
2360
2358
  }
2361
2359
  }
2362
- class ar extends g {
2360
+ class lr extends g {
2363
2361
  constructor() {
2364
2362
  super("MiLaboratories.Controller.Shared.StreamingAPI", []);
2365
2363
  }
@@ -2379,8 +2377,8 @@ class ar extends g {
2379
2377
  ), t;
2380
2378
  }
2381
2379
  }
2382
- new ar();
2383
- class lr extends g {
2380
+ new lr();
2381
+ class cr extends g {
2384
2382
  constructor() {
2385
2383
  super("MiLaboratories.Controller.Shared.StreamingAPI.StreamBinary", [
2386
2384
  {
@@ -2471,8 +2469,8 @@ class lr extends g {
2471
2469
  ), t;
2472
2470
  }
2473
2471
  }
2474
- const cr = new lr();
2475
- class dr extends g {
2472
+ const dr = new cr();
2473
+ class hr extends g {
2476
2474
  constructor() {
2477
2475
  super("MiLaboratories.Controller.Shared.StreamingAPI.ReadBinary", [
2478
2476
  {
@@ -2550,8 +2548,8 @@ class dr extends g {
2550
2548
  ), t;
2551
2549
  }
2552
2550
  }
2553
- const hr = new dr();
2554
- class ur extends g {
2551
+ const ur = new hr();
2552
+ class pr extends g {
2555
2553
  constructor() {
2556
2554
  super("MiLaboratories.Controller.Shared.StreamingAPI.StreamText", [
2557
2555
  {
@@ -2654,8 +2652,8 @@ class ur extends g {
2654
2652
  ), t;
2655
2653
  }
2656
2654
  }
2657
- const pr = new ur();
2658
- class gr extends g {
2655
+ const gr = new pr();
2656
+ class fr extends g {
2659
2657
  constructor() {
2660
2658
  super("MiLaboratories.Controller.Shared.StreamingAPI.ReadText", [
2661
2659
  {
@@ -2758,8 +2756,8 @@ class gr extends g {
2758
2756
  ), t;
2759
2757
  }
2760
2758
  }
2761
- const fr = new gr();
2762
- class mr extends g {
2759
+ const mr = new fr();
2760
+ class wr extends g {
2763
2761
  constructor() {
2764
2762
  super("MiLaboratories.Controller.Shared.StreamingAPI.LastLines", [
2765
2763
  {
@@ -2862,8 +2860,8 @@ class mr extends g {
2862
2860
  ), t;
2863
2861
  }
2864
2862
  }
2865
- const wr = new mr();
2866
- class yr extends g {
2863
+ const yr = new wr();
2864
+ class br extends g {
2867
2865
  constructor() {
2868
2866
  super("MiLaboratories.Controller.Shared.StreamingAPI.Response", [
2869
2867
  {
@@ -2940,44 +2938,44 @@ class yr extends g {
2940
2938
  ), t;
2941
2939
  }
2942
2940
  }
2943
- const U = new yr(), G = new v(
2941
+ const U = new br(), G = new v(
2944
2942
  "MiLaboratories.Controller.Shared.Streaming",
2945
2943
  [
2946
2944
  {
2947
2945
  name: "StreamBinary",
2948
2946
  serverStreaming: !0,
2949
2947
  options: {},
2950
- I: cr,
2948
+ I: dr,
2951
2949
  O: U
2952
2950
  },
2953
2951
  {
2954
2952
  name: "ReadBinary",
2955
2953
  options: {},
2956
- I: hr,
2954
+ I: ur,
2957
2955
  O: U
2958
2956
  },
2959
2957
  {
2960
2958
  name: "StreamText",
2961
2959
  serverStreaming: !0,
2962
2960
  options: {},
2963
- I: pr,
2961
+ I: gr,
2964
2962
  O: U
2965
2963
  },
2966
2964
  {
2967
2965
  name: "ReadText",
2968
2966
  options: {},
2969
- I: fr,
2967
+ I: mr,
2970
2968
  O: U
2971
2969
  },
2972
2970
  {
2973
2971
  name: "LastLines",
2974
2972
  options: {},
2975
- I: wr,
2973
+ I: yr,
2976
2974
  O: U
2977
2975
  }
2978
2976
  ]
2979
2977
  );
2980
- class br {
2978
+ class Tr {
2981
2979
  constructor(e) {
2982
2980
  d(this, "typeName", G.typeName);
2983
2981
  d(this, "methods", G.methods);
@@ -3076,10 +3074,10 @@ class br {
3076
3074
  );
3077
3075
  }
3078
3076
  }
3079
- class Tr {
3077
+ class kr {
3080
3078
  constructor(e, t, n) {
3081
3079
  d(this, "grpcClient");
3082
- 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);
3083
3081
  }
3084
3082
  close() {
3085
3083
  }
@@ -3112,13 +3110,13 @@ class Tr {
3112
3110
  )).response;
3113
3111
  }
3114
3112
  }
3115
- const kr = process.env.PL_STORAGE_TO_PATH ? Object.fromEntries(
3113
+ const Lr = process.env.PL_STORAGE_TO_PATH ? Object.fromEntries(
3116
3114
  process.env.PL_STORAGE_TO_PATH.split(";").map((s) => s.split(":"))
3117
3115
  ) : {};
3118
- function Pn(s, e, t) {
3119
- return t === void 0 && (t = kr), e.getDriver({
3116
+ function In(s, e, t) {
3117
+ return t === void 0 && (t = Lr), e.getDriver({
3120
3118
  name: "DownloadBlob",
3121
- init: (r, o, c) => new Jt(
3119
+ init: (r, o, c) => new Qt(
3122
3120
  o,
3123
3121
  c,
3124
3122
  s,
@@ -3126,31 +3124,31 @@ function Pn(s, e, t) {
3126
3124
  )
3127
3125
  });
3128
3126
  }
3129
- function In(s, e) {
3127
+ function Nn(s, e) {
3130
3128
  return s.getDriver({
3131
3129
  name: "StreamLogs",
3132
- init: (t, n, r) => new Tr(n, r, e)
3130
+ init: (t, n, r) => new kr(n, r, e)
3133
3131
  });
3134
3132
  }
3135
- function Nn(s, e) {
3133
+ function Rn(s, e) {
3136
3134
  return s.getDriver({
3137
3135
  name: "UploadProgress",
3138
- init: (t, n, r) => new At(n, r, s, e)
3136
+ init: (t, n, r) => new zt(n, r, s, e)
3139
3137
  });
3140
3138
  }
3141
- function Rn(s, e) {
3139
+ function Sn(s, e) {
3142
3140
  return s.getDriver({
3143
3141
  name: "UploadBlob",
3144
- init: (t, n, r) => new It(n, r, s, e)
3142
+ init: (t, n, r) => new Nt(n, r, s, e)
3145
3143
  });
3146
3144
  }
3147
- function Sn(s, e) {
3145
+ function Un(s, e) {
3148
3146
  return s.getDriver({
3149
3147
  name: "LsFiles",
3150
- init: (t, n, r) => new ir(n, e)
3148
+ init: (t, n, r) => new ar(n, e)
3151
3149
  });
3152
3150
  }
3153
- class Un {
3151
+ class Bn {
3154
3152
  constructor(e, t) {
3155
3153
  d(this, "updater");
3156
3154
  d(this, "schedule", () => this.updater.schedule());
@@ -3179,7 +3177,7 @@ class Se {
3179
3177
  })());
3180
3178
  }
3181
3179
  }
3182
- async function Bn(s, e) {
3180
+ async function vn(s, e) {
3183
3181
  return s.withReadTx("LogsDriverGetStream", async (t) => {
3184
3182
  const n = await t.getResourceData(e, !0), r = await Me(t, He(n, "stream"));
3185
3183
  if (r.error != "")
@@ -3188,9 +3186,9 @@ async function Bn(s, e) {
3188
3186
  return await t.getResourceData(r.valueId, !1);
3189
3187
  });
3190
3188
  }
3191
- const Ue = "8C7#F1328%9E089B3D22", Lr = /(?<stage>.*):\s*(?<progress>[\d.]+%)\s.*(?<eta>ETA:.*)/g;
3192
- function Pr(s) {
3193
- 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);
3194
3192
  if (t == null || t.length != 4)
3195
3193
  return;
3196
3194
  const [n, r, o, c] = t;
@@ -3203,7 +3201,7 @@ function Pr(s) {
3203
3201
  // ETA: 00:00:07
3204
3202
  };
3205
3203
  }
3206
- async function vn(s, e, t) {
3204
+ async function Dn(s, e, t) {
3207
3205
  const n = await e.lastLines(
3208
3206
  s,
3209
3207
  1,
@@ -3216,7 +3214,7 @@ async function vn(s, e, t) {
3216
3214
  const r = n.data.toString().split(/\r?\n/)[0];
3217
3215
  if (r == null)
3218
3216
  return { found: !1 };
3219
- const o = Pr(r);
3217
+ const o = Ir(r);
3220
3218
  return o === void 0 ? { found: !1 } : { found: !0, ...o };
3221
3219
  }
3222
3220
  class Be {
@@ -3257,7 +3255,7 @@ class Be {
3257
3255
  this.cache.delete(e.path), this.totalSizeBytes -= e.sizeBytes;
3258
3256
  }
3259
3257
  }
3260
- class Dn {
3258
+ class $n {
3261
3259
  constructor(e, t) {
3262
3260
  this.logsStreamDriver = e, this.downloadDriver = t;
3263
3261
  }
@@ -3351,12 +3349,12 @@ function q(s, e) {
3351
3349
  var t;
3352
3350
  return (t = s.accessor(e).node().traverse("stream")) == null ? void 0 : t.resourceInfo;
3353
3351
  }
3354
- function $(s) {
3352
+ function _(s) {
3355
3353
  let e;
3356
3354
  if (C(s))
3357
3355
  e = s.match(De);
3358
- else if (Ir(s))
3359
- e = s.match(_e);
3356
+ else if (Nr(s))
3357
+ e = s.match($e);
3360
3358
  else throw new Error(`Log handle is malformed: ${s}`);
3361
3359
  if (e == null) throw new Error(`Log handle wasn't parsed: ${s}`);
3362
3360
  const { resourceType: t, resourceVersion: n, resourceId: r } = e.groups;
@@ -3372,11 +3370,11 @@ const De = /^log\+live:\/\/log\/(?<resourceType>.*)\/(?<resourceVersion>.*)\/(?<
3372
3370
  function C(s) {
3373
3371
  return De.test(s);
3374
3372
  }
3375
- const _e = /^log\+ready:\/\/log\/(?<resourceType>.*)\/(?<resourceVersion>.*)\/(?<resourceId>.*)$/;
3376
- function Ir(s) {
3377
- return _e.test(s);
3373
+ const $e = /^log\+ready:\/\/log\/(?<resourceType>.*)\/(?<resourceVersion>.*)\/(?<resourceId>.*)$/;
3374
+ function Nr(s) {
3375
+ return $e.test(s);
3378
3376
  }
3379
- const Nr = ye({
3377
+ const Rr = ye({
3380
3378
  kv: {
3381
3379
  "ctl/file/blobInfo": L.object({
3382
3380
  sizeBytes: L.coerce.number()
@@ -3416,17 +3414,17 @@ class _n {
3416
3414
  getOnDemandBlob(e, t) {
3417
3415
  if (t === void 0)
3418
3416
  return b.make((c) => this.getOnDemandBlob(e, c));
3419
- const n = be(e) ? Te(e, Nr, t) : e, r = k();
3417
+ const n = be(e) ? Te(e, Rr, t) : e, r = k();
3420
3418
  return t.addOnDestroy(() => this.releaseOnDemandBlob(n.id, r)), this.getOnDemandBlobNoCtx(t.watcher, n, r);
3421
3419
  }
3422
3420
  getLocalPath(e) {
3423
3421
  return Z(e, this.signer);
3424
3422
  }
3425
3423
  async getContent(e) {
3426
- if (vr(e)) return await Sr(this.getLocalPath(e));
3424
+ if (Dr(e)) return await Ur(this.getLocalPath(e));
3427
3425
  if (!_r(e)) throw new Error("Malformed remote handle");
3428
- const t = $r(e, this.signer), { content: n } = await this.clientDownload.downloadBlob(t);
3429
- return await we(n);
3426
+ const t = Cr(e, this.signer), { content: n } = await this.clientDownload.downloadBlob(t);
3427
+ return await me(n);
3430
3428
  }
3431
3429
  getDownloadedBlobNoCtx(e, t, n) {
3432
3430
  let r = this.idToDownload.get(t.id);
@@ -3445,11 +3443,11 @@ class _n {
3445
3443
  }
3446
3444
  }
3447
3445
  setNewDownloadTask(e, t, n) {
3448
- const r = this.getFilePath(t.id), o = new Br(
3446
+ const r = this.getFilePath(t.id), o = new vr(
3449
3447
  this.clientDownload,
3450
3448
  t,
3451
3449
  r,
3452
- Dr(r, this.signer)
3450
+ $r(r, this.signer)
3453
3451
  );
3454
3452
  return this.idToDownload.set(t.id, o), o;
3455
3453
  }
@@ -3459,9 +3457,9 @@ class _n {
3459
3457
  }
3460
3458
  getOnDemandBlobNoCtx(e, t, n) {
3461
3459
  let r = this.idToOnDemand.get(t.id);
3462
- return r === void 0 && (r = new Rr(
3460
+ return r === void 0 && (r = new Sr(
3463
3461
  t.kv["ctl/file/blobInfo"].sizeBytes,
3464
- Cr(t, this.signer)
3462
+ Or(t, this.signer)
3465
3463
  ), this.idToOnDemand.set(t.id, r)), r.attach(e, n), r.getHandle();
3466
3464
  }
3467
3465
  getLastLogs(e, t, n) {
@@ -3531,7 +3529,7 @@ class _n {
3531
3529
  }
3532
3530
  async lastLines(e, t, n, r) {
3533
3531
  const o = await this.clientLogs.lastLines(
3534
- $(e),
3532
+ _(e),
3535
3533
  t,
3536
3534
  BigInt(n ?? 0),
3537
3535
  r
@@ -3546,7 +3544,7 @@ class _n {
3546
3544
  }
3547
3545
  async readText(e, t, n, r) {
3548
3546
  const o = await this.clientLogs.readText(
3549
- $(e),
3547
+ _(e),
3550
3548
  t,
3551
3549
  BigInt(n ?? 0),
3552
3550
  r
@@ -3592,7 +3590,7 @@ class _n {
3592
3590
  return m.resolve(m.join(this.saveDir, String(BigInt(e))));
3593
3591
  }
3594
3592
  }
3595
- class Rr {
3593
+ class Sr {
3596
3594
  constructor(e, t) {
3597
3595
  d(this, "change", new S());
3598
3596
  d(this, "counter", new D());
@@ -3624,7 +3622,7 @@ class ae {
3624
3622
  }
3625
3623
  async update() {
3626
3624
  try {
3627
- const e = await Ur(
3625
+ const e = await Br(
3628
3626
  this.path,
3629
3627
  this.lines,
3630
3628
  this.patternToSearch
@@ -3646,13 +3644,13 @@ async function le(s) {
3646
3644
  return !1;
3647
3645
  }
3648
3646
  }
3649
- async function Sr(s) {
3650
- return await we(K.toWeb(E.createReadStream(s)));
3647
+ async function Ur(s) {
3648
+ return await me(K.toWeb(E.createReadStream(s)));
3651
3649
  }
3652
- function Ur(s, e, t) {
3650
+ function Br(s, e, t) {
3653
3651
  const n = E.createReadStream(s), r = new ee();
3654
3652
  return new Promise((o, c) => {
3655
- const i = Je.createInterface(n, r), l = new Qe();
3653
+ const i = Qe.createInterface(n, r), l = new Xe();
3656
3654
  i.on("line", function(a) {
3657
3655
  t != null && !a.includes(t) || (l.push(a), l.length > e && l.shift());
3658
3656
  }), i.on("error", c), i.on("close", function() {
@@ -3660,7 +3658,7 @@ function Ur(s, e, t) {
3660
3658
  });
3661
3659
  });
3662
3660
  }
3663
- let Br = class {
3661
+ let vr = class {
3664
3662
  constructor(e, t, n, r) {
3665
3663
  d(this, "counter", new D());
3666
3664
  d(this, "change", new S());
@@ -3679,7 +3677,7 @@ let Br = class {
3679
3677
  this.rInfo
3680
3678
  );
3681
3679
  if (await le(m.dirname(this.path)) || w.mkdir(m.dirname(this.path), { recursive: !0 }), await le(this.path))
3682
- e.cancel("the file already existed");
3680
+ await e.cancel("the file already existed");
3683
3681
  else {
3684
3682
  const n = ee.toWeb(E.createWriteStream(this.path));
3685
3683
  await e.pipeTo(n);
@@ -3720,12 +3718,12 @@ let Br = class {
3720
3718
  };
3721
3719
  class ce extends Error {
3722
3720
  }
3723
- const $e = /^blob\+local:\/\/download\/(?<path>.*)#(?<signature>.*)$/;
3724
- function vr(s) {
3725
- return !!s.match($e);
3721
+ const _e = /^blob\+local:\/\/download\/(?<path>.*)#(?<signature>.*)$/;
3722
+ function Dr(s) {
3723
+ return !!s.match(_e);
3726
3724
  }
3727
3725
  function Z(s, e) {
3728
- const t = s.match($e);
3726
+ const t = s.match(_e);
3729
3727
  if (t === null)
3730
3728
  throw new Error(`Local handle is malformed: ${s}, matches: ${t}`);
3731
3729
  const { path: n, signature: r } = t.groups;
@@ -3735,14 +3733,14 @@ function Z(s, e) {
3735
3733
  `Signature verification failed for: ${s}`
3736
3734
  ), n;
3737
3735
  }
3738
- function Dr(s, e) {
3736
+ function $r(s, e) {
3739
3737
  return `blob+local://download/${s}#${e.sign(s)}`;
3740
3738
  }
3741
3739
  const Ce = /^blob\+remote:\/\/download\/(?<content>(?<resourceType>.*)\/(?<resourceVersion>.*)\/(?<resourceId>.*))#(?<signature>.*)$/;
3742
3740
  function _r(s) {
3743
3741
  return !!s.match(Ce);
3744
3742
  }
3745
- function $r(s, e) {
3743
+ function Cr(s, e) {
3746
3744
  const t = s.match(Ce);
3747
3745
  if (t === null)
3748
3746
  throw new Error(
@@ -3758,16 +3756,16 @@ function $r(s, e) {
3758
3756
  type: { name: r, version: o }
3759
3757
  };
3760
3758
  }
3761
- function Cr(s, e) {
3759
+ function Or(s, e) {
3762
3760
  const t = `${s.type.name}/${s.type.version}/${BigInt(s.id)}`;
3763
3761
  return `blob+remote://download/${t}#${e.sign(t)}`;
3764
3762
  }
3765
- const Or = L.object({
3763
+ const Er = L.object({
3766
3764
  localPath: L.string(),
3767
3765
  pathSignature: L.string(),
3768
3766
  modificationTime: L.string()
3769
- }), Er = L.union([Or, L.object({})]), Fr = ye({
3770
- data: Er,
3767
+ }), Fr = L.union([Er, L.object({})]), Wr = ye({
3768
+ data: Fr,
3771
3769
  fields: {
3772
3770
  blob: !1,
3773
3771
  // for BlobUpload
@@ -3775,7 +3773,7 @@ const Or = L.object({
3775
3773
  // for BlobIndex
3776
3774
  }
3777
3775
  });
3778
- class Cn {
3776
+ class On {
3779
3777
  constructor(e, t, n, r, o = {
3780
3778
  nConcurrentPartUploads: 10,
3781
3779
  nConcurrentGetProgresses: 10,
@@ -3798,7 +3796,7 @@ class Cn {
3798
3796
  // 15 seconds
3799
3797
  backoffMultiplier: 1.5,
3800
3798
  jitter: 0.5
3801
- }), this.hooks = new me(
3799
+ }), this.hooks = new we(
3802
3800
  () => this.startUpdating(),
3803
3801
  () => this.stopUpdating(),
3804
3802
  { stopDebounce: o.stopPollingDelay },
@@ -3808,7 +3806,7 @@ class Cn {
3808
3806
  getProgressId(e, t) {
3809
3807
  if (t == null)
3810
3808
  return b.make((c) => this.getProgressId(e, c));
3811
- const n = be(e) ? Te(e, Fr, t) : e, r = k();
3809
+ const n = be(e) ? Te(e, Wr, t) : e, r = k();
3812
3810
  t.attacheHooks(this.hooks), t.addOnDestroy(() => this.release(n.id, r));
3813
3811
  const o = this.getProgressIdNoCtx(t.watcher, n, r);
3814
3812
  return de(o) || t.markUnstable(
@@ -3819,7 +3817,7 @@ class Cn {
3819
3817
  const r = t.fields.blob != null || t.fields.incarnation != null, o = this.idToProgress.get(t.id);
3820
3818
  if (o != null)
3821
3819
  return o.attach(e, n), o.mustGetProgress(r);
3822
- const c = new Wr(
3820
+ const c = new Ar(
3823
3821
  this.logger,
3824
3822
  this.clientBlob,
3825
3823
  this.clientProgress,
@@ -3876,7 +3874,7 @@ class Cn {
3876
3874
  return Array.from(this.idToProgress.entries()).filter(([e, t]) => !de(t.progress)).map(([e, t]) => t);
3877
3875
  }
3878
3876
  }
3879
- class Wr {
3877
+ class Ar {
3880
3878
  constructor(e, t, n, r, o, c) {
3881
3879
  d(this, "change", new S());
3882
3880
  d(this, "counter", new D());
@@ -3886,7 +3884,7 @@ class Wr {
3886
3884
  this.logger = e, this.clientBlob = t, this.clientProgress = n, this.nConcurrentPartsUpload = r, this.res = c;
3887
3885
  const i = c.type.name.startsWith("BlobUpload");
3888
3886
  let l;
3889
- i && (this.uploadOpts = Ar(c), l = xr(
3887
+ i && (this.uploadOpts = zr(c), l = Mr(
3890
3888
  o,
3891
3889
  this.uploadOpts.localPath,
3892
3890
  this.uploadOpts.pathSignature
@@ -3955,7 +3953,7 @@ class Wr {
3955
3953
  async updateStatus() {
3956
3954
  try {
3957
3955
  const e = await this.clientProgress.getStatus(this.res), t = this.progress.status;
3958
- 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();
3959
3957
  } catch (e) {
3960
3958
  if (this.setLastError(e), e.name == "RpcError" && e.code == "DEADLINE_EXCEEDED") {
3961
3959
  this.logger.warn(
@@ -3976,7 +3974,7 @@ class Wr {
3976
3974
  function de(s) {
3977
3975
  return s.done && s.status !== void 0 && s.status !== null && s.status.progress >= 1;
3978
3976
  }
3979
- function Ar(s) {
3977
+ function zr(s) {
3980
3978
  if (s.data == null || !("modificationTime" in s.data))
3981
3979
  throw new Error(
3982
3980
  "no upload options in BlobUpload resource data: " + B(s.data)
@@ -4000,14 +3998,14 @@ function Ar(s) {
4000
3998
  pathSignature: e.pathSignature
4001
3999
  };
4002
4000
  }
4003
- function zr(s) {
4001
+ function xr(s) {
4004
4002
  return {
4005
4003
  progress: s.progress ?? 0,
4006
4004
  bytesProcessed: Number(s.bytesProcessed),
4007
4005
  bytesTotal: Number(s.bytesTotal)
4008
4006
  };
4009
4007
  }
4010
- function xr(s, e, t) {
4008
+ function Mr(s, e, t) {
4011
4009
  try {
4012
4010
  return s.verify(e, t), !0;
4013
4011
  } catch {
@@ -4020,7 +4018,7 @@ function Oe(s) {
4020
4018
  function he(s) {
4021
4019
  return s.name == "RpcError" && (s.code == "NOT_FOUND" || s.code == "ABORTED" || s.code == "ALREADY_EXISTS");
4022
4020
  }
4023
- class On {
4021
+ class En {
4024
4022
  constructor(e, t = {
4025
4023
  nConcurrentGetLogs: 10,
4026
4024
  pollingInterval: 1e3,
@@ -4037,7 +4035,7 @@ class On {
4037
4035
  d(this, "keepRunning", !1);
4038
4036
  /** Actual state of main loop. */
4039
4037
  d(this, "currentLoop");
4040
- this.clientLogs = e, this.opts = t, this.hooks = new me(
4038
+ this.clientLogs = e, this.opts = t, this.hooks = new we(
4041
4039
  () => this.startUpdating(),
4042
4040
  () => this.stopUpdating(),
4043
4041
  { stopDebounce: t.stopPollingDelay },
@@ -4111,7 +4109,7 @@ class On {
4111
4109
  return await this.tryWithNotFound(
4112
4110
  e,
4113
4111
  () => this.clientLogs.lastLines(
4114
- $(e),
4112
+ _(e),
4115
4113
  t,
4116
4114
  BigInt(n ?? 0),
4117
4115
  r
@@ -4122,7 +4120,7 @@ class On {
4122
4120
  return await this.tryWithNotFound(
4123
4121
  e,
4124
4122
  () => this.clientLogs.readText(
4125
- $(e),
4123
+ _(e),
4126
4124
  t,
4127
4125
  BigInt(n ?? 0),
4128
4126
  r
@@ -4234,7 +4232,7 @@ class ue {
4234
4232
  }
4235
4233
  }
4236
4234
  }
4237
- class En {
4235
+ class Fn {
4238
4236
  constructor(e, t, n, r = {
4239
4237
  cacheSoftSizeBytes: 50 * 1024 * 1024,
4240
4238
  withGunzip: !0,
@@ -4308,18 +4306,18 @@ class En {
4308
4306
  );
4309
4307
  }
4310
4308
  setNewTask(e, t, n) {
4311
- const r = new Mr(this.getFilePath(t), t);
4309
+ const r = new Hr(this.getFilePath(t), t);
4312
4310
  return r.attach(e, n), this.urlToDownload.set(t.toString(), r), r;
4313
4311
  }
4314
4312
  removeTask(e, t) {
4315
4313
  e.abort(t), e.change.markChanged(), this.urlToDownload.delete(e.url.toString());
4316
4314
  }
4317
4315
  getFilePath(e) {
4318
- const t = Xe("sha256").update(e.toString()).digest("hex");
4316
+ const t = Ye("sha256").update(e.toString()).digest("hex");
4319
4317
  return m.join(this.saveDir, t);
4320
4318
  }
4321
4319
  }
4322
- class Mr {
4320
+ class Hr {
4323
4321
  constructor(e, t) {
4324
4322
  d(this, "counter", new D());
4325
4323
  d(this, "change", new S());
@@ -4349,7 +4347,7 @@ class Mr {
4349
4347
  }
4350
4348
  }
4351
4349
  async downloadAndUntar(e, t, n) {
4352
- if (await Hr(this.path))
4350
+ if (await jr(this.path))
4353
4351
  return await Ee(this.path);
4354
4352
  const r = await e.downloadRemoteFile(
4355
4353
  this.url.toString(),
@@ -4358,10 +4356,10 @@ class Mr {
4358
4356
  );
4359
4357
  let o = r.content;
4360
4358
  if (t) {
4361
- const i = Ze.toWeb(Ye.createGunzip());
4359
+ const i = Ze.toWeb(Ke.createGunzip());
4362
4360
  o = o.pipeThrough(i, { signal: n });
4363
4361
  }
4364
- const c = ee.toWeb(Ke.extract(this.path));
4362
+ const c = ee.toWeb(et.extract(this.path));
4365
4363
  return await o.pipeTo(c, { signal: n }), r.size;
4366
4364
  }
4367
4365
  getPath() {
@@ -4380,7 +4378,7 @@ class Mr {
4380
4378
  }
4381
4379
  class pe extends Error {
4382
4380
  }
4383
- async function Hr(s) {
4381
+ async function jr(s) {
4384
4382
  try {
4385
4383
  return await w.access(s), !0;
4386
4384
  } catch {
@@ -4399,14 +4397,14 @@ async function Ee(s) {
4399
4397
  async function J(s) {
4400
4398
  await w.rm(s, { recursive: !0, force: !0 });
4401
4399
  }
4402
- function jr(s) {
4400
+ function Gr(s) {
4403
4401
  var t;
4404
4402
  return {
4405
4403
  parent: s.list.items.length > 0 ? (t = s.list.items[0]) == null ? void 0 : t.directory : void 0,
4406
- entries: s.list.items.map((n) => Gr(n, s))
4404
+ entries: s.list.items.map((n) => Vr(n, s))
4407
4405
  };
4408
4406
  }
4409
- function Gr(s, e) {
4407
+ function Vr(s, e) {
4410
4408
  return s.isDir ? {
4411
4409
  type: "dir",
4412
4410
  name: s.name,
@@ -4415,18 +4413,18 @@ function Gr(s, e) {
4415
4413
  type: "file",
4416
4414
  name: s.name,
4417
4415
  fullPath: s.fullName,
4418
- handle: Vr({ item: s, ...e })
4416
+ handle: qr({ item: s, ...e })
4419
4417
  };
4420
4418
  }
4421
- function Vr(s) {
4422
- return s.remote ? qr(s) : Fe(
4419
+ function qr(s) {
4420
+ return s.remote ? Zr(s) : Fe(
4423
4421
  s.item.fullName,
4424
4422
  s.signer,
4425
4423
  s.item.size,
4426
4424
  O(s.item.lastModified).seconds
4427
4425
  );
4428
4426
  }
4429
- function qr(s) {
4427
+ function Zr(s) {
4430
4428
  return `index://index/${encodeURIComponent(
4431
4429
  JSON.stringify({
4432
4430
  storageId: s.storageName,
@@ -4443,7 +4441,7 @@ function Fe(s, e, t, n) {
4443
4441
  };
4444
4442
  return `upload://upload/${encodeURIComponent(JSON.stringify(r))}`;
4445
4443
  }
4446
- function Zr(s, e) {
4444
+ function Jr(s, e) {
4447
4445
  if (!(e.dirent.isFile() || e.dirent.isDirectory())) {
4448
4446
  s.warn(
4449
4447
  `tried to get non-dir and non-file ${e.dirent.name}, skip it`
@@ -4462,32 +4460,32 @@ function Zr(s, e) {
4462
4460
  size: BigInt(e.stat.size)
4463
4461
  };
4464
4462
  }
4465
- function Jr(s, e) {
4466
- 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);
4467
4465
  return t.concat(n);
4468
4466
  }
4469
- function Qr(s) {
4470
- if (rn(s))
4471
- return on(s);
4472
- if (Yr(s))
4473
- return en(s);
4467
+ function Xr(s) {
4468
+ if (nn(s))
4469
+ return sn(s);
4470
+ if (Kr(s))
4471
+ return tn(s);
4474
4472
  qe(s);
4475
4473
  }
4476
- function Xr([s, e]) {
4474
+ function Yr([s, e]) {
4477
4475
  return {
4478
4476
  name: s,
4479
- handle: Kr(s, e),
4477
+ handle: en(s, e),
4480
4478
  initialFullPath: e
4481
4479
  };
4482
4480
  }
4483
4481
  const We = /^local:\/\/(?<name>.*)\/(?<path>.*)$/;
4484
- function Yr(s) {
4482
+ function Kr(s) {
4485
4483
  return We.test(s);
4486
4484
  }
4487
- function Kr(s, e) {
4485
+ function en(s, e) {
4488
4486
  return `local://${s}/${encodeURIComponent(e)}`;
4489
4487
  }
4490
- function en(s) {
4488
+ function tn(s) {
4491
4489
  const e = s.match(We);
4492
4490
  if (e == null)
4493
4491
  throw new Error(`Local list handle wasn't parsed: ${s}`);
@@ -4498,36 +4496,36 @@ function en(s) {
4498
4496
  remote: !1
4499
4497
  };
4500
4498
  }
4501
- function tn([s, e]) {
4499
+ function rn([s, e]) {
4502
4500
  return {
4503
4501
  name: s,
4504
- handle: nn(s, e),
4502
+ handle: on(s, e),
4505
4503
  initialFullPath: ""
4506
4504
  };
4507
4505
  }
4508
4506
  const Ae = /^remote:\/\/(?<name>.*)\/(?<resourceId>.*)$/;
4509
- function rn(s) {
4507
+ function nn(s) {
4510
4508
  return Ae.test(s);
4511
4509
  }
4512
- function nn(s, e) {
4510
+ function on(s, e) {
4513
4511
  return `remote://${s}/${BigInt(e)}`;
4514
4512
  }
4515
- function on(s) {
4513
+ function sn(s) {
4516
4514
  const e = s.match(Ae);
4517
4515
  if (e == null)
4518
4516
  throw new Error(`Remote list handle wasn't parsed: ${s}`);
4519
4517
  const { name: t, resourceId: n } = e.groups;
4520
4518
  return {
4521
4519
  id: Q(BigInt(n)),
4522
- type: sn(t),
4520
+ type: an(t),
4523
4521
  name: t,
4524
4522
  remote: !0
4525
4523
  };
4526
4524
  }
4527
- function sn(s) {
4525
+ function an(s) {
4528
4526
  return { name: `LS/${s}`, version: "1" };
4529
4527
  }
4530
- class Fn {
4528
+ class Wn {
4531
4529
  constructor(e, t, n, r, o) {
4532
4530
  d(this, "storageIdToResourceId");
4533
4531
  this.logger = e, this.clientLs = t, this.client = n, this.signer = r, this.localStorageToPath = o;
@@ -4543,15 +4541,15 @@ class Fn {
4543
4541
  );
4544
4542
  }
4545
4543
  async getStorageList() {
4546
- return Jr(
4544
+ return Qr(
4547
4545
  this.localStorageToPath,
4548
4546
  await this.getAvailableStorageIds()
4549
4547
  );
4550
4548
  }
4551
4549
  async listFiles(e, t) {
4552
- const n = Qr(e);
4550
+ const n = Xr(e);
4553
4551
  let r;
4554
- 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({
4555
4553
  storageName: n.name,
4556
4554
  list: r,
4557
4555
  signer: this.signer,
@@ -4559,7 +4557,7 @@ class Fn {
4559
4557
  });
4560
4558
  }
4561
4559
  async getAvailableStorageIds() {
4562
- 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;
4563
4561
  }
4564
4562
  async getLocalFiles(e, t, n) {
4565
4563
  const r = m.resolve(t), o = m.isAbsolute(n) ? n : m.resolve(m.join(r, n)), c = await w.opendir(o), i = [];
@@ -4574,58 +4572,58 @@ class Fn {
4574
4572
  }
4575
4573
  return {
4576
4574
  delimiter: m.sep,
4577
- 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)
4578
4576
  };
4579
4577
  }
4580
4578
  }
4581
- async function an(s) {
4579
+ async function ln(s) {
4582
4580
  return s.withReadTx("GetAvailableStorageIds", async (e) => {
4583
4581
  const t = await e.getResourceByName("LSProvider"), n = await e.getResourceData(t, !0);
4584
- return ln(n);
4582
+ return cn(n);
4585
4583
  });
4586
4584
  }
4587
- function ln(s) {
4585
+ function cn(s) {
4588
4586
  return Object.fromEntries(
4589
4587
  s.fields.filter((e) => e.type == "Dynamic" && Ge(e.value)).map((e) => [e.name.substring(8), e.value])
4590
4588
  );
4591
4589
  }
4592
4590
  export {
4593
- Jt as ClientDownload,
4594
- Tr as ClientLogs,
4595
- ir as ClientLs,
4596
- At as ClientProgress,
4597
- It as ClientUpload,
4598
- 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,
4599
4597
  _n as DownloadDriver,
4600
- En as DownloadUrlDriver,
4601
- Dn as LogsDriver,
4602
- On as LogsStreamDriver,
4603
- Un as LongUpdater,
4604
- Fn as LsDriver,
4598
+ Fn as DownloadUrlDriver,
4599
+ $n as LogsDriver,
4600
+ En as LogsStreamDriver,
4601
+ Bn as LongUpdater,
4602
+ Wn as LsDriver,
4605
4603
  ke as MTimeError,
4606
- Pt as NetworkError,
4604
+ It as NetworkError,
4607
4605
  Pe as NoFileForUploading,
4608
- Nr as OnDemandBlobResourceSnapshot,
4609
- kr as PL_STORAGE_TO_PATH,
4606
+ Rr as OnDemandBlobResourceSnapshot,
4607
+ Lr as PL_STORAGE_TO_PATH,
4610
4608
  Le as UnexpectedEOF,
4611
4609
  Ne as UnknownStorageError,
4612
4610
  Se as Updater,
4613
- Cn as UploadDriver,
4614
- Fr as UploadResourceSnapshot,
4611
+ On as UploadDriver,
4612
+ Wr as UploadResourceSnapshot,
4615
4613
  Re as WrongLocalFileUrl,
4616
- Pn as createDownloadClient,
4617
- In as createLogsClient,
4618
- Sn as createLsFilesClient,
4619
- Rn as createUploadBlobClient,
4620
- Nn as createUploadProgressClient,
4614
+ In as createDownloadClient,
4615
+ Nn as createLogsClient,
4616
+ Un as createLsFilesClient,
4617
+ Sn as createUploadBlobClient,
4618
+ Rn as createUploadProgressClient,
4621
4619
  ve as dataToHandle,
4622
- Bn as getStream,
4623
- $ as handleToData,
4624
- Qt as headersFromProto,
4625
- Ar as importToUploadOpts,
4620
+ vn as getStream,
4621
+ _ as handleToData,
4622
+ Xt as headersFromProto,
4623
+ zr as importToUploadOpts,
4626
4624
  C as isLiveLogHandle,
4627
- Ir as isReadyLogHandle,
4628
- Pr as lineToProgress,
4629
- vn as mixcrProgressFromLogs
4625
+ Nr as isReadyLogHandle,
4626
+ Ir as lineToProgress,
4627
+ Dn as mixcrProgressFromLogs
4630
4628
  };
4631
4629
  //# sourceMappingURL=index.mjs.map