@milaboratories/pl-drivers 1.3.16 → 1.3.17

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
@@ -2,31 +2,31 @@ var je = Object.defineProperty;
2
2
  var Ge = (s, e, t) => e in s ? je(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
3
  var d = (s, e, t) => Ge(s, typeof e != "symbol" ? e + "" : e, t);
4
4
  import * as m from "node:fs/promises";
5
- import { addRTypeToMetadata as k, valErr as Ve, getField as qe, isNullResourceId as Je, bigintToResourceId as Y, stringifyWithResourceId as be, isNotNullResourceId as Ze } from "@milaboratories/pl-client";
5
+ import { addRTypeToMetadata as k, valErr as Ve, getField as qe, isNullResourceId as Je, bigintToResourceId as Y, stringifyWithResourceId as be, resourceIdToString as Ze, isNotNullResourceId as Qe } from "@milaboratories/pl-client";
6
6
  import { ServiceType as D, stackIntercept as y } from "@protobuf-ts/runtime-rpc";
7
7
  import { MessageType as g, reflectionMergePartial as f, UnknownFieldHandler as u, WireType as h, PbLong as I, typeofJsonValue as Te } from "@protobuf-ts/runtime";
8
8
  import { request as ke } from "undici";
9
- import { notEmpty as K, mapGet as ce, mapEntries as Qe, TaskProcessor as ee, CallersCounter as v, asyncPool as te, fileExists as Xe, assertNever as Ye } from "@milaboratories/ts-helpers";
10
- import { Readable as re, Writable as ne, Transform as Ke } from "node:stream";
9
+ import { notEmpty as K, mapGet as ce, mapEntries as Xe, TaskProcessor as ee, CallersCounter as v, asyncPool as te, fileExists as Ye, assertNever as Ke } from "@milaboratories/ts-helpers";
10
+ import { Readable as re, Writable as ne, Transform as et } from "node:stream";
11
11
  import * as O from "node:fs";
12
12
  import * as w from "node:path";
13
13
  import Z from "node:path";
14
- import { text as et, buffer as Le } from "node:stream/consumers";
15
- import { Computable as b, ChangeSource as U, PollingComputableHooks as Pe } from "@milaboratories/computable";
14
+ import { text as tt, buffer as Le } from "node:stream/consumers";
15
+ import { Computable as b, ChangeSource as N, PollingComputableHooks as Pe } from "@milaboratories/computable";
16
16
  import { scheduler as oe } from "node:timers/promises";
17
- import * as tt from "node:readline/promises";
18
- import rt from "denque";
17
+ import * as rt from "node:readline/promises";
18
+ import nt from "denque";
19
19
  import * as de from "node:os";
20
- import nt from "node:os";
21
- import { randomUUID as L, createHash as ot } from "node:crypto";
22
- import { rsSchema as se, treeEntryToResourceInfo as R, isPlTreeEntry as ie, makeResourceSnapshot as Q, isPlTreeEntryAccessor as st } from "@milaboratories/pl-tree";
20
+ import ot from "node:os";
21
+ import { randomUUID as L, createHash as st } from "node:crypto";
22
+ import { rsSchema as se, treeEntryToResourceInfo as R, isPlTreeEntry as ie, makeResourceSnapshot as Q, isPlTreeEntryAccessor as it } from "@milaboratories/pl-tree";
23
23
  import { z as T } from "zod";
24
- import * as it from "node:zlib";
25
- import * as at from "tar-fs";
26
- import { isImportFileHandleIndex as lt } from "@milaboratories/pl-model-common";
27
- import ct from "node:util";
28
- import { exec as dt } from "node:child_process";
29
- class ht extends g {
24
+ import * as at from "node:zlib";
25
+ import * as lt from "tar-fs";
26
+ import { isImportFileHandleIndex as ct } from "@milaboratories/pl-model-common";
27
+ import dt from "node:util";
28
+ import { exec as ht } from "node:child_process";
29
+ class ut extends g {
30
30
  constructor() {
31
31
  super("MiLaboratories.Controller.Shared.uploadapi", []);
32
32
  }
@@ -46,8 +46,8 @@ class ht extends g {
46
46
  ), t;
47
47
  }
48
48
  }
49
- new ht();
50
- class ut extends g {
49
+ new ut();
50
+ class pt extends g {
51
51
  constructor() {
52
52
  super("MiLaboratories.Controller.Shared.uploadapi.Init", []);
53
53
  }
@@ -67,8 +67,8 @@ class ut extends g {
67
67
  ), t;
68
68
  }
69
69
  }
70
- new ut();
71
- class pt extends g {
70
+ new pt();
71
+ class gt extends g {
72
72
  constructor() {
73
73
  super("MiLaboratories.Controller.Shared.uploadapi.Init.Request", [
74
74
  {
@@ -122,8 +122,8 @@ class pt extends g {
122
122
  ), t;
123
123
  }
124
124
  }
125
- const gt = new pt();
126
- class ft extends g {
125
+ const ft = new gt();
126
+ class mt extends g {
127
127
  constructor() {
128
128
  super("MiLaboratories.Controller.Shared.uploadapi.Init.Response", [
129
129
  {
@@ -198,8 +198,8 @@ class ft extends g {
198
198
  ), t;
199
199
  }
200
200
  }
201
- const mt = new ft();
202
- class wt extends g {
201
+ const wt = new mt();
202
+ class yt extends g {
203
203
  constructor() {
204
204
  super("MiLaboratories.Controller.Shared.uploadapi.UpdateProgress", []);
205
205
  }
@@ -219,8 +219,8 @@ class wt extends g {
219
219
  ), t;
220
220
  }
221
221
  }
222
- new wt();
223
- class yt extends g {
222
+ new yt();
223
+ class bt extends g {
224
224
  constructor() {
225
225
  super("MiLaboratories.Controller.Shared.uploadapi.UpdateProgress.Request", [
226
226
  {
@@ -290,8 +290,8 @@ class yt extends g {
290
290
  ), t;
291
291
  }
292
292
  }
293
- const bt = new yt();
294
- class Tt extends g {
293
+ const Tt = new bt();
294
+ class kt extends g {
295
295
  constructor() {
296
296
  super(
297
297
  "MiLaboratories.Controller.Shared.uploadapi.UpdateProgress.Response",
@@ -318,8 +318,8 @@ class Tt extends g {
318
318
  ), t;
319
319
  }
320
320
  }
321
- const kt = new Tt();
322
- class Lt extends g {
321
+ const Lt = new kt();
322
+ class Pt extends g {
323
323
  constructor() {
324
324
  super("MiLaboratories.Controller.Shared.uploadapi.GetPartURL", []);
325
325
  }
@@ -339,8 +339,8 @@ class Lt extends g {
339
339
  ), t;
340
340
  }
341
341
  }
342
- new Lt();
343
- class Pt extends g {
342
+ new Pt();
343
+ class It extends g {
344
344
  constructor() {
345
345
  super("MiLaboratories.Controller.Shared.uploadapi.GetPartURL.Request", [
346
346
  {
@@ -422,8 +422,8 @@ class Pt extends g {
422
422
  ), t;
423
423
  }
424
424
  }
425
- const It = new Pt();
426
- class Rt extends g {
425
+ const Rt = new It();
426
+ class St extends g {
427
427
  constructor() {
428
428
  super("MiLaboratories.Controller.Shared.uploadapi.GetPartURL.HTTPHeader", [
429
429
  {
@@ -493,8 +493,8 @@ class Rt extends g {
493
493
  ), t;
494
494
  }
495
495
  }
496
- const E = new Rt();
497
- class St extends g {
496
+ const E = new St();
497
+ class Nt extends g {
498
498
  constructor() {
499
499
  super("MiLaboratories.Controller.Shared.uploadapi.GetPartURL.Response", [
500
500
  {
@@ -610,8 +610,8 @@ class St extends g {
610
610
  ), t;
611
611
  }
612
612
  }
613
- const Ut = new St();
614
- class Nt extends g {
613
+ const Ut = new Nt();
614
+ class Bt extends g {
615
615
  constructor() {
616
616
  super("MiLaboratories.Controller.Shared.uploadapi.Finalize", []);
617
617
  }
@@ -631,8 +631,8 @@ class Nt extends g {
631
631
  ), t;
632
632
  }
633
633
  }
634
- new Nt();
635
- class Bt extends g {
634
+ new Bt();
635
+ class Dt extends g {
636
636
  constructor() {
637
637
  super("MiLaboratories.Controller.Shared.uploadapi.Finalize.Request", [
638
638
  {
@@ -686,8 +686,8 @@ class Bt extends g {
686
686
  ), t;
687
687
  }
688
688
  }
689
- const Dt = new Bt();
690
- class vt extends g {
689
+ const vt = new Dt();
690
+ class $t extends g {
691
691
  constructor() {
692
692
  super("MiLaboratories.Controller.Shared.uploadapi.Finalize.Response", []);
693
693
  }
@@ -707,36 +707,36 @@ class vt extends g {
707
707
  ), t;
708
708
  }
709
709
  }
710
- const $t = new vt(), W = new D(
710
+ const _t = new $t(), W = new D(
711
711
  "MiLaboratories.Controller.Shared.Upload",
712
712
  [
713
713
  {
714
714
  name: "Init",
715
715
  options: {},
716
- I: gt,
717
- O: mt
716
+ I: ft,
717
+ O: wt
718
718
  },
719
719
  {
720
720
  name: "GetPartURL",
721
721
  options: {},
722
- I: It,
722
+ I: Rt,
723
723
  O: Ut
724
724
  },
725
725
  {
726
726
  name: "UpdateProgress",
727
727
  options: {},
728
- I: bt,
729
- O: kt
728
+ I: Tt,
729
+ O: Lt
730
730
  },
731
731
  {
732
732
  name: "Finalize",
733
733
  options: {},
734
- I: Dt,
735
- O: $t
734
+ I: vt,
735
+ O: _t
736
736
  }
737
737
  ]
738
738
  );
739
- class _t {
739
+ class Ct {
740
740
  constructor(e) {
741
741
  d(this, "typeName", W.typeName);
742
742
  d(this, "methods", W.methods);
@@ -801,14 +801,14 @@ class Ie extends Error {
801
801
  }
802
802
  class Re extends Error {
803
803
  }
804
- class Ct extends Error {
804
+ class Ot extends Error {
805
805
  }
806
806
  class Se extends Error {
807
807
  }
808
- class Ot {
808
+ class Ft {
809
809
  constructor(e, t, n, r) {
810
810
  d(this, "grpcClient");
811
- this.grpcTransport = e, this.httpClient = t, this.logger = r, this.grpcClient = new _t(this.grpcTransport);
811
+ this.grpcTransport = e, this.httpClient = t, this.logger = r, this.grpcClient = new Ct(this.grpcTransport);
812
812
  }
813
813
  close() {
814
814
  }
@@ -834,7 +834,7 @@ class Ot {
834
834
  if (this.logger.info(
835
835
  `uploaded chunk ${r} from ${o} of resource: ${e}, response: '${le.toString()}', status code: ${P.statusCode}`
836
836
  ), P.statusCode != 200)
837
- throw new Ct(
837
+ throw new Ot(
838
838
  `response is not ok, status code: ${P.statusCode}, body: ${le}, headers: ${P.headers}, url: ${c.uploadUrl}`
839
839
  );
840
840
  await this.grpcClient.updateProgress(
@@ -898,7 +898,7 @@ class Ot {
898
898
  };
899
899
  }
900
900
  }
901
- class Ft extends g {
901
+ class Et extends g {
902
902
  constructor() {
903
903
  super("google.protobuf.Duration", [
904
904
  {
@@ -1002,8 +1002,8 @@ class Ft extends g {
1002
1002
  ), t;
1003
1003
  }
1004
1004
  }
1005
- const $ = new Ft();
1006
- class Et extends g {
1005
+ const $ = new Et();
1006
+ class Wt extends g {
1007
1007
  constructor() {
1008
1008
  super("MiLaboratories.Controller.Shared.ProgressAPI", []);
1009
1009
  }
@@ -1023,8 +1023,8 @@ class Et extends g {
1023
1023
  ), t;
1024
1024
  }
1025
1025
  }
1026
- new Et();
1027
- class Wt extends g {
1026
+ new Wt();
1027
+ class At extends g {
1028
1028
  constructor() {
1029
1029
  super("MiLaboratories.Controller.Shared.ProgressAPI.Report", [
1030
1030
  {
@@ -1123,8 +1123,8 @@ class Wt extends g {
1123
1123
  ), t;
1124
1124
  }
1125
1125
  }
1126
- const S = new Wt();
1127
- class At extends g {
1126
+ const S = new At();
1127
+ class zt extends g {
1128
1128
  constructor() {
1129
1129
  super("MiLaboratories.Controller.Shared.ProgressAPI.GetStatus", []);
1130
1130
  }
@@ -1144,8 +1144,8 @@ class At extends g {
1144
1144
  ), t;
1145
1145
  }
1146
1146
  }
1147
- new At();
1148
- class zt extends g {
1147
+ new zt();
1148
+ class xt extends g {
1149
1149
  constructor() {
1150
1150
  super("MiLaboratories.Controller.Shared.ProgressAPI.GetStatus.Request", [
1151
1151
  {
@@ -1203,8 +1203,8 @@ class zt extends g {
1203
1203
  ), t;
1204
1204
  }
1205
1205
  }
1206
- const xt = new zt();
1207
- class Mt extends g {
1206
+ const Mt = new xt();
1207
+ class Ht extends g {
1208
1208
  constructor() {
1209
1209
  super("MiLaboratories.Controller.Shared.ProgressAPI.GetStatus.Response", [
1210
1210
  { no: 1, name: "report", kind: "message", T: () => S }
@@ -1264,8 +1264,8 @@ class Mt extends g {
1264
1264
  ), t;
1265
1265
  }
1266
1266
  }
1267
- const Ht = new Mt();
1268
- class jt extends g {
1267
+ const jt = new Ht();
1268
+ class Gt extends g {
1269
1269
  constructor() {
1270
1270
  super("MiLaboratories.Controller.Shared.ProgressAPI.RealtimeStatus", []);
1271
1271
  }
@@ -1285,8 +1285,8 @@ class jt extends g {
1285
1285
  ), t;
1286
1286
  }
1287
1287
  }
1288
- new jt();
1289
- class Gt extends g {
1288
+ new Gt();
1289
+ class Vt extends g {
1290
1290
  constructor() {
1291
1291
  super(
1292
1292
  "MiLaboratories.Controller.Shared.ProgressAPI.RealtimeStatus.Request",
@@ -1361,8 +1361,8 @@ class Gt extends g {
1361
1361
  ), t;
1362
1362
  }
1363
1363
  }
1364
- const Vt = new Gt();
1365
- class qt extends g {
1364
+ const qt = new Vt();
1365
+ class Jt extends g {
1366
1366
  constructor() {
1367
1367
  super(
1368
1368
  "MiLaboratories.Controller.Shared.ProgressAPI.RealtimeStatus.Response",
@@ -1423,7 +1423,7 @@ class qt extends g {
1423
1423
  ), t;
1424
1424
  }
1425
1425
  }
1426
- const Jt = new qt(), A = new D(
1426
+ const Zt = new Jt(), A = new D(
1427
1427
  "MiLaboratories.Controller.Shared.Progress",
1428
1428
  [
1429
1429
  {
@@ -1431,19 +1431,19 @@ const Jt = new qt(), A = new D(
1431
1431
  options: {
1432
1432
  "google.api.http": { get: "/resources/{resource_id}/get-progress" }
1433
1433
  },
1434
- I: xt,
1435
- O: Ht
1434
+ I: Mt,
1435
+ O: jt
1436
1436
  },
1437
1437
  {
1438
1438
  name: "RealtimeStatus",
1439
1439
  serverStreaming: !0,
1440
1440
  options: {},
1441
- I: Vt,
1442
- O: Jt
1441
+ I: qt,
1442
+ O: Zt
1443
1443
  }
1444
1444
  ]
1445
1445
  );
1446
- class Zt {
1446
+ class Qt {
1447
1447
  constructor(e) {
1448
1448
  d(this, "typeName", A.typeName);
1449
1449
  d(this, "methods", A.methods);
@@ -1465,10 +1465,10 @@ class Zt {
1465
1465
  return y("serverStreaming", this._transport, n, r, e);
1466
1466
  }
1467
1467
  }
1468
- class Qt {
1468
+ class Xt {
1469
1469
  constructor(e, t, n, r) {
1470
1470
  d(this, "grpcClient");
1471
- this.grpcTransport = e, this.client = n, this.logger = r, this.grpcClient = new Zt(this.grpcTransport);
1471
+ this.grpcTransport = e, this.client = n, this.logger = r, this.grpcClient = new Qt(this.grpcTransport);
1472
1472
  }
1473
1473
  close() {
1474
1474
  }
@@ -1507,7 +1507,7 @@ class Qt {
1507
1507
  }
1508
1508
  }
1509
1509
  }
1510
- class Xt extends g {
1510
+ class Yt extends g {
1511
1511
  constructor() {
1512
1512
  super("MiLaboratories.Controller.Shared.DownloadAPI", []);
1513
1513
  }
@@ -1527,8 +1527,8 @@ class Xt extends g {
1527
1527
  ), t;
1528
1528
  }
1529
1529
  }
1530
- new Xt();
1531
- class Yt extends g {
1530
+ new Yt();
1531
+ class Kt extends g {
1532
1532
  constructor() {
1533
1533
  super("MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL", []);
1534
1534
  }
@@ -1548,8 +1548,8 @@ class Yt extends g {
1548
1548
  ), t;
1549
1549
  }
1550
1550
  }
1551
- new Yt();
1552
- class Kt extends g {
1551
+ new Kt();
1552
+ class er extends g {
1553
1553
  constructor() {
1554
1554
  super(
1555
1555
  "MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL.Request",
@@ -1610,8 +1610,8 @@ class Kt extends g {
1610
1610
  ), t;
1611
1611
  }
1612
1612
  }
1613
- const er = new Kt();
1614
- class tr extends g {
1613
+ const tr = new er();
1614
+ class rr extends g {
1615
1615
  constructor() {
1616
1616
  super(
1617
1617
  "MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL.HTTPHeader",
@@ -1684,8 +1684,8 @@ class tr extends g {
1684
1684
  ), t;
1685
1685
  }
1686
1686
  }
1687
- const z = new tr();
1688
- class rr extends g {
1687
+ const z = new rr();
1688
+ class nr extends g {
1689
1689
  constructor() {
1690
1690
  super(
1691
1691
  "MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL.Response",
@@ -1768,7 +1768,7 @@ class rr extends g {
1768
1768
  ), t;
1769
1769
  }
1770
1770
  }
1771
- const nr = new rr(), x = new D(
1771
+ const or = new nr(), x = new D(
1772
1772
  "MiLaboratories.Controller.Shared.Download",
1773
1773
  [
1774
1774
  {
@@ -1776,12 +1776,12 @@ const nr = new rr(), x = new D(
1776
1776
  options: {
1777
1777
  "google.api.http": { get: "/resources/{resource_id}/get-download-url" }
1778
1778
  },
1779
- I: er,
1780
- O: nr
1779
+ I: tr,
1780
+ O: or
1781
1781
  }
1782
1782
  ]
1783
1783
  );
1784
- class or {
1784
+ class sr {
1785
1785
  constructor(e) {
1786
1786
  d(this, "typeName", x.typeName);
1787
1787
  d(this, "methods", x.methods);
@@ -1798,7 +1798,7 @@ class or {
1798
1798
  }
1799
1799
  class ae extends Error {
1800
1800
  }
1801
- class Ue {
1801
+ class Ne {
1802
1802
  constructor(e) {
1803
1803
  this.httpClient = e;
1804
1804
  }
@@ -1809,7 +1809,7 @@ class Ue {
1809
1809
  signal: n
1810
1810
  }), i = re.toWeb(o);
1811
1811
  if (r != 200) {
1812
- const c = await et(i), l = c.substring(0, Math.min(c.length, 1e3));
1812
+ const c = await tt(i), l = c.substring(0, Math.min(c.length, 1e3));
1813
1813
  throw 400 <= r && r < 500 ? new ae(
1814
1814
  `Http error: statusCode: ${r} url: ${e.toString()}, beginning of body: ${l}`
1815
1815
  ) : new Error(`Http error: statusCode: ${r} url: ${e.toString()}`);
@@ -1824,20 +1824,20 @@ function B(s) {
1824
1824
  if (!Z.isAbsolute(s)) throw new Error(`Path ${s} is not absolute.`);
1825
1825
  return s;
1826
1826
  }
1827
- const sr = "storage://";
1828
- class Ne extends Error {
1827
+ const ir = "storage://";
1828
+ class Ue extends Error {
1829
1829
  }
1830
1830
  class Be extends Error {
1831
1831
  }
1832
- class ir {
1832
+ class ar {
1833
1833
  constructor(e, t, n, r) {
1834
1834
  d(this, "grpcClient");
1835
1835
  d(this, "downloadHelper");
1836
1836
  d(this, "localStorageIdsToRoot");
1837
- d(this, "isLocal", (e) => e.startsWith(sr));
1837
+ d(this, "isLocal", (e) => e.startsWith(ir));
1838
1838
  this.grpcTransport = e, this.httpClient = t, this.logger = n;
1839
1839
  for (const o of r) o.localPath !== "" && B(o.localPath);
1840
- this.grpcClient = new or(this.grpcTransport), this.downloadHelper = new Ue(t), this.localStorageIdsToRoot = new Map(
1840
+ this.grpcClient = new sr(this.grpcTransport), this.downloadHelper = new Ne(t), this.localStorageIdsToRoot = new Map(
1841
1841
  r.map((o) => [o.storageId, o.localPath])
1842
1842
  );
1843
1843
  }
@@ -1854,32 +1854,32 @@ class ir {
1854
1854
  const { downloadUrl: r, headers: o } = await this.getUrl(e, t, n);
1855
1855
  return this.logger.info(`download from url ${r}`), this.isLocal(r) ? await this.readLocalFile(r) : await this.downloadHelper.downloadRemoteFile(
1856
1856
  r,
1857
- lr(o),
1857
+ cr(o),
1858
1858
  n
1859
1859
  );
1860
1860
  }
1861
1861
  async readLocalFile(e) {
1862
- const t = ar(e, this.localStorageIdsToRoot), r = (await m.stat(t)).size;
1862
+ const t = lr(e, this.localStorageIdsToRoot), r = (await m.stat(t)).size;
1863
1863
  return {
1864
1864
  content: re.toWeb(O.createReadStream(t)),
1865
1865
  size: r
1866
1866
  };
1867
1867
  }
1868
1868
  }
1869
- function ar(s, e) {
1869
+ function lr(s, e) {
1870
1870
  const t = new URL(s);
1871
1871
  if (t.pathname == "")
1872
1872
  throw new Be(`url for local filepath ${s} does not match url scheme`);
1873
1873
  const n = t.host, r = e.get(n);
1874
1874
  if (r === void 0)
1875
- throw new Ne(`Unknown storage location: ${n}`);
1875
+ throw new Ue(`Unknown storage location: ${n}`);
1876
1876
  const o = decodeURIComponent(t.pathname.slice(1));
1877
1877
  return r === "" ? o : w.join(r, o);
1878
1878
  }
1879
- function lr(s) {
1879
+ function cr(s) {
1880
1880
  return Object.fromEntries(s.map(({ name: e, value: t }) => [e, t]));
1881
1881
  }
1882
- class cr extends g {
1882
+ class dr extends g {
1883
1883
  constructor() {
1884
1884
  super("google.protobuf.Timestamp", [
1885
1885
  {
@@ -2012,8 +2012,8 @@ class cr extends g {
2012
2012
  ), t;
2013
2013
  }
2014
2014
  }
2015
- const M = new cr();
2016
- class dr extends g {
2015
+ const M = new dr();
2016
+ class hr extends g {
2017
2017
  constructor() {
2018
2018
  super("MiLaboratories.Controller.Shared.LsAPI", []);
2019
2019
  }
@@ -2033,8 +2033,8 @@ class dr extends g {
2033
2033
  ), t;
2034
2034
  }
2035
2035
  }
2036
- new dr();
2037
- class hr extends g {
2036
+ new hr();
2037
+ class ur extends g {
2038
2038
  constructor() {
2039
2039
  super("MiLaboratories.Controller.Shared.LsAPI.ListItem", [
2040
2040
  {
@@ -2157,8 +2157,8 @@ class hr extends g {
2157
2157
  ), t;
2158
2158
  }
2159
2159
  }
2160
- const H = new hr();
2161
- class ur extends g {
2160
+ const H = new ur();
2161
+ class pr extends g {
2162
2162
  constructor() {
2163
2163
  super("MiLaboratories.Controller.Shared.LsAPI.List", []);
2164
2164
  }
@@ -2178,8 +2178,8 @@ class ur extends g {
2178
2178
  ), t;
2179
2179
  }
2180
2180
  }
2181
- new ur();
2182
- class pr extends g {
2181
+ new pr();
2182
+ class gr extends g {
2183
2183
  constructor() {
2184
2184
  super("MiLaboratories.Controller.Shared.LsAPI.List.Request", [
2185
2185
  {
@@ -2244,8 +2244,8 @@ class pr extends g {
2244
2244
  ), t;
2245
2245
  }
2246
2246
  }
2247
- const gr = new pr();
2248
- class fr extends g {
2247
+ const fr = new gr();
2248
+ class mr extends g {
2249
2249
  constructor() {
2250
2250
  super("MiLaboratories.Controller.Shared.LsAPI.List.Response", [
2251
2251
  {
@@ -2317,10 +2317,10 @@ class fr extends g {
2317
2317
  ), t;
2318
2318
  }
2319
2319
  }
2320
- const mr = new fr(), j = new D("MiLaboratories.Controller.Shared.LS", [
2321
- { name: "List", options: {}, I: gr, O: mr }
2320
+ const wr = new mr(), j = new D("MiLaboratories.Controller.Shared.LS", [
2321
+ { name: "List", options: {}, I: fr, O: wr }
2322
2322
  ]);
2323
- class wr {
2323
+ class yr {
2324
2324
  constructor(e) {
2325
2325
  d(this, "typeName", j.typeName);
2326
2326
  d(this, "methods", j.methods);
@@ -2341,10 +2341,10 @@ class wr {
2341
2341
  );
2342
2342
  }
2343
2343
  }
2344
- class yr {
2344
+ class br {
2345
2345
  constructor(e, t) {
2346
2346
  d(this, "grpcClient");
2347
- this.logger = t, this.grpcClient = new wr(e);
2347
+ this.logger = t, this.grpcClient = new yr(e);
2348
2348
  }
2349
2349
  close() {
2350
2350
  }
@@ -2358,7 +2358,7 @@ class yr {
2358
2358
  ).response;
2359
2359
  }
2360
2360
  }
2361
- class br extends g {
2361
+ class Tr extends g {
2362
2362
  constructor() {
2363
2363
  super("MiLaboratories.Controller.Shared.StreamingAPI", []);
2364
2364
  }
@@ -2378,8 +2378,8 @@ class br extends g {
2378
2378
  ), t;
2379
2379
  }
2380
2380
  }
2381
- new br();
2382
- class Tr extends g {
2381
+ new Tr();
2382
+ class kr extends g {
2383
2383
  constructor() {
2384
2384
  super("MiLaboratories.Controller.Shared.StreamingAPI.StreamBinary", [
2385
2385
  {
@@ -2470,8 +2470,8 @@ class Tr extends g {
2470
2470
  ), t;
2471
2471
  }
2472
2472
  }
2473
- const kr = new Tr();
2474
- class Lr extends g {
2473
+ const Lr = new kr();
2474
+ class Pr extends g {
2475
2475
  constructor() {
2476
2476
  super("MiLaboratories.Controller.Shared.StreamingAPI.ReadBinary", [
2477
2477
  {
@@ -2549,8 +2549,8 @@ class Lr extends g {
2549
2549
  ), t;
2550
2550
  }
2551
2551
  }
2552
- const Pr = new Lr();
2553
- class Ir extends g {
2552
+ const Ir = new Pr();
2553
+ class Rr extends g {
2554
2554
  constructor() {
2555
2555
  super("MiLaboratories.Controller.Shared.StreamingAPI.StreamText", [
2556
2556
  {
@@ -2653,8 +2653,8 @@ class Ir extends g {
2653
2653
  ), t;
2654
2654
  }
2655
2655
  }
2656
- const Rr = new Ir();
2657
- class Sr extends g {
2656
+ const Sr = new Rr();
2657
+ class Nr extends g {
2658
2658
  constructor() {
2659
2659
  super("MiLaboratories.Controller.Shared.StreamingAPI.ReadText", [
2660
2660
  {
@@ -2757,8 +2757,8 @@ class Sr extends g {
2757
2757
  ), t;
2758
2758
  }
2759
2759
  }
2760
- const Ur = new Sr();
2761
- class Nr extends g {
2760
+ const Ur = new Nr();
2761
+ class Br extends g {
2762
2762
  constructor() {
2763
2763
  super("MiLaboratories.Controller.Shared.StreamingAPI.LastLines", [
2764
2764
  {
@@ -2861,8 +2861,8 @@ class Nr extends g {
2861
2861
  ), t;
2862
2862
  }
2863
2863
  }
2864
- const Br = new Nr();
2865
- class Dr extends g {
2864
+ const Dr = new Br();
2865
+ class vr extends g {
2866
2866
  constructor() {
2867
2867
  super("MiLaboratories.Controller.Shared.StreamingAPI.Response", [
2868
2868
  {
@@ -2939,44 +2939,44 @@ class Dr extends g {
2939
2939
  ), t;
2940
2940
  }
2941
2941
  }
2942
- const N = new Dr(), G = new D(
2942
+ const U = new vr(), G = new D(
2943
2943
  "MiLaboratories.Controller.Shared.Streaming",
2944
2944
  [
2945
2945
  {
2946
2946
  name: "StreamBinary",
2947
2947
  serverStreaming: !0,
2948
2948
  options: {},
2949
- I: kr,
2950
- O: N
2949
+ I: Lr,
2950
+ O: U
2951
2951
  },
2952
2952
  {
2953
2953
  name: "ReadBinary",
2954
2954
  options: {},
2955
- I: Pr,
2956
- O: N
2955
+ I: Ir,
2956
+ O: U
2957
2957
  },
2958
2958
  {
2959
2959
  name: "StreamText",
2960
2960
  serverStreaming: !0,
2961
2961
  options: {},
2962
- I: Rr,
2963
- O: N
2962
+ I: Sr,
2963
+ O: U
2964
2964
  },
2965
2965
  {
2966
2966
  name: "ReadText",
2967
2967
  options: {},
2968
2968
  I: Ur,
2969
- O: N
2969
+ O: U
2970
2970
  },
2971
2971
  {
2972
2972
  name: "LastLines",
2973
2973
  options: {},
2974
- I: Br,
2975
- O: N
2974
+ I: Dr,
2975
+ O: U
2976
2976
  }
2977
2977
  ]
2978
2978
  );
2979
- class vr {
2979
+ class $r {
2980
2980
  constructor(e) {
2981
2981
  d(this, "typeName", G.typeName);
2982
2982
  d(this, "methods", G.methods);
@@ -3075,10 +3075,10 @@ class vr {
3075
3075
  );
3076
3076
  }
3077
3077
  }
3078
- class $r {
3078
+ class _r {
3079
3079
  constructor(e, t, n) {
3080
3080
  d(this, "grpcClient");
3081
- this.grpcTransport = e, this.httpClient = t, this.logger = n, this.grpcClient = new vr(this.grpcTransport);
3081
+ this.grpcTransport = e, this.httpClient = t, this.logger = n, this.grpcClient = new $r(this.grpcTransport);
3082
3082
  }
3083
3083
  close() {
3084
3084
  }
@@ -3111,37 +3111,37 @@ class $r {
3111
3111
  )).response;
3112
3112
  }
3113
3113
  }
3114
- function Cn(s, e, t) {
3114
+ function On(s, e, t) {
3115
3115
  return e.getDriver({
3116
3116
  name: "DownloadBlob",
3117
- init: (n, r, o) => new ir(r, o, s, t)
3117
+ init: (n, r, o) => new ar(r, o, s, t)
3118
3118
  });
3119
3119
  }
3120
- function On(s, e) {
3120
+ function Fn(s, e) {
3121
3121
  return s.getDriver({
3122
3122
  name: "StreamLogs",
3123
- init: (t, n, r) => new $r(n, r, e)
3123
+ init: (t, n, r) => new _r(n, r, e)
3124
3124
  });
3125
3125
  }
3126
- function Fn(s, e) {
3126
+ function En(s, e) {
3127
3127
  return s.getDriver({
3128
3128
  name: "UploadProgress",
3129
- init: (t, n, r) => new Qt(n, r, s, e)
3129
+ init: (t, n, r) => new Xt(n, r, s, e)
3130
3130
  });
3131
3131
  }
3132
- function En(s, e) {
3132
+ function Wn(s, e) {
3133
3133
  return s.getDriver({
3134
3134
  name: "UploadBlob",
3135
- init: (t, n, r) => new Ot(n, r, s, e)
3135
+ init: (t, n, r) => new Ft(n, r, s, e)
3136
3136
  });
3137
3137
  }
3138
- function _r(s, e) {
3138
+ function Cr(s, e) {
3139
3139
  return s.getDriver({
3140
3140
  name: "LsFiles",
3141
- init: (t, n, r) => new yr(n, e)
3141
+ init: (t, n, r) => new br(n, e)
3142
3142
  });
3143
3143
  }
3144
- class Wn {
3144
+ class An {
3145
3145
  constructor(e, t) {
3146
3146
  d(this, "updater");
3147
3147
  d(this, "schedule", () => this.updater.schedule());
@@ -3170,7 +3170,7 @@ class De {
3170
3170
  })());
3171
3171
  }
3172
3172
  }
3173
- async function An(s, e) {
3173
+ async function zn(s, e) {
3174
3174
  return s.withReadTx("LogsDriverGetStream", async (t) => {
3175
3175
  const n = await t.getResourceData(e, !0), r = await Ve(t, qe(n, "stream"));
3176
3176
  if (r.error != "")
@@ -3179,9 +3179,9 @@ async function An(s, e) {
3179
3179
  return await t.getResourceData(r.valueId, !1);
3180
3180
  });
3181
3181
  }
3182
- const ve = "8C7#F1328%9E089B3D22", Cr = /(?<stage>.*):\s*(?<progress>[\d.]+%)\s.*(?<eta>ETA:.*)/g;
3183
- function Or(s) {
3184
- const t = s.replace(ve, "").match(Cr);
3182
+ const ve = "8C7#F1328%9E089B3D22", Or = /(?<stage>.*):\s*(?<progress>[\d.]+%)\s.*(?<eta>ETA:.*)/g;
3183
+ function Fr(s) {
3184
+ const t = s.replace(ve, "").match(Or);
3185
3185
  if (t == null || t.length != 4)
3186
3186
  return;
3187
3187
  const [n, r, o, a] = t;
@@ -3194,14 +3194,14 @@ function Or(s) {
3194
3194
  // ETA: 00:00:07
3195
3195
  };
3196
3196
  }
3197
- async function zn(s, e, t) {
3197
+ async function xn(s, e, t) {
3198
3198
  const n = await e.lastLines(s, 1, 0n, ve, t);
3199
3199
  if (n.data == null || n.data.length == 0)
3200
3200
  return { found: !1 };
3201
3201
  const r = n.data.toString().split(/\r?\n/)[0];
3202
3202
  if (r == null)
3203
3203
  return { found: !1 };
3204
- const o = Or(r);
3204
+ const o = Fr(r);
3205
3205
  return o === void 0 ? { found: !1 } : { found: !0, ...o };
3206
3206
  }
3207
3207
  class $e {
@@ -3227,7 +3227,7 @@ class $e {
3227
3227
  if (this.totalSizeBytes <= this.softSizeBytes) return [];
3228
3228
  const e = [];
3229
3229
  let t = 0;
3230
- return Qe(this.cache).filter(([n, r]) => r.counter.isZero()).forEach(([n, r]) => {
3230
+ return Xe(this.cache).filter(([n, r]) => r.counter.isZero()).forEach(([n, r]) => {
3231
3231
  if (this.totalSizeBytes - t <= this.softSizeBytes) return;
3232
3232
  const o = ce(this.cache, n);
3233
3233
  t += o.sizeBytes, e.push(o);
@@ -3242,7 +3242,7 @@ class $e {
3242
3242
  this.cache.delete(e.path), this.totalSizeBytes -= e.sizeBytes;
3243
3243
  }
3244
3244
  }
3245
- class xn {
3245
+ class Mn {
3246
3246
  constructor(e, t, n) {
3247
3247
  this.logger = e, this.logsStreamDriver = t, this.downloadDriver = n;
3248
3248
  }
@@ -3310,7 +3310,7 @@ function _(s) {
3310
3310
  let e;
3311
3311
  if (C(s))
3312
3312
  e = s.match(Ce);
3313
- else if (Fr(s))
3313
+ else if (Er(s))
3314
3314
  e = s.match(Oe);
3315
3315
  else throw new Error(`Log handle is malformed: ${s}`);
3316
3316
  if (e == null) throw new Error(`Log handle wasn't parsed: ${s}`);
@@ -3328,17 +3328,17 @@ function C(s) {
3328
3328
  return Ce.test(s);
3329
3329
  }
3330
3330
  const Oe = /^log\+ready:\/\/log\/(?<resourceType>.*)\/(?<resourceVersion>.*)\/(?<resourceId>.*)$/;
3331
- function Fr(s) {
3331
+ function Er(s) {
3332
3332
  return Oe.test(s);
3333
3333
  }
3334
- const Er = se({
3334
+ const Wr = se({
3335
3335
  kv: {
3336
3336
  "ctl/file/blobInfo": T.object({
3337
3337
  sizeBytes: T.coerce.number()
3338
3338
  })
3339
3339
  }
3340
3340
  });
3341
- class Mn {
3341
+ class Hn {
3342
3342
  constructor(e, t, n, r, o, a) {
3343
3343
  /** Represents a Resource Id to the path of a blob as a map. */
3344
3344
  d(this, "idToDownload", /* @__PURE__ */ new Map());
@@ -3362,16 +3362,16 @@ class Mn {
3362
3362
  }
3363
3363
  getOnDemandBlob(e, t) {
3364
3364
  if (t === void 0) return b.make((a) => this.getOnDemandBlob(e, a));
3365
- const n = ie(e) ? Q(e, Er, t) : e, r = L();
3365
+ const n = ie(e) ? Q(e, Wr, t) : e, r = L();
3366
3366
  return t.addOnDestroy(() => this.releaseOnDemandBlob(n.id, r)), this.getOnDemandBlobNoCtx(t.watcher, n, r);
3367
3367
  }
3368
3368
  getLocalPath(e) {
3369
3369
  return J(e, this.signer);
3370
3370
  }
3371
3371
  async getContent(e) {
3372
- if (Mr(e)) return await Ar(this.getLocalPath(e));
3373
- if (!jr(e)) throw new Error("Malformed remote handle");
3374
- const t = Gr(e, this.signer), { content: n } = await this.clientDownload.downloadBlob(t);
3372
+ if (Hr(e)) return await zr(this.getLocalPath(e));
3373
+ if (!Gr(e)) throw new Error("Malformed remote handle");
3374
+ const t = Vr(e, this.signer), { content: n } = await this.clientDownload.downloadBlob(t);
3375
3375
  return await Le(n);
3376
3376
  }
3377
3377
  getDownloadedBlobNoCtx(e, t, n) {
@@ -3391,11 +3391,11 @@ class Mn {
3391
3391
  }
3392
3392
  }
3393
3393
  setNewDownloadTask(e, t, n) {
3394
- const r = this.getFilePath(t.id), o = new xr(
3394
+ const r = this.getFilePath(t.id), o = new Mr(
3395
3395
  this.clientDownload,
3396
3396
  t,
3397
3397
  r,
3398
- Hr(r, this.signer)
3398
+ jr(r, this.signer)
3399
3399
  );
3400
3400
  return this.idToDownload.set(t.id, o), o;
3401
3401
  }
@@ -3405,9 +3405,9 @@ class Mn {
3405
3405
  }
3406
3406
  getOnDemandBlobNoCtx(e, t, n) {
3407
3407
  let r = this.idToOnDemand.get(t.id);
3408
- return r === void 0 && (r = new Wr(
3408
+ return r === void 0 && (r = new Ar(
3409
3409
  t.kv["ctl/file/blobInfo"].sizeBytes,
3410
- Vr(t, this.signer)
3410
+ qr(t, this.signer)
3411
3411
  ), this.idToOnDemand.set(t.id, r)), r.attach(e, n), r.getHandle();
3412
3412
  }
3413
3413
  getLastLogs(e, t, n) {
@@ -3527,9 +3527,9 @@ class Mn {
3527
3527
  return w.resolve(w.join(this.saveDir, String(BigInt(e))));
3528
3528
  }
3529
3529
  }
3530
- class Wr {
3530
+ class Ar {
3531
3531
  constructor(e, t) {
3532
- d(this, "change", new U());
3532
+ d(this, "change", new N());
3533
3533
  d(this, "counter", new v());
3534
3534
  this.size = e, this.handle = t;
3535
3535
  }
@@ -3547,7 +3547,7 @@ class he {
3547
3547
  constructor(e, t, n) {
3548
3548
  d(this, "updater");
3549
3549
  d(this, "log");
3550
- d(this, "change", new U());
3550
+ d(this, "change", new N());
3551
3551
  d(this, "error");
3552
3552
  this.path = e, this.lines = t, this.patternToSearch = n, this.updater = new De(async () => this.update());
3553
3553
  }
@@ -3559,7 +3559,7 @@ class he {
3559
3559
  }
3560
3560
  async update() {
3561
3561
  try {
3562
- const e = await zr(this.path, this.lines, this.patternToSearch);
3562
+ const e = await xr(this.path, this.lines, this.patternToSearch);
3563
3563
  this.log != e && this.change.markChanged(), this.log = e;
3564
3564
  } catch (e) {
3565
3565
  if (e.name == "RpcError" && e.code == "NOT_FOUND") {
@@ -3577,13 +3577,13 @@ async function ue(s) {
3577
3577
  return !1;
3578
3578
  }
3579
3579
  }
3580
- async function Ar(s) {
3580
+ async function zr(s) {
3581
3581
  return await Le(re.toWeb(O.createReadStream(s)));
3582
3582
  }
3583
- function zr(s, e, t) {
3583
+ function xr(s, e, t) {
3584
3584
  const n = O.createReadStream(s), r = new ne();
3585
3585
  return new Promise((o, a) => {
3586
- const i = tt.createInterface(n, r), c = new rt();
3586
+ const i = rt.createInterface(n, r), c = new nt();
3587
3587
  i.on("line", function(l) {
3588
3588
  t != null && !l.includes(t) || (c.push(l), c.length > e && c.shift());
3589
3589
  }), i.on("error", a), i.on("close", function() {
@@ -3591,10 +3591,10 @@ function zr(s, e, t) {
3591
3591
  });
3592
3592
  });
3593
3593
  }
3594
- let xr = class {
3594
+ let Mr = class {
3595
3595
  constructor(e, t, n, r) {
3596
3596
  d(this, "counter", new v());
3597
- d(this, "change", new U());
3597
+ d(this, "change", new N());
3598
3598
  d(this, "signalCtl", new AbortController());
3599
3599
  d(this, "error");
3600
3600
  d(this, "done", !1);
@@ -3615,7 +3615,7 @@ let xr = class {
3615
3615
  }
3616
3616
  this.setDone(t);
3617
3617
  } catch (e) {
3618
- if (e instanceof pe || e instanceof ae || e instanceof Ne || e instanceof Be || e.code == "ENOENT") {
3618
+ if (e instanceof pe || e instanceof ae || e instanceof Ue || e instanceof Be || e.code == "ENOENT") {
3619
3619
  this.setError(e), await m.rm(this.path);
3620
3620
  return;
3621
3621
  }
@@ -3650,7 +3650,7 @@ let xr = class {
3650
3650
  class pe extends Error {
3651
3651
  }
3652
3652
  const Fe = /^blob\+local:\/\/download\/(?<path>.*)#(?<signature>.*)$/;
3653
- function Mr(s) {
3653
+ function Hr(s) {
3654
3654
  return !!s.match(Fe);
3655
3655
  }
3656
3656
  function J(s, e) {
@@ -3659,14 +3659,14 @@ function J(s, e) {
3659
3659
  const { path: n, signature: r } = t.groups;
3660
3660
  return e.verify(n, r, `Signature verification failed for: ${s}`), n;
3661
3661
  }
3662
- function Hr(s, e) {
3662
+ function jr(s, e) {
3663
3663
  return `blob+local://download/${s}#${e.sign(s)}`;
3664
3664
  }
3665
3665
  const Ee = /^blob\+remote:\/\/download\/(?<content>(?<resourceType>.*)\/(?<resourceVersion>.*)\/(?<resourceId>.*))#(?<signature>.*)$/;
3666
- function jr(s) {
3666
+ function Gr(s) {
3667
3667
  return !!s.match(Ee);
3668
3668
  }
3669
- function Gr(s, e) {
3669
+ function Vr(s, e) {
3670
3670
  const t = s.match(Ee);
3671
3671
  if (t === null) throw new Error(`Remote handle is malformed: ${s}, matches: ${t}`);
3672
3672
  const { content: n, resourceType: r, resourceVersion: o, resourceId: a, signature: i } = t.groups;
@@ -3675,7 +3675,7 @@ function Gr(s, e) {
3675
3675
  type: { name: r, version: o }
3676
3676
  };
3677
3677
  }
3678
- function Vr(s, e) {
3678
+ function qr(s, e) {
3679
3679
  const t = `${s.type.name}/${s.type.version}/${BigInt(s.id)}`;
3680
3680
  return `blob+remote://download/${t}#${e.sign(t)}`;
3681
3681
  }
@@ -3693,24 +3693,24 @@ const F = T.object({
3693
3693
  storageId: T.string(),
3694
3694
  /** Path inside storage */
3695
3695
  path: T.string()
3696
- }), jn = T.union([
3696
+ }), Gn = T.union([
3697
3697
  F,
3698
3698
  We
3699
- ]), qr = se({
3699
+ ]), Jr = se({
3700
3700
  data: F,
3701
3701
  fields: {
3702
3702
  blob: !1
3703
3703
  }
3704
- }), Jr = se({
3704
+ }), Zr = se({
3705
3705
  fields: {
3706
3706
  incarnation: !1
3707
3707
  }
3708
3708
  });
3709
- function Zr(s, e) {
3710
- const t = ie(s) ? e.accessor(s).node() : st(s) ? s.node() : s;
3711
- return t.resourceType.name.startsWith("BlobUpload") ? Q(t, qr) : Q(t, Jr);
3709
+ function Qr(s, e) {
3710
+ const t = ie(s) ? e.accessor(s).node() : it(s) ? s.node() : s;
3711
+ return t.resourceType.name.startsWith("BlobUpload") ? Q(t, Jr) : Q(t, Zr);
3712
3712
  }
3713
- class Gn {
3713
+ class Vn {
3714
3714
  constructor(e, t, n, r, o = {
3715
3715
  nConcurrentPartUploads: 10,
3716
3716
  nConcurrentGetProgresses: 10,
@@ -3742,16 +3742,18 @@ class Gn {
3742
3742
  }
3743
3743
  getProgressId(e, t) {
3744
3744
  if (t == null) return b.make((a) => this.getProgressId(e, a));
3745
- const n = ie(e) ? Zr(e, t) : e, r = L();
3745
+ const n = ie(e) ? Qr(e, t) : e, r = L();
3746
3746
  t.attacheHooks(this.hooks), t.addOnDestroy(() => this.release(n.id, r));
3747
3747
  const o = this.getProgressIdNoCtx(t.watcher, n, r);
3748
- return ge(o) || t.markUnstable(`upload/index progress was got, but it's not stable: ${o}`), o;
3748
+ return ge(o) || t.markUnstable(
3749
+ `upload/index progress was got, but it's not stable: ${JSON.stringify(o)}`
3750
+ ), o;
3749
3751
  }
3750
3752
  getProgressIdNoCtx(e, t, n) {
3751
3753
  const r = "blob" in t.fields ? t.fields.blob !== void 0 : t.fields.incarnation !== void 0, o = this.idToProgress.get(t.id);
3752
3754
  if (o != null)
3753
3755
  return o.attach(e, n), o.mustGetProgress(r);
3754
- const a = new Qr(
3756
+ const a = new Xr(
3755
3757
  this.logger,
3756
3758
  this.clientBlob,
3757
3759
  this.clientProgress,
@@ -3806,9 +3808,9 @@ class Gn {
3806
3808
  return Array.from(this.idToProgress.entries()).filter(([e, t]) => !ge(t.progress)).map(([e, t]) => t);
3807
3809
  }
3808
3810
  }
3809
- class Qr {
3811
+ class Xr {
3810
3812
  constructor(e, t, n, r, o, a) {
3811
- d(this, "change", new U());
3813
+ d(this, "change", new N());
3812
3814
  d(this, "counter", new v());
3813
3815
  d(this, "progress");
3814
3816
  /** If this is upload progress this field will be defined */
@@ -3817,7 +3819,7 @@ class Qr {
3817
3819
  this.logger = e, this.clientBlob = t, this.clientProgress = n, this.nConcurrentPartsUpload = r, this.res = a;
3818
3820
  const i = a.type.name.startsWith("BlobUpload");
3819
3821
  let c;
3820
- i && (this.uploadData = F.parse(a.data), c = Yr(
3822
+ i && (this.uploadData = F.parse(a.data), c = Kr(
3821
3823
  o,
3822
3824
  this.uploadData.localPath,
3823
3825
  this.uploadData.pathSignature
@@ -3892,7 +3894,7 @@ class Qr {
3892
3894
  async updateStatus() {
3893
3895
  try {
3894
3896
  const e = await this.clientProgress.getStatus(this.res), t = this.progress.status;
3895
- this.progress.status = Xr(e), this.setDone(e.done), (e.done || e.progress != (t == null ? void 0 : t.progress)) && this.change.markChanged();
3897
+ this.progress.status = Yr(e), this.setDone(e.done), (e.done || e.progress != (t == null ? void 0 : t.progress)) && this.change.markChanged();
3896
3898
  } catch (e) {
3897
3899
  if (this.setLastError(e), e.name == "RpcError" && e.code == "DEADLINE_EXCEEDED") {
3898
3900
  this.logger.warn("deadline exceeded while getting a status of BlobImport");
@@ -3911,14 +3913,14 @@ class Qr {
3911
3913
  function ge(s) {
3912
3914
  return s.done && s.status !== void 0 && s.status !== null && s.status.progress >= 1;
3913
3915
  }
3914
- function Xr(s) {
3916
+ function Yr(s) {
3915
3917
  return {
3916
3918
  progress: s.progress ?? 0,
3917
3919
  bytesProcessed: Number(s.bytesProcessed),
3918
3920
  bytesTotal: Number(s.bytesTotal)
3919
3921
  };
3920
3922
  }
3921
- function Yr(s, e, t) {
3923
+ function Kr(s, e, t) {
3922
3924
  try {
3923
3925
  return s.verify(e, t), !0;
3924
3926
  } catch {
@@ -3931,7 +3933,7 @@ function Ae(s) {
3931
3933
  function fe(s) {
3932
3934
  return s.name == "RpcError" && (s.code == "NOT_FOUND" || s.code == "ABORTED" || s.code == "ALREADY_EXISTS");
3933
3935
  }
3934
- class Vn {
3936
+ class qn {
3935
3937
  constructor(e, t, n = {
3936
3938
  nConcurrentGetLogs: 10,
3937
3939
  pollingInterval: 1e3,
@@ -3999,7 +4001,7 @@ class Vn {
3999
4001
  getLogHandle(e, t) {
4000
4002
  if (t == null) return b.make((o) => this.getLogHandle(e, o));
4001
4003
  const n = R(e, t), r = this.getLogHandleNoCtx(n);
4002
- return t.markUnstable(), r;
4004
+ return t.markUnstable(`live_log:${Ze(n.id)}`), r;
4003
4005
  }
4004
4006
  getLogHandleNoCtx(e) {
4005
4007
  return _e(!0, e);
@@ -4086,7 +4088,7 @@ class me {
4086
4088
  constructor(e, t, n, r, o) {
4087
4089
  d(this, "logs");
4088
4090
  d(this, "error");
4089
- d(this, "change", new U());
4091
+ d(this, "change", new N());
4090
4092
  d(this, "counter", new v());
4091
4093
  this.logger = e, this.clientLogs = t, this.rInfo = n, this.lines = r, this.patternToSearch = o;
4092
4094
  }
@@ -4123,7 +4125,7 @@ class me {
4123
4125
  }
4124
4126
  }
4125
4127
  }
4126
- class qn {
4128
+ class Jn {
4127
4129
  constructor(e, t, n, r = {
4128
4130
  cacheSoftSizeBytes: 50 * 1024 * 1024,
4129
4131
  withGunzip: !0,
@@ -4135,7 +4137,7 @@ class qn {
4135
4137
  /** Writes and removes files to a hard drive and holds a counter for every
4136
4138
  * file that should be kept. */
4137
4139
  d(this, "cache");
4138
- this.logger = e, this.saveDir = n, this.opts = r, this.downloadQueue = new ee(this.logger, this.opts.nConcurrentDownloads), this.cache = new $e(this.opts.cacheSoftSizeBytes), this.downloadHelper = new Ue(t);
4140
+ this.logger = e, this.saveDir = n, this.opts = r, this.downloadQueue = new ee(this.logger, this.opts.nConcurrentDownloads), this.cache = new $e(this.opts.cacheSoftSizeBytes), this.downloadHelper = new Ne(t);
4139
4141
  }
4140
4142
  getPath(e, t) {
4141
4143
  if (t === void 0) return b.make((o) => this.getPath(e, o));
@@ -4188,21 +4190,21 @@ class qn {
4188
4190
  );
4189
4191
  }
4190
4192
  setNewTask(e, t, n) {
4191
- const r = new Kr(this.getFilePath(t), t);
4193
+ const r = new en(this.getFilePath(t), t);
4192
4194
  return r.attach(e, n), this.urlToDownload.set(t.toString(), r), r;
4193
4195
  }
4194
4196
  removeTask(e, t) {
4195
4197
  e.abort(t), e.change.markChanged(), this.urlToDownload.delete(e.url.toString());
4196
4198
  }
4197
4199
  getFilePath(e) {
4198
- const t = ot("sha256").update(e.toString()).digest("hex");
4200
+ const t = st("sha256").update(e.toString()).digest("hex");
4199
4201
  return w.join(this.saveDir, t);
4200
4202
  }
4201
4203
  }
4202
- class Kr {
4204
+ class en {
4203
4205
  constructor(e, t) {
4204
4206
  d(this, "counter", new v());
4205
- d(this, "change", new U());
4207
+ d(this, "change", new N());
4206
4208
  d(this, "signalCtl", new AbortController());
4207
4209
  d(this, "error");
4208
4210
  d(this, "done", !1);
@@ -4229,15 +4231,15 @@ class Kr {
4229
4231
  }
4230
4232
  }
4231
4233
  async downloadAndUntar(e, t, n) {
4232
- if (await Xe(this.path))
4234
+ if (await Ye(this.path))
4233
4235
  return await ze(this.path);
4234
4236
  const r = await e.downloadRemoteFile(this.url.toString(), {}, n);
4235
4237
  let o = r.content;
4236
4238
  if (t) {
4237
- const i = Ke.toWeb(it.createGunzip());
4239
+ const i = et.toWeb(at.createGunzip());
4238
4240
  o = o.pipeThrough(i, { signal: n });
4239
4241
  }
4240
- const a = ne.toWeb(at.extract(this.path));
4242
+ const a = ne.toWeb(lt.extract(this.path));
4241
4243
  return await o.pipeTo(a, { signal: n }), r.size;
4242
4244
  }
4243
4245
  getPath() {
@@ -4274,7 +4276,7 @@ function ye(s, e) {
4274
4276
  path: e
4275
4277
  }))}`;
4276
4278
  }
4277
- function en(s, e, t, n) {
4279
+ function tn(s, e, t, n) {
4278
4280
  const r = {
4279
4281
  localPath: s,
4280
4282
  pathSignature: e.sign(s),
@@ -4283,31 +4285,31 @@ function en(s, e, t, n) {
4283
4285
  };
4284
4286
  return `upload://upload/${encodeURIComponent(JSON.stringify(r))}`;
4285
4287
  }
4286
- function tn(s) {
4288
+ function rn(s) {
4287
4289
  const e = new URL(s);
4288
4290
  return F.parse(
4289
4291
  JSON.parse(decodeURIComponent(e.pathname.substring(1)))
4290
4292
  );
4291
4293
  }
4292
- function rn(s) {
4294
+ function nn(s) {
4293
4295
  const e = new URL(s);
4294
4296
  return We.parse(JSON.parse(decodeURIComponent(e.pathname.substring(1))));
4295
4297
  }
4296
- function nn(s) {
4297
- if (ln(s))
4298
- return dn(s);
4299
- if (on(s))
4300
- return an(s);
4301
- Ye(s);
4298
+ function on(s) {
4299
+ if (cn(s))
4300
+ return hn(s);
4301
+ if (sn(s))
4302
+ return ln(s);
4303
+ Ke(s);
4302
4304
  }
4303
4305
  const xe = /^local:\/\/(?<name>.*)\/(?<path>.*)$/;
4304
- function on(s) {
4306
+ function sn(s) {
4305
4307
  return xe.test(s);
4306
4308
  }
4307
- function sn(s, e) {
4309
+ function an(s, e) {
4308
4310
  return `local://${s}/${encodeURIComponent(e)}`;
4309
4311
  }
4310
- function an(s) {
4312
+ function ln(s) {
4311
4313
  const e = s.match(xe);
4312
4314
  if (e == null) throw new Error(`Local list handle wasn't parsed: ${s}`);
4313
4315
  const { name: t, path: n } = e.groups;
@@ -4318,28 +4320,28 @@ function an(s) {
4318
4320
  };
4319
4321
  }
4320
4322
  const Me = /^remote:\/\/(?<name>.*)\/(?<resourceId>.*)$/;
4321
- function ln(s) {
4323
+ function cn(s) {
4322
4324
  return Me.test(s);
4323
4325
  }
4324
- function cn(s, e) {
4326
+ function dn(s, e) {
4325
4327
  return `remote://${s}/${BigInt(e)}`;
4326
4328
  }
4327
- function dn(s) {
4329
+ function hn(s) {
4328
4330
  const e = s.match(Me);
4329
4331
  if (e == null) throw new Error(`Remote list handle wasn't parsed: ${s}`);
4330
4332
  const { name: t, resourceId: n } = e.groups;
4331
4333
  return {
4332
4334
  id: Y(BigInt(n)),
4333
- type: hn(t),
4335
+ type: un(t),
4334
4336
  name: t,
4335
4337
  isRemote: !0
4336
4338
  };
4337
4339
  }
4338
- function hn(s) {
4340
+ function un(s) {
4339
4341
  return { name: `LS/${s}`, version: "1" };
4340
4342
  }
4341
- async function un() {
4342
- const s = nt.homedir();
4343
+ async function pn() {
4344
+ const s = ot.homedir();
4343
4345
  if (Z.sep == "/")
4344
4346
  return [
4345
4347
  {
@@ -4351,7 +4353,7 @@ async function un() {
4351
4353
  {
4352
4354
  const t = Z.parse(s).root.replaceAll(":\\", "");
4353
4355
  try {
4354
- return (await ct.promisify(dt)("wmic logicaldisk get name")).stdout.split(`\r
4356
+ return (await dt.promisify(ht)("wmic logicaldisk get name")).stdout.split(`\r
4355
4357
  `).filter((o) => o.includes(":")).map((o) => o.trim().replaceAll(":", "")).map((o) => {
4356
4358
  const a = o == t;
4357
4359
  return {
@@ -4403,13 +4405,13 @@ class He {
4403
4405
  * @private
4404
4406
  */
4405
4407
  async tryResolveLocalFileHandle(e) {
4406
- if (lt(e)) {
4407
- const t = rn(e), n = this.localProjectionsMap.get(t.storageId);
4408
+ if (ct(e)) {
4409
+ const t = nn(e), n = this.localProjectionsMap.get(t.storageId);
4408
4410
  if (!n)
4409
4411
  throw new Error(`Storage ${t.storageId} is not mounted locally.`);
4410
4412
  return w.join(n.localPath, t.path);
4411
4413
  } else {
4412
- const t = tn(e);
4414
+ const t = rn(e);
4413
4415
  this.signer.verify(
4414
4416
  t.localPath,
4415
4417
  t.pathSignature,
@@ -4432,7 +4434,7 @@ class He {
4432
4434
  );
4433
4435
  }
4434
4436
  const t = await m.stat(e, { bigint: !0 });
4435
- return en(
4437
+ return tn(
4436
4438
  e,
4437
4439
  this.signer,
4438
4440
  t.size,
@@ -4443,12 +4445,12 @@ class He {
4443
4445
  async getStorageList() {
4444
4446
  const e = [...this.virtualStoragesMap.values()].map((r) => ({
4445
4447
  name: r.name,
4446
- handle: sn(r.name, r.root),
4448
+ handle: an(r.name, r.root),
4447
4449
  initialFullPath: r.initialPath
4448
4450
  })), n = Object.entries(this.storageIdToResourceId).map(
4449
4451
  ([r, o]) => ({
4450
4452
  name: r,
4451
- handle: cn(r, o),
4453
+ handle: dn(r, o),
4452
4454
  initialFullPath: "",
4453
4455
  // we don't have any additional information from where to start browsing remote storages
4454
4456
  isInitialPathHome: !1
@@ -4457,7 +4459,7 @@ class He {
4457
4459
  return [...e, ...n];
4458
4460
  }
4459
4461
  async listFiles(e, t) {
4460
- const n = nn(e);
4462
+ const n = on(e);
4461
4463
  if (n.isRemote)
4462
4464
  return {
4463
4465
  entries: (await this.lsClient.list(n, t)).items.map((o) => ({
@@ -4489,8 +4491,8 @@ class He {
4489
4491
  );
4490
4492
  }
4491
4493
  static async init(e, t, n, r, o, a) {
4492
- const i = _r(t, e);
4493
- a || (a = await un());
4494
+ const i = Cr(t, e);
4495
+ a || (a = await pn());
4494
4496
  for (const p of a) B(p.root);
4495
4497
  for (const p of r) p.localPath !== "" && B(p.localPath);
4496
4498
  const c = new Map(a.map((p) => [p.name, p])), l = new Map(r.map((p) => [p.storageId, p]));
@@ -4501,7 +4503,7 @@ class He {
4501
4503
  return new He(
4502
4504
  e,
4503
4505
  i,
4504
- await pn(t),
4506
+ await gn(t),
4505
4507
  n,
4506
4508
  c,
4507
4509
  l,
@@ -4509,60 +4511,60 @@ class He {
4509
4511
  );
4510
4512
  }
4511
4513
  }
4512
- async function pn(s) {
4514
+ async function gn(s) {
4513
4515
  return s.withReadTx("GetAvailableStorageIds", async (e) => {
4514
4516
  const t = await e.getResourceByName("LSProvider"), n = await e.getResourceData(t, !0);
4515
- return gn(n);
4517
+ return fn(n);
4516
4518
  });
4517
4519
  }
4518
- function gn(s) {
4520
+ function fn(s) {
4519
4521
  return Object.fromEntries(
4520
- s.fields.filter((e) => e.type == "Dynamic" && Ze(e.value)).map((e) => [e.name.substring(8), e.value])
4522
+ s.fields.filter((e) => e.type == "Dynamic" && Qe(e.value)).map((e) => [e.name.substring(8), e.value])
4521
4523
  );
4522
4524
  }
4523
4525
  export {
4524
- ir as ClientDownload,
4525
- $r as ClientLogs,
4526
- yr as ClientLs,
4527
- Qt as ClientProgress,
4528
- Ot as ClientUpload,
4529
- un as DefaultVirtualLocalStorages,
4530
- xr as Download,
4531
- Mn as DownloadDriver,
4532
- qn as DownloadUrlDriver,
4533
- jn as ImportFileHandleData,
4526
+ ar as ClientDownload,
4527
+ _r as ClientLogs,
4528
+ br as ClientLs,
4529
+ Xt as ClientProgress,
4530
+ Ft as ClientUpload,
4531
+ pn as DefaultVirtualLocalStorages,
4532
+ Mr as Download,
4533
+ Hn as DownloadDriver,
4534
+ Jn as DownloadUrlDriver,
4535
+ Gn as ImportFileHandleData,
4534
4536
  We as ImportFileHandleIndexData,
4535
4537
  F as ImportFileHandleUploadData,
4536
- Jr as IndexResourceSnapshot,
4537
- xn as LogsDriver,
4538
- Vn as LogsStreamDriver,
4539
- Wn as LongUpdater,
4538
+ Zr as IndexResourceSnapshot,
4539
+ Mn as LogsDriver,
4540
+ qn as LogsStreamDriver,
4541
+ An as LongUpdater,
4540
4542
  He as LsDriver,
4541
4543
  Ie as MTimeError,
4542
- Ct as NetworkError,
4544
+ Ot as NetworkError,
4543
4545
  Se as NoFileForUploading,
4544
- Er as OnDemandBlobResourceSnapshot,
4546
+ Wr as OnDemandBlobResourceSnapshot,
4545
4547
  Re as UnexpectedEOF,
4546
- Ne as UnknownStorageError,
4548
+ Ue as UnknownStorageError,
4547
4549
  De as Updater,
4548
- Gn as UploadDriver,
4549
- qr as UploadResourceSnapshot,
4550
+ Vn as UploadDriver,
4551
+ Jr as UploadResourceSnapshot,
4550
4552
  Be as WrongLocalFileUrl,
4551
- Cn as createDownloadClient,
4552
- On as createLogsClient,
4553
- _r as createLsFilesClient,
4554
- En as createUploadBlobClient,
4555
- Fn as createUploadProgressClient,
4553
+ On as createDownloadClient,
4554
+ Fn as createLogsClient,
4555
+ Cr as createLsFilesClient,
4556
+ Wn as createUploadBlobClient,
4557
+ En as createUploadProgressClient,
4556
4558
  _e as dataToHandle,
4557
- An as getStream,
4559
+ zn as getStream,
4558
4560
  _ as handleToData,
4559
- lr as headersFromProto,
4561
+ cr as headersFromProto,
4560
4562
  C as isLiveLogHandle,
4561
- Fr as isReadyLogHandle,
4562
- Or as lineToProgress,
4563
- Zr as makeBlobImportSnapshot,
4564
- zn as mixcrProgressFromLogs,
4565
- ar as parseLocalFileUrl,
4563
+ Er as isReadyLogHandle,
4564
+ Fr as lineToProgress,
4565
+ Qr as makeBlobImportSnapshot,
4566
+ xn as mixcrProgressFromLogs,
4567
+ lr as parseLocalFileUrl,
4566
4568
  B as validateAbsolute
4567
4569
  };
4568
4570
  //# sourceMappingURL=index.mjs.map