@milaboratories/pl-drivers 1.3.0 → 1.3.2
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/clients/download.d.ts +1 -0
- package/dist/clients/download.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +495 -492
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/clients/download.test.ts +12 -1
- package/src/clients/download.ts +24 -19
package/dist/index.mjs
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var d = (s, e, t) =>
|
|
1
|
+
var Me = Object.defineProperty;
|
|
2
|
+
var He = (s, e, t) => e in s ? Me(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
+
var d = (s, e, t) => He(s, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
import * as m from "node:fs/promises";
|
|
5
|
-
import { addRTypeToMetadata as k, valErr as
|
|
5
|
+
import { addRTypeToMetadata as k, valErr as je, getField as Ge, isNullResourceId as Ve, bigintToResourceId as Y, stringifyWithResourceId as qe, isNotNullResourceId as Je } from "@milaboratories/pl-client";
|
|
6
6
|
import { ServiceType as D, stackIntercept as y } from "@protobuf-ts/runtime-rpc";
|
|
7
|
-
import { MessageType as g, reflectionMergePartial as f, UnknownFieldHandler as u, WireType as h, PbLong as I, typeofJsonValue as
|
|
8
|
-
import { request as
|
|
9
|
-
import { notEmpty as K, mapGet as ce, mapEntries as
|
|
10
|
-
import { Readable as re, Writable as ne, Transform as
|
|
7
|
+
import { MessageType as g, reflectionMergePartial as f, UnknownFieldHandler as u, WireType as h, PbLong as I, typeofJsonValue as ye } from "@protobuf-ts/runtime";
|
|
8
|
+
import { request as be } from "undici";
|
|
9
|
+
import { notEmpty as K, mapGet as ce, mapEntries as Ze, TaskProcessor as ee, CallersCounter as v, asyncPool as te, fileExists as Qe, assertNever as Xe } from "@milaboratories/ts-helpers";
|
|
10
|
+
import { Readable as re, Writable as ne, Transform as Ye } from "node:stream";
|
|
11
11
|
import * as O from "node:fs";
|
|
12
12
|
import * as w from "node:path";
|
|
13
|
-
import
|
|
14
|
-
import { text as
|
|
15
|
-
import { Computable as b, ChangeSource as N, PollingComputableHooks as
|
|
13
|
+
import Ke from "node:path";
|
|
14
|
+
import { text as et, buffer as Te } from "node:stream/consumers";
|
|
15
|
+
import { Computable as b, ChangeSource as N, PollingComputableHooks as ke } from "@milaboratories/computable";
|
|
16
16
|
import { scheduler as oe } from "node:timers/promises";
|
|
17
|
-
import * as
|
|
18
|
-
import
|
|
17
|
+
import * as tt from "node:readline/promises";
|
|
18
|
+
import rt from "denque";
|
|
19
19
|
import * as Z from "node:os";
|
|
20
|
-
import { randomUUID as L, createHash as
|
|
21
|
-
import { rsSchema as se, treeEntryToResourceInfo as R, isPlTreeEntry as ie, makeResourceSnapshot as Q, isPlTreeEntryAccessor as
|
|
20
|
+
import { randomUUID as L, createHash as nt } from "node:crypto";
|
|
21
|
+
import { rsSchema as se, treeEntryToResourceInfo as R, isPlTreeEntry as ie, makeResourceSnapshot as Q, isPlTreeEntryAccessor as ot } from "@milaboratories/pl-tree";
|
|
22
22
|
import { z as T } from "zod";
|
|
23
|
-
import * as
|
|
24
|
-
import * as
|
|
25
|
-
import { isImportFileHandleIndex as
|
|
26
|
-
class
|
|
23
|
+
import * as st from "node:zlib";
|
|
24
|
+
import * as it from "tar-fs";
|
|
25
|
+
import { isImportFileHandleIndex as at } from "@milaboratories/pl-model-common";
|
|
26
|
+
class lt extends g {
|
|
27
27
|
constructor() {
|
|
28
28
|
super("MiLaboratories.Controller.Shared.uploadapi", []);
|
|
29
29
|
}
|
|
@@ -43,8 +43,8 @@ class ct extends g {
|
|
|
43
43
|
), t;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
new
|
|
47
|
-
class
|
|
46
|
+
new lt();
|
|
47
|
+
class ct extends g {
|
|
48
48
|
constructor() {
|
|
49
49
|
super("MiLaboratories.Controller.Shared.uploadapi.Init", []);
|
|
50
50
|
}
|
|
@@ -64,8 +64,8 @@ class dt extends g {
|
|
|
64
64
|
), t;
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
new
|
|
68
|
-
class
|
|
67
|
+
new ct();
|
|
68
|
+
class dt extends g {
|
|
69
69
|
constructor() {
|
|
70
70
|
super("MiLaboratories.Controller.Shared.uploadapi.Init.Request", [
|
|
71
71
|
{
|
|
@@ -83,9 +83,9 @@ class ht extends g {
|
|
|
83
83
|
return t.resourceId = 0n, e !== void 0 && f(this, t, e), t;
|
|
84
84
|
}
|
|
85
85
|
internalBinaryRead(e, t, n, r) {
|
|
86
|
-
let o = r ?? this.create(),
|
|
87
|
-
for (; e.pos <
|
|
88
|
-
let [i,
|
|
86
|
+
let o = r ?? this.create(), c = e.pos + t;
|
|
87
|
+
for (; e.pos < c; ) {
|
|
88
|
+
let [i, l] = e.tag();
|
|
89
89
|
switch (i) {
|
|
90
90
|
case /* uint64 resource_id */
|
|
91
91
|
1:
|
|
@@ -95,14 +95,14 @@ class ht extends g {
|
|
|
95
95
|
let a = n.readUnknownField;
|
|
96
96
|
if (a === "throw")
|
|
97
97
|
throw new globalThis.Error(
|
|
98
|
-
`Unknown field ${i} (wire type ${
|
|
98
|
+
`Unknown field ${i} (wire type ${l}) for ${this.typeName}`
|
|
99
99
|
);
|
|
100
|
-
let p = e.skip(
|
|
100
|
+
let p = e.skip(l);
|
|
101
101
|
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
102
102
|
this.typeName,
|
|
103
103
|
o,
|
|
104
104
|
i,
|
|
105
|
-
|
|
105
|
+
l,
|
|
106
106
|
p
|
|
107
107
|
);
|
|
108
108
|
}
|
|
@@ -119,8 +119,8 @@ class ht extends g {
|
|
|
119
119
|
), t;
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
-
const
|
|
123
|
-
class
|
|
122
|
+
const ht = new dt();
|
|
123
|
+
class ut extends g {
|
|
124
124
|
constructor() {
|
|
125
125
|
super("MiLaboratories.Controller.Shared.uploadapi.Init.Response", [
|
|
126
126
|
{
|
|
@@ -147,9 +147,9 @@ class pt extends g {
|
|
|
147
147
|
return t.partsCount = 0n, t.uploadedParts = [], e !== void 0 && f(this, t, e), t;
|
|
148
148
|
}
|
|
149
149
|
internalBinaryRead(e, t, n, r) {
|
|
150
|
-
let o = r ?? this.create(),
|
|
151
|
-
for (; e.pos <
|
|
152
|
-
let [i,
|
|
150
|
+
let o = r ?? this.create(), c = e.pos + t;
|
|
151
|
+
for (; e.pos < c; ) {
|
|
152
|
+
let [i, l] = e.tag();
|
|
153
153
|
switch (i) {
|
|
154
154
|
case /* uint64 parts_count */
|
|
155
155
|
1:
|
|
@@ -157,7 +157,7 @@ class pt extends g {
|
|
|
157
157
|
break;
|
|
158
158
|
case /* repeated uint64 uploaded_parts */
|
|
159
159
|
2:
|
|
160
|
-
if (
|
|
160
|
+
if (l === h.LengthDelimited)
|
|
161
161
|
for (let P = e.int32() + e.pos; e.pos < P; )
|
|
162
162
|
o.uploadedParts.push(e.uint64().toBigInt());
|
|
163
163
|
else o.uploadedParts.push(e.uint64().toBigInt());
|
|
@@ -166,14 +166,14 @@ class pt extends g {
|
|
|
166
166
|
let a = n.readUnknownField;
|
|
167
167
|
if (a === "throw")
|
|
168
168
|
throw new globalThis.Error(
|
|
169
|
-
`Unknown field ${i} (wire type ${
|
|
169
|
+
`Unknown field ${i} (wire type ${l}) for ${this.typeName}`
|
|
170
170
|
);
|
|
171
|
-
let p = e.skip(
|
|
171
|
+
let p = e.skip(l);
|
|
172
172
|
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
173
173
|
this.typeName,
|
|
174
174
|
o,
|
|
175
175
|
i,
|
|
176
|
-
|
|
176
|
+
l,
|
|
177
177
|
p
|
|
178
178
|
);
|
|
179
179
|
}
|
|
@@ -195,8 +195,8 @@ class pt extends g {
|
|
|
195
195
|
), t;
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
|
-
const
|
|
199
|
-
class
|
|
198
|
+
const pt = new ut();
|
|
199
|
+
class gt extends g {
|
|
200
200
|
constructor() {
|
|
201
201
|
super("MiLaboratories.Controller.Shared.uploadapi.UpdateProgress", []);
|
|
202
202
|
}
|
|
@@ -216,8 +216,8 @@ class ft extends g {
|
|
|
216
216
|
), t;
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
|
-
new
|
|
220
|
-
class
|
|
219
|
+
new gt();
|
|
220
|
+
class ft extends g {
|
|
221
221
|
constructor() {
|
|
222
222
|
super("MiLaboratories.Controller.Shared.uploadapi.UpdateProgress.Request", [
|
|
223
223
|
{
|
|
@@ -247,9 +247,9 @@ class mt extends g {
|
|
|
247
247
|
), t;
|
|
248
248
|
}
|
|
249
249
|
internalBinaryRead(e, t, n, r) {
|
|
250
|
-
let o = r ?? this.create(),
|
|
251
|
-
for (; e.pos <
|
|
252
|
-
let [i,
|
|
250
|
+
let o = r ?? this.create(), c = e.pos + t;
|
|
251
|
+
for (; e.pos < c; ) {
|
|
252
|
+
let [i, l] = e.tag();
|
|
253
253
|
switch (i) {
|
|
254
254
|
case /* uint64 resource_id */
|
|
255
255
|
1:
|
|
@@ -263,14 +263,14 @@ class mt extends g {
|
|
|
263
263
|
let a = n.readUnknownField;
|
|
264
264
|
if (a === "throw")
|
|
265
265
|
throw new globalThis.Error(
|
|
266
|
-
`Unknown field ${i} (wire type ${
|
|
266
|
+
`Unknown field ${i} (wire type ${l}) for ${this.typeName}`
|
|
267
267
|
);
|
|
268
|
-
let p = e.skip(
|
|
268
|
+
let p = e.skip(l);
|
|
269
269
|
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
270
270
|
this.typeName,
|
|
271
271
|
o,
|
|
272
272
|
i,
|
|
273
|
-
|
|
273
|
+
l,
|
|
274
274
|
p
|
|
275
275
|
);
|
|
276
276
|
}
|
|
@@ -287,8 +287,8 @@ class mt extends g {
|
|
|
287
287
|
), t;
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
|
-
const
|
|
291
|
-
class
|
|
290
|
+
const mt = new ft();
|
|
291
|
+
class wt extends g {
|
|
292
292
|
constructor() {
|
|
293
293
|
super(
|
|
294
294
|
"MiLaboratories.Controller.Shared.uploadapi.UpdateProgress.Response",
|
|
@@ -315,8 +315,8 @@ class yt extends g {
|
|
|
315
315
|
), t;
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
|
-
const
|
|
319
|
-
class
|
|
318
|
+
const yt = new wt();
|
|
319
|
+
class bt extends g {
|
|
320
320
|
constructor() {
|
|
321
321
|
super("MiLaboratories.Controller.Shared.uploadapi.GetPartURL", []);
|
|
322
322
|
}
|
|
@@ -336,8 +336,8 @@ class Tt extends g {
|
|
|
336
336
|
), t;
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
|
-
new
|
|
340
|
-
class
|
|
339
|
+
new bt();
|
|
340
|
+
class Tt extends g {
|
|
341
341
|
constructor() {
|
|
342
342
|
super("MiLaboratories.Controller.Shared.uploadapi.GetPartURL.Request", [
|
|
343
343
|
{
|
|
@@ -375,9 +375,9 @@ class kt extends g {
|
|
|
375
375
|
), t;
|
|
376
376
|
}
|
|
377
377
|
internalBinaryRead(e, t, n, r) {
|
|
378
|
-
let o = r ?? this.create(),
|
|
379
|
-
for (; e.pos <
|
|
380
|
-
let [i,
|
|
378
|
+
let o = r ?? this.create(), c = e.pos + t;
|
|
379
|
+
for (; e.pos < c; ) {
|
|
380
|
+
let [i, l] = e.tag();
|
|
381
381
|
switch (i) {
|
|
382
382
|
case /* uint64 resource_id */
|
|
383
383
|
1:
|
|
@@ -395,14 +395,14 @@ class kt extends g {
|
|
|
395
395
|
let a = n.readUnknownField;
|
|
396
396
|
if (a === "throw")
|
|
397
397
|
throw new globalThis.Error(
|
|
398
|
-
`Unknown field ${i} (wire type ${
|
|
398
|
+
`Unknown field ${i} (wire type ${l}) for ${this.typeName}`
|
|
399
399
|
);
|
|
400
|
-
let p = e.skip(
|
|
400
|
+
let p = e.skip(l);
|
|
401
401
|
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
402
402
|
this.typeName,
|
|
403
403
|
o,
|
|
404
404
|
i,
|
|
405
|
-
|
|
405
|
+
l,
|
|
406
406
|
p
|
|
407
407
|
);
|
|
408
408
|
}
|
|
@@ -419,8 +419,8 @@ class kt extends g {
|
|
|
419
419
|
), t;
|
|
420
420
|
}
|
|
421
421
|
}
|
|
422
|
-
const
|
|
423
|
-
class
|
|
422
|
+
const kt = new Tt();
|
|
423
|
+
class Lt extends g {
|
|
424
424
|
constructor() {
|
|
425
425
|
super("MiLaboratories.Controller.Shared.uploadapi.GetPartURL.HTTPHeader", [
|
|
426
426
|
{
|
|
@@ -450,9 +450,9 @@ class Pt extends g {
|
|
|
450
450
|
), t;
|
|
451
451
|
}
|
|
452
452
|
internalBinaryRead(e, t, n, r) {
|
|
453
|
-
let o = r ?? this.create(),
|
|
454
|
-
for (; e.pos <
|
|
455
|
-
let [i,
|
|
453
|
+
let o = r ?? this.create(), c = e.pos + t;
|
|
454
|
+
for (; e.pos < c; ) {
|
|
455
|
+
let [i, l] = e.tag();
|
|
456
456
|
switch (i) {
|
|
457
457
|
case /* string Name = 1 [json_name = "Name"];*/
|
|
458
458
|
1:
|
|
@@ -466,14 +466,14 @@ class Pt extends g {
|
|
|
466
466
|
let a = n.readUnknownField;
|
|
467
467
|
if (a === "throw")
|
|
468
468
|
throw new globalThis.Error(
|
|
469
|
-
`Unknown field ${i} (wire type ${
|
|
469
|
+
`Unknown field ${i} (wire type ${l}) for ${this.typeName}`
|
|
470
470
|
);
|
|
471
|
-
let p = e.skip(
|
|
471
|
+
let p = e.skip(l);
|
|
472
472
|
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
473
473
|
this.typeName,
|
|
474
474
|
o,
|
|
475
475
|
i,
|
|
476
|
-
|
|
476
|
+
l,
|
|
477
477
|
p
|
|
478
478
|
);
|
|
479
479
|
}
|
|
@@ -490,8 +490,8 @@ class Pt extends g {
|
|
|
490
490
|
), t;
|
|
491
491
|
}
|
|
492
492
|
}
|
|
493
|
-
const E = new
|
|
494
|
-
class
|
|
493
|
+
const E = new Lt();
|
|
494
|
+
class Pt extends g {
|
|
495
495
|
constructor() {
|
|
496
496
|
super("MiLaboratories.Controller.Shared.uploadapi.GetPartURL.Response", [
|
|
497
497
|
{
|
|
@@ -542,9 +542,9 @@ class It extends g {
|
|
|
542
542
|
), t;
|
|
543
543
|
}
|
|
544
544
|
internalBinaryRead(e, t, n, r) {
|
|
545
|
-
let o = r ?? this.create(),
|
|
546
|
-
for (; e.pos <
|
|
547
|
-
let [i,
|
|
545
|
+
let o = r ?? this.create(), c = e.pos + t;
|
|
546
|
+
for (; e.pos < c; ) {
|
|
547
|
+
let [i, l] = e.tag();
|
|
548
548
|
switch (i) {
|
|
549
549
|
case /* string upload_url */
|
|
550
550
|
1:
|
|
@@ -576,14 +576,14 @@ class It extends g {
|
|
|
576
576
|
let a = n.readUnknownField;
|
|
577
577
|
if (a === "throw")
|
|
578
578
|
throw new globalThis.Error(
|
|
579
|
-
`Unknown field ${i} (wire type ${
|
|
579
|
+
`Unknown field ${i} (wire type ${l}) for ${this.typeName}`
|
|
580
580
|
);
|
|
581
|
-
let p = e.skip(
|
|
581
|
+
let p = e.skip(l);
|
|
582
582
|
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
583
583
|
this.typeName,
|
|
584
584
|
o,
|
|
585
585
|
i,
|
|
586
|
-
|
|
586
|
+
l,
|
|
587
587
|
p
|
|
588
588
|
);
|
|
589
589
|
}
|
|
@@ -607,8 +607,8 @@ class It extends g {
|
|
|
607
607
|
), t;
|
|
608
608
|
}
|
|
609
609
|
}
|
|
610
|
-
const
|
|
611
|
-
class
|
|
610
|
+
const It = new Pt();
|
|
611
|
+
class Rt extends g {
|
|
612
612
|
constructor() {
|
|
613
613
|
super("MiLaboratories.Controller.Shared.uploadapi.Finalize", []);
|
|
614
614
|
}
|
|
@@ -628,8 +628,8 @@ class St extends g {
|
|
|
628
628
|
), t;
|
|
629
629
|
}
|
|
630
630
|
}
|
|
631
|
-
new
|
|
632
|
-
class
|
|
631
|
+
new Rt();
|
|
632
|
+
class St extends g {
|
|
633
633
|
constructor() {
|
|
634
634
|
super("MiLaboratories.Controller.Shared.uploadapi.Finalize.Request", [
|
|
635
635
|
{
|
|
@@ -647,9 +647,9 @@ class Nt extends g {
|
|
|
647
647
|
return t.resourceId = 0n, e !== void 0 && f(this, t, e), t;
|
|
648
648
|
}
|
|
649
649
|
internalBinaryRead(e, t, n, r) {
|
|
650
|
-
let o = r ?? this.create(),
|
|
651
|
-
for (; e.pos <
|
|
652
|
-
let [i,
|
|
650
|
+
let o = r ?? this.create(), c = e.pos + t;
|
|
651
|
+
for (; e.pos < c; ) {
|
|
652
|
+
let [i, l] = e.tag();
|
|
653
653
|
switch (i) {
|
|
654
654
|
case /* uint64 resource_id */
|
|
655
655
|
1:
|
|
@@ -659,14 +659,14 @@ class Nt extends g {
|
|
|
659
659
|
let a = n.readUnknownField;
|
|
660
660
|
if (a === "throw")
|
|
661
661
|
throw new globalThis.Error(
|
|
662
|
-
`Unknown field ${i} (wire type ${
|
|
662
|
+
`Unknown field ${i} (wire type ${l}) for ${this.typeName}`
|
|
663
663
|
);
|
|
664
|
-
let p = e.skip(
|
|
664
|
+
let p = e.skip(l);
|
|
665
665
|
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
666
666
|
this.typeName,
|
|
667
667
|
o,
|
|
668
668
|
i,
|
|
669
|
-
|
|
669
|
+
l,
|
|
670
670
|
p
|
|
671
671
|
);
|
|
672
672
|
}
|
|
@@ -683,8 +683,8 @@ class Nt extends g {
|
|
|
683
683
|
), t;
|
|
684
684
|
}
|
|
685
685
|
}
|
|
686
|
-
const
|
|
687
|
-
class
|
|
686
|
+
const Nt = new St();
|
|
687
|
+
class Ut extends g {
|
|
688
688
|
constructor() {
|
|
689
689
|
super("MiLaboratories.Controller.Shared.uploadapi.Finalize.Response", []);
|
|
690
690
|
}
|
|
@@ -704,36 +704,36 @@ class Bt extends g {
|
|
|
704
704
|
), t;
|
|
705
705
|
}
|
|
706
706
|
}
|
|
707
|
-
const
|
|
707
|
+
const Bt = new Ut(), W = new D(
|
|
708
708
|
"MiLaboratories.Controller.Shared.Upload",
|
|
709
709
|
[
|
|
710
710
|
{
|
|
711
711
|
name: "Init",
|
|
712
712
|
options: {},
|
|
713
|
-
I:
|
|
714
|
-
O:
|
|
713
|
+
I: ht,
|
|
714
|
+
O: pt
|
|
715
715
|
},
|
|
716
716
|
{
|
|
717
717
|
name: "GetPartURL",
|
|
718
718
|
options: {},
|
|
719
|
-
I:
|
|
720
|
-
O:
|
|
719
|
+
I: kt,
|
|
720
|
+
O: It
|
|
721
721
|
},
|
|
722
722
|
{
|
|
723
723
|
name: "UpdateProgress",
|
|
724
724
|
options: {},
|
|
725
|
-
I:
|
|
726
|
-
O:
|
|
725
|
+
I: mt,
|
|
726
|
+
O: yt
|
|
727
727
|
},
|
|
728
728
|
{
|
|
729
729
|
name: "Finalize",
|
|
730
730
|
options: {},
|
|
731
|
-
I:
|
|
732
|
-
O:
|
|
731
|
+
I: Nt,
|
|
732
|
+
O: Bt
|
|
733
733
|
}
|
|
734
734
|
]
|
|
735
735
|
);
|
|
736
|
-
class
|
|
736
|
+
class Dt {
|
|
737
737
|
constructor(e) {
|
|
738
738
|
d(this, "typeName", W.typeName);
|
|
739
739
|
d(this, "methods", W.methods);
|
|
@@ -794,18 +794,18 @@ class vt {
|
|
|
794
794
|
return y("unary", this._transport, n, r, e);
|
|
795
795
|
}
|
|
796
796
|
}
|
|
797
|
-
class
|
|
797
|
+
class Le extends Error {
|
|
798
798
|
}
|
|
799
|
-
class
|
|
799
|
+
class Pe extends Error {
|
|
800
800
|
}
|
|
801
|
-
class
|
|
801
|
+
class vt extends Error {
|
|
802
802
|
}
|
|
803
|
-
class
|
|
803
|
+
class Ie extends Error {
|
|
804
804
|
}
|
|
805
|
-
class
|
|
805
|
+
class $t {
|
|
806
806
|
constructor(e, t, n, r) {
|
|
807
807
|
d(this, "grpcClient");
|
|
808
|
-
this.grpcTransport = e, this.httpClient = t, this.logger = r, this.grpcClient = new
|
|
808
|
+
this.grpcTransport = e, this.httpClient = t, this.logger = r, this.grpcClient = new Dt(this.grpcTransport);
|
|
809
809
|
}
|
|
810
810
|
close() {
|
|
811
811
|
}
|
|
@@ -816,8 +816,8 @@ class _t {
|
|
|
816
816
|
);
|
|
817
817
|
return this.partsToUpload(r.response);
|
|
818
818
|
}
|
|
819
|
-
async partUpload({ id: e, type: t }, n, r, o,
|
|
820
|
-
const
|
|
819
|
+
async partUpload({ id: e, type: t }, n, r, o, c, i) {
|
|
820
|
+
const l = await this.grpcClient.getPartURL(
|
|
821
821
|
{
|
|
822
822
|
resourceId: e,
|
|
823
823
|
partNumber: r,
|
|
@@ -827,27 +827,27 @@ class _t {
|
|
|
827
827
|
k(t, i)
|
|
828
828
|
).response, { chunk: a, mTime: p } = await this.readChunk(
|
|
829
829
|
n,
|
|
830
|
-
|
|
831
|
-
|
|
830
|
+
l.chunkStart,
|
|
831
|
+
l.chunkEnd
|
|
832
832
|
);
|
|
833
|
-
if (p >
|
|
834
|
-
throw new
|
|
835
|
-
"file was modified, expected mtime: " +
|
|
833
|
+
if (p > c)
|
|
834
|
+
throw new Le(
|
|
835
|
+
"file was modified, expected mtime: " + c + ", got: " + p + "."
|
|
836
836
|
);
|
|
837
|
-
const P = await
|
|
838
|
-
|
|
839
|
-
this.prepareUploadOpts(
|
|
837
|
+
const P = await be(
|
|
838
|
+
l.uploadUrl,
|
|
839
|
+
this.prepareUploadOpts(l, a)
|
|
840
840
|
), le = await P.body.text();
|
|
841
841
|
if (this.logger.info(
|
|
842
842
|
`uploaded chunk ${r} from ${o} of resource: ${e}, response: '${le.toString()}', status code: ${P.statusCode}`
|
|
843
843
|
), P.statusCode != 200)
|
|
844
|
-
throw new
|
|
845
|
-
`response is not ok, status code: ${P.statusCode}, body: ${le}, headers: ${P.headers}, url: ${
|
|
844
|
+
throw new vt(
|
|
845
|
+
`response is not ok, status code: ${P.statusCode}, body: ${le}, headers: ${P.headers}, url: ${l.uploadUrl}`
|
|
846
846
|
);
|
|
847
847
|
await this.grpcClient.updateProgress(
|
|
848
848
|
{
|
|
849
849
|
resourceId: e,
|
|
850
|
-
bytesProcessed:
|
|
850
|
+
bytesProcessed: l.chunkEnd - l.chunkStart
|
|
851
851
|
},
|
|
852
852
|
k(t, i)
|
|
853
853
|
);
|
|
@@ -862,13 +862,13 @@ class _t {
|
|
|
862
862
|
let r;
|
|
863
863
|
try {
|
|
864
864
|
r = await m.open(e);
|
|
865
|
-
const o = Number(n - t),
|
|
865
|
+
const o = Number(n - t), c = Number(t), i = Buffer.alloc(o), l = await this.readBytesFromPosition(r, i, o, c), a = await m.stat(e);
|
|
866
866
|
return {
|
|
867
|
-
chunk: i.subarray(0,
|
|
867
|
+
chunk: i.subarray(0, l),
|
|
868
868
|
mTime: BigInt(Math.floor(a.mtimeMs / 1e3))
|
|
869
869
|
};
|
|
870
870
|
} catch (o) {
|
|
871
|
-
throw o.code == "ENOENT" ? new
|
|
871
|
+
throw o.code == "ENOENT" ? new Ie(`there is no file ${e} for uploading`) : o;
|
|
872
872
|
} finally {
|
|
873
873
|
r == null || r.close();
|
|
874
874
|
}
|
|
@@ -878,15 +878,15 @@ class _t {
|
|
|
878
878
|
async readBytesFromPosition(e, t, n, r) {
|
|
879
879
|
let o = 0;
|
|
880
880
|
for (; o < n; ) {
|
|
881
|
-
const { bytesRead:
|
|
881
|
+
const { bytesRead: c } = await e.read(
|
|
882
882
|
t,
|
|
883
883
|
o,
|
|
884
884
|
n - o,
|
|
885
885
|
r + o
|
|
886
886
|
);
|
|
887
|
-
if (
|
|
888
|
-
throw new
|
|
889
|
-
o +=
|
|
887
|
+
if (c === 0)
|
|
888
|
+
throw new Pe("file ended earlier than expected.");
|
|
889
|
+
o += c;
|
|
890
890
|
}
|
|
891
891
|
return o;
|
|
892
892
|
}
|
|
@@ -908,7 +908,7 @@ class _t {
|
|
|
908
908
|
};
|
|
909
909
|
}
|
|
910
910
|
}
|
|
911
|
-
class
|
|
911
|
+
class _t extends g {
|
|
912
912
|
constructor() {
|
|
913
913
|
super("google.protobuf.Duration", [
|
|
914
914
|
{
|
|
@@ -948,7 +948,7 @@ class Ct extends g {
|
|
|
948
948
|
internalJsonRead(e, t, n) {
|
|
949
949
|
if (typeof e != "string")
|
|
950
950
|
throw new Error(
|
|
951
|
-
"Unable to parse Duration from JSON " +
|
|
951
|
+
"Unable to parse Duration from JSON " + ye(e) + ". Expected string."
|
|
952
952
|
);
|
|
953
953
|
let r = e.match(/^(-?)([0-9]+)(?:\.([0-9]+))?s/);
|
|
954
954
|
if (r === null)
|
|
@@ -956,12 +956,12 @@ class Ct extends g {
|
|
|
956
956
|
"Unable to parse Duration from JSON string. Invalid format."
|
|
957
957
|
);
|
|
958
958
|
n || (n = this.create());
|
|
959
|
-
let [, o,
|
|
960
|
-
if (
|
|
959
|
+
let [, o, c, i] = r, l = I.from(o + c);
|
|
960
|
+
if (l.toNumber() > 315576e6 || l.toNumber() < -315576e6)
|
|
961
961
|
throw new Error(
|
|
962
962
|
"Unable to parse Duration from JSON string. Value out of range."
|
|
963
963
|
);
|
|
964
|
-
if (n.seconds =
|
|
964
|
+
if (n.seconds = l.toBigInt(), typeof i == "string") {
|
|
965
965
|
let a = o + i + "0".repeat(9 - i.length);
|
|
966
966
|
n.nanos = parseInt(a);
|
|
967
967
|
}
|
|
@@ -972,9 +972,9 @@ class Ct extends g {
|
|
|
972
972
|
return t.seconds = 0n, t.nanos = 0, e !== void 0 && f(this, t, e), t;
|
|
973
973
|
}
|
|
974
974
|
internalBinaryRead(e, t, n, r) {
|
|
975
|
-
let o = r ?? this.create(),
|
|
976
|
-
for (; e.pos <
|
|
977
|
-
let [i,
|
|
975
|
+
let o = r ?? this.create(), c = e.pos + t;
|
|
976
|
+
for (; e.pos < c; ) {
|
|
977
|
+
let [i, l] = e.tag();
|
|
978
978
|
switch (i) {
|
|
979
979
|
case /* int64 seconds */
|
|
980
980
|
1:
|
|
@@ -988,14 +988,14 @@ class Ct extends g {
|
|
|
988
988
|
let a = n.readUnknownField;
|
|
989
989
|
if (a === "throw")
|
|
990
990
|
throw new globalThis.Error(
|
|
991
|
-
`Unknown field ${i} (wire type ${
|
|
991
|
+
`Unknown field ${i} (wire type ${l}) for ${this.typeName}`
|
|
992
992
|
);
|
|
993
|
-
let p = e.skip(
|
|
993
|
+
let p = e.skip(l);
|
|
994
994
|
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
995
995
|
this.typeName,
|
|
996
996
|
o,
|
|
997
997
|
i,
|
|
998
|
-
|
|
998
|
+
l,
|
|
999
999
|
p
|
|
1000
1000
|
);
|
|
1001
1001
|
}
|
|
@@ -1012,8 +1012,8 @@ class Ct extends g {
|
|
|
1012
1012
|
), t;
|
|
1013
1013
|
}
|
|
1014
1014
|
}
|
|
1015
|
-
const $ = new
|
|
1016
|
-
class
|
|
1015
|
+
const $ = new _t();
|
|
1016
|
+
class Ct extends g {
|
|
1017
1017
|
constructor() {
|
|
1018
1018
|
super("MiLaboratories.Controller.Shared.ProgressAPI", []);
|
|
1019
1019
|
}
|
|
@@ -1033,8 +1033,8 @@ class Ot extends g {
|
|
|
1033
1033
|
), t;
|
|
1034
1034
|
}
|
|
1035
1035
|
}
|
|
1036
|
-
new
|
|
1037
|
-
class
|
|
1036
|
+
new Ct();
|
|
1037
|
+
class Ot extends g {
|
|
1038
1038
|
constructor() {
|
|
1039
1039
|
super("MiLaboratories.Controller.Shared.ProgressAPI.Report", [
|
|
1040
1040
|
{
|
|
@@ -1081,9 +1081,9 @@ class Ft extends g {
|
|
|
1081
1081
|
return t.progress = 0, t.bytesProcessed = 0n, t.bytesTotal = 0n, t.done = !1, t.name = "", e !== void 0 && f(this, t, e), t;
|
|
1082
1082
|
}
|
|
1083
1083
|
internalBinaryRead(e, t, n, r) {
|
|
1084
|
-
let o = r ?? this.create(),
|
|
1085
|
-
for (; e.pos <
|
|
1086
|
-
let [i,
|
|
1084
|
+
let o = r ?? this.create(), c = e.pos + t;
|
|
1085
|
+
for (; e.pos < c; ) {
|
|
1086
|
+
let [i, l] = e.tag();
|
|
1087
1087
|
switch (i) {
|
|
1088
1088
|
case /* float progress */
|
|
1089
1089
|
1:
|
|
@@ -1109,14 +1109,14 @@ class Ft extends g {
|
|
|
1109
1109
|
let a = n.readUnknownField;
|
|
1110
1110
|
if (a === "throw")
|
|
1111
1111
|
throw new globalThis.Error(
|
|
1112
|
-
`Unknown field ${i} (wire type ${
|
|
1112
|
+
`Unknown field ${i} (wire type ${l}) for ${this.typeName}`
|
|
1113
1113
|
);
|
|
1114
|
-
let p = e.skip(
|
|
1114
|
+
let p = e.skip(l);
|
|
1115
1115
|
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
1116
1116
|
this.typeName,
|
|
1117
1117
|
o,
|
|
1118
1118
|
i,
|
|
1119
|
-
|
|
1119
|
+
l,
|
|
1120
1120
|
p
|
|
1121
1121
|
);
|
|
1122
1122
|
}
|
|
@@ -1133,8 +1133,8 @@ class Ft extends g {
|
|
|
1133
1133
|
), t;
|
|
1134
1134
|
}
|
|
1135
1135
|
}
|
|
1136
|
-
const S = new
|
|
1137
|
-
class
|
|
1136
|
+
const S = new Ot();
|
|
1137
|
+
class Ft extends g {
|
|
1138
1138
|
constructor() {
|
|
1139
1139
|
super("MiLaboratories.Controller.Shared.ProgressAPI.GetStatus", []);
|
|
1140
1140
|
}
|
|
@@ -1154,8 +1154,8 @@ class Et extends g {
|
|
|
1154
1154
|
), t;
|
|
1155
1155
|
}
|
|
1156
1156
|
}
|
|
1157
|
-
new
|
|
1158
|
-
class
|
|
1157
|
+
new Ft();
|
|
1158
|
+
class Et extends g {
|
|
1159
1159
|
constructor() {
|
|
1160
1160
|
super("MiLaboratories.Controller.Shared.ProgressAPI.GetStatus.Request", [
|
|
1161
1161
|
{
|
|
@@ -1177,9 +1177,9 @@ class Wt extends g {
|
|
|
1177
1177
|
), t;
|
|
1178
1178
|
}
|
|
1179
1179
|
internalBinaryRead(e, t, n, r) {
|
|
1180
|
-
let o = r ?? this.create(),
|
|
1181
|
-
for (; e.pos <
|
|
1182
|
-
let [i,
|
|
1180
|
+
let o = r ?? this.create(), c = e.pos + t;
|
|
1181
|
+
for (; e.pos < c; ) {
|
|
1182
|
+
let [i, l] = e.tag();
|
|
1183
1183
|
switch (i) {
|
|
1184
1184
|
case /* uint64 resource_id */
|
|
1185
1185
|
1:
|
|
@@ -1189,14 +1189,14 @@ class Wt extends g {
|
|
|
1189
1189
|
let a = n.readUnknownField;
|
|
1190
1190
|
if (a === "throw")
|
|
1191
1191
|
throw new globalThis.Error(
|
|
1192
|
-
`Unknown field ${i} (wire type ${
|
|
1192
|
+
`Unknown field ${i} (wire type ${l}) for ${this.typeName}`
|
|
1193
1193
|
);
|
|
1194
|
-
let p = e.skip(
|
|
1194
|
+
let p = e.skip(l);
|
|
1195
1195
|
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
1196
1196
|
this.typeName,
|
|
1197
1197
|
o,
|
|
1198
1198
|
i,
|
|
1199
|
-
|
|
1199
|
+
l,
|
|
1200
1200
|
p
|
|
1201
1201
|
);
|
|
1202
1202
|
}
|
|
@@ -1213,8 +1213,8 @@ class Wt extends g {
|
|
|
1213
1213
|
), t;
|
|
1214
1214
|
}
|
|
1215
1215
|
}
|
|
1216
|
-
const
|
|
1217
|
-
class
|
|
1216
|
+
const Wt = new Et();
|
|
1217
|
+
class zt extends g {
|
|
1218
1218
|
constructor() {
|
|
1219
1219
|
super("MiLaboratories.Controller.Shared.ProgressAPI.GetStatus.Response", [
|
|
1220
1220
|
{ no: 1, name: "report", kind: "message", T: () => S }
|
|
@@ -1229,9 +1229,9 @@ class xt extends g {
|
|
|
1229
1229
|
), t;
|
|
1230
1230
|
}
|
|
1231
1231
|
internalBinaryRead(e, t, n, r) {
|
|
1232
|
-
let o = r ?? this.create(),
|
|
1233
|
-
for (; e.pos <
|
|
1234
|
-
let [i,
|
|
1232
|
+
let o = r ?? this.create(), c = e.pos + t;
|
|
1233
|
+
for (; e.pos < c; ) {
|
|
1234
|
+
let [i, l] = e.tag();
|
|
1235
1235
|
switch (i) {
|
|
1236
1236
|
case /* MiLaboratories.Controller.Shared.ProgressAPI.Report report */
|
|
1237
1237
|
1:
|
|
@@ -1246,14 +1246,14 @@ class xt extends g {
|
|
|
1246
1246
|
let a = n.readUnknownField;
|
|
1247
1247
|
if (a === "throw")
|
|
1248
1248
|
throw new globalThis.Error(
|
|
1249
|
-
`Unknown field ${i} (wire type ${
|
|
1249
|
+
`Unknown field ${i} (wire type ${l}) for ${this.typeName}`
|
|
1250
1250
|
);
|
|
1251
|
-
let p = e.skip(
|
|
1251
|
+
let p = e.skip(l);
|
|
1252
1252
|
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
1253
1253
|
this.typeName,
|
|
1254
1254
|
o,
|
|
1255
1255
|
i,
|
|
1256
|
-
|
|
1256
|
+
l,
|
|
1257
1257
|
p
|
|
1258
1258
|
);
|
|
1259
1259
|
}
|
|
@@ -1274,8 +1274,8 @@ class xt extends g {
|
|
|
1274
1274
|
), t;
|
|
1275
1275
|
}
|
|
1276
1276
|
}
|
|
1277
|
-
const At = new
|
|
1278
|
-
class
|
|
1277
|
+
const At = new zt();
|
|
1278
|
+
class xt extends g {
|
|
1279
1279
|
constructor() {
|
|
1280
1280
|
super("MiLaboratories.Controller.Shared.ProgressAPI.RealtimeStatus", []);
|
|
1281
1281
|
}
|
|
@@ -1295,8 +1295,8 @@ class Mt extends g {
|
|
|
1295
1295
|
), t;
|
|
1296
1296
|
}
|
|
1297
1297
|
}
|
|
1298
|
-
new
|
|
1299
|
-
class
|
|
1298
|
+
new xt();
|
|
1299
|
+
class Mt extends g {
|
|
1300
1300
|
constructor() {
|
|
1301
1301
|
super(
|
|
1302
1302
|
"MiLaboratories.Controller.Shared.ProgressAPI.RealtimeStatus.Request",
|
|
@@ -1322,9 +1322,9 @@ class Ht extends g {
|
|
|
1322
1322
|
), t;
|
|
1323
1323
|
}
|
|
1324
1324
|
internalBinaryRead(e, t, n, r) {
|
|
1325
|
-
let o = r ?? this.create(),
|
|
1326
|
-
for (; e.pos <
|
|
1327
|
-
let [i,
|
|
1325
|
+
let o = r ?? this.create(), c = e.pos + t;
|
|
1326
|
+
for (; e.pos < c; ) {
|
|
1327
|
+
let [i, l] = e.tag();
|
|
1328
1328
|
switch (i) {
|
|
1329
1329
|
case /* uint64 resource_id */
|
|
1330
1330
|
1:
|
|
@@ -1343,14 +1343,14 @@ class Ht extends g {
|
|
|
1343
1343
|
let a = n.readUnknownField;
|
|
1344
1344
|
if (a === "throw")
|
|
1345
1345
|
throw new globalThis.Error(
|
|
1346
|
-
`Unknown field ${i} (wire type ${
|
|
1346
|
+
`Unknown field ${i} (wire type ${l}) for ${this.typeName}`
|
|
1347
1347
|
);
|
|
1348
|
-
let p = e.skip(
|
|
1348
|
+
let p = e.skip(l);
|
|
1349
1349
|
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
1350
1350
|
this.typeName,
|
|
1351
1351
|
o,
|
|
1352
1352
|
i,
|
|
1353
|
-
|
|
1353
|
+
l,
|
|
1354
1354
|
p
|
|
1355
1355
|
);
|
|
1356
1356
|
}
|
|
@@ -1371,8 +1371,8 @@ class Ht extends g {
|
|
|
1371
1371
|
), t;
|
|
1372
1372
|
}
|
|
1373
1373
|
}
|
|
1374
|
-
const
|
|
1375
|
-
class
|
|
1374
|
+
const Ht = new Mt();
|
|
1375
|
+
class jt extends g {
|
|
1376
1376
|
constructor() {
|
|
1377
1377
|
super(
|
|
1378
1378
|
"MiLaboratories.Controller.Shared.ProgressAPI.RealtimeStatus.Response",
|
|
@@ -1388,9 +1388,9 @@ class Gt extends g {
|
|
|
1388
1388
|
), t;
|
|
1389
1389
|
}
|
|
1390
1390
|
internalBinaryRead(e, t, n, r) {
|
|
1391
|
-
let o = r ?? this.create(),
|
|
1392
|
-
for (; e.pos <
|
|
1393
|
-
let [i,
|
|
1391
|
+
let o = r ?? this.create(), c = e.pos + t;
|
|
1392
|
+
for (; e.pos < c; ) {
|
|
1393
|
+
let [i, l] = e.tag();
|
|
1394
1394
|
switch (i) {
|
|
1395
1395
|
case /* MiLaboratories.Controller.Shared.ProgressAPI.Report report */
|
|
1396
1396
|
1:
|
|
@@ -1405,14 +1405,14 @@ class Gt extends g {
|
|
|
1405
1405
|
let a = n.readUnknownField;
|
|
1406
1406
|
if (a === "throw")
|
|
1407
1407
|
throw new globalThis.Error(
|
|
1408
|
-
`Unknown field ${i} (wire type ${
|
|
1408
|
+
`Unknown field ${i} (wire type ${l}) for ${this.typeName}`
|
|
1409
1409
|
);
|
|
1410
|
-
let p = e.skip(
|
|
1410
|
+
let p = e.skip(l);
|
|
1411
1411
|
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
1412
1412
|
this.typeName,
|
|
1413
1413
|
o,
|
|
1414
1414
|
i,
|
|
1415
|
-
|
|
1415
|
+
l,
|
|
1416
1416
|
p
|
|
1417
1417
|
);
|
|
1418
1418
|
}
|
|
@@ -1433,7 +1433,7 @@ class Gt extends g {
|
|
|
1433
1433
|
), t;
|
|
1434
1434
|
}
|
|
1435
1435
|
}
|
|
1436
|
-
const
|
|
1436
|
+
const Gt = new jt(), z = new D(
|
|
1437
1437
|
"MiLaboratories.Controller.Shared.Progress",
|
|
1438
1438
|
[
|
|
1439
1439
|
{
|
|
@@ -1441,19 +1441,19 @@ const Vt = new Gt(), z = new D(
|
|
|
1441
1441
|
options: {
|
|
1442
1442
|
"google.api.http": { get: "/resources/{resource_id}/get-progress" }
|
|
1443
1443
|
},
|
|
1444
|
-
I:
|
|
1444
|
+
I: Wt,
|
|
1445
1445
|
O: At
|
|
1446
1446
|
},
|
|
1447
1447
|
{
|
|
1448
1448
|
name: "RealtimeStatus",
|
|
1449
1449
|
serverStreaming: !0,
|
|
1450
1450
|
options: {},
|
|
1451
|
-
I:
|
|
1452
|
-
O:
|
|
1451
|
+
I: Ht,
|
|
1452
|
+
O: Gt
|
|
1453
1453
|
}
|
|
1454
1454
|
]
|
|
1455
1455
|
);
|
|
1456
|
-
class
|
|
1456
|
+
class Vt {
|
|
1457
1457
|
constructor(e) {
|
|
1458
1458
|
d(this, "typeName", z.typeName);
|
|
1459
1459
|
d(this, "methods", z.methods);
|
|
@@ -1475,10 +1475,10 @@ class qt {
|
|
|
1475
1475
|
return y("serverStreaming", this._transport, n, r, e);
|
|
1476
1476
|
}
|
|
1477
1477
|
}
|
|
1478
|
-
class
|
|
1478
|
+
class qt {
|
|
1479
1479
|
constructor(e, t, n, r) {
|
|
1480
1480
|
d(this, "grpcClient");
|
|
1481
|
-
this.grpcTransport = e, this.client = n, this.logger = r, this.grpcClient = new
|
|
1481
|
+
this.grpcTransport = e, this.client = n, this.logger = r, this.grpcClient = new Vt(this.grpcTransport);
|
|
1482
1482
|
}
|
|
1483
1483
|
close() {
|
|
1484
1484
|
}
|
|
@@ -1499,25 +1499,25 @@ class Jt {
|
|
|
1499
1499
|
// GRPC stream every updateIntervalMs milliseconds.
|
|
1500
1500
|
async *realtimeStatus({ id: e, type: t }, n = 100, r) {
|
|
1501
1501
|
r = k(t, r);
|
|
1502
|
-
const o = Math.floor(n / 1e3),
|
|
1502
|
+
const o = Math.floor(n / 1e3), c = (n - o * 1e3) * 1e6, i = $.create({
|
|
1503
1503
|
seconds: BigInt(o),
|
|
1504
|
-
nanos:
|
|
1504
|
+
nanos: c
|
|
1505
1505
|
});
|
|
1506
1506
|
try {
|
|
1507
|
-
const { responses:
|
|
1507
|
+
const { responses: l } = this.grpcClient.realtimeStatus(
|
|
1508
1508
|
{
|
|
1509
1509
|
resourceId: e,
|
|
1510
1510
|
updateInterval: i
|
|
1511
1511
|
},
|
|
1512
1512
|
r
|
|
1513
1513
|
);
|
|
1514
|
-
yield*
|
|
1515
|
-
} catch (
|
|
1516
|
-
throw this.logger.warn("Failed to get realtime status" +
|
|
1514
|
+
yield* l;
|
|
1515
|
+
} catch (l) {
|
|
1516
|
+
throw this.logger.warn("Failed to get realtime status" + l), l;
|
|
1517
1517
|
}
|
|
1518
1518
|
}
|
|
1519
1519
|
}
|
|
1520
|
-
class
|
|
1520
|
+
class Jt extends g {
|
|
1521
1521
|
constructor() {
|
|
1522
1522
|
super("MiLaboratories.Controller.Shared.DownloadAPI", []);
|
|
1523
1523
|
}
|
|
@@ -1537,8 +1537,8 @@ class Zt extends g {
|
|
|
1537
1537
|
), t;
|
|
1538
1538
|
}
|
|
1539
1539
|
}
|
|
1540
|
-
new
|
|
1541
|
-
class
|
|
1540
|
+
new Jt();
|
|
1541
|
+
class Zt extends g {
|
|
1542
1542
|
constructor() {
|
|
1543
1543
|
super("MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL", []);
|
|
1544
1544
|
}
|
|
@@ -1558,8 +1558,8 @@ class Qt extends g {
|
|
|
1558
1558
|
), t;
|
|
1559
1559
|
}
|
|
1560
1560
|
}
|
|
1561
|
-
new
|
|
1562
|
-
class
|
|
1561
|
+
new Zt();
|
|
1562
|
+
class Qt extends g {
|
|
1563
1563
|
constructor() {
|
|
1564
1564
|
super(
|
|
1565
1565
|
"MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL.Request",
|
|
@@ -1584,9 +1584,9 @@ class Xt extends g {
|
|
|
1584
1584
|
), t;
|
|
1585
1585
|
}
|
|
1586
1586
|
internalBinaryRead(e, t, n, r) {
|
|
1587
|
-
let o = r ?? this.create(),
|
|
1588
|
-
for (; e.pos <
|
|
1589
|
-
let [i,
|
|
1587
|
+
let o = r ?? this.create(), c = e.pos + t;
|
|
1588
|
+
for (; e.pos < c; ) {
|
|
1589
|
+
let [i, l] = e.tag();
|
|
1590
1590
|
switch (i) {
|
|
1591
1591
|
case /* uint64 resource_id */
|
|
1592
1592
|
1:
|
|
@@ -1596,14 +1596,14 @@ class Xt extends g {
|
|
|
1596
1596
|
let a = n.readUnknownField;
|
|
1597
1597
|
if (a === "throw")
|
|
1598
1598
|
throw new globalThis.Error(
|
|
1599
|
-
`Unknown field ${i} (wire type ${
|
|
1599
|
+
`Unknown field ${i} (wire type ${l}) for ${this.typeName}`
|
|
1600
1600
|
);
|
|
1601
|
-
let p = e.skip(
|
|
1601
|
+
let p = e.skip(l);
|
|
1602
1602
|
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
1603
1603
|
this.typeName,
|
|
1604
1604
|
o,
|
|
1605
1605
|
i,
|
|
1606
|
-
|
|
1606
|
+
l,
|
|
1607
1607
|
p
|
|
1608
1608
|
);
|
|
1609
1609
|
}
|
|
@@ -1620,8 +1620,8 @@ class Xt extends g {
|
|
|
1620
1620
|
), t;
|
|
1621
1621
|
}
|
|
1622
1622
|
}
|
|
1623
|
-
const
|
|
1624
|
-
class
|
|
1623
|
+
const Xt = new Qt();
|
|
1624
|
+
class Yt extends g {
|
|
1625
1625
|
constructor() {
|
|
1626
1626
|
super(
|
|
1627
1627
|
"MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL.HTTPHeader",
|
|
@@ -1654,9 +1654,9 @@ class Kt extends g {
|
|
|
1654
1654
|
), t;
|
|
1655
1655
|
}
|
|
1656
1656
|
internalBinaryRead(e, t, n, r) {
|
|
1657
|
-
let o = r ?? this.create(),
|
|
1658
|
-
for (; e.pos <
|
|
1659
|
-
let [i,
|
|
1657
|
+
let o = r ?? this.create(), c = e.pos + t;
|
|
1658
|
+
for (; e.pos < c; ) {
|
|
1659
|
+
let [i, l] = e.tag();
|
|
1660
1660
|
switch (i) {
|
|
1661
1661
|
case /* string Name = 1 [json_name = "Name"];*/
|
|
1662
1662
|
1:
|
|
@@ -1670,14 +1670,14 @@ class Kt extends g {
|
|
|
1670
1670
|
let a = n.readUnknownField;
|
|
1671
1671
|
if (a === "throw")
|
|
1672
1672
|
throw new globalThis.Error(
|
|
1673
|
-
`Unknown field ${i} (wire type ${
|
|
1673
|
+
`Unknown field ${i} (wire type ${l}) for ${this.typeName}`
|
|
1674
1674
|
);
|
|
1675
|
-
let p = e.skip(
|
|
1675
|
+
let p = e.skip(l);
|
|
1676
1676
|
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
1677
1677
|
this.typeName,
|
|
1678
1678
|
o,
|
|
1679
1679
|
i,
|
|
1680
|
-
|
|
1680
|
+
l,
|
|
1681
1681
|
p
|
|
1682
1682
|
);
|
|
1683
1683
|
}
|
|
@@ -1694,8 +1694,8 @@ class Kt extends g {
|
|
|
1694
1694
|
), t;
|
|
1695
1695
|
}
|
|
1696
1696
|
}
|
|
1697
|
-
const
|
|
1698
|
-
class
|
|
1697
|
+
const A = new Yt();
|
|
1698
|
+
class Kt extends g {
|
|
1699
1699
|
constructor() {
|
|
1700
1700
|
super(
|
|
1701
1701
|
"MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL.Response",
|
|
@@ -1712,7 +1712,7 @@ class er extends g {
|
|
|
1712
1712
|
name: "headers",
|
|
1713
1713
|
kind: "message",
|
|
1714
1714
|
repeat: 1,
|
|
1715
|
-
T: () =>
|
|
1715
|
+
T: () => A
|
|
1716
1716
|
}
|
|
1717
1717
|
]
|
|
1718
1718
|
);
|
|
@@ -1726,9 +1726,9 @@ class er extends g {
|
|
|
1726
1726
|
), t;
|
|
1727
1727
|
}
|
|
1728
1728
|
internalBinaryRead(e, t, n, r) {
|
|
1729
|
-
let o = r ?? this.create(),
|
|
1730
|
-
for (; e.pos <
|
|
1731
|
-
let [i,
|
|
1729
|
+
let o = r ?? this.create(), c = e.pos + t;
|
|
1730
|
+
for (; e.pos < c; ) {
|
|
1731
|
+
let [i, l] = e.tag();
|
|
1732
1732
|
switch (i) {
|
|
1733
1733
|
case /* string download_url */
|
|
1734
1734
|
1:
|
|
@@ -1737,7 +1737,7 @@ class er extends g {
|
|
|
1737
1737
|
case /* repeated MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL.HTTPHeader headers */
|
|
1738
1738
|
2:
|
|
1739
1739
|
o.headers.push(
|
|
1740
|
-
|
|
1740
|
+
A.internalBinaryRead(
|
|
1741
1741
|
e,
|
|
1742
1742
|
e.uint32(),
|
|
1743
1743
|
n
|
|
@@ -1748,14 +1748,14 @@ class er extends g {
|
|
|
1748
1748
|
let a = n.readUnknownField;
|
|
1749
1749
|
if (a === "throw")
|
|
1750
1750
|
throw new globalThis.Error(
|
|
1751
|
-
`Unknown field ${i} (wire type ${
|
|
1751
|
+
`Unknown field ${i} (wire type ${l}) for ${this.typeName}`
|
|
1752
1752
|
);
|
|
1753
|
-
let p = e.skip(
|
|
1753
|
+
let p = e.skip(l);
|
|
1754
1754
|
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
1755
1755
|
this.typeName,
|
|
1756
1756
|
o,
|
|
1757
1757
|
i,
|
|
1758
|
-
|
|
1758
|
+
l,
|
|
1759
1759
|
p
|
|
1760
1760
|
);
|
|
1761
1761
|
}
|
|
@@ -1765,7 +1765,7 @@ class er extends g {
|
|
|
1765
1765
|
internalBinaryWrite(e, t, n) {
|
|
1766
1766
|
e.downloadUrl !== "" && t.tag(1, h.LengthDelimited).string(e.downloadUrl);
|
|
1767
1767
|
for (let o = 0; o < e.headers.length; o++)
|
|
1768
|
-
|
|
1768
|
+
A.internalBinaryWrite(
|
|
1769
1769
|
e.headers[o],
|
|
1770
1770
|
t.tag(2, h.LengthDelimited).fork(),
|
|
1771
1771
|
n
|
|
@@ -1778,7 +1778,7 @@ class er extends g {
|
|
|
1778
1778
|
), t;
|
|
1779
1779
|
}
|
|
1780
1780
|
}
|
|
1781
|
-
const
|
|
1781
|
+
const er = new Kt(), x = new D(
|
|
1782
1782
|
"MiLaboratories.Controller.Shared.Download",
|
|
1783
1783
|
[
|
|
1784
1784
|
{
|
|
@@ -1786,16 +1786,16 @@ const tr = new er(), A = new D(
|
|
|
1786
1786
|
options: {
|
|
1787
1787
|
"google.api.http": { get: "/resources/{resource_id}/get-download-url" }
|
|
1788
1788
|
},
|
|
1789
|
-
I:
|
|
1790
|
-
O:
|
|
1789
|
+
I: Xt,
|
|
1790
|
+
O: er
|
|
1791
1791
|
}
|
|
1792
1792
|
]
|
|
1793
1793
|
);
|
|
1794
|
-
class
|
|
1794
|
+
class tr {
|
|
1795
1795
|
constructor(e) {
|
|
1796
|
-
d(this, "typeName",
|
|
1797
|
-
d(this, "methods",
|
|
1798
|
-
d(this, "options",
|
|
1796
|
+
d(this, "typeName", x.typeName);
|
|
1797
|
+
d(this, "methods", x.methods);
|
|
1798
|
+
d(this, "options", x.options);
|
|
1799
1799
|
this._transport = e;
|
|
1800
1800
|
}
|
|
1801
1801
|
/**
|
|
@@ -1808,18 +1808,18 @@ class rr {
|
|
|
1808
1808
|
}
|
|
1809
1809
|
class ae extends Error {
|
|
1810
1810
|
}
|
|
1811
|
-
class
|
|
1811
|
+
class Re {
|
|
1812
1812
|
constructor(e) {
|
|
1813
1813
|
this.httpClient = e;
|
|
1814
1814
|
}
|
|
1815
1815
|
async downloadRemoteFile(e, t, n) {
|
|
1816
|
-
const { statusCode: r, body: o, headers:
|
|
1816
|
+
const { statusCode: r, body: o, headers: c } = await be(e, {
|
|
1817
1817
|
dispatcher: this.httpClient,
|
|
1818
1818
|
headers: t,
|
|
1819
1819
|
signal: n
|
|
1820
1820
|
}), i = re.toWeb(o);
|
|
1821
1821
|
if (r != 200) {
|
|
1822
|
-
const
|
|
1822
|
+
const l = await et(i), a = l.substring(0, Math.min(l.length, 1e3));
|
|
1823
1823
|
throw 400 <= r && r < 500 ? new ae(
|
|
1824
1824
|
`Http error: statusCode: ${r} url: ${e.toString()}, beginning of body: ${a}`
|
|
1825
1825
|
) : new Error(
|
|
@@ -1828,28 +1828,28 @@ class Se {
|
|
|
1828
1828
|
}
|
|
1829
1829
|
return {
|
|
1830
1830
|
content: i,
|
|
1831
|
-
size: Number(
|
|
1831
|
+
size: Number(c["content-length"])
|
|
1832
1832
|
};
|
|
1833
1833
|
}
|
|
1834
1834
|
}
|
|
1835
1835
|
function B(s) {
|
|
1836
|
-
if (!
|
|
1836
|
+
if (!Ke.isAbsolute(s)) throw new Error(`Path ${s} is not absolute.`);
|
|
1837
1837
|
return s;
|
|
1838
1838
|
}
|
|
1839
|
-
const
|
|
1840
|
-
class
|
|
1839
|
+
const rr = "storage://";
|
|
1840
|
+
class Se extends Error {
|
|
1841
1841
|
}
|
|
1842
|
-
class
|
|
1842
|
+
class Ne extends Error {
|
|
1843
1843
|
}
|
|
1844
|
-
class
|
|
1844
|
+
class nr {
|
|
1845
1845
|
constructor(e, t, n, r) {
|
|
1846
1846
|
d(this, "grpcClient");
|
|
1847
1847
|
d(this, "downloadHelper");
|
|
1848
1848
|
d(this, "localStorageIdsToRoot");
|
|
1849
|
-
d(this, "isLocal", (e) => e.startsWith(
|
|
1849
|
+
d(this, "isLocal", (e) => e.startsWith(rr));
|
|
1850
1850
|
this.grpcTransport = e, this.httpClient = t, this.logger = n;
|
|
1851
1851
|
for (const o of r) o.localPath !== "" && B(o.localPath);
|
|
1852
|
-
this.grpcClient = new
|
|
1852
|
+
this.grpcClient = new tr(this.grpcTransport), this.downloadHelper = new Re(t), this.localStorageIdsToRoot = new Map(
|
|
1853
1853
|
r.map((o) => [o.storageId, o.localPath])
|
|
1854
1854
|
);
|
|
1855
1855
|
}
|
|
@@ -1871,21 +1871,23 @@ class or {
|
|
|
1871
1871
|
);
|
|
1872
1872
|
}
|
|
1873
1873
|
async readLocalFile(e) {
|
|
1874
|
-
const t = e.
|
|
1875
|
-
if (t === null || t.length != 3)
|
|
1876
|
-
throw new Ue(
|
|
1877
|
-
`url for local filepath ${e} does not match regex ${de}, parsed: ${t}`
|
|
1878
|
-
);
|
|
1879
|
-
const [n, r, o] = t, l = this.localStorageIdsToRoot.get(r);
|
|
1880
|
-
if (l === void 0)
|
|
1881
|
-
throw new Ne(`Unknown storage location: ${r}`);
|
|
1882
|
-
const i = l === "" ? o : w.join(l, o), a = (await m.stat(i)).size;
|
|
1874
|
+
const t = or(e, this.localStorageIdsToRoot), r = (await m.stat(t)).size;
|
|
1883
1875
|
return {
|
|
1884
|
-
content: re.toWeb(O.createReadStream(
|
|
1885
|
-
size:
|
|
1876
|
+
content: re.toWeb(O.createReadStream(t)),
|
|
1877
|
+
size: r
|
|
1886
1878
|
};
|
|
1887
1879
|
}
|
|
1888
1880
|
}
|
|
1881
|
+
function or(s, e) {
|
|
1882
|
+
const t = new URL(s);
|
|
1883
|
+
if (t.pathname == "")
|
|
1884
|
+
throw new Ne(`url for local filepath ${s} does not match url scheme`);
|
|
1885
|
+
const n = t.host, r = e.get(n);
|
|
1886
|
+
if (r === void 0)
|
|
1887
|
+
throw new Se(`Unknown storage location: ${n}`);
|
|
1888
|
+
const o = decodeURIComponent(t.pathname.slice(1));
|
|
1889
|
+
return r === "" ? o : w.join(r, o);
|
|
1890
|
+
}
|
|
1889
1891
|
function sr(s) {
|
|
1890
1892
|
return Object.fromEntries(s.map(({ name: e, value: t }) => [e, t]));
|
|
1891
1893
|
}
|
|
@@ -1959,7 +1961,7 @@ class ir extends g {
|
|
|
1959
1961
|
internalJsonRead(e, t, n) {
|
|
1960
1962
|
if (typeof e != "string")
|
|
1961
1963
|
throw new Error(
|
|
1962
|
-
"Unable to parse Timestamp from JSON " +
|
|
1964
|
+
"Unable to parse Timestamp from JSON " + ye(e) + "."
|
|
1963
1965
|
);
|
|
1964
1966
|
let r = e.match(
|
|
1965
1967
|
/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/
|
|
@@ -1982,9 +1984,9 @@ class ir extends g {
|
|
|
1982
1984
|
return t.seconds = 0n, t.nanos = 0, e !== void 0 && f(this, t, e), t;
|
|
1983
1985
|
}
|
|
1984
1986
|
internalBinaryRead(e, t, n, r) {
|
|
1985
|
-
let o = r ?? this.create(),
|
|
1986
|
-
for (; e.pos <
|
|
1987
|
-
let [i,
|
|
1987
|
+
let o = r ?? this.create(), c = e.pos + t;
|
|
1988
|
+
for (; e.pos < c; ) {
|
|
1989
|
+
let [i, l] = e.tag();
|
|
1988
1990
|
switch (i) {
|
|
1989
1991
|
case /* int64 seconds */
|
|
1990
1992
|
1:
|
|
@@ -1998,14 +2000,14 @@ class ir extends g {
|
|
|
1998
2000
|
let a = n.readUnknownField;
|
|
1999
2001
|
if (a === "throw")
|
|
2000
2002
|
throw new globalThis.Error(
|
|
2001
|
-
`Unknown field ${i} (wire type ${
|
|
2003
|
+
`Unknown field ${i} (wire type ${l}) for ${this.typeName}`
|
|
2002
2004
|
);
|
|
2003
|
-
let p = e.skip(
|
|
2005
|
+
let p = e.skip(l);
|
|
2004
2006
|
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
2005
2007
|
this.typeName,
|
|
2006
2008
|
o,
|
|
2007
2009
|
i,
|
|
2008
|
-
|
|
2010
|
+
l,
|
|
2009
2011
|
p
|
|
2010
2012
|
);
|
|
2011
2013
|
}
|
|
@@ -2098,9 +2100,9 @@ class lr extends g {
|
|
|
2098
2100
|
return t.name = "", t.size = 0n, t.isDir = !1, t.fullName = "", t.directory = "", t.version = "", e !== void 0 && f(this, t, e), t;
|
|
2099
2101
|
}
|
|
2100
2102
|
internalBinaryRead(e, t, n, r) {
|
|
2101
|
-
let o = r ?? this.create(),
|
|
2102
|
-
for (; e.pos <
|
|
2103
|
-
let [i,
|
|
2103
|
+
let o = r ?? this.create(), c = e.pos + t;
|
|
2104
|
+
for (; e.pos < c; ) {
|
|
2105
|
+
let [i, l] = e.tag();
|
|
2104
2106
|
switch (i) {
|
|
2105
2107
|
case /* string name */
|
|
2106
2108
|
1:
|
|
@@ -2139,14 +2141,14 @@ class lr extends g {
|
|
|
2139
2141
|
let a = n.readUnknownField;
|
|
2140
2142
|
if (a === "throw")
|
|
2141
2143
|
throw new globalThis.Error(
|
|
2142
|
-
`Unknown field ${i} (wire type ${
|
|
2144
|
+
`Unknown field ${i} (wire type ${l}) for ${this.typeName}`
|
|
2143
2145
|
);
|
|
2144
|
-
let p = e.skip(
|
|
2146
|
+
let p = e.skip(l);
|
|
2145
2147
|
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
2146
2148
|
this.typeName,
|
|
2147
2149
|
o,
|
|
2148
2150
|
i,
|
|
2149
|
-
|
|
2151
|
+
l,
|
|
2150
2152
|
p
|
|
2151
2153
|
);
|
|
2152
2154
|
}
|
|
@@ -2214,9 +2216,9 @@ class dr extends g {
|
|
|
2214
2216
|
return t.resourceId = 0n, t.location = "", e !== void 0 && f(this, t, e), t;
|
|
2215
2217
|
}
|
|
2216
2218
|
internalBinaryRead(e, t, n, r) {
|
|
2217
|
-
let o = r ?? this.create(),
|
|
2218
|
-
for (; e.pos <
|
|
2219
|
-
let [i,
|
|
2219
|
+
let o = r ?? this.create(), c = e.pos + t;
|
|
2220
|
+
for (; e.pos < c; ) {
|
|
2221
|
+
let [i, l] = e.tag();
|
|
2220
2222
|
switch (i) {
|
|
2221
2223
|
case /* uint64 resource_id */
|
|
2222
2224
|
1:
|
|
@@ -2230,14 +2232,14 @@ class dr extends g {
|
|
|
2230
2232
|
let a = n.readUnknownField;
|
|
2231
2233
|
if (a === "throw")
|
|
2232
2234
|
throw new globalThis.Error(
|
|
2233
|
-
`Unknown field ${i} (wire type ${
|
|
2235
|
+
`Unknown field ${i} (wire type ${l}) for ${this.typeName}`
|
|
2234
2236
|
);
|
|
2235
|
-
let p = e.skip(
|
|
2237
|
+
let p = e.skip(l);
|
|
2236
2238
|
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
2237
2239
|
this.typeName,
|
|
2238
2240
|
o,
|
|
2239
2241
|
i,
|
|
2240
|
-
|
|
2242
|
+
l,
|
|
2241
2243
|
p
|
|
2242
2244
|
);
|
|
2243
2245
|
}
|
|
@@ -2279,9 +2281,9 @@ class ur extends g {
|
|
|
2279
2281
|
return t.items = [], t.delimiter = "", e !== void 0 && f(this, t, e), t;
|
|
2280
2282
|
}
|
|
2281
2283
|
internalBinaryRead(e, t, n, r) {
|
|
2282
|
-
let o = r ?? this.create(),
|
|
2283
|
-
for (; e.pos <
|
|
2284
|
-
let [i,
|
|
2284
|
+
let o = r ?? this.create(), c = e.pos + t;
|
|
2285
|
+
for (; e.pos < c; ) {
|
|
2286
|
+
let [i, l] = e.tag();
|
|
2285
2287
|
switch (i) {
|
|
2286
2288
|
case /* repeated MiLaboratories.Controller.Shared.LsAPI.ListItem items */
|
|
2287
2289
|
1:
|
|
@@ -2297,14 +2299,14 @@ class ur extends g {
|
|
|
2297
2299
|
let a = n.readUnknownField;
|
|
2298
2300
|
if (a === "throw")
|
|
2299
2301
|
throw new globalThis.Error(
|
|
2300
|
-
`Unknown field ${i} (wire type ${
|
|
2302
|
+
`Unknown field ${i} (wire type ${l}) for ${this.typeName}`
|
|
2301
2303
|
);
|
|
2302
|
-
let p = e.skip(
|
|
2304
|
+
let p = e.skip(l);
|
|
2303
2305
|
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
2304
2306
|
this.typeName,
|
|
2305
2307
|
o,
|
|
2306
2308
|
i,
|
|
2307
|
-
|
|
2309
|
+
l,
|
|
2308
2310
|
p
|
|
2309
2311
|
);
|
|
2310
2312
|
}
|
|
@@ -2432,9 +2434,9 @@ class wr extends g {
|
|
|
2432
2434
|
return t.resourceId = 0n, t.offset = 0n, e !== void 0 && f(this, t, e), t;
|
|
2433
2435
|
}
|
|
2434
2436
|
internalBinaryRead(e, t, n, r) {
|
|
2435
|
-
let o = r ?? this.create(),
|
|
2436
|
-
for (; e.pos <
|
|
2437
|
-
let [i,
|
|
2437
|
+
let o = r ?? this.create(), c = e.pos + t;
|
|
2438
|
+
for (; e.pos < c; ) {
|
|
2439
|
+
let [i, l] = e.tag();
|
|
2438
2440
|
switch (i) {
|
|
2439
2441
|
case /* uint64 resource_id */
|
|
2440
2442
|
1:
|
|
@@ -2456,14 +2458,14 @@ class wr extends g {
|
|
|
2456
2458
|
let a = n.readUnknownField;
|
|
2457
2459
|
if (a === "throw")
|
|
2458
2460
|
throw new globalThis.Error(
|
|
2459
|
-
`Unknown field ${i} (wire type ${
|
|
2461
|
+
`Unknown field ${i} (wire type ${l}) for ${this.typeName}`
|
|
2460
2462
|
);
|
|
2461
|
-
let p = e.skip(
|
|
2463
|
+
let p = e.skip(l);
|
|
2462
2464
|
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
2463
2465
|
this.typeName,
|
|
2464
2466
|
o,
|
|
2465
2467
|
i,
|
|
2466
|
-
|
|
2468
|
+
l,
|
|
2467
2469
|
p
|
|
2468
2470
|
);
|
|
2469
2471
|
}
|
|
@@ -2515,9 +2517,9 @@ class br extends g {
|
|
|
2515
2517
|
return t.resourceId = 0n, t.offset = 0n, e !== void 0 && f(this, t, e), t;
|
|
2516
2518
|
}
|
|
2517
2519
|
internalBinaryRead(e, t, n, r) {
|
|
2518
|
-
let o = r ?? this.create(),
|
|
2519
|
-
for (; e.pos <
|
|
2520
|
-
let [i,
|
|
2520
|
+
let o = r ?? this.create(), c = e.pos + t;
|
|
2521
|
+
for (; e.pos < c; ) {
|
|
2522
|
+
let [i, l] = e.tag();
|
|
2521
2523
|
switch (i) {
|
|
2522
2524
|
case /* uint64 resource_id */
|
|
2523
2525
|
1:
|
|
@@ -2535,14 +2537,14 @@ class br extends g {
|
|
|
2535
2537
|
let a = n.readUnknownField;
|
|
2536
2538
|
if (a === "throw")
|
|
2537
2539
|
throw new globalThis.Error(
|
|
2538
|
-
`Unknown field ${i} (wire type ${
|
|
2540
|
+
`Unknown field ${i} (wire type ${l}) for ${this.typeName}`
|
|
2539
2541
|
);
|
|
2540
|
-
let p = e.skip(
|
|
2542
|
+
let p = e.skip(l);
|
|
2541
2543
|
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
2542
2544
|
this.typeName,
|
|
2543
2545
|
o,
|
|
2544
2546
|
i,
|
|
2545
|
-
|
|
2547
|
+
l,
|
|
2546
2548
|
p
|
|
2547
2549
|
);
|
|
2548
2550
|
}
|
|
@@ -2611,9 +2613,9 @@ class kr extends g {
|
|
|
2611
2613
|
return t.resourceId = 0n, t.offset = 0n, e !== void 0 && f(this, t, e), t;
|
|
2612
2614
|
}
|
|
2613
2615
|
internalBinaryRead(e, t, n, r) {
|
|
2614
|
-
let o = r ?? this.create(),
|
|
2615
|
-
for (; e.pos <
|
|
2616
|
-
let [i,
|
|
2616
|
+
let o = r ?? this.create(), c = e.pos + t;
|
|
2617
|
+
for (; e.pos < c; ) {
|
|
2618
|
+
let [i, l] = e.tag();
|
|
2617
2619
|
switch (i) {
|
|
2618
2620
|
case /* uint64 resource_id */
|
|
2619
2621
|
1:
|
|
@@ -2639,14 +2641,14 @@ class kr extends g {
|
|
|
2639
2641
|
let a = n.readUnknownField;
|
|
2640
2642
|
if (a === "throw")
|
|
2641
2643
|
throw new globalThis.Error(
|
|
2642
|
-
`Unknown field ${i} (wire type ${
|
|
2644
|
+
`Unknown field ${i} (wire type ${l}) for ${this.typeName}`
|
|
2643
2645
|
);
|
|
2644
|
-
let p = e.skip(
|
|
2646
|
+
let p = e.skip(l);
|
|
2645
2647
|
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
2646
2648
|
this.typeName,
|
|
2647
2649
|
o,
|
|
2648
2650
|
i,
|
|
2649
|
-
|
|
2651
|
+
l,
|
|
2650
2652
|
p
|
|
2651
2653
|
);
|
|
2652
2654
|
}
|
|
@@ -2715,9 +2717,9 @@ class Pr extends g {
|
|
|
2715
2717
|
return t.resourceId = 0n, t.offset = 0n, e !== void 0 && f(this, t, e), t;
|
|
2716
2718
|
}
|
|
2717
2719
|
internalBinaryRead(e, t, n, r) {
|
|
2718
|
-
let o = r ?? this.create(),
|
|
2719
|
-
for (; e.pos <
|
|
2720
|
-
let [i,
|
|
2720
|
+
let o = r ?? this.create(), c = e.pos + t;
|
|
2721
|
+
for (; e.pos < c; ) {
|
|
2722
|
+
let [i, l] = e.tag();
|
|
2721
2723
|
switch (i) {
|
|
2722
2724
|
case /* uint64 resource_id */
|
|
2723
2725
|
1:
|
|
@@ -2743,14 +2745,14 @@ class Pr extends g {
|
|
|
2743
2745
|
let a = n.readUnknownField;
|
|
2744
2746
|
if (a === "throw")
|
|
2745
2747
|
throw new globalThis.Error(
|
|
2746
|
-
`Unknown field ${i} (wire type ${
|
|
2748
|
+
`Unknown field ${i} (wire type ${l}) for ${this.typeName}`
|
|
2747
2749
|
);
|
|
2748
|
-
let p = e.skip(
|
|
2750
|
+
let p = e.skip(l);
|
|
2749
2751
|
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
2750
2752
|
this.typeName,
|
|
2751
2753
|
o,
|
|
2752
2754
|
i,
|
|
2753
|
-
|
|
2755
|
+
l,
|
|
2754
2756
|
p
|
|
2755
2757
|
);
|
|
2756
2758
|
}
|
|
@@ -2819,9 +2821,9 @@ class Rr extends g {
|
|
|
2819
2821
|
return t.resourceId = 0n, e !== void 0 && f(this, t, e), t;
|
|
2820
2822
|
}
|
|
2821
2823
|
internalBinaryRead(e, t, n, r) {
|
|
2822
|
-
let o = r ?? this.create(),
|
|
2823
|
-
for (; e.pos <
|
|
2824
|
-
let [i,
|
|
2824
|
+
let o = r ?? this.create(), c = e.pos + t;
|
|
2825
|
+
for (; e.pos < c; ) {
|
|
2826
|
+
let [i, l] = e.tag();
|
|
2825
2827
|
switch (i) {
|
|
2826
2828
|
case /* uint64 resource_id */
|
|
2827
2829
|
1:
|
|
@@ -2847,14 +2849,14 @@ class Rr extends g {
|
|
|
2847
2849
|
let a = n.readUnknownField;
|
|
2848
2850
|
if (a === "throw")
|
|
2849
2851
|
throw new globalThis.Error(
|
|
2850
|
-
`Unknown field ${i} (wire type ${
|
|
2852
|
+
`Unknown field ${i} (wire type ${l}) for ${this.typeName}`
|
|
2851
2853
|
);
|
|
2852
|
-
let p = e.skip(
|
|
2854
|
+
let p = e.skip(l);
|
|
2853
2855
|
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
2854
2856
|
this.typeName,
|
|
2855
2857
|
o,
|
|
2856
2858
|
i,
|
|
2857
|
-
|
|
2859
|
+
l,
|
|
2858
2860
|
p
|
|
2859
2861
|
);
|
|
2860
2862
|
}
|
|
@@ -2905,9 +2907,9 @@ class Nr extends g {
|
|
|
2905
2907
|
return t.data = new Uint8Array(0), t.size = 0n, t.newOffset = 0n, e !== void 0 && f(this, t, e), t;
|
|
2906
2908
|
}
|
|
2907
2909
|
internalBinaryRead(e, t, n, r) {
|
|
2908
|
-
let o = r ?? this.create(),
|
|
2909
|
-
for (; e.pos <
|
|
2910
|
-
let [i,
|
|
2910
|
+
let o = r ?? this.create(), c = e.pos + t;
|
|
2911
|
+
for (; e.pos < c; ) {
|
|
2912
|
+
let [i, l] = e.tag();
|
|
2911
2913
|
switch (i) {
|
|
2912
2914
|
case /* bytes data */
|
|
2913
2915
|
1:
|
|
@@ -2925,14 +2927,14 @@ class Nr extends g {
|
|
|
2925
2927
|
let a = n.readUnknownField;
|
|
2926
2928
|
if (a === "throw")
|
|
2927
2929
|
throw new globalThis.Error(
|
|
2928
|
-
`Unknown field ${i} (wire type ${
|
|
2930
|
+
`Unknown field ${i} (wire type ${l}) for ${this.typeName}`
|
|
2929
2931
|
);
|
|
2930
|
-
let p = e.skip(
|
|
2932
|
+
let p = e.skip(l);
|
|
2931
2933
|
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
2932
2934
|
this.typeName,
|
|
2933
2935
|
o,
|
|
2934
2936
|
i,
|
|
2935
|
-
|
|
2937
|
+
l,
|
|
2936
2938
|
p
|
|
2937
2939
|
);
|
|
2938
2940
|
}
|
|
@@ -3095,7 +3097,7 @@ class Br {
|
|
|
3095
3097
|
/** Reads text back and returns the text,
|
|
3096
3098
|
* the new offset
|
|
3097
3099
|
* and the total size of the (currently existing) file. */
|
|
3098
|
-
async lastLines({ id: e, type: t }, n, r = 0n, o,
|
|
3100
|
+
async lastLines({ id: e, type: t }, n, r = 0n, o, c) {
|
|
3099
3101
|
return (await this.grpcClient.lastLines(
|
|
3100
3102
|
{
|
|
3101
3103
|
resourceId: e,
|
|
@@ -3103,13 +3105,13 @@ class Br {
|
|
|
3103
3105
|
offset: r,
|
|
3104
3106
|
search: o
|
|
3105
3107
|
},
|
|
3106
|
-
k(t,
|
|
3108
|
+
k(t, c)
|
|
3107
3109
|
)).response;
|
|
3108
3110
|
}
|
|
3109
3111
|
/** Reads the file forward and returns the text,
|
|
3110
3112
|
* the new offset
|
|
3111
3113
|
* and the total size of the (currently existing) file. */
|
|
3112
|
-
async readText({ id: e, type: t }, n, r = 0n, o,
|
|
3114
|
+
async readText({ id: e, type: t }, n, r = 0n, o, c) {
|
|
3113
3115
|
return (await this.grpcClient.readText(
|
|
3114
3116
|
{
|
|
3115
3117
|
resourceId: K(e),
|
|
@@ -3117,14 +3119,14 @@ class Br {
|
|
|
3117
3119
|
offset: r,
|
|
3118
3120
|
search: o
|
|
3119
3121
|
},
|
|
3120
|
-
k(t,
|
|
3122
|
+
k(t, c)
|
|
3121
3123
|
)).response;
|
|
3122
3124
|
}
|
|
3123
3125
|
}
|
|
3124
3126
|
function Nn(s, e, t) {
|
|
3125
3127
|
return e.getDriver({
|
|
3126
3128
|
name: "DownloadBlob",
|
|
3127
|
-
init: (n, r, o) => new
|
|
3129
|
+
init: (n, r, o) => new nr(r, o, s, t)
|
|
3128
3130
|
});
|
|
3129
3131
|
}
|
|
3130
3132
|
function Un(s, e) {
|
|
@@ -3136,13 +3138,13 @@ function Un(s, e) {
|
|
|
3136
3138
|
function Bn(s, e) {
|
|
3137
3139
|
return s.getDriver({
|
|
3138
3140
|
name: "UploadProgress",
|
|
3139
|
-
init: (t, n, r) => new
|
|
3141
|
+
init: (t, n, r) => new qt(n, r, s, e)
|
|
3140
3142
|
});
|
|
3141
3143
|
}
|
|
3142
3144
|
function Dn(s, e) {
|
|
3143
3145
|
return s.getDriver({
|
|
3144
3146
|
name: "UploadBlob",
|
|
3145
|
-
init: (t, n, r) => new
|
|
3147
|
+
init: (t, n, r) => new $t(n, r, s, e)
|
|
3146
3148
|
});
|
|
3147
3149
|
}
|
|
3148
3150
|
function Dr(s, e) {
|
|
@@ -3155,7 +3157,7 @@ class vn {
|
|
|
3155
3157
|
constructor(e, t) {
|
|
3156
3158
|
d(this, "updater");
|
|
3157
3159
|
d(this, "schedule", () => this.updater.schedule());
|
|
3158
|
-
this.onUpdate = e, this.sleepMs = t, this.updater = new
|
|
3160
|
+
this.onUpdate = e, this.sleepMs = t, this.updater = new Ue(async () => {
|
|
3159
3161
|
for (; ; ) {
|
|
3160
3162
|
if (await this.onUpdate()) return;
|
|
3161
3163
|
await oe.wait(this.sleepMs);
|
|
@@ -3163,7 +3165,7 @@ class vn {
|
|
|
3163
3165
|
});
|
|
3164
3166
|
}
|
|
3165
3167
|
}
|
|
3166
|
-
class
|
|
3168
|
+
class Ue {
|
|
3167
3169
|
constructor(e) {
|
|
3168
3170
|
d(this, "updating");
|
|
3169
3171
|
this.onUpdate = e;
|
|
@@ -3182,25 +3184,25 @@ class Be {
|
|
|
3182
3184
|
}
|
|
3183
3185
|
async function $n(s, e) {
|
|
3184
3186
|
return s.withReadTx("LogsDriverGetStream", async (t) => {
|
|
3185
|
-
const n = await t.getResourceData(e, !0), r = await
|
|
3187
|
+
const n = await t.getResourceData(e, !0), r = await je(t, Ge(n, "stream"));
|
|
3186
3188
|
if (r.error != "")
|
|
3187
3189
|
throw new Error(`while getting stream: ${r.error}`);
|
|
3188
|
-
if (!
|
|
3190
|
+
if (!Ve(r.valueId))
|
|
3189
3191
|
return await t.getResourceData(r.valueId, !1);
|
|
3190
3192
|
});
|
|
3191
3193
|
}
|
|
3192
|
-
const
|
|
3194
|
+
const Be = "8C7#F1328%9E089B3D22", vr = /(?<stage>.*):\s*(?<progress>[\d.]+%)\s.*(?<eta>ETA:.*)/g;
|
|
3193
3195
|
function $r(s) {
|
|
3194
|
-
const t = s.replace(
|
|
3196
|
+
const t = s.replace(Be, "").match(vr);
|
|
3195
3197
|
if (t == null || t.length != 4)
|
|
3196
3198
|
return;
|
|
3197
|
-
const [n, r, o,
|
|
3199
|
+
const [n, r, o, c] = t;
|
|
3198
3200
|
return {
|
|
3199
3201
|
stage: r,
|
|
3200
3202
|
// For example, 'Building pre-clones from tag groups'
|
|
3201
3203
|
progress: o,
|
|
3202
3204
|
// 35.3%
|
|
3203
|
-
eta:
|
|
3205
|
+
eta: c
|
|
3204
3206
|
// ETA: 00:00:07
|
|
3205
3207
|
};
|
|
3206
3208
|
}
|
|
@@ -3209,7 +3211,7 @@ async function _n(s, e, t) {
|
|
|
3209
3211
|
s,
|
|
3210
3212
|
1,
|
|
3211
3213
|
0n,
|
|
3212
|
-
|
|
3214
|
+
Be,
|
|
3213
3215
|
t
|
|
3214
3216
|
);
|
|
3215
3217
|
if (n.data == null || n.data.length == 0)
|
|
@@ -3220,7 +3222,7 @@ async function _n(s, e, t) {
|
|
|
3220
3222
|
const o = $r(r);
|
|
3221
3223
|
return o === void 0 ? { found: !1 } : { found: !0, ...o };
|
|
3222
3224
|
}
|
|
3223
|
-
class
|
|
3225
|
+
class De {
|
|
3224
3226
|
constructor(e) {
|
|
3225
3227
|
d(this, "cache", /* @__PURE__ */ new Map());
|
|
3226
3228
|
d(this, "totalSizeBytes", 0);
|
|
@@ -3243,7 +3245,7 @@ class ve {
|
|
|
3243
3245
|
if (this.totalSizeBytes <= this.softSizeBytes) return [];
|
|
3244
3246
|
const e = [];
|
|
3245
3247
|
let t = 0;
|
|
3246
|
-
return
|
|
3248
|
+
return Ze(this.cache).filter(([n, r]) => r.counter.isZero()).forEach(([n, r]) => {
|
|
3247
3249
|
if (this.totalSizeBytes - t <= this.softSizeBytes) return;
|
|
3248
3250
|
const o = ce(this.cache, n);
|
|
3249
3251
|
t += o.sizeBytes, e.push(o);
|
|
@@ -3355,9 +3357,9 @@ function q(s, e) {
|
|
|
3355
3357
|
function _(s) {
|
|
3356
3358
|
let e;
|
|
3357
3359
|
if (C(s))
|
|
3358
|
-
e = s.match(
|
|
3360
|
+
e = s.match($e);
|
|
3359
3361
|
else if (_r(s))
|
|
3360
|
-
e = s.match(
|
|
3362
|
+
e = s.match(_e);
|
|
3361
3363
|
else throw new Error(`Log handle is malformed: ${s}`);
|
|
3362
3364
|
if (e == null) throw new Error(`Log handle wasn't parsed: ${s}`);
|
|
3363
3365
|
const { resourceType: t, resourceVersion: n, resourceId: r } = e.groups;
|
|
@@ -3366,16 +3368,16 @@ function _(s) {
|
|
|
3366
3368
|
type: { name: t, version: n }
|
|
3367
3369
|
};
|
|
3368
3370
|
}
|
|
3369
|
-
function
|
|
3371
|
+
function ve(s, e) {
|
|
3370
3372
|
return s ? `log+live://log/${e.type.name}/${e.type.version}/${BigInt(e.id)}` : `log+ready://log/${e.type.name}/${e.type.version}/${BigInt(e.id)}`;
|
|
3371
3373
|
}
|
|
3372
|
-
const
|
|
3374
|
+
const $e = /^log\+live:\/\/log\/(?<resourceType>.*)\/(?<resourceVersion>.*)\/(?<resourceId>.*)$/;
|
|
3373
3375
|
function C(s) {
|
|
3374
|
-
return
|
|
3376
|
+
return $e.test(s);
|
|
3375
3377
|
}
|
|
3376
|
-
const
|
|
3378
|
+
const _e = /^log\+ready:\/\/log\/(?<resourceType>.*)\/(?<resourceVersion>.*)\/(?<resourceId>.*)$/;
|
|
3377
3379
|
function _r(s) {
|
|
3378
|
-
return
|
|
3380
|
+
return _e.test(s);
|
|
3379
3381
|
}
|
|
3380
3382
|
const Cr = se({
|
|
3381
3383
|
kv: {
|
|
@@ -3385,7 +3387,7 @@ const Cr = se({
|
|
|
3385
3387
|
}
|
|
3386
3388
|
});
|
|
3387
3389
|
class On {
|
|
3388
|
-
constructor(e, t, n, r, o,
|
|
3390
|
+
constructor(e, t, n, r, o, c) {
|
|
3389
3391
|
/** Represents a Resource Id to the path of a blob as a map. */
|
|
3390
3392
|
d(this, "idToDownload", /* @__PURE__ */ new Map());
|
|
3391
3393
|
/** Writes and removes files to a hard drive and holds a counter for every
|
|
@@ -3397,14 +3399,14 @@ class On {
|
|
|
3397
3399
|
d(this, "idToLastLines", /* @__PURE__ */ new Map());
|
|
3398
3400
|
d(this, "idToProgressLog", /* @__PURE__ */ new Map());
|
|
3399
3401
|
d(this, "saveDir");
|
|
3400
|
-
this.logger = e, this.clientDownload = t, this.clientLogs = n, this.signer = o, this.cache = new
|
|
3402
|
+
this.logger = e, this.clientDownload = t, this.clientLogs = n, this.signer = o, this.cache = new De(c.cacheSoftSizeBytes), this.downloadQueue = new ee(
|
|
3401
3403
|
this.logger,
|
|
3402
|
-
|
|
3404
|
+
c.nConcurrentDownloads
|
|
3403
3405
|
), this.saveDir = w.resolve(r);
|
|
3404
3406
|
}
|
|
3405
3407
|
getDownloadedBlob(e, t) {
|
|
3406
3408
|
if (t === void 0)
|
|
3407
|
-
return b.make((
|
|
3409
|
+
return b.make((c) => this.getDownloadedBlob(e, c));
|
|
3408
3410
|
const n = R(e, t), r = L();
|
|
3409
3411
|
t.addOnDestroy(() => this.releaseBlob(n.id, r));
|
|
3410
3412
|
const o = this.getDownloadedBlobNoCtx(
|
|
@@ -3416,7 +3418,7 @@ class On {
|
|
|
3416
3418
|
}
|
|
3417
3419
|
getOnDemandBlob(e, t) {
|
|
3418
3420
|
if (t === void 0)
|
|
3419
|
-
return b.make((
|
|
3421
|
+
return b.make((c) => this.getOnDemandBlob(e, c));
|
|
3420
3422
|
const n = ie(e) ? Q(e, Cr, t) : e, r = L();
|
|
3421
3423
|
return t.addOnDestroy(() => this.releaseOnDemandBlob(n.id, r)), this.getOnDemandBlobNoCtx(t.watcher, n, r);
|
|
3422
3424
|
}
|
|
@@ -3425,18 +3427,18 @@ class On {
|
|
|
3425
3427
|
}
|
|
3426
3428
|
async getContent(e) {
|
|
3427
3429
|
if (zr(e)) return await Fr(this.getLocalPath(e));
|
|
3428
|
-
if (!
|
|
3430
|
+
if (!xr(e)) throw new Error("Malformed remote handle");
|
|
3429
3431
|
const t = Mr(e, this.signer), { content: n } = await this.clientDownload.downloadBlob(t);
|
|
3430
|
-
return await
|
|
3432
|
+
return await Te(n);
|
|
3431
3433
|
}
|
|
3432
3434
|
getDownloadedBlobNoCtx(e, t, n) {
|
|
3433
3435
|
let r = this.idToDownload.get(t.id);
|
|
3434
3436
|
if (r === void 0) {
|
|
3435
|
-
const
|
|
3437
|
+
const c = this.setNewDownloadTask(e, t, n);
|
|
3436
3438
|
this.downloadQueue.push({
|
|
3437
|
-
fn: () => this.downloadBlob(
|
|
3439
|
+
fn: () => this.downloadBlob(c, n),
|
|
3438
3440
|
recoverableErrorPredicate: (i) => !0
|
|
3439
|
-
}), r =
|
|
3441
|
+
}), r = c;
|
|
3440
3442
|
}
|
|
3441
3443
|
r.attach(e, n);
|
|
3442
3444
|
const o = r.getBlob();
|
|
@@ -3450,7 +3452,7 @@ class On {
|
|
|
3450
3452
|
this.clientDownload,
|
|
3451
3453
|
t,
|
|
3452
3454
|
r,
|
|
3453
|
-
|
|
3455
|
+
Ar(r, this.signer)
|
|
3454
3456
|
);
|
|
3455
3457
|
return this.idToDownload.set(t.id, o), o;
|
|
3456
3458
|
}
|
|
@@ -3470,26 +3472,26 @@ class On {
|
|
|
3470
3472
|
return b.make((i) => this.getLastLogs(e, t, i));
|
|
3471
3473
|
const r = R(e, n), o = L();
|
|
3472
3474
|
n.addOnDestroy(() => this.releaseBlob(r.id, o));
|
|
3473
|
-
const
|
|
3475
|
+
const c = this.getLastLogsNoCtx(
|
|
3474
3476
|
n.watcher,
|
|
3475
3477
|
r,
|
|
3476
3478
|
t,
|
|
3477
3479
|
o
|
|
3478
3480
|
);
|
|
3479
|
-
return
|
|
3481
|
+
return c == null && n.markUnstable("either a file was not downloaded or logs was not read"), c;
|
|
3480
3482
|
}
|
|
3481
3483
|
getLastLogsNoCtx(e, t, n, r) {
|
|
3482
3484
|
const o = this.getDownloadedBlobNoCtx(e, t, r);
|
|
3483
3485
|
if (o == null) return;
|
|
3484
|
-
const
|
|
3486
|
+
const c = J(o.handle, this.signer);
|
|
3485
3487
|
let i = this.idToLastLines.get(t.id);
|
|
3486
3488
|
if (i == null) {
|
|
3487
|
-
const a = new
|
|
3489
|
+
const a = new de(c, n);
|
|
3488
3490
|
this.idToLastLines.set(t.id, a), i = a;
|
|
3489
3491
|
}
|
|
3490
|
-
const
|
|
3491
|
-
if (
|
|
3492
|
-
return
|
|
3492
|
+
const l = i.getOrSchedule(e);
|
|
3493
|
+
if (l.error) throw l.error;
|
|
3494
|
+
return l.log;
|
|
3493
3495
|
}
|
|
3494
3496
|
getProgressLog(e, t, n) {
|
|
3495
3497
|
if (n == null)
|
|
@@ -3498,28 +3500,28 @@ class On {
|
|
|
3498
3500
|
);
|
|
3499
3501
|
const r = R(e, n), o = L();
|
|
3500
3502
|
n.addOnDestroy(() => this.releaseBlob(r.id, o));
|
|
3501
|
-
const
|
|
3503
|
+
const c = this.getProgressLogNoCtx(
|
|
3502
3504
|
n.watcher,
|
|
3503
3505
|
r,
|
|
3504
3506
|
t,
|
|
3505
3507
|
o
|
|
3506
3508
|
);
|
|
3507
|
-
return
|
|
3509
|
+
return c === void 0 && n.markUnstable(
|
|
3508
3510
|
"either a file was not downloaded or a progress log was not read"
|
|
3509
|
-
),
|
|
3511
|
+
), c;
|
|
3510
3512
|
}
|
|
3511
3513
|
getProgressLogNoCtx(e, t, n, r) {
|
|
3512
3514
|
const o = this.getDownloadedBlobNoCtx(e, t, r);
|
|
3513
3515
|
if (o == null) return;
|
|
3514
|
-
const
|
|
3516
|
+
const c = J(o.handle, this.signer);
|
|
3515
3517
|
let i = this.idToProgressLog.get(t.id);
|
|
3516
3518
|
if (i == null) {
|
|
3517
|
-
const a = new
|
|
3519
|
+
const a = new de(c, 1, n);
|
|
3518
3520
|
this.idToProgressLog.set(t.id, a), i = a;
|
|
3519
3521
|
}
|
|
3520
|
-
const
|
|
3521
|
-
if (
|
|
3522
|
-
return
|
|
3522
|
+
const l = i.getOrSchedule(e);
|
|
3523
|
+
if (l.error) throw l.error;
|
|
3524
|
+
return l.log;
|
|
3523
3525
|
}
|
|
3524
3526
|
getLogHandle(e, t) {
|
|
3525
3527
|
if (t == null)
|
|
@@ -3528,7 +3530,7 @@ class On {
|
|
|
3528
3530
|
return this.getLogHandleNoCtx(n);
|
|
3529
3531
|
}
|
|
3530
3532
|
getLogHandleNoCtx(e) {
|
|
3531
|
-
return
|
|
3533
|
+
return ve(!1, e);
|
|
3532
3534
|
}
|
|
3533
3535
|
async lastLines(e, t, n, r) {
|
|
3534
3536
|
const o = await this.clientLogs.lastLines(
|
|
@@ -3569,7 +3571,7 @@ class On {
|
|
|
3569
3571
|
r.map(async (o) => {
|
|
3570
3572
|
await m.rm(o.path), this.cache.removeCache(o), this.removeTask(
|
|
3571
3573
|
o,
|
|
3572
|
-
`the task ${o.path} was removedfrom cache along with ${r.map((
|
|
3574
|
+
`the task ${o.path} was removedfrom cache along with ${r.map((c) => c.path)}`
|
|
3573
3575
|
);
|
|
3574
3576
|
})
|
|
3575
3577
|
);
|
|
@@ -3609,13 +3611,13 @@ class Or {
|
|
|
3609
3611
|
return this.counter.dec(e);
|
|
3610
3612
|
}
|
|
3611
3613
|
}
|
|
3612
|
-
class
|
|
3614
|
+
class de {
|
|
3613
3615
|
constructor(e, t, n) {
|
|
3614
3616
|
d(this, "updater");
|
|
3615
3617
|
d(this, "log");
|
|
3616
3618
|
d(this, "change", new N());
|
|
3617
3619
|
d(this, "error");
|
|
3618
|
-
this.path = e, this.lines = t, this.patternToSearch = n, this.updater = new
|
|
3620
|
+
this.path = e, this.lines = t, this.patternToSearch = n, this.updater = new Ue(async () => this.update());
|
|
3619
3621
|
}
|
|
3620
3622
|
getOrSchedule(e) {
|
|
3621
3623
|
return this.change.attachWatcher(e), this.updater.schedule(), {
|
|
@@ -3640,7 +3642,7 @@ class he {
|
|
|
3640
3642
|
}
|
|
3641
3643
|
}
|
|
3642
3644
|
}
|
|
3643
|
-
async function
|
|
3645
|
+
async function he(s) {
|
|
3644
3646
|
try {
|
|
3645
3647
|
return await m.access(s), !0;
|
|
3646
3648
|
} catch {
|
|
@@ -3648,16 +3650,16 @@ async function ue(s) {
|
|
|
3648
3650
|
}
|
|
3649
3651
|
}
|
|
3650
3652
|
async function Fr(s) {
|
|
3651
|
-
return await
|
|
3653
|
+
return await Te(re.toWeb(O.createReadStream(s)));
|
|
3652
3654
|
}
|
|
3653
3655
|
function Er(s, e, t) {
|
|
3654
3656
|
const n = O.createReadStream(s), r = new ne();
|
|
3655
|
-
return new Promise((o,
|
|
3656
|
-
const i =
|
|
3657
|
+
return new Promise((o, c) => {
|
|
3658
|
+
const i = tt.createInterface(n, r), l = new rt();
|
|
3657
3659
|
i.on("line", function(a) {
|
|
3658
|
-
t != null && !a.includes(t) || (
|
|
3659
|
-
}), i.on("error",
|
|
3660
|
-
o(
|
|
3660
|
+
t != null && !a.includes(t) || (l.push(a), l.length > e && l.shift());
|
|
3661
|
+
}), i.on("error", c), i.on("close", function() {
|
|
3662
|
+
o(l.toArray().join(Z.EOL) + Z.EOL);
|
|
3661
3663
|
});
|
|
3662
3664
|
});
|
|
3663
3665
|
}
|
|
@@ -3679,7 +3681,7 @@ let Wr = class {
|
|
|
3679
3681
|
const { content: e, size: t } = await this.clientDownload.downloadBlob(
|
|
3680
3682
|
this.rInfo
|
|
3681
3683
|
);
|
|
3682
|
-
if (await
|
|
3684
|
+
if (await he(w.dirname(this.path)) || await m.mkdir(w.dirname(this.path), { recursive: !0 }), await he(this.path))
|
|
3683
3685
|
await e.cancel("the file already existed");
|
|
3684
3686
|
else {
|
|
3685
3687
|
const n = ne.toWeb(O.createWriteStream(this.path));
|
|
@@ -3687,7 +3689,7 @@ let Wr = class {
|
|
|
3687
3689
|
}
|
|
3688
3690
|
this.setDone(t);
|
|
3689
3691
|
} catch (e) {
|
|
3690
|
-
if (e instanceof
|
|
3692
|
+
if (e instanceof ue || e instanceof ae || e instanceof Se || e instanceof Ne || e.code == "ENOENT") {
|
|
3691
3693
|
this.setError(e), await m.rm(this.path);
|
|
3692
3694
|
return;
|
|
3693
3695
|
}
|
|
@@ -3713,20 +3715,20 @@ let Wr = class {
|
|
|
3713
3715
|
this.done = !0, this.sizeBytes = e, this.change.markChanged();
|
|
3714
3716
|
}
|
|
3715
3717
|
abort(e) {
|
|
3716
|
-
this.signalCtl.abort(new
|
|
3718
|
+
this.signalCtl.abort(new ue(e));
|
|
3717
3719
|
}
|
|
3718
3720
|
setError(e) {
|
|
3719
3721
|
this.error = e, this.change.markChanged();
|
|
3720
3722
|
}
|
|
3721
3723
|
};
|
|
3722
|
-
class
|
|
3724
|
+
class ue extends Error {
|
|
3723
3725
|
}
|
|
3724
|
-
const
|
|
3726
|
+
const Ce = /^blob\+local:\/\/download\/(?<path>.*)#(?<signature>.*)$/;
|
|
3725
3727
|
function zr(s) {
|
|
3726
|
-
return !!s.match(
|
|
3728
|
+
return !!s.match(Ce);
|
|
3727
3729
|
}
|
|
3728
3730
|
function J(s, e) {
|
|
3729
|
-
const t = s.match(
|
|
3731
|
+
const t = s.match(Ce);
|
|
3730
3732
|
if (t === null)
|
|
3731
3733
|
throw new Error(`Local handle is malformed: ${s}, matches: ${t}`);
|
|
3732
3734
|
const { path: n, signature: r } = t.groups;
|
|
@@ -3736,26 +3738,26 @@ function J(s, e) {
|
|
|
3736
3738
|
`Signature verification failed for: ${s}`
|
|
3737
3739
|
), n;
|
|
3738
3740
|
}
|
|
3739
|
-
function
|
|
3741
|
+
function Ar(s, e) {
|
|
3740
3742
|
return `blob+local://download/${s}#${e.sign(s)}`;
|
|
3741
3743
|
}
|
|
3742
|
-
const
|
|
3743
|
-
function
|
|
3744
|
-
return !!s.match(
|
|
3744
|
+
const Oe = /^blob\+remote:\/\/download\/(?<content>(?<resourceType>.*)\/(?<resourceVersion>.*)\/(?<resourceId>.*))#(?<signature>.*)$/;
|
|
3745
|
+
function xr(s) {
|
|
3746
|
+
return !!s.match(Oe);
|
|
3745
3747
|
}
|
|
3746
3748
|
function Mr(s, e) {
|
|
3747
|
-
const t = s.match(
|
|
3749
|
+
const t = s.match(Oe);
|
|
3748
3750
|
if (t === null)
|
|
3749
3751
|
throw new Error(
|
|
3750
3752
|
`Remote handle is malformed: ${s}, matches: ${t}`
|
|
3751
3753
|
);
|
|
3752
|
-
const { content: n, resourceType: r, resourceVersion: o, resourceId:
|
|
3754
|
+
const { content: n, resourceType: r, resourceVersion: o, resourceId: c, signature: i } = t.groups;
|
|
3753
3755
|
return e.verify(
|
|
3754
3756
|
n,
|
|
3755
3757
|
i,
|
|
3756
3758
|
`Signature verification failed for ${s}`
|
|
3757
3759
|
), {
|
|
3758
|
-
id: Y(BigInt(
|
|
3760
|
+
id: Y(BigInt(c)),
|
|
3759
3761
|
type: { name: r, version: o }
|
|
3760
3762
|
};
|
|
3761
3763
|
}
|
|
@@ -3772,14 +3774,14 @@ const F = T.object({
|
|
|
3772
3774
|
sizeBytes: T.string(),
|
|
3773
3775
|
/** Modification time unix timestamp in seconds */
|
|
3774
3776
|
modificationTime: T.string()
|
|
3775
|
-
}),
|
|
3777
|
+
}), Fe = T.object({
|
|
3776
3778
|
/** Pl storage id */
|
|
3777
3779
|
storageId: T.string(),
|
|
3778
3780
|
/** Path inside storage */
|
|
3779
3781
|
path: T.string()
|
|
3780
3782
|
}), En = T.union([
|
|
3781
3783
|
F,
|
|
3782
|
-
|
|
3784
|
+
Fe
|
|
3783
3785
|
]), jr = se({
|
|
3784
3786
|
data: F,
|
|
3785
3787
|
fields: {
|
|
@@ -3791,7 +3793,7 @@ const F = T.object({
|
|
|
3791
3793
|
}
|
|
3792
3794
|
});
|
|
3793
3795
|
function Vr(s, e) {
|
|
3794
|
-
const t = ie(s) ? e.accessor(s).node() :
|
|
3796
|
+
const t = ie(s) ? e.accessor(s).node() : ot(s) ? s.node() : s;
|
|
3795
3797
|
return t.resourceType.name.startsWith("BlobUpload") ? Q(t, jr) : Q(t, Gr);
|
|
3796
3798
|
}
|
|
3797
3799
|
class Wn {
|
|
@@ -3817,25 +3819,25 @@ class Wn {
|
|
|
3817
3819
|
// 15 seconds
|
|
3818
3820
|
backoffMultiplier: 1.5,
|
|
3819
3821
|
jitter: 0.5
|
|
3820
|
-
}), this.hooks = new
|
|
3822
|
+
}), this.hooks = new ke(
|
|
3821
3823
|
() => this.startUpdating(),
|
|
3822
3824
|
() => this.stopUpdating(),
|
|
3823
3825
|
{ stopDebounce: o.stopPollingDelay },
|
|
3824
|
-
(
|
|
3826
|
+
(c, i) => this.scheduleOnNextState(c, i)
|
|
3825
3827
|
);
|
|
3826
3828
|
}
|
|
3827
3829
|
getProgressId(e, t) {
|
|
3828
|
-
if (t == null) return b.make((
|
|
3830
|
+
if (t == null) return b.make((c) => this.getProgressId(e, c));
|
|
3829
3831
|
const n = ie(e) ? Vr(e, t) : e, r = L();
|
|
3830
3832
|
t.attacheHooks(this.hooks), t.addOnDestroy(() => this.release(n.id, r));
|
|
3831
3833
|
const o = this.getProgressIdNoCtx(t.watcher, n, r);
|
|
3832
|
-
return
|
|
3834
|
+
return pe(o) || t.markUnstable(`upload/index progress was got, but it's not stable: ${o}`), o;
|
|
3833
3835
|
}
|
|
3834
3836
|
getProgressIdNoCtx(e, t, n) {
|
|
3835
3837
|
const r = "blob" in t.fields ? t.fields.blob !== void 0 : t.fields.incarnation !== void 0, o = this.idToProgress.get(t.id);
|
|
3836
3838
|
if (o != null)
|
|
3837
3839
|
return o.attach(e, n), o.mustGetProgress(r);
|
|
3838
|
-
const
|
|
3840
|
+
const c = new qr(
|
|
3839
3841
|
this.logger,
|
|
3840
3842
|
this.clientBlob,
|
|
3841
3843
|
this.clientProgress,
|
|
@@ -3843,10 +3845,10 @@ class Wn {
|
|
|
3843
3845
|
this.signer,
|
|
3844
3846
|
t
|
|
3845
3847
|
);
|
|
3846
|
-
return this.idToProgress.set(t.id,
|
|
3847
|
-
fn: () =>
|
|
3848
|
-
recoverableErrorPredicate: (i) => !
|
|
3849
|
-
}),
|
|
3848
|
+
return this.idToProgress.set(t.id, c), c.attach(e, n), c.progress.isUpload && c.progress.isUploadSignMatch && this.uploadQueue.push({
|
|
3849
|
+
fn: () => c.uploadBlobTask(),
|
|
3850
|
+
recoverableErrorPredicate: (i) => !Ee(i)
|
|
3851
|
+
}), c.mustGetProgress(r);
|
|
3850
3852
|
}
|
|
3851
3853
|
/** Decrement counters for the file and remove an uploading if counter == 0. */
|
|
3852
3854
|
async release(e, t) {
|
|
@@ -3887,21 +3889,21 @@ class Wn {
|
|
|
3887
3889
|
this.currentLoop = void 0;
|
|
3888
3890
|
}
|
|
3889
3891
|
getAllNotDoneProgresses() {
|
|
3890
|
-
return Array.from(this.idToProgress.entries()).filter(([e, t]) => !
|
|
3892
|
+
return Array.from(this.idToProgress.entries()).filter(([e, t]) => !pe(t.progress)).map(([e, t]) => t);
|
|
3891
3893
|
}
|
|
3892
3894
|
}
|
|
3893
3895
|
class qr {
|
|
3894
|
-
constructor(e, t, n, r, o,
|
|
3896
|
+
constructor(e, t, n, r, o, c) {
|
|
3895
3897
|
d(this, "change", new N());
|
|
3896
3898
|
d(this, "counter", new v());
|
|
3897
3899
|
d(this, "progress");
|
|
3898
3900
|
/** If this is upload progress this field will be defined */
|
|
3899
3901
|
d(this, "uploadData");
|
|
3900
3902
|
d(this, "uploadingTerminallyFailed");
|
|
3901
|
-
this.logger = e, this.clientBlob = t, this.clientProgress = n, this.nConcurrentPartsUpload = r, this.res =
|
|
3902
|
-
const i =
|
|
3903
|
-
let
|
|
3904
|
-
i && (this.uploadData = F.parse(
|
|
3903
|
+
this.logger = e, this.clientBlob = t, this.clientProgress = n, this.nConcurrentPartsUpload = r, this.res = c;
|
|
3904
|
+
const i = c.type.name.startsWith("BlobUpload");
|
|
3905
|
+
let l;
|
|
3906
|
+
i && (this.uploadData = F.parse(c.data), l = Zr(
|
|
3905
3907
|
o,
|
|
3906
3908
|
this.uploadData.localPath,
|
|
3907
3909
|
this.uploadData.pathSignature
|
|
@@ -3909,7 +3911,7 @@ class qr {
|
|
|
3909
3911
|
done: !1,
|
|
3910
3912
|
status: void 0,
|
|
3911
3913
|
isUpload: i,
|
|
3912
|
-
isUploadSignMatch:
|
|
3914
|
+
isUploadSignMatch: l,
|
|
3913
3915
|
lastError: void 0
|
|
3914
3916
|
};
|
|
3915
3917
|
}
|
|
@@ -3931,11 +3933,11 @@ class qr {
|
|
|
3931
3933
|
try {
|
|
3932
3934
|
await this.uploadBlob();
|
|
3933
3935
|
} catch (e) {
|
|
3934
|
-
if (this.setLastError(e),
|
|
3936
|
+
if (this.setLastError(e), ge(e)) {
|
|
3935
3937
|
this.logger.warn(`resource was deleted while uploading a blob: ${e}`), this.change.markChanged(), this.setDone(!0);
|
|
3936
3938
|
return;
|
|
3937
3939
|
}
|
|
3938
|
-
throw this.logger.error(`error while uploading a blob: ${e}`), this.change.markChanged(),
|
|
3940
|
+
throw this.logger.error(`error while uploading a blob: ${e}`), this.change.markChanged(), Ee(e) && this.terminateWithError(e), e;
|
|
3939
3941
|
}
|
|
3940
3942
|
}
|
|
3941
3943
|
/** Uploads a blob using client. */
|
|
@@ -3972,9 +3974,9 @@ class qr {
|
|
|
3972
3974
|
this.logger.warn("deadline exceeded while getting a status of BlobImport");
|
|
3973
3975
|
return;
|
|
3974
3976
|
}
|
|
3975
|
-
if (
|
|
3977
|
+
if (ge(e)) {
|
|
3976
3978
|
this.logger.warn(
|
|
3977
|
-
`resource was not found while updating a status of BlobImport: ${e}, ${
|
|
3979
|
+
`resource was not found while updating a status of BlobImport: ${e}, ${qe(this.res)}`
|
|
3978
3980
|
), this.change.markChanged(), this.setDone(!0);
|
|
3979
3981
|
return;
|
|
3980
3982
|
}
|
|
@@ -3982,7 +3984,7 @@ class qr {
|
|
|
3982
3984
|
}
|
|
3983
3985
|
}
|
|
3984
3986
|
}
|
|
3985
|
-
function
|
|
3987
|
+
function pe(s) {
|
|
3986
3988
|
return s.done && s.status !== void 0 && s.status !== null && s.status.progress >= 1;
|
|
3987
3989
|
}
|
|
3988
3990
|
function Jr(s) {
|
|
@@ -3999,10 +4001,10 @@ function Zr(s, e, t) {
|
|
|
3999
4001
|
return !1;
|
|
4000
4002
|
}
|
|
4001
4003
|
}
|
|
4002
|
-
function
|
|
4003
|
-
return s instanceof
|
|
4004
|
+
function Ee(s) {
|
|
4005
|
+
return s instanceof Le || s instanceof Pe || s instanceof Ie;
|
|
4004
4006
|
}
|
|
4005
|
-
function
|
|
4007
|
+
function ge(s) {
|
|
4006
4008
|
return s.name == "RpcError" && (s.code == "NOT_FOUND" || s.code == "ABORTED" || s.code == "ALREADY_EXISTS");
|
|
4007
4009
|
}
|
|
4008
4010
|
class zn {
|
|
@@ -4022,7 +4024,7 @@ class zn {
|
|
|
4022
4024
|
d(this, "keepRunning", !1);
|
|
4023
4025
|
/** Actual state of main loop. */
|
|
4024
4026
|
d(this, "currentLoop");
|
|
4025
|
-
this.clientLogs = e, this.opts = t, this.hooks = new
|
|
4027
|
+
this.clientLogs = e, this.opts = t, this.hooks = new ke(
|
|
4026
4028
|
() => this.startUpdating(),
|
|
4027
4029
|
() => this.stopUpdating(),
|
|
4028
4030
|
{ stopDebounce: t.stopPollingDelay },
|
|
@@ -4034,21 +4036,21 @@ class zn {
|
|
|
4034
4036
|
return b.make((i) => this.getLastLogs(e, t, i));
|
|
4035
4037
|
const r = R(e, n), o = L();
|
|
4036
4038
|
n.attacheHooks(this.hooks), n.addOnDestroy(() => this.releaseLastLogs(r.id, o));
|
|
4037
|
-
const
|
|
4039
|
+
const c = this.getLastLogsNoCtx(n.watcher, r, t, o);
|
|
4038
4040
|
return n.markUnstable(
|
|
4039
4041
|
"The logs are from stream, so we consider them unstable. Final values will be got from blobs."
|
|
4040
|
-
),
|
|
4042
|
+
), c;
|
|
4041
4043
|
}
|
|
4042
4044
|
getLastLogsNoCtx(e, t, n, r) {
|
|
4043
4045
|
let o = this.idToLastLines.get(t.id);
|
|
4044
4046
|
if (o == null) {
|
|
4045
|
-
const i = new
|
|
4047
|
+
const i = new fe(this.clientLogs, t, n);
|
|
4046
4048
|
this.idToLastLines.set(t.id, i), o = i;
|
|
4047
4049
|
}
|
|
4048
4050
|
o.attach(e, r);
|
|
4049
|
-
const
|
|
4050
|
-
if (
|
|
4051
|
-
return
|
|
4051
|
+
const c = o.getLog();
|
|
4052
|
+
if (c.error != null) throw c.error;
|
|
4053
|
+
return c.log;
|
|
4052
4054
|
}
|
|
4053
4055
|
getProgressLog(e, t, n) {
|
|
4054
4056
|
if (n == null)
|
|
@@ -4057,7 +4059,7 @@ class zn {
|
|
|
4057
4059
|
);
|
|
4058
4060
|
const r = R(e, n), o = L();
|
|
4059
4061
|
n.attacheHooks(this.hooks), n.addOnDestroy(() => this.releaseProgressLog(r.id, o));
|
|
4060
|
-
const
|
|
4062
|
+
const c = this.getProgressLogNoCtx(
|
|
4061
4063
|
n.watcher,
|
|
4062
4064
|
r,
|
|
4063
4065
|
t,
|
|
@@ -4065,12 +4067,12 @@ class zn {
|
|
|
4065
4067
|
);
|
|
4066
4068
|
return n.markUnstable(
|
|
4067
4069
|
"The progress log is from the stream, so we consider it unstable. Final value will be got from blobs."
|
|
4068
|
-
),
|
|
4070
|
+
), c;
|
|
4069
4071
|
}
|
|
4070
4072
|
getProgressLogNoCtx(e, t, n, r) {
|
|
4071
4073
|
let o = this.idToProgressLog.get(t.id);
|
|
4072
4074
|
if (o == null) {
|
|
4073
|
-
const i = new
|
|
4075
|
+
const i = new fe(
|
|
4074
4076
|
this.clientLogs,
|
|
4075
4077
|
t,
|
|
4076
4078
|
1,
|
|
@@ -4079,9 +4081,9 @@ class zn {
|
|
|
4079
4081
|
this.idToProgressLog.set(t.id, i), o = i;
|
|
4080
4082
|
}
|
|
4081
4083
|
o.attach(e, r);
|
|
4082
|
-
const
|
|
4083
|
-
if (
|
|
4084
|
-
return
|
|
4084
|
+
const c = o.getLog();
|
|
4085
|
+
if (c.error) throw c.error;
|
|
4086
|
+
return c.log;
|
|
4085
4087
|
}
|
|
4086
4088
|
getLogHandle(e, t) {
|
|
4087
4089
|
if (t == null)
|
|
@@ -4090,7 +4092,7 @@ class zn {
|
|
|
4090
4092
|
return t.markUnstable(), r;
|
|
4091
4093
|
}
|
|
4092
4094
|
getLogHandleNoCtx(e) {
|
|
4093
|
-
return
|
|
4095
|
+
return ve(!0, e);
|
|
4094
4096
|
}
|
|
4095
4097
|
async lastLines(e, t, n, r) {
|
|
4096
4098
|
return await this.tryWithNotFound(
|
|
@@ -4178,7 +4180,7 @@ class zn {
|
|
|
4178
4180
|
return Array.from(this.idToLastLines.entries()).concat(Array.from(this.idToProgressLog.entries())).filter(([e, t]) => !t.getLog().done).map(([e, t]) => t);
|
|
4179
4181
|
}
|
|
4180
4182
|
}
|
|
4181
|
-
class
|
|
4183
|
+
class fe {
|
|
4182
4184
|
constructor(e, t, n, r) {
|
|
4183
4185
|
d(this, "logs");
|
|
4184
4186
|
d(this, "error");
|
|
@@ -4219,7 +4221,7 @@ class me {
|
|
|
4219
4221
|
}
|
|
4220
4222
|
}
|
|
4221
4223
|
}
|
|
4222
|
-
class
|
|
4224
|
+
class An {
|
|
4223
4225
|
constructor(e, t, n, r = {
|
|
4224
4226
|
cacheSoftSizeBytes: 50 * 1024 * 1024,
|
|
4225
4227
|
withGunzip: !0,
|
|
@@ -4234,7 +4236,7 @@ class xn {
|
|
|
4234
4236
|
this.logger = e, this.saveDir = n, this.opts = r, this.downloadQueue = new ee(
|
|
4235
4237
|
this.logger,
|
|
4236
4238
|
this.opts.nConcurrentDownloads
|
|
4237
|
-
), this.cache = new
|
|
4239
|
+
), this.cache = new De(this.opts.cacheSoftSizeBytes), this.downloadHelper = new Re(t);
|
|
4238
4240
|
}
|
|
4239
4241
|
getPath(e, t) {
|
|
4240
4242
|
if (t === void 0) return b.make((o) => this.getPath(e, o));
|
|
@@ -4249,11 +4251,11 @@ class xn {
|
|
|
4249
4251
|
const r = e.toString(), o = this.urlToDownload.get(r);
|
|
4250
4252
|
if (o != null)
|
|
4251
4253
|
return o.attach(t, n), o.getPath();
|
|
4252
|
-
const
|
|
4254
|
+
const c = this.setNewTask(t, e, n);
|
|
4253
4255
|
return this.downloadQueue.push({
|
|
4254
|
-
fn: async () => this.downloadUrl(
|
|
4256
|
+
fn: async () => this.downloadUrl(c, n),
|
|
4255
4257
|
recoverableErrorPredicate: (i) => !0
|
|
4256
|
-
}),
|
|
4258
|
+
}), c.getPath();
|
|
4257
4259
|
}
|
|
4258
4260
|
/** Downloads and extracts a tar archive if it wasn't downloaded yet. */
|
|
4259
4261
|
async downloadUrl(e, t) {
|
|
@@ -4268,10 +4270,10 @@ class xn {
|
|
|
4268
4270
|
if (this.cache.existsFile(r.path)) {
|
|
4269
4271
|
const o = this.cache.removeFile(r.path, t);
|
|
4270
4272
|
await Promise.all(
|
|
4271
|
-
o.map(async (
|
|
4272
|
-
await X(
|
|
4273
|
-
|
|
4274
|
-
`the task ${JSON.stringify(
|
|
4273
|
+
o.map(async (c) => {
|
|
4274
|
+
await X(c.path), this.cache.removeCache(c), this.removeTask(
|
|
4275
|
+
c,
|
|
4276
|
+
`the task ${JSON.stringify(c)} was removedfrom cache along with ${JSON.stringify(o)}`
|
|
4275
4277
|
);
|
|
4276
4278
|
})
|
|
4277
4279
|
);
|
|
@@ -4300,7 +4302,7 @@ class xn {
|
|
|
4300
4302
|
e.abort(t), e.change.markChanged(), this.urlToDownload.delete(e.url.toString());
|
|
4301
4303
|
}
|
|
4302
4304
|
getFilePath(e) {
|
|
4303
|
-
const t =
|
|
4305
|
+
const t = nt("sha256").update(e.toString()).digest("hex");
|
|
4304
4306
|
return w.join(this.saveDir, t);
|
|
4305
4307
|
}
|
|
4306
4308
|
}
|
|
@@ -4326,7 +4328,7 @@ class Qr {
|
|
|
4326
4328
|
);
|
|
4327
4329
|
this.setDone(n);
|
|
4328
4330
|
} catch (n) {
|
|
4329
|
-
if (n instanceof
|
|
4331
|
+
if (n instanceof me || n instanceof ae) {
|
|
4330
4332
|
this.setError(n), await X(this.path);
|
|
4331
4333
|
return;
|
|
4332
4334
|
}
|
|
@@ -4334,8 +4336,8 @@ class Qr {
|
|
|
4334
4336
|
}
|
|
4335
4337
|
}
|
|
4336
4338
|
async downloadAndUntar(e, t, n) {
|
|
4337
|
-
if (await
|
|
4338
|
-
return await
|
|
4339
|
+
if (await Qe(this.path))
|
|
4340
|
+
return await We(this.path);
|
|
4339
4341
|
const r = await e.downloadRemoteFile(
|
|
4340
4342
|
this.url.toString(),
|
|
4341
4343
|
{},
|
|
@@ -4343,11 +4345,11 @@ class Qr {
|
|
|
4343
4345
|
);
|
|
4344
4346
|
let o = r.content;
|
|
4345
4347
|
if (t) {
|
|
4346
|
-
const i =
|
|
4348
|
+
const i = Ye.toWeb(st.createGunzip());
|
|
4347
4349
|
o = o.pipeThrough(i, { signal: n });
|
|
4348
4350
|
}
|
|
4349
|
-
const
|
|
4350
|
-
return await o.pipeTo(
|
|
4351
|
+
const c = ne.toWeb(it.extract(this.path));
|
|
4352
|
+
return await o.pipeTo(c, { signal: n }), r.size;
|
|
4351
4353
|
}
|
|
4352
4354
|
getPath() {
|
|
4353
4355
|
if (this.done) return { path: K(this.path) };
|
|
@@ -4357,27 +4359,27 @@ class Qr {
|
|
|
4357
4359
|
this.done = !0, this.sizeBytes = e, this.change.markChanged();
|
|
4358
4360
|
}
|
|
4359
4361
|
abort(e) {
|
|
4360
|
-
this.signalCtl.abort(new
|
|
4362
|
+
this.signalCtl.abort(new me(e));
|
|
4361
4363
|
}
|
|
4362
4364
|
setError(e) {
|
|
4363
4365
|
this.error = String(e), this.change.markChanged();
|
|
4364
4366
|
}
|
|
4365
4367
|
}
|
|
4366
|
-
class
|
|
4368
|
+
class me extends Error {
|
|
4367
4369
|
}
|
|
4368
|
-
async function
|
|
4370
|
+
async function We(s) {
|
|
4369
4371
|
const e = await m.readdir(s, { withFileTypes: !0 });
|
|
4370
4372
|
return (await Promise.all(
|
|
4371
4373
|
e.map(async (n) => {
|
|
4372
4374
|
const r = w.join(s, n.name);
|
|
4373
|
-
return n.isDirectory() ? await
|
|
4375
|
+
return n.isDirectory() ? await We(r) : (await m.stat(r)).size;
|
|
4374
4376
|
})
|
|
4375
4377
|
)).reduce((n, r) => n + r, 0);
|
|
4376
4378
|
}
|
|
4377
4379
|
async function X(s) {
|
|
4378
4380
|
await m.rm(s, { recursive: !0, force: !0 });
|
|
4379
4381
|
}
|
|
4380
|
-
function
|
|
4382
|
+
function we(s, e) {
|
|
4381
4383
|
return `index://index/${encodeURIComponent(JSON.stringify({
|
|
4382
4384
|
storageId: s,
|
|
4383
4385
|
path: e
|
|
@@ -4400,24 +4402,24 @@ function Yr(s) {
|
|
|
4400
4402
|
}
|
|
4401
4403
|
function Kr(s) {
|
|
4402
4404
|
const e = new URL(s);
|
|
4403
|
-
return
|
|
4405
|
+
return Fe.parse(JSON.parse(decodeURIComponent(e.pathname.substring(1))));
|
|
4404
4406
|
}
|
|
4405
4407
|
function en(s) {
|
|
4406
4408
|
if (on(s))
|
|
4407
4409
|
return an(s);
|
|
4408
4410
|
if (tn(s))
|
|
4409
4411
|
return nn(s);
|
|
4410
|
-
|
|
4412
|
+
Xe(s);
|
|
4411
4413
|
}
|
|
4412
|
-
const
|
|
4414
|
+
const ze = /^local:\/\/(?<name>.*)\/(?<path>.*)$/;
|
|
4413
4415
|
function tn(s) {
|
|
4414
|
-
return
|
|
4416
|
+
return ze.test(s);
|
|
4415
4417
|
}
|
|
4416
4418
|
function rn(s, e) {
|
|
4417
4419
|
return `local://${s}/${encodeURIComponent(e)}`;
|
|
4418
4420
|
}
|
|
4419
4421
|
function nn(s) {
|
|
4420
|
-
const e = s.match(
|
|
4422
|
+
const e = s.match(ze);
|
|
4421
4423
|
if (e == null) throw new Error(`Local list handle wasn't parsed: ${s}`);
|
|
4422
4424
|
const { name: t, path: n } = e.groups;
|
|
4423
4425
|
return {
|
|
@@ -4447,7 +4449,7 @@ function an(s) {
|
|
|
4447
4449
|
function ln(s) {
|
|
4448
4450
|
return { name: `LS/${s}`, version: "1" };
|
|
4449
4451
|
}
|
|
4450
|
-
function
|
|
4452
|
+
function xn() {
|
|
4451
4453
|
const s = Z.homedir();
|
|
4452
4454
|
return w.sep === "/" ? [{ name: "local", root: "/", initialPath: s }] : [
|
|
4453
4455
|
{
|
|
@@ -4458,9 +4460,9 @@ function An() {
|
|
|
4458
4460
|
}
|
|
4459
4461
|
];
|
|
4460
4462
|
}
|
|
4461
|
-
class
|
|
4462
|
-
constructor(e, t, n, r, o,
|
|
4463
|
-
this.logger = e, this.lsClient = t, this.storageIdToResourceId = n, this.signer = r, this.virtualStoragesMap = o, this.localProjectionsMap =
|
|
4463
|
+
class xe {
|
|
4464
|
+
constructor(e, t, n, r, o, c, i) {
|
|
4465
|
+
this.logger = e, this.lsClient = t, this.storageIdToResourceId = n, this.signer = r, this.virtualStoragesMap = o, this.localProjectionsMap = c, this.openFileDialogCallback = i;
|
|
4464
4466
|
}
|
|
4465
4467
|
async getLocalFileContent(e, t) {
|
|
4466
4468
|
const n = await this.tryResolveLocalFileHandle(e);
|
|
@@ -4490,7 +4492,7 @@ class Me {
|
|
|
4490
4492
|
* @private
|
|
4491
4493
|
*/
|
|
4492
4494
|
async tryResolveLocalFileHandle(e) {
|
|
4493
|
-
if (
|
|
4495
|
+
if (at(e)) {
|
|
4494
4496
|
const t = Kr(e), n = this.localProjectionsMap.get(t.storageId);
|
|
4495
4497
|
if (!n)
|
|
4496
4498
|
throw new Error(`Storage ${t.storageId} is not mounted locally.`);
|
|
@@ -4513,7 +4515,7 @@ class Me {
|
|
|
4513
4515
|
for (const n of this.localProjectionsMap.values())
|
|
4514
4516
|
if (e.startsWith(n.localPath)) {
|
|
4515
4517
|
const r = n.localPath === "" ? e : w.relative(n.localPath, e);
|
|
4516
|
-
return
|
|
4518
|
+
return we(
|
|
4517
4519
|
n.storageId,
|
|
4518
4520
|
r
|
|
4519
4521
|
);
|
|
@@ -4550,18 +4552,18 @@ class Me {
|
|
|
4550
4552
|
type: o.isDir ? "dir" : "file",
|
|
4551
4553
|
name: o.name,
|
|
4552
4554
|
fullPath: o.fullName,
|
|
4553
|
-
handle:
|
|
4555
|
+
handle: we(n.name, o.fullName)
|
|
4554
4556
|
}))
|
|
4555
4557
|
};
|
|
4556
4558
|
{
|
|
4557
4559
|
w.sep === "/" && t === "" && (t = "/");
|
|
4558
4560
|
const r = n.rootPath === "" ? B(t) : w.join(n.rootPath, t), o = [];
|
|
4559
|
-
for await (const
|
|
4560
|
-
if (!
|
|
4561
|
-
const i = w.join(r,
|
|
4561
|
+
for await (const c of await m.opendir(r)) {
|
|
4562
|
+
if (!c.isFile() && !c.isDirectory()) continue;
|
|
4563
|
+
const i = w.join(r, c.name);
|
|
4562
4564
|
o.push({
|
|
4563
|
-
type:
|
|
4564
|
-
name:
|
|
4565
|
+
type: c.isFile() ? "file" : "dir",
|
|
4566
|
+
name: c.name,
|
|
4565
4567
|
fullPath: i,
|
|
4566
4568
|
handle: await this.getLocalFileHandle(i)
|
|
4567
4569
|
});
|
|
@@ -4569,23 +4571,23 @@ class Me {
|
|
|
4569
4571
|
return { entries: o };
|
|
4570
4572
|
}
|
|
4571
4573
|
}
|
|
4572
|
-
static async init(e, t, n, r, o,
|
|
4574
|
+
static async init(e, t, n, r, o, c) {
|
|
4573
4575
|
const i = Dr(t, e);
|
|
4574
4576
|
for (const p of r) B(p.root);
|
|
4575
4577
|
for (const p of o) p.localPath !== "" && B(p.localPath);
|
|
4576
|
-
const
|
|
4577
|
-
if ((/* @__PURE__ */ new Set([...
|
|
4578
|
+
const l = new Map(r.map((p) => [p.name, p])), a = new Map(o.map((p) => [p.storageId, p]));
|
|
4579
|
+
if ((/* @__PURE__ */ new Set([...l.keys(), ...a.keys()])).size !== l.size + a.size)
|
|
4578
4580
|
throw new Error(
|
|
4579
4581
|
"Intersection between local projection storage ids and virtual storages names detected."
|
|
4580
4582
|
);
|
|
4581
|
-
return new
|
|
4583
|
+
return new xe(
|
|
4582
4584
|
e,
|
|
4583
4585
|
i,
|
|
4584
4586
|
await cn(t),
|
|
4585
4587
|
n,
|
|
4586
|
-
|
|
4588
|
+
l,
|
|
4587
4589
|
a,
|
|
4588
|
-
|
|
4590
|
+
c
|
|
4589
4591
|
);
|
|
4590
4592
|
}
|
|
4591
4593
|
}
|
|
@@ -4597,43 +4599,43 @@ async function cn(s) {
|
|
|
4597
4599
|
}
|
|
4598
4600
|
function dn(s) {
|
|
4599
4601
|
return Object.fromEntries(
|
|
4600
|
-
s.fields.filter((e) => e.type == "Dynamic" &&
|
|
4602
|
+
s.fields.filter((e) => e.type == "Dynamic" && Je(e.value)).map((e) => [e.name.substring(8), e.value])
|
|
4601
4603
|
);
|
|
4602
4604
|
}
|
|
4603
4605
|
export {
|
|
4604
|
-
|
|
4606
|
+
nr as ClientDownload,
|
|
4605
4607
|
Br as ClientLogs,
|
|
4606
4608
|
fr as ClientLs,
|
|
4607
|
-
|
|
4608
|
-
|
|
4609
|
-
|
|
4609
|
+
qt as ClientProgress,
|
|
4610
|
+
$t as ClientUpload,
|
|
4611
|
+
xn as DefaultVirtualLocalStorages,
|
|
4610
4612
|
Wr as Download,
|
|
4611
4613
|
On as DownloadDriver,
|
|
4612
|
-
|
|
4614
|
+
An as DownloadUrlDriver,
|
|
4613
4615
|
En as ImportFileHandleData,
|
|
4614
|
-
|
|
4616
|
+
Fe as ImportFileHandleIndexData,
|
|
4615
4617
|
F as ImportFileHandleUploadData,
|
|
4616
4618
|
Gr as IndexResourceSnapshot,
|
|
4617
4619
|
Cn as LogsDriver,
|
|
4618
4620
|
zn as LogsStreamDriver,
|
|
4619
4621
|
vn as LongUpdater,
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4622
|
+
xe as LsDriver,
|
|
4623
|
+
Le as MTimeError,
|
|
4624
|
+
vt as NetworkError,
|
|
4625
|
+
Ie as NoFileForUploading,
|
|
4624
4626
|
Cr as OnDemandBlobResourceSnapshot,
|
|
4625
|
-
|
|
4626
|
-
|
|
4627
|
-
|
|
4627
|
+
Pe as UnexpectedEOF,
|
|
4628
|
+
Se as UnknownStorageError,
|
|
4629
|
+
Ue as Updater,
|
|
4628
4630
|
Wn as UploadDriver,
|
|
4629
4631
|
jr as UploadResourceSnapshot,
|
|
4630
|
-
|
|
4632
|
+
Ne as WrongLocalFileUrl,
|
|
4631
4633
|
Nn as createDownloadClient,
|
|
4632
4634
|
Un as createLogsClient,
|
|
4633
4635
|
Dr as createLsFilesClient,
|
|
4634
4636
|
Dn as createUploadBlobClient,
|
|
4635
4637
|
Bn as createUploadProgressClient,
|
|
4636
|
-
|
|
4638
|
+
ve as dataToHandle,
|
|
4637
4639
|
$n as getStream,
|
|
4638
4640
|
_ as handleToData,
|
|
4639
4641
|
sr as headersFromProto,
|
|
@@ -4642,6 +4644,7 @@ export {
|
|
|
4642
4644
|
$r as lineToProgress,
|
|
4643
4645
|
Vr as makeBlobImportSnapshot,
|
|
4644
4646
|
_n as mixcrProgressFromLogs,
|
|
4647
|
+
or as parseLocalFileUrl,
|
|
4645
4648
|
B as validateAbsolute
|
|
4646
4649
|
};
|
|
4647
4650
|
//# sourceMappingURL=index.mjs.map
|