@milaboratories/pl-drivers 1.3.2 → 1.3.4
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/README.md +5 -3
- package/dist/clients/download.d.ts.map +1 -1
- package/dist/clients/progress.d.ts.map +1 -1
- package/dist/clients/upload.d.ts.map +1 -1
- package/dist/drivers/download_and_logs_blob.d.ts.map +1 -1
- package/dist/drivers/download_url.d.ts.map +1 -1
- package/dist/drivers/helpers/helpers.d.ts.map +1 -1
- package/dist/drivers/helpers/test_helpers.d.ts.map +1 -1
- package/dist/drivers/logs.d.ts.map +1 -1
- package/dist/drivers/logs_stream.d.ts.map +1 -1
- package/dist/drivers/ls.d.ts +3 -13
- package/dist/drivers/ls.d.ts.map +1 -1
- package/dist/drivers/types.d.ts +9 -0
- package/dist/drivers/types.d.ts.map +1 -1
- package/dist/drivers/virtual_storages.d.ts +3 -0
- package/dist/drivers/virtual_storages.d.ts.map +1 -0
- package/dist/helpers/download.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +768 -876
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/clients/download.test.ts +9 -5
- package/src/clients/download.ts +5 -8
- package/src/clients/progress.ts +1 -4
- package/src/clients/upload.test.ts +2 -5
- package/src/clients/upload.ts +10 -44
- package/src/drivers/download_and_logs_blob.ts +32 -109
- package/src/drivers/download_blob.test.ts +37 -55
- package/src/drivers/download_url.test.ts +1 -1
- package/src/drivers/download_url.ts +6 -25
- package/src/drivers/helpers/helpers.ts +3 -12
- package/src/drivers/helpers/test_helpers.ts +1 -3
- package/src/drivers/logs.test.ts +27 -65
- package/src/drivers/logs.ts +17 -66
- package/src/drivers/logs_stream.ts +12 -48
- package/src/drivers/ls.test.ts +2 -6
- package/src/drivers/ls.ts +37 -44
- package/src/drivers/types.ts +12 -0
- package/src/drivers/virtual_storages.ts +41 -0
- package/src/helpers/download.ts +2 -4
- package/src/index.ts +1 -0
package/dist/index.mjs
CHANGED
|
@@ -1,29 +1,32 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var d = (s, e, t) =>
|
|
1
|
+
var He = Object.defineProperty;
|
|
2
|
+
var je = (s, e, t) => e in s ? He(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
+
var d = (s, e, t) => je(s, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
import * as m from "node:fs/promises";
|
|
5
|
-
import { addRTypeToMetadata as k, valErr as
|
|
5
|
+
import { addRTypeToMetadata as k, valErr as Ge, getField as Ve, isNullResourceId as qe, bigintToResourceId as Y, stringifyWithResourceId as Je, isNotNullResourceId as Ze } from "@milaboratories/pl-client";
|
|
6
6
|
import { ServiceType as D, stackIntercept as y } from "@protobuf-ts/runtime-rpc";
|
|
7
|
-
import { MessageType as g, reflectionMergePartial as f, UnknownFieldHandler as u, WireType as h, PbLong as I, typeofJsonValue as
|
|
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 be } from "@protobuf-ts/runtime";
|
|
8
|
+
import { request as Te } from "undici";
|
|
9
|
+
import { notEmpty as K, mapGet as ce, mapEntries as Qe, TaskProcessor as ee, CallersCounter as v, asyncPool as te, fileExists as Xe, assertNever as Ye } from "@milaboratories/ts-helpers";
|
|
10
|
+
import { Readable as re, Writable as ne, Transform as Ke } from "node:stream";
|
|
11
11
|
import * as O from "node:fs";
|
|
12
12
|
import * as w from "node:path";
|
|
13
|
-
import
|
|
14
|
-
import { text as et, buffer as
|
|
15
|
-
import { Computable as b, ChangeSource as N, PollingComputableHooks as
|
|
13
|
+
import Z from "node:path";
|
|
14
|
+
import { text as et, buffer as ke } from "node:stream/consumers";
|
|
15
|
+
import { Computable as b, ChangeSource as N, PollingComputableHooks as Le } from "@milaboratories/computable";
|
|
16
16
|
import { scheduler as oe } from "node:timers/promises";
|
|
17
17
|
import * as tt from "node:readline/promises";
|
|
18
18
|
import rt from "denque";
|
|
19
|
-
import * as
|
|
20
|
-
import
|
|
21
|
-
import {
|
|
19
|
+
import * as de from "node:os";
|
|
20
|
+
import nt from "node:os";
|
|
21
|
+
import { randomUUID as L, createHash as ot } from "node:crypto";
|
|
22
|
+
import { rsSchema as se, treeEntryToResourceInfo as R, isPlTreeEntry as ie, makeResourceSnapshot as Q, isPlTreeEntryAccessor as st } from "@milaboratories/pl-tree";
|
|
22
23
|
import { z as T } from "zod";
|
|
23
|
-
import * as
|
|
24
|
-
import * as
|
|
25
|
-
import { isImportFileHandleIndex as
|
|
26
|
-
|
|
24
|
+
import * as it from "node:zlib";
|
|
25
|
+
import * as at from "tar-fs";
|
|
26
|
+
import { isImportFileHandleIndex as lt } from "@milaboratories/pl-model-common";
|
|
27
|
+
import ct from "node:util";
|
|
28
|
+
import { exec as dt } from "node:child_process";
|
|
29
|
+
class ht extends g {
|
|
27
30
|
constructor() {
|
|
28
31
|
super("MiLaboratories.Controller.Shared.uploadapi", []);
|
|
29
32
|
}
|
|
@@ -43,8 +46,8 @@ class lt extends g {
|
|
|
43
46
|
), t;
|
|
44
47
|
}
|
|
45
48
|
}
|
|
46
|
-
new
|
|
47
|
-
class
|
|
49
|
+
new ht();
|
|
50
|
+
class ut extends g {
|
|
48
51
|
constructor() {
|
|
49
52
|
super("MiLaboratories.Controller.Shared.uploadapi.Init", []);
|
|
50
53
|
}
|
|
@@ -64,8 +67,8 @@ class ct extends g {
|
|
|
64
67
|
), t;
|
|
65
68
|
}
|
|
66
69
|
}
|
|
67
|
-
new
|
|
68
|
-
class
|
|
70
|
+
new ut();
|
|
71
|
+
class pt extends g {
|
|
69
72
|
constructor() {
|
|
70
73
|
super("MiLaboratories.Controller.Shared.uploadapi.Init.Request", [
|
|
71
74
|
{
|
|
@@ -83,26 +86,26 @@ class dt extends g {
|
|
|
83
86
|
return t.resourceId = 0n, e !== void 0 && f(this, t, e), t;
|
|
84
87
|
}
|
|
85
88
|
internalBinaryRead(e, t, n, r) {
|
|
86
|
-
let o = r ?? this.create(),
|
|
87
|
-
for (; e.pos <
|
|
88
|
-
let [i,
|
|
89
|
+
let o = r ?? this.create(), a = e.pos + t;
|
|
90
|
+
for (; e.pos < a; ) {
|
|
91
|
+
let [i, c] = e.tag();
|
|
89
92
|
switch (i) {
|
|
90
93
|
case /* uint64 resource_id */
|
|
91
94
|
1:
|
|
92
95
|
o.resourceId = e.uint64().toBigInt();
|
|
93
96
|
break;
|
|
94
97
|
default:
|
|
95
|
-
let
|
|
96
|
-
if (
|
|
98
|
+
let l = n.readUnknownField;
|
|
99
|
+
if (l === "throw")
|
|
97
100
|
throw new globalThis.Error(
|
|
98
|
-
`Unknown field ${i} (wire type ${
|
|
101
|
+
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
99
102
|
);
|
|
100
|
-
let p = e.skip(
|
|
101
|
-
|
|
103
|
+
let p = e.skip(c);
|
|
104
|
+
l !== !1 && (l === !0 ? u.onRead : l)(
|
|
102
105
|
this.typeName,
|
|
103
106
|
o,
|
|
104
107
|
i,
|
|
105
|
-
|
|
108
|
+
c,
|
|
106
109
|
p
|
|
107
110
|
);
|
|
108
111
|
}
|
|
@@ -119,8 +122,8 @@ class dt extends g {
|
|
|
119
122
|
), t;
|
|
120
123
|
}
|
|
121
124
|
}
|
|
122
|
-
const
|
|
123
|
-
class
|
|
125
|
+
const gt = new pt();
|
|
126
|
+
class ft extends g {
|
|
124
127
|
constructor() {
|
|
125
128
|
super("MiLaboratories.Controller.Shared.uploadapi.Init.Response", [
|
|
126
129
|
{
|
|
@@ -147,9 +150,9 @@ class ut extends g {
|
|
|
147
150
|
return t.partsCount = 0n, t.uploadedParts = [], e !== void 0 && f(this, t, e), t;
|
|
148
151
|
}
|
|
149
152
|
internalBinaryRead(e, t, n, r) {
|
|
150
|
-
let o = r ?? this.create(),
|
|
151
|
-
for (; e.pos <
|
|
152
|
-
let [i,
|
|
153
|
+
let o = r ?? this.create(), a = e.pos + t;
|
|
154
|
+
for (; e.pos < a; ) {
|
|
155
|
+
let [i, c] = e.tag();
|
|
153
156
|
switch (i) {
|
|
154
157
|
case /* uint64 parts_count */
|
|
155
158
|
1:
|
|
@@ -157,23 +160,23 @@ class ut extends g {
|
|
|
157
160
|
break;
|
|
158
161
|
case /* repeated uint64 uploaded_parts */
|
|
159
162
|
2:
|
|
160
|
-
if (
|
|
163
|
+
if (c === h.LengthDelimited)
|
|
161
164
|
for (let P = e.int32() + e.pos; e.pos < P; )
|
|
162
165
|
o.uploadedParts.push(e.uint64().toBigInt());
|
|
163
166
|
else o.uploadedParts.push(e.uint64().toBigInt());
|
|
164
167
|
break;
|
|
165
168
|
default:
|
|
166
|
-
let
|
|
167
|
-
if (
|
|
169
|
+
let l = n.readUnknownField;
|
|
170
|
+
if (l === "throw")
|
|
168
171
|
throw new globalThis.Error(
|
|
169
|
-
`Unknown field ${i} (wire type ${
|
|
172
|
+
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
170
173
|
);
|
|
171
|
-
let p = e.skip(
|
|
172
|
-
|
|
174
|
+
let p = e.skip(c);
|
|
175
|
+
l !== !1 && (l === !0 ? u.onRead : l)(
|
|
173
176
|
this.typeName,
|
|
174
177
|
o,
|
|
175
178
|
i,
|
|
176
|
-
|
|
179
|
+
c,
|
|
177
180
|
p
|
|
178
181
|
);
|
|
179
182
|
}
|
|
@@ -195,8 +198,8 @@ class ut extends g {
|
|
|
195
198
|
), t;
|
|
196
199
|
}
|
|
197
200
|
}
|
|
198
|
-
const
|
|
199
|
-
class
|
|
201
|
+
const mt = new ft();
|
|
202
|
+
class wt extends g {
|
|
200
203
|
constructor() {
|
|
201
204
|
super("MiLaboratories.Controller.Shared.uploadapi.UpdateProgress", []);
|
|
202
205
|
}
|
|
@@ -216,8 +219,8 @@ class gt extends g {
|
|
|
216
219
|
), t;
|
|
217
220
|
}
|
|
218
221
|
}
|
|
219
|
-
new
|
|
220
|
-
class
|
|
222
|
+
new wt();
|
|
223
|
+
class yt extends g {
|
|
221
224
|
constructor() {
|
|
222
225
|
super("MiLaboratories.Controller.Shared.uploadapi.UpdateProgress.Request", [
|
|
223
226
|
{
|
|
@@ -247,9 +250,9 @@ class ft extends g {
|
|
|
247
250
|
), t;
|
|
248
251
|
}
|
|
249
252
|
internalBinaryRead(e, t, n, r) {
|
|
250
|
-
let o = r ?? this.create(),
|
|
251
|
-
for (; e.pos <
|
|
252
|
-
let [i,
|
|
253
|
+
let o = r ?? this.create(), a = e.pos + t;
|
|
254
|
+
for (; e.pos < a; ) {
|
|
255
|
+
let [i, c] = e.tag();
|
|
253
256
|
switch (i) {
|
|
254
257
|
case /* uint64 resource_id */
|
|
255
258
|
1:
|
|
@@ -260,17 +263,17 @@ class ft extends g {
|
|
|
260
263
|
o.bytesProcessed = e.int64().toBigInt();
|
|
261
264
|
break;
|
|
262
265
|
default:
|
|
263
|
-
let
|
|
264
|
-
if (
|
|
266
|
+
let l = n.readUnknownField;
|
|
267
|
+
if (l === "throw")
|
|
265
268
|
throw new globalThis.Error(
|
|
266
|
-
`Unknown field ${i} (wire type ${
|
|
269
|
+
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
267
270
|
);
|
|
268
|
-
let p = e.skip(
|
|
269
|
-
|
|
271
|
+
let p = e.skip(c);
|
|
272
|
+
l !== !1 && (l === !0 ? u.onRead : l)(
|
|
270
273
|
this.typeName,
|
|
271
274
|
o,
|
|
272
275
|
i,
|
|
273
|
-
|
|
276
|
+
c,
|
|
274
277
|
p
|
|
275
278
|
);
|
|
276
279
|
}
|
|
@@ -287,8 +290,8 @@ class ft extends g {
|
|
|
287
290
|
), t;
|
|
288
291
|
}
|
|
289
292
|
}
|
|
290
|
-
const
|
|
291
|
-
class
|
|
293
|
+
const bt = new yt();
|
|
294
|
+
class Tt extends g {
|
|
292
295
|
constructor() {
|
|
293
296
|
super(
|
|
294
297
|
"MiLaboratories.Controller.Shared.uploadapi.UpdateProgress.Response",
|
|
@@ -315,8 +318,8 @@ class wt extends g {
|
|
|
315
318
|
), t;
|
|
316
319
|
}
|
|
317
320
|
}
|
|
318
|
-
const
|
|
319
|
-
class
|
|
321
|
+
const kt = new Tt();
|
|
322
|
+
class Lt extends g {
|
|
320
323
|
constructor() {
|
|
321
324
|
super("MiLaboratories.Controller.Shared.uploadapi.GetPartURL", []);
|
|
322
325
|
}
|
|
@@ -336,8 +339,8 @@ class bt extends g {
|
|
|
336
339
|
), t;
|
|
337
340
|
}
|
|
338
341
|
}
|
|
339
|
-
new
|
|
340
|
-
class
|
|
342
|
+
new Lt();
|
|
343
|
+
class Pt extends g {
|
|
341
344
|
constructor() {
|
|
342
345
|
super("MiLaboratories.Controller.Shared.uploadapi.GetPartURL.Request", [
|
|
343
346
|
{
|
|
@@ -375,9 +378,9 @@ class Tt extends g {
|
|
|
375
378
|
), t;
|
|
376
379
|
}
|
|
377
380
|
internalBinaryRead(e, t, n, r) {
|
|
378
|
-
let o = r ?? this.create(),
|
|
379
|
-
for (; e.pos <
|
|
380
|
-
let [i,
|
|
381
|
+
let o = r ?? this.create(), a = e.pos + t;
|
|
382
|
+
for (; e.pos < a; ) {
|
|
383
|
+
let [i, c] = e.tag();
|
|
381
384
|
switch (i) {
|
|
382
385
|
case /* uint64 resource_id */
|
|
383
386
|
1:
|
|
@@ -392,17 +395,17 @@ class Tt extends g {
|
|
|
392
395
|
o.uploadedPartSize = e.uint64().toBigInt();
|
|
393
396
|
break;
|
|
394
397
|
default:
|
|
395
|
-
let
|
|
396
|
-
if (
|
|
398
|
+
let l = n.readUnknownField;
|
|
399
|
+
if (l === "throw")
|
|
397
400
|
throw new globalThis.Error(
|
|
398
|
-
`Unknown field ${i} (wire type ${
|
|
401
|
+
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
399
402
|
);
|
|
400
|
-
let p = e.skip(
|
|
401
|
-
|
|
403
|
+
let p = e.skip(c);
|
|
404
|
+
l !== !1 && (l === !0 ? u.onRead : l)(
|
|
402
405
|
this.typeName,
|
|
403
406
|
o,
|
|
404
407
|
i,
|
|
405
|
-
|
|
408
|
+
c,
|
|
406
409
|
p
|
|
407
410
|
);
|
|
408
411
|
}
|
|
@@ -419,8 +422,8 @@ class Tt extends g {
|
|
|
419
422
|
), t;
|
|
420
423
|
}
|
|
421
424
|
}
|
|
422
|
-
const
|
|
423
|
-
class
|
|
425
|
+
const It = new Pt();
|
|
426
|
+
class Rt extends g {
|
|
424
427
|
constructor() {
|
|
425
428
|
super("MiLaboratories.Controller.Shared.uploadapi.GetPartURL.HTTPHeader", [
|
|
426
429
|
{
|
|
@@ -450,9 +453,9 @@ class Lt extends g {
|
|
|
450
453
|
), t;
|
|
451
454
|
}
|
|
452
455
|
internalBinaryRead(e, t, n, r) {
|
|
453
|
-
let o = r ?? this.create(),
|
|
454
|
-
for (; e.pos <
|
|
455
|
-
let [i,
|
|
456
|
+
let o = r ?? this.create(), a = e.pos + t;
|
|
457
|
+
for (; e.pos < a; ) {
|
|
458
|
+
let [i, c] = e.tag();
|
|
456
459
|
switch (i) {
|
|
457
460
|
case /* string Name = 1 [json_name = "Name"];*/
|
|
458
461
|
1:
|
|
@@ -463,17 +466,17 @@ class Lt extends g {
|
|
|
463
466
|
o.value = e.string();
|
|
464
467
|
break;
|
|
465
468
|
default:
|
|
466
|
-
let
|
|
467
|
-
if (
|
|
469
|
+
let l = n.readUnknownField;
|
|
470
|
+
if (l === "throw")
|
|
468
471
|
throw new globalThis.Error(
|
|
469
|
-
`Unknown field ${i} (wire type ${
|
|
472
|
+
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
470
473
|
);
|
|
471
|
-
let p = e.skip(
|
|
472
|
-
|
|
474
|
+
let p = e.skip(c);
|
|
475
|
+
l !== !1 && (l === !0 ? u.onRead : l)(
|
|
473
476
|
this.typeName,
|
|
474
477
|
o,
|
|
475
478
|
i,
|
|
476
|
-
|
|
479
|
+
c,
|
|
477
480
|
p
|
|
478
481
|
);
|
|
479
482
|
}
|
|
@@ -490,8 +493,8 @@ class Lt extends g {
|
|
|
490
493
|
), t;
|
|
491
494
|
}
|
|
492
495
|
}
|
|
493
|
-
const E = new
|
|
494
|
-
class
|
|
496
|
+
const E = new Rt();
|
|
497
|
+
class St extends g {
|
|
495
498
|
constructor() {
|
|
496
499
|
super("MiLaboratories.Controller.Shared.uploadapi.GetPartURL.Response", [
|
|
497
500
|
{
|
|
@@ -542,9 +545,9 @@ class Pt extends g {
|
|
|
542
545
|
), t;
|
|
543
546
|
}
|
|
544
547
|
internalBinaryRead(e, t, n, r) {
|
|
545
|
-
let o = r ?? this.create(),
|
|
546
|
-
for (; e.pos <
|
|
547
|
-
let [i,
|
|
548
|
+
let o = r ?? this.create(), a = e.pos + t;
|
|
549
|
+
for (; e.pos < a; ) {
|
|
550
|
+
let [i, c] = e.tag();
|
|
548
551
|
switch (i) {
|
|
549
552
|
case /* string upload_url */
|
|
550
553
|
1:
|
|
@@ -573,17 +576,17 @@ class Pt extends g {
|
|
|
573
576
|
o.chunkEnd = e.uint64().toBigInt();
|
|
574
577
|
break;
|
|
575
578
|
default:
|
|
576
|
-
let
|
|
577
|
-
if (
|
|
579
|
+
let l = n.readUnknownField;
|
|
580
|
+
if (l === "throw")
|
|
578
581
|
throw new globalThis.Error(
|
|
579
|
-
`Unknown field ${i} (wire type ${
|
|
582
|
+
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
580
583
|
);
|
|
581
|
-
let p = e.skip(
|
|
582
|
-
|
|
584
|
+
let p = e.skip(c);
|
|
585
|
+
l !== !1 && (l === !0 ? u.onRead : l)(
|
|
583
586
|
this.typeName,
|
|
584
587
|
o,
|
|
585
588
|
i,
|
|
586
|
-
|
|
589
|
+
c,
|
|
587
590
|
p
|
|
588
591
|
);
|
|
589
592
|
}
|
|
@@ -607,8 +610,8 @@ class Pt extends g {
|
|
|
607
610
|
), t;
|
|
608
611
|
}
|
|
609
612
|
}
|
|
610
|
-
const
|
|
611
|
-
class
|
|
613
|
+
const Nt = new St();
|
|
614
|
+
class Ut extends g {
|
|
612
615
|
constructor() {
|
|
613
616
|
super("MiLaboratories.Controller.Shared.uploadapi.Finalize", []);
|
|
614
617
|
}
|
|
@@ -628,8 +631,8 @@ class Rt extends g {
|
|
|
628
631
|
), t;
|
|
629
632
|
}
|
|
630
633
|
}
|
|
631
|
-
new
|
|
632
|
-
class
|
|
634
|
+
new Ut();
|
|
635
|
+
class Bt extends g {
|
|
633
636
|
constructor() {
|
|
634
637
|
super("MiLaboratories.Controller.Shared.uploadapi.Finalize.Request", [
|
|
635
638
|
{
|
|
@@ -647,26 +650,26 @@ class St extends g {
|
|
|
647
650
|
return t.resourceId = 0n, e !== void 0 && f(this, t, e), t;
|
|
648
651
|
}
|
|
649
652
|
internalBinaryRead(e, t, n, r) {
|
|
650
|
-
let o = r ?? this.create(),
|
|
651
|
-
for (; e.pos <
|
|
652
|
-
let [i,
|
|
653
|
+
let o = r ?? this.create(), a = e.pos + t;
|
|
654
|
+
for (; e.pos < a; ) {
|
|
655
|
+
let [i, c] = e.tag();
|
|
653
656
|
switch (i) {
|
|
654
657
|
case /* uint64 resource_id */
|
|
655
658
|
1:
|
|
656
659
|
o.resourceId = e.uint64().toBigInt();
|
|
657
660
|
break;
|
|
658
661
|
default:
|
|
659
|
-
let
|
|
660
|
-
if (
|
|
662
|
+
let l = n.readUnknownField;
|
|
663
|
+
if (l === "throw")
|
|
661
664
|
throw new globalThis.Error(
|
|
662
|
-
`Unknown field ${i} (wire type ${
|
|
665
|
+
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
663
666
|
);
|
|
664
|
-
let p = e.skip(
|
|
665
|
-
|
|
667
|
+
let p = e.skip(c);
|
|
668
|
+
l !== !1 && (l === !0 ? u.onRead : l)(
|
|
666
669
|
this.typeName,
|
|
667
670
|
o,
|
|
668
671
|
i,
|
|
669
|
-
|
|
672
|
+
c,
|
|
670
673
|
p
|
|
671
674
|
);
|
|
672
675
|
}
|
|
@@ -683,8 +686,8 @@ class St extends g {
|
|
|
683
686
|
), t;
|
|
684
687
|
}
|
|
685
688
|
}
|
|
686
|
-
const
|
|
687
|
-
class
|
|
689
|
+
const Dt = new Bt();
|
|
690
|
+
class vt extends g {
|
|
688
691
|
constructor() {
|
|
689
692
|
super("MiLaboratories.Controller.Shared.uploadapi.Finalize.Response", []);
|
|
690
693
|
}
|
|
@@ -704,36 +707,36 @@ class Ut extends g {
|
|
|
704
707
|
), t;
|
|
705
708
|
}
|
|
706
709
|
}
|
|
707
|
-
const
|
|
710
|
+
const $t = new vt(), W = new D(
|
|
708
711
|
"MiLaboratories.Controller.Shared.Upload",
|
|
709
712
|
[
|
|
710
713
|
{
|
|
711
714
|
name: "Init",
|
|
712
715
|
options: {},
|
|
713
|
-
I:
|
|
714
|
-
O:
|
|
716
|
+
I: gt,
|
|
717
|
+
O: mt
|
|
715
718
|
},
|
|
716
719
|
{
|
|
717
720
|
name: "GetPartURL",
|
|
718
721
|
options: {},
|
|
719
|
-
I:
|
|
720
|
-
O:
|
|
722
|
+
I: It,
|
|
723
|
+
O: Nt
|
|
721
724
|
},
|
|
722
725
|
{
|
|
723
726
|
name: "UpdateProgress",
|
|
724
727
|
options: {},
|
|
725
|
-
I:
|
|
726
|
-
O:
|
|
728
|
+
I: bt,
|
|
729
|
+
O: kt
|
|
727
730
|
},
|
|
728
731
|
{
|
|
729
732
|
name: "Finalize",
|
|
730
733
|
options: {},
|
|
731
|
-
I:
|
|
732
|
-
O:
|
|
734
|
+
I: Dt,
|
|
735
|
+
O: $t
|
|
733
736
|
}
|
|
734
737
|
]
|
|
735
738
|
);
|
|
736
|
-
class
|
|
739
|
+
class _t {
|
|
737
740
|
constructor(e) {
|
|
738
741
|
d(this, "typeName", W.typeName);
|
|
739
742
|
d(this, "methods", W.methods);
|
|
@@ -794,30 +797,27 @@ class Dt {
|
|
|
794
797
|
return y("unary", this._transport, n, r, e);
|
|
795
798
|
}
|
|
796
799
|
}
|
|
797
|
-
class Le extends Error {
|
|
798
|
-
}
|
|
799
800
|
class Pe extends Error {
|
|
800
801
|
}
|
|
801
|
-
class vt extends Error {
|
|
802
|
-
}
|
|
803
802
|
class Ie extends Error {
|
|
804
803
|
}
|
|
805
|
-
class
|
|
804
|
+
class Ct extends Error {
|
|
805
|
+
}
|
|
806
|
+
class Re extends Error {
|
|
807
|
+
}
|
|
808
|
+
class Ot {
|
|
806
809
|
constructor(e, t, n, r) {
|
|
807
810
|
d(this, "grpcClient");
|
|
808
|
-
this.grpcTransport = e, this.httpClient = t, this.logger = r, this.grpcClient = new
|
|
811
|
+
this.grpcTransport = e, this.httpClient = t, this.logger = r, this.grpcClient = new _t(this.grpcTransport);
|
|
809
812
|
}
|
|
810
813
|
close() {
|
|
811
814
|
}
|
|
812
815
|
async initUpload({ id: e, type: t }, n) {
|
|
813
|
-
const r = await this.grpcClient.init(
|
|
814
|
-
{ resourceId: e },
|
|
815
|
-
k(t, n)
|
|
816
|
-
);
|
|
816
|
+
const r = await this.grpcClient.init({ resourceId: e }, k(t, n));
|
|
817
817
|
return this.partsToUpload(r.response);
|
|
818
818
|
}
|
|
819
|
-
async partUpload({ id: e, type: t }, n, r, o,
|
|
820
|
-
const
|
|
819
|
+
async partUpload({ id: e, type: t }, n, r, o, a, i) {
|
|
820
|
+
const c = await this.grpcClient.getPartURL(
|
|
821
821
|
{
|
|
822
822
|
resourceId: e,
|
|
823
823
|
partNumber: r,
|
|
@@ -825,50 +825,40 @@ class $t {
|
|
|
825
825
|
// we update progress as a separate call later.
|
|
826
826
|
},
|
|
827
827
|
k(t, i)
|
|
828
|
-
).response, { chunk:
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
);
|
|
833
|
-
if (p > c)
|
|
834
|
-
throw new Le(
|
|
835
|
-
"file was modified, expected mtime: " + c + ", got: " + p + "."
|
|
828
|
+
).response, { chunk: l, mTime: p } = await this.readChunk(n, c.chunkStart, c.chunkEnd);
|
|
829
|
+
if (p > a)
|
|
830
|
+
throw new Pe(
|
|
831
|
+
"file was modified, expected mtime: " + a + ", got: " + p + "."
|
|
836
832
|
);
|
|
837
|
-
const P = await
|
|
838
|
-
l.uploadUrl,
|
|
839
|
-
this.prepareUploadOpts(l, a)
|
|
840
|
-
), le = await P.body.text();
|
|
833
|
+
const P = await Te(c.uploadUrl, this.prepareUploadOpts(c, l)), le = await P.body.text();
|
|
841
834
|
if (this.logger.info(
|
|
842
835
|
`uploaded chunk ${r} from ${o} of resource: ${e}, response: '${le.toString()}', status code: ${P.statusCode}`
|
|
843
836
|
), P.statusCode != 200)
|
|
844
|
-
throw new
|
|
845
|
-
`response is not ok, status code: ${P.statusCode}, body: ${le}, headers: ${P.headers}, url: ${
|
|
837
|
+
throw new Ct(
|
|
838
|
+
`response is not ok, status code: ${P.statusCode}, body: ${le}, headers: ${P.headers}, url: ${c.uploadUrl}`
|
|
846
839
|
);
|
|
847
840
|
await this.grpcClient.updateProgress(
|
|
848
841
|
{
|
|
849
842
|
resourceId: e,
|
|
850
|
-
bytesProcessed:
|
|
843
|
+
bytesProcessed: c.chunkEnd - c.chunkStart
|
|
851
844
|
},
|
|
852
845
|
k(t, i)
|
|
853
846
|
);
|
|
854
847
|
}
|
|
855
848
|
async finalizeUpload({ id: e, type: t }, n) {
|
|
856
|
-
return await this.grpcClient.finalize(
|
|
857
|
-
{ resourceId: e },
|
|
858
|
-
k(t, n)
|
|
859
|
-
);
|
|
849
|
+
return await this.grpcClient.finalize({ resourceId: e }, k(t, n));
|
|
860
850
|
}
|
|
861
851
|
async readChunk(e, t, n) {
|
|
862
852
|
let r;
|
|
863
853
|
try {
|
|
864
854
|
r = await m.open(e);
|
|
865
|
-
const o = Number(n - t),
|
|
855
|
+
const o = Number(n - t), a = Number(t), i = Buffer.alloc(o), c = await this.readBytesFromPosition(r, i, o, a), l = await m.stat(e);
|
|
866
856
|
return {
|
|
867
|
-
chunk: i.subarray(0,
|
|
868
|
-
mTime: BigInt(Math.floor(
|
|
857
|
+
chunk: i.subarray(0, c),
|
|
858
|
+
mTime: BigInt(Math.floor(l.mtimeMs / 1e3))
|
|
869
859
|
};
|
|
870
860
|
} catch (o) {
|
|
871
|
-
throw o.code == "ENOENT" ? new
|
|
861
|
+
throw o.code == "ENOENT" ? new Re(`there is no file ${e} for uploading`) : o;
|
|
872
862
|
} finally {
|
|
873
863
|
r == null || r.close();
|
|
874
864
|
}
|
|
@@ -878,15 +868,15 @@ class $t {
|
|
|
878
868
|
async readBytesFromPosition(e, t, n, r) {
|
|
879
869
|
let o = 0;
|
|
880
870
|
for (; o < n; ) {
|
|
881
|
-
const { bytesRead:
|
|
871
|
+
const { bytesRead: a } = await e.read(
|
|
882
872
|
t,
|
|
883
873
|
o,
|
|
884
874
|
n - o,
|
|
885
875
|
r + o
|
|
886
876
|
);
|
|
887
|
-
if (
|
|
888
|
-
throw new
|
|
889
|
-
o +=
|
|
877
|
+
if (a === 0)
|
|
878
|
+
throw new Ie("file ended earlier than expected.");
|
|
879
|
+
o += a;
|
|
890
880
|
}
|
|
891
881
|
return o;
|
|
892
882
|
}
|
|
@@ -908,7 +898,7 @@ class $t {
|
|
|
908
898
|
};
|
|
909
899
|
}
|
|
910
900
|
}
|
|
911
|
-
class
|
|
901
|
+
class Ft extends g {
|
|
912
902
|
constructor() {
|
|
913
903
|
super("google.protobuf.Duration", [
|
|
914
904
|
{
|
|
@@ -948,7 +938,7 @@ class _t extends g {
|
|
|
948
938
|
internalJsonRead(e, t, n) {
|
|
949
939
|
if (typeof e != "string")
|
|
950
940
|
throw new Error(
|
|
951
|
-
"Unable to parse Duration from JSON " +
|
|
941
|
+
"Unable to parse Duration from JSON " + be(e) + ". Expected string."
|
|
952
942
|
);
|
|
953
943
|
let r = e.match(/^(-?)([0-9]+)(?:\.([0-9]+))?s/);
|
|
954
944
|
if (r === null)
|
|
@@ -956,14 +946,14 @@ class _t extends g {
|
|
|
956
946
|
"Unable to parse Duration from JSON string. Invalid format."
|
|
957
947
|
);
|
|
958
948
|
n || (n = this.create());
|
|
959
|
-
let [, o,
|
|
960
|
-
if (
|
|
949
|
+
let [, o, a, i] = r, c = I.from(o + a);
|
|
950
|
+
if (c.toNumber() > 315576e6 || c.toNumber() < -315576e6)
|
|
961
951
|
throw new Error(
|
|
962
952
|
"Unable to parse Duration from JSON string. Value out of range."
|
|
963
953
|
);
|
|
964
|
-
if (n.seconds =
|
|
965
|
-
let
|
|
966
|
-
n.nanos = parseInt(
|
|
954
|
+
if (n.seconds = c.toBigInt(), typeof i == "string") {
|
|
955
|
+
let l = o + i + "0".repeat(9 - i.length);
|
|
956
|
+
n.nanos = parseInt(l);
|
|
967
957
|
}
|
|
968
958
|
return n;
|
|
969
959
|
}
|
|
@@ -972,9 +962,9 @@ class _t extends g {
|
|
|
972
962
|
return t.seconds = 0n, t.nanos = 0, e !== void 0 && f(this, t, e), t;
|
|
973
963
|
}
|
|
974
964
|
internalBinaryRead(e, t, n, r) {
|
|
975
|
-
let o = r ?? this.create(),
|
|
976
|
-
for (; e.pos <
|
|
977
|
-
let [i,
|
|
965
|
+
let o = r ?? this.create(), a = e.pos + t;
|
|
966
|
+
for (; e.pos < a; ) {
|
|
967
|
+
let [i, c] = e.tag();
|
|
978
968
|
switch (i) {
|
|
979
969
|
case /* int64 seconds */
|
|
980
970
|
1:
|
|
@@ -985,17 +975,17 @@ class _t extends g {
|
|
|
985
975
|
o.nanos = e.int32();
|
|
986
976
|
break;
|
|
987
977
|
default:
|
|
988
|
-
let
|
|
989
|
-
if (
|
|
978
|
+
let l = n.readUnknownField;
|
|
979
|
+
if (l === "throw")
|
|
990
980
|
throw new globalThis.Error(
|
|
991
|
-
`Unknown field ${i} (wire type ${
|
|
981
|
+
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
992
982
|
);
|
|
993
|
-
let p = e.skip(
|
|
994
|
-
|
|
983
|
+
let p = e.skip(c);
|
|
984
|
+
l !== !1 && (l === !0 ? u.onRead : l)(
|
|
995
985
|
this.typeName,
|
|
996
986
|
o,
|
|
997
987
|
i,
|
|
998
|
-
|
|
988
|
+
c,
|
|
999
989
|
p
|
|
1000
990
|
);
|
|
1001
991
|
}
|
|
@@ -1012,8 +1002,8 @@ class _t extends g {
|
|
|
1012
1002
|
), t;
|
|
1013
1003
|
}
|
|
1014
1004
|
}
|
|
1015
|
-
const $ = new
|
|
1016
|
-
class
|
|
1005
|
+
const $ = new Ft();
|
|
1006
|
+
class Et extends g {
|
|
1017
1007
|
constructor() {
|
|
1018
1008
|
super("MiLaboratories.Controller.Shared.ProgressAPI", []);
|
|
1019
1009
|
}
|
|
@@ -1033,8 +1023,8 @@ class Ct extends g {
|
|
|
1033
1023
|
), t;
|
|
1034
1024
|
}
|
|
1035
1025
|
}
|
|
1036
|
-
new
|
|
1037
|
-
class
|
|
1026
|
+
new Et();
|
|
1027
|
+
class Wt extends g {
|
|
1038
1028
|
constructor() {
|
|
1039
1029
|
super("MiLaboratories.Controller.Shared.ProgressAPI.Report", [
|
|
1040
1030
|
{
|
|
@@ -1081,9 +1071,9 @@ class Ot extends g {
|
|
|
1081
1071
|
return t.progress = 0, t.bytesProcessed = 0n, t.bytesTotal = 0n, t.done = !1, t.name = "", e !== void 0 && f(this, t, e), t;
|
|
1082
1072
|
}
|
|
1083
1073
|
internalBinaryRead(e, t, n, r) {
|
|
1084
|
-
let o = r ?? this.create(),
|
|
1085
|
-
for (; e.pos <
|
|
1086
|
-
let [i,
|
|
1074
|
+
let o = r ?? this.create(), a = e.pos + t;
|
|
1075
|
+
for (; e.pos < a; ) {
|
|
1076
|
+
let [i, c] = e.tag();
|
|
1087
1077
|
switch (i) {
|
|
1088
1078
|
case /* float progress */
|
|
1089
1079
|
1:
|
|
@@ -1106,17 +1096,17 @@ class Ot extends g {
|
|
|
1106
1096
|
o.name = e.string();
|
|
1107
1097
|
break;
|
|
1108
1098
|
default:
|
|
1109
|
-
let
|
|
1110
|
-
if (
|
|
1099
|
+
let l = n.readUnknownField;
|
|
1100
|
+
if (l === "throw")
|
|
1111
1101
|
throw new globalThis.Error(
|
|
1112
|
-
`Unknown field ${i} (wire type ${
|
|
1102
|
+
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
1113
1103
|
);
|
|
1114
|
-
let p = e.skip(
|
|
1115
|
-
|
|
1104
|
+
let p = e.skip(c);
|
|
1105
|
+
l !== !1 && (l === !0 ? u.onRead : l)(
|
|
1116
1106
|
this.typeName,
|
|
1117
1107
|
o,
|
|
1118
1108
|
i,
|
|
1119
|
-
|
|
1109
|
+
c,
|
|
1120
1110
|
p
|
|
1121
1111
|
);
|
|
1122
1112
|
}
|
|
@@ -1133,8 +1123,8 @@ class Ot extends g {
|
|
|
1133
1123
|
), t;
|
|
1134
1124
|
}
|
|
1135
1125
|
}
|
|
1136
|
-
const S = new
|
|
1137
|
-
class
|
|
1126
|
+
const S = new Wt();
|
|
1127
|
+
class At extends g {
|
|
1138
1128
|
constructor() {
|
|
1139
1129
|
super("MiLaboratories.Controller.Shared.ProgressAPI.GetStatus", []);
|
|
1140
1130
|
}
|
|
@@ -1154,8 +1144,8 @@ class Ft extends g {
|
|
|
1154
1144
|
), t;
|
|
1155
1145
|
}
|
|
1156
1146
|
}
|
|
1157
|
-
new
|
|
1158
|
-
class
|
|
1147
|
+
new At();
|
|
1148
|
+
class zt extends g {
|
|
1159
1149
|
constructor() {
|
|
1160
1150
|
super("MiLaboratories.Controller.Shared.ProgressAPI.GetStatus.Request", [
|
|
1161
1151
|
{
|
|
@@ -1177,26 +1167,26 @@ class Et extends g {
|
|
|
1177
1167
|
), t;
|
|
1178
1168
|
}
|
|
1179
1169
|
internalBinaryRead(e, t, n, r) {
|
|
1180
|
-
let o = r ?? this.create(),
|
|
1181
|
-
for (; e.pos <
|
|
1182
|
-
let [i,
|
|
1170
|
+
let o = r ?? this.create(), a = e.pos + t;
|
|
1171
|
+
for (; e.pos < a; ) {
|
|
1172
|
+
let [i, c] = e.tag();
|
|
1183
1173
|
switch (i) {
|
|
1184
1174
|
case /* uint64 resource_id */
|
|
1185
1175
|
1:
|
|
1186
1176
|
o.resourceId = e.uint64().toBigInt();
|
|
1187
1177
|
break;
|
|
1188
1178
|
default:
|
|
1189
|
-
let
|
|
1190
|
-
if (
|
|
1179
|
+
let l = n.readUnknownField;
|
|
1180
|
+
if (l === "throw")
|
|
1191
1181
|
throw new globalThis.Error(
|
|
1192
|
-
`Unknown field ${i} (wire type ${
|
|
1182
|
+
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
1193
1183
|
);
|
|
1194
|
-
let p = e.skip(
|
|
1195
|
-
|
|
1184
|
+
let p = e.skip(c);
|
|
1185
|
+
l !== !1 && (l === !0 ? u.onRead : l)(
|
|
1196
1186
|
this.typeName,
|
|
1197
1187
|
o,
|
|
1198
1188
|
i,
|
|
1199
|
-
|
|
1189
|
+
c,
|
|
1200
1190
|
p
|
|
1201
1191
|
);
|
|
1202
1192
|
}
|
|
@@ -1213,8 +1203,8 @@ class Et extends g {
|
|
|
1213
1203
|
), t;
|
|
1214
1204
|
}
|
|
1215
1205
|
}
|
|
1216
|
-
const
|
|
1217
|
-
class
|
|
1206
|
+
const xt = new zt();
|
|
1207
|
+
class Mt extends g {
|
|
1218
1208
|
constructor() {
|
|
1219
1209
|
super("MiLaboratories.Controller.Shared.ProgressAPI.GetStatus.Response", [
|
|
1220
1210
|
{ no: 1, name: "report", kind: "message", T: () => S }
|
|
@@ -1229,9 +1219,9 @@ class zt extends g {
|
|
|
1229
1219
|
), t;
|
|
1230
1220
|
}
|
|
1231
1221
|
internalBinaryRead(e, t, n, r) {
|
|
1232
|
-
let o = r ?? this.create(),
|
|
1233
|
-
for (; e.pos <
|
|
1234
|
-
let [i,
|
|
1222
|
+
let o = r ?? this.create(), a = e.pos + t;
|
|
1223
|
+
for (; e.pos < a; ) {
|
|
1224
|
+
let [i, c] = e.tag();
|
|
1235
1225
|
switch (i) {
|
|
1236
1226
|
case /* MiLaboratories.Controller.Shared.ProgressAPI.Report report */
|
|
1237
1227
|
1:
|
|
@@ -1243,17 +1233,17 @@ class zt extends g {
|
|
|
1243
1233
|
);
|
|
1244
1234
|
break;
|
|
1245
1235
|
default:
|
|
1246
|
-
let
|
|
1247
|
-
if (
|
|
1236
|
+
let l = n.readUnknownField;
|
|
1237
|
+
if (l === "throw")
|
|
1248
1238
|
throw new globalThis.Error(
|
|
1249
|
-
`Unknown field ${i} (wire type ${
|
|
1239
|
+
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
1250
1240
|
);
|
|
1251
|
-
let p = e.skip(
|
|
1252
|
-
|
|
1241
|
+
let p = e.skip(c);
|
|
1242
|
+
l !== !1 && (l === !0 ? u.onRead : l)(
|
|
1253
1243
|
this.typeName,
|
|
1254
1244
|
o,
|
|
1255
1245
|
i,
|
|
1256
|
-
|
|
1246
|
+
c,
|
|
1257
1247
|
p
|
|
1258
1248
|
);
|
|
1259
1249
|
}
|
|
@@ -1274,8 +1264,8 @@ class zt extends g {
|
|
|
1274
1264
|
), t;
|
|
1275
1265
|
}
|
|
1276
1266
|
}
|
|
1277
|
-
const
|
|
1278
|
-
class
|
|
1267
|
+
const Ht = new Mt();
|
|
1268
|
+
class jt extends g {
|
|
1279
1269
|
constructor() {
|
|
1280
1270
|
super("MiLaboratories.Controller.Shared.ProgressAPI.RealtimeStatus", []);
|
|
1281
1271
|
}
|
|
@@ -1295,8 +1285,8 @@ class xt extends g {
|
|
|
1295
1285
|
), t;
|
|
1296
1286
|
}
|
|
1297
1287
|
}
|
|
1298
|
-
new
|
|
1299
|
-
class
|
|
1288
|
+
new jt();
|
|
1289
|
+
class Gt extends g {
|
|
1300
1290
|
constructor() {
|
|
1301
1291
|
super(
|
|
1302
1292
|
"MiLaboratories.Controller.Shared.ProgressAPI.RealtimeStatus.Request",
|
|
@@ -1322,9 +1312,9 @@ class Mt extends g {
|
|
|
1322
1312
|
), t;
|
|
1323
1313
|
}
|
|
1324
1314
|
internalBinaryRead(e, t, n, r) {
|
|
1325
|
-
let o = r ?? this.create(),
|
|
1326
|
-
for (; e.pos <
|
|
1327
|
-
let [i,
|
|
1315
|
+
let o = r ?? this.create(), a = e.pos + t;
|
|
1316
|
+
for (; e.pos < a; ) {
|
|
1317
|
+
let [i, c] = e.tag();
|
|
1328
1318
|
switch (i) {
|
|
1329
1319
|
case /* uint64 resource_id */
|
|
1330
1320
|
1:
|
|
@@ -1340,17 +1330,17 @@ class Mt extends g {
|
|
|
1340
1330
|
);
|
|
1341
1331
|
break;
|
|
1342
1332
|
default:
|
|
1343
|
-
let
|
|
1344
|
-
if (
|
|
1333
|
+
let l = n.readUnknownField;
|
|
1334
|
+
if (l === "throw")
|
|
1345
1335
|
throw new globalThis.Error(
|
|
1346
|
-
`Unknown field ${i} (wire type ${
|
|
1336
|
+
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
1347
1337
|
);
|
|
1348
|
-
let p = e.skip(
|
|
1349
|
-
|
|
1338
|
+
let p = e.skip(c);
|
|
1339
|
+
l !== !1 && (l === !0 ? u.onRead : l)(
|
|
1350
1340
|
this.typeName,
|
|
1351
1341
|
o,
|
|
1352
1342
|
i,
|
|
1353
|
-
|
|
1343
|
+
c,
|
|
1354
1344
|
p
|
|
1355
1345
|
);
|
|
1356
1346
|
}
|
|
@@ -1371,8 +1361,8 @@ class Mt extends g {
|
|
|
1371
1361
|
), t;
|
|
1372
1362
|
}
|
|
1373
1363
|
}
|
|
1374
|
-
const
|
|
1375
|
-
class
|
|
1364
|
+
const Vt = new Gt();
|
|
1365
|
+
class qt extends g {
|
|
1376
1366
|
constructor() {
|
|
1377
1367
|
super(
|
|
1378
1368
|
"MiLaboratories.Controller.Shared.ProgressAPI.RealtimeStatus.Response",
|
|
@@ -1388,9 +1378,9 @@ class jt extends g {
|
|
|
1388
1378
|
), t;
|
|
1389
1379
|
}
|
|
1390
1380
|
internalBinaryRead(e, t, n, r) {
|
|
1391
|
-
let o = r ?? this.create(),
|
|
1392
|
-
for (; e.pos <
|
|
1393
|
-
let [i,
|
|
1381
|
+
let o = r ?? this.create(), a = e.pos + t;
|
|
1382
|
+
for (; e.pos < a; ) {
|
|
1383
|
+
let [i, c] = e.tag();
|
|
1394
1384
|
switch (i) {
|
|
1395
1385
|
case /* MiLaboratories.Controller.Shared.ProgressAPI.Report report */
|
|
1396
1386
|
1:
|
|
@@ -1402,17 +1392,17 @@ class jt extends g {
|
|
|
1402
1392
|
);
|
|
1403
1393
|
break;
|
|
1404
1394
|
default:
|
|
1405
|
-
let
|
|
1406
|
-
if (
|
|
1395
|
+
let l = n.readUnknownField;
|
|
1396
|
+
if (l === "throw")
|
|
1407
1397
|
throw new globalThis.Error(
|
|
1408
|
-
`Unknown field ${i} (wire type ${
|
|
1398
|
+
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
1409
1399
|
);
|
|
1410
|
-
let p = e.skip(
|
|
1411
|
-
|
|
1400
|
+
let p = e.skip(c);
|
|
1401
|
+
l !== !1 && (l === !0 ? u.onRead : l)(
|
|
1412
1402
|
this.typeName,
|
|
1413
1403
|
o,
|
|
1414
1404
|
i,
|
|
1415
|
-
|
|
1405
|
+
c,
|
|
1416
1406
|
p
|
|
1417
1407
|
);
|
|
1418
1408
|
}
|
|
@@ -1433,7 +1423,7 @@ class jt extends g {
|
|
|
1433
1423
|
), t;
|
|
1434
1424
|
}
|
|
1435
1425
|
}
|
|
1436
|
-
const
|
|
1426
|
+
const Jt = new qt(), A = new D(
|
|
1437
1427
|
"MiLaboratories.Controller.Shared.Progress",
|
|
1438
1428
|
[
|
|
1439
1429
|
{
|
|
@@ -1441,23 +1431,23 @@ const Gt = new jt(), z = new D(
|
|
|
1441
1431
|
options: {
|
|
1442
1432
|
"google.api.http": { get: "/resources/{resource_id}/get-progress" }
|
|
1443
1433
|
},
|
|
1444
|
-
I:
|
|
1445
|
-
O:
|
|
1434
|
+
I: xt,
|
|
1435
|
+
O: Ht
|
|
1446
1436
|
},
|
|
1447
1437
|
{
|
|
1448
1438
|
name: "RealtimeStatus",
|
|
1449
1439
|
serverStreaming: !0,
|
|
1450
1440
|
options: {},
|
|
1451
|
-
I:
|
|
1452
|
-
O:
|
|
1441
|
+
I: Vt,
|
|
1442
|
+
O: Jt
|
|
1453
1443
|
}
|
|
1454
1444
|
]
|
|
1455
1445
|
);
|
|
1456
|
-
class
|
|
1446
|
+
class Zt {
|
|
1457
1447
|
constructor(e) {
|
|
1458
|
-
d(this, "typeName",
|
|
1459
|
-
d(this, "methods",
|
|
1460
|
-
d(this, "options",
|
|
1448
|
+
d(this, "typeName", A.typeName);
|
|
1449
|
+
d(this, "methods", A.methods);
|
|
1450
|
+
d(this, "options", A.options);
|
|
1461
1451
|
this._transport = e;
|
|
1462
1452
|
}
|
|
1463
1453
|
/**
|
|
@@ -1475,10 +1465,10 @@ class Vt {
|
|
|
1475
1465
|
return y("serverStreaming", this._transport, n, r, e);
|
|
1476
1466
|
}
|
|
1477
1467
|
}
|
|
1478
|
-
class
|
|
1468
|
+
class Qt {
|
|
1479
1469
|
constructor(e, t, n, r) {
|
|
1480
1470
|
d(this, "grpcClient");
|
|
1481
|
-
this.grpcTransport = e, this.client = n, this.logger = r, this.grpcClient = new
|
|
1471
|
+
this.grpcTransport = e, this.client = n, this.logger = r, this.grpcClient = new Zt(this.grpcTransport);
|
|
1482
1472
|
}
|
|
1483
1473
|
close() {
|
|
1484
1474
|
}
|
|
@@ -1499,25 +1489,25 @@ class qt {
|
|
|
1499
1489
|
// GRPC stream every updateIntervalMs milliseconds.
|
|
1500
1490
|
async *realtimeStatus({ id: e, type: t }, n = 100, r) {
|
|
1501
1491
|
r = k(t, r);
|
|
1502
|
-
const o = Math.floor(n / 1e3),
|
|
1492
|
+
const o = Math.floor(n / 1e3), a = (n - o * 1e3) * 1e6, i = $.create({
|
|
1503
1493
|
seconds: BigInt(o),
|
|
1504
|
-
nanos:
|
|
1494
|
+
nanos: a
|
|
1505
1495
|
});
|
|
1506
1496
|
try {
|
|
1507
|
-
const { responses:
|
|
1497
|
+
const { responses: c } = this.grpcClient.realtimeStatus(
|
|
1508
1498
|
{
|
|
1509
1499
|
resourceId: e,
|
|
1510
1500
|
updateInterval: i
|
|
1511
1501
|
},
|
|
1512
1502
|
r
|
|
1513
1503
|
);
|
|
1514
|
-
yield*
|
|
1515
|
-
} catch (
|
|
1516
|
-
throw this.logger.warn("Failed to get realtime status" +
|
|
1504
|
+
yield* c;
|
|
1505
|
+
} catch (c) {
|
|
1506
|
+
throw this.logger.warn("Failed to get realtime status" + c), c;
|
|
1517
1507
|
}
|
|
1518
1508
|
}
|
|
1519
1509
|
}
|
|
1520
|
-
class
|
|
1510
|
+
class Xt extends g {
|
|
1521
1511
|
constructor() {
|
|
1522
1512
|
super("MiLaboratories.Controller.Shared.DownloadAPI", []);
|
|
1523
1513
|
}
|
|
@@ -1537,8 +1527,8 @@ class Jt extends g {
|
|
|
1537
1527
|
), t;
|
|
1538
1528
|
}
|
|
1539
1529
|
}
|
|
1540
|
-
new
|
|
1541
|
-
class
|
|
1530
|
+
new Xt();
|
|
1531
|
+
class Yt extends g {
|
|
1542
1532
|
constructor() {
|
|
1543
1533
|
super("MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL", []);
|
|
1544
1534
|
}
|
|
@@ -1558,8 +1548,8 @@ class Zt extends g {
|
|
|
1558
1548
|
), t;
|
|
1559
1549
|
}
|
|
1560
1550
|
}
|
|
1561
|
-
new
|
|
1562
|
-
class
|
|
1551
|
+
new Yt();
|
|
1552
|
+
class Kt extends g {
|
|
1563
1553
|
constructor() {
|
|
1564
1554
|
super(
|
|
1565
1555
|
"MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL.Request",
|
|
@@ -1584,26 +1574,26 @@ class Qt extends g {
|
|
|
1584
1574
|
), t;
|
|
1585
1575
|
}
|
|
1586
1576
|
internalBinaryRead(e, t, n, r) {
|
|
1587
|
-
let o = r ?? this.create(),
|
|
1588
|
-
for (; e.pos <
|
|
1589
|
-
let [i,
|
|
1577
|
+
let o = r ?? this.create(), a = e.pos + t;
|
|
1578
|
+
for (; e.pos < a; ) {
|
|
1579
|
+
let [i, c] = e.tag();
|
|
1590
1580
|
switch (i) {
|
|
1591
1581
|
case /* uint64 resource_id */
|
|
1592
1582
|
1:
|
|
1593
1583
|
o.resourceId = e.uint64().toBigInt();
|
|
1594
1584
|
break;
|
|
1595
1585
|
default:
|
|
1596
|
-
let
|
|
1597
|
-
if (
|
|
1586
|
+
let l = n.readUnknownField;
|
|
1587
|
+
if (l === "throw")
|
|
1598
1588
|
throw new globalThis.Error(
|
|
1599
|
-
`Unknown field ${i} (wire type ${
|
|
1589
|
+
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
1600
1590
|
);
|
|
1601
|
-
let p = e.skip(
|
|
1602
|
-
|
|
1591
|
+
let p = e.skip(c);
|
|
1592
|
+
l !== !1 && (l === !0 ? u.onRead : l)(
|
|
1603
1593
|
this.typeName,
|
|
1604
1594
|
o,
|
|
1605
1595
|
i,
|
|
1606
|
-
|
|
1596
|
+
c,
|
|
1607
1597
|
p
|
|
1608
1598
|
);
|
|
1609
1599
|
}
|
|
@@ -1620,8 +1610,8 @@ class Qt extends g {
|
|
|
1620
1610
|
), t;
|
|
1621
1611
|
}
|
|
1622
1612
|
}
|
|
1623
|
-
const
|
|
1624
|
-
class
|
|
1613
|
+
const er = new Kt();
|
|
1614
|
+
class tr extends g {
|
|
1625
1615
|
constructor() {
|
|
1626
1616
|
super(
|
|
1627
1617
|
"MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL.HTTPHeader",
|
|
@@ -1654,9 +1644,9 @@ class Yt extends g {
|
|
|
1654
1644
|
), t;
|
|
1655
1645
|
}
|
|
1656
1646
|
internalBinaryRead(e, t, n, r) {
|
|
1657
|
-
let o = r ?? this.create(),
|
|
1658
|
-
for (; e.pos <
|
|
1659
|
-
let [i,
|
|
1647
|
+
let o = r ?? this.create(), a = e.pos + t;
|
|
1648
|
+
for (; e.pos < a; ) {
|
|
1649
|
+
let [i, c] = e.tag();
|
|
1660
1650
|
switch (i) {
|
|
1661
1651
|
case /* string Name = 1 [json_name = "Name"];*/
|
|
1662
1652
|
1:
|
|
@@ -1667,17 +1657,17 @@ class Yt extends g {
|
|
|
1667
1657
|
o.value = e.string();
|
|
1668
1658
|
break;
|
|
1669
1659
|
default:
|
|
1670
|
-
let
|
|
1671
|
-
if (
|
|
1660
|
+
let l = n.readUnknownField;
|
|
1661
|
+
if (l === "throw")
|
|
1672
1662
|
throw new globalThis.Error(
|
|
1673
|
-
`Unknown field ${i} (wire type ${
|
|
1663
|
+
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
1674
1664
|
);
|
|
1675
|
-
let p = e.skip(
|
|
1676
|
-
|
|
1665
|
+
let p = e.skip(c);
|
|
1666
|
+
l !== !1 && (l === !0 ? u.onRead : l)(
|
|
1677
1667
|
this.typeName,
|
|
1678
1668
|
o,
|
|
1679
1669
|
i,
|
|
1680
|
-
|
|
1670
|
+
c,
|
|
1681
1671
|
p
|
|
1682
1672
|
);
|
|
1683
1673
|
}
|
|
@@ -1694,8 +1684,8 @@ class Yt extends g {
|
|
|
1694
1684
|
), t;
|
|
1695
1685
|
}
|
|
1696
1686
|
}
|
|
1697
|
-
const
|
|
1698
|
-
class
|
|
1687
|
+
const z = new tr();
|
|
1688
|
+
class rr extends g {
|
|
1699
1689
|
constructor() {
|
|
1700
1690
|
super(
|
|
1701
1691
|
"MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL.Response",
|
|
@@ -1712,7 +1702,7 @@ class Kt extends g {
|
|
|
1712
1702
|
name: "headers",
|
|
1713
1703
|
kind: "message",
|
|
1714
1704
|
repeat: 1,
|
|
1715
|
-
T: () =>
|
|
1705
|
+
T: () => z
|
|
1716
1706
|
}
|
|
1717
1707
|
]
|
|
1718
1708
|
);
|
|
@@ -1726,9 +1716,9 @@ class Kt extends g {
|
|
|
1726
1716
|
), t;
|
|
1727
1717
|
}
|
|
1728
1718
|
internalBinaryRead(e, t, n, r) {
|
|
1729
|
-
let o = r ?? this.create(),
|
|
1730
|
-
for (; e.pos <
|
|
1731
|
-
let [i,
|
|
1719
|
+
let o = r ?? this.create(), a = e.pos + t;
|
|
1720
|
+
for (; e.pos < a; ) {
|
|
1721
|
+
let [i, c] = e.tag();
|
|
1732
1722
|
switch (i) {
|
|
1733
1723
|
case /* string download_url */
|
|
1734
1724
|
1:
|
|
@@ -1737,7 +1727,7 @@ class Kt extends g {
|
|
|
1737
1727
|
case /* repeated MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL.HTTPHeader headers */
|
|
1738
1728
|
2:
|
|
1739
1729
|
o.headers.push(
|
|
1740
|
-
|
|
1730
|
+
z.internalBinaryRead(
|
|
1741
1731
|
e,
|
|
1742
1732
|
e.uint32(),
|
|
1743
1733
|
n
|
|
@@ -1745,17 +1735,17 @@ class Kt extends g {
|
|
|
1745
1735
|
);
|
|
1746
1736
|
break;
|
|
1747
1737
|
default:
|
|
1748
|
-
let
|
|
1749
|
-
if (
|
|
1738
|
+
let l = n.readUnknownField;
|
|
1739
|
+
if (l === "throw")
|
|
1750
1740
|
throw new globalThis.Error(
|
|
1751
|
-
`Unknown field ${i} (wire type ${
|
|
1741
|
+
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
1752
1742
|
);
|
|
1753
|
-
let p = e.skip(
|
|
1754
|
-
|
|
1743
|
+
let p = e.skip(c);
|
|
1744
|
+
l !== !1 && (l === !0 ? u.onRead : l)(
|
|
1755
1745
|
this.typeName,
|
|
1756
1746
|
o,
|
|
1757
1747
|
i,
|
|
1758
|
-
|
|
1748
|
+
c,
|
|
1759
1749
|
p
|
|
1760
1750
|
);
|
|
1761
1751
|
}
|
|
@@ -1765,7 +1755,7 @@ class Kt extends g {
|
|
|
1765
1755
|
internalBinaryWrite(e, t, n) {
|
|
1766
1756
|
e.downloadUrl !== "" && t.tag(1, h.LengthDelimited).string(e.downloadUrl);
|
|
1767
1757
|
for (let o = 0; o < e.headers.length; o++)
|
|
1768
|
-
|
|
1758
|
+
z.internalBinaryWrite(
|
|
1769
1759
|
e.headers[o],
|
|
1770
1760
|
t.tag(2, h.LengthDelimited).fork(),
|
|
1771
1761
|
n
|
|
@@ -1778,7 +1768,7 @@ class Kt extends g {
|
|
|
1778
1768
|
), t;
|
|
1779
1769
|
}
|
|
1780
1770
|
}
|
|
1781
|
-
const
|
|
1771
|
+
const nr = new rr(), x = new D(
|
|
1782
1772
|
"MiLaboratories.Controller.Shared.Download",
|
|
1783
1773
|
[
|
|
1784
1774
|
{
|
|
@@ -1786,12 +1776,12 @@ const er = new Kt(), x = new D(
|
|
|
1786
1776
|
options: {
|
|
1787
1777
|
"google.api.http": { get: "/resources/{resource_id}/get-download-url" }
|
|
1788
1778
|
},
|
|
1789
|
-
I:
|
|
1790
|
-
O:
|
|
1779
|
+
I: er,
|
|
1780
|
+
O: nr
|
|
1791
1781
|
}
|
|
1792
1782
|
]
|
|
1793
1783
|
);
|
|
1794
|
-
class
|
|
1784
|
+
class or {
|
|
1795
1785
|
constructor(e) {
|
|
1796
1786
|
d(this, "typeName", x.typeName);
|
|
1797
1787
|
d(this, "methods", x.methods);
|
|
@@ -1808,48 +1798,46 @@ class tr {
|
|
|
1808
1798
|
}
|
|
1809
1799
|
class ae extends Error {
|
|
1810
1800
|
}
|
|
1811
|
-
class
|
|
1801
|
+
class Se {
|
|
1812
1802
|
constructor(e) {
|
|
1813
1803
|
this.httpClient = e;
|
|
1814
1804
|
}
|
|
1815
1805
|
async downloadRemoteFile(e, t, n) {
|
|
1816
|
-
const { statusCode: r, body: o, headers:
|
|
1806
|
+
const { statusCode: r, body: o, headers: a } = await Te(e, {
|
|
1817
1807
|
dispatcher: this.httpClient,
|
|
1818
1808
|
headers: t,
|
|
1819
1809
|
signal: n
|
|
1820
1810
|
}), i = re.toWeb(o);
|
|
1821
1811
|
if (r != 200) {
|
|
1822
|
-
const
|
|
1812
|
+
const c = await et(i), l = c.substring(0, Math.min(c.length, 1e3));
|
|
1823
1813
|
throw 400 <= r && r < 500 ? new ae(
|
|
1824
|
-
`Http error: statusCode: ${r} url: ${e.toString()}, beginning of body: ${
|
|
1825
|
-
) : new Error(
|
|
1826
|
-
`Http error: statusCode: ${r} url: ${e.toString()}`
|
|
1827
|
-
);
|
|
1814
|
+
`Http error: statusCode: ${r} url: ${e.toString()}, beginning of body: ${l}`
|
|
1815
|
+
) : new Error(`Http error: statusCode: ${r} url: ${e.toString()}`);
|
|
1828
1816
|
}
|
|
1829
1817
|
return {
|
|
1830
1818
|
content: i,
|
|
1831
|
-
size: Number(
|
|
1819
|
+
size: Number(a["content-length"])
|
|
1832
1820
|
};
|
|
1833
1821
|
}
|
|
1834
1822
|
}
|
|
1835
1823
|
function B(s) {
|
|
1836
|
-
if (!
|
|
1824
|
+
if (!Z.isAbsolute(s)) throw new Error(`Path ${s} is not absolute.`);
|
|
1837
1825
|
return s;
|
|
1838
1826
|
}
|
|
1839
|
-
const
|
|
1840
|
-
class Se extends Error {
|
|
1841
|
-
}
|
|
1827
|
+
const sr = "storage://";
|
|
1842
1828
|
class Ne extends Error {
|
|
1843
1829
|
}
|
|
1844
|
-
class
|
|
1830
|
+
class Ue extends Error {
|
|
1831
|
+
}
|
|
1832
|
+
class ir {
|
|
1845
1833
|
constructor(e, t, n, r) {
|
|
1846
1834
|
d(this, "grpcClient");
|
|
1847
1835
|
d(this, "downloadHelper");
|
|
1848
1836
|
d(this, "localStorageIdsToRoot");
|
|
1849
|
-
d(this, "isLocal", (e) => e.startsWith(
|
|
1837
|
+
d(this, "isLocal", (e) => e.startsWith(sr));
|
|
1850
1838
|
this.grpcTransport = e, this.httpClient = t, this.logger = n;
|
|
1851
1839
|
for (const o of r) o.localPath !== "" && B(o.localPath);
|
|
1852
|
-
this.grpcClient = new
|
|
1840
|
+
this.grpcClient = new or(this.grpcTransport), this.downloadHelper = new Se(t), this.localStorageIdsToRoot = new Map(
|
|
1853
1841
|
r.map((o) => [o.storageId, o.localPath])
|
|
1854
1842
|
);
|
|
1855
1843
|
}
|
|
@@ -1866,32 +1854,32 @@ class nr {
|
|
|
1866
1854
|
const { downloadUrl: r, headers: o } = await this.getUrl(e, t, n);
|
|
1867
1855
|
return this.logger.info(`download from url ${r}`), this.isLocal(r) ? await this.readLocalFile(r) : await this.downloadHelper.downloadRemoteFile(
|
|
1868
1856
|
r,
|
|
1869
|
-
|
|
1857
|
+
lr(o),
|
|
1870
1858
|
n
|
|
1871
1859
|
);
|
|
1872
1860
|
}
|
|
1873
1861
|
async readLocalFile(e) {
|
|
1874
|
-
const t =
|
|
1862
|
+
const t = ar(e, this.localStorageIdsToRoot), r = (await m.stat(t)).size;
|
|
1875
1863
|
return {
|
|
1876
1864
|
content: re.toWeb(O.createReadStream(t)),
|
|
1877
1865
|
size: r
|
|
1878
1866
|
};
|
|
1879
1867
|
}
|
|
1880
1868
|
}
|
|
1881
|
-
function
|
|
1869
|
+
function ar(s, e) {
|
|
1882
1870
|
const t = new URL(s);
|
|
1883
1871
|
if (t.pathname == "")
|
|
1884
|
-
throw new
|
|
1872
|
+
throw new Ue(`url for local filepath ${s} does not match url scheme`);
|
|
1885
1873
|
const n = t.host, r = e.get(n);
|
|
1886
1874
|
if (r === void 0)
|
|
1887
|
-
throw new
|
|
1875
|
+
throw new Ne(`Unknown storage location: ${n}`);
|
|
1888
1876
|
const o = decodeURIComponent(t.pathname.slice(1));
|
|
1889
1877
|
return r === "" ? o : w.join(r, o);
|
|
1890
1878
|
}
|
|
1891
|
-
function
|
|
1879
|
+
function lr(s) {
|
|
1892
1880
|
return Object.fromEntries(s.map(({ name: e, value: t }) => [e, t]));
|
|
1893
1881
|
}
|
|
1894
|
-
class
|
|
1882
|
+
class cr extends g {
|
|
1895
1883
|
constructor() {
|
|
1896
1884
|
super("google.protobuf.Timestamp", [
|
|
1897
1885
|
{
|
|
@@ -1961,7 +1949,7 @@ class ir extends g {
|
|
|
1961
1949
|
internalJsonRead(e, t, n) {
|
|
1962
1950
|
if (typeof e != "string")
|
|
1963
1951
|
throw new Error(
|
|
1964
|
-
"Unable to parse Timestamp from JSON " +
|
|
1952
|
+
"Unable to parse Timestamp from JSON " + be(e) + "."
|
|
1965
1953
|
);
|
|
1966
1954
|
let r = e.match(
|
|
1967
1955
|
/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/
|
|
@@ -1984,9 +1972,9 @@ class ir extends g {
|
|
|
1984
1972
|
return t.seconds = 0n, t.nanos = 0, e !== void 0 && f(this, t, e), t;
|
|
1985
1973
|
}
|
|
1986
1974
|
internalBinaryRead(e, t, n, r) {
|
|
1987
|
-
let o = r ?? this.create(),
|
|
1988
|
-
for (; e.pos <
|
|
1989
|
-
let [i,
|
|
1975
|
+
let o = r ?? this.create(), a = e.pos + t;
|
|
1976
|
+
for (; e.pos < a; ) {
|
|
1977
|
+
let [i, c] = e.tag();
|
|
1990
1978
|
switch (i) {
|
|
1991
1979
|
case /* int64 seconds */
|
|
1992
1980
|
1:
|
|
@@ -1997,17 +1985,17 @@ class ir extends g {
|
|
|
1997
1985
|
o.nanos = e.int32();
|
|
1998
1986
|
break;
|
|
1999
1987
|
default:
|
|
2000
|
-
let
|
|
2001
|
-
if (
|
|
1988
|
+
let l = n.readUnknownField;
|
|
1989
|
+
if (l === "throw")
|
|
2002
1990
|
throw new globalThis.Error(
|
|
2003
|
-
`Unknown field ${i} (wire type ${
|
|
1991
|
+
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
2004
1992
|
);
|
|
2005
|
-
let p = e.skip(
|
|
2006
|
-
|
|
1993
|
+
let p = e.skip(c);
|
|
1994
|
+
l !== !1 && (l === !0 ? u.onRead : l)(
|
|
2007
1995
|
this.typeName,
|
|
2008
1996
|
o,
|
|
2009
1997
|
i,
|
|
2010
|
-
|
|
1998
|
+
c,
|
|
2011
1999
|
p
|
|
2012
2000
|
);
|
|
2013
2001
|
}
|
|
@@ -2024,8 +2012,8 @@ class ir extends g {
|
|
|
2024
2012
|
), t;
|
|
2025
2013
|
}
|
|
2026
2014
|
}
|
|
2027
|
-
const M = new
|
|
2028
|
-
class
|
|
2015
|
+
const M = new cr();
|
|
2016
|
+
class dr extends g {
|
|
2029
2017
|
constructor() {
|
|
2030
2018
|
super("MiLaboratories.Controller.Shared.LsAPI", []);
|
|
2031
2019
|
}
|
|
@@ -2045,8 +2033,8 @@ class ar extends g {
|
|
|
2045
2033
|
), t;
|
|
2046
2034
|
}
|
|
2047
2035
|
}
|
|
2048
|
-
new
|
|
2049
|
-
class
|
|
2036
|
+
new dr();
|
|
2037
|
+
class hr extends g {
|
|
2050
2038
|
constructor() {
|
|
2051
2039
|
super("MiLaboratories.Controller.Shared.LsAPI.ListItem", [
|
|
2052
2040
|
{
|
|
@@ -2100,9 +2088,9 @@ class lr extends g {
|
|
|
2100
2088
|
return t.name = "", t.size = 0n, t.isDir = !1, t.fullName = "", t.directory = "", t.version = "", e !== void 0 && f(this, t, e), t;
|
|
2101
2089
|
}
|
|
2102
2090
|
internalBinaryRead(e, t, n, r) {
|
|
2103
|
-
let o = r ?? this.create(),
|
|
2104
|
-
for (; e.pos <
|
|
2105
|
-
let [i,
|
|
2091
|
+
let o = r ?? this.create(), a = e.pos + t;
|
|
2092
|
+
for (; e.pos < a; ) {
|
|
2093
|
+
let [i, c] = e.tag();
|
|
2106
2094
|
switch (i) {
|
|
2107
2095
|
case /* string name */
|
|
2108
2096
|
1:
|
|
@@ -2138,17 +2126,17 @@ class lr extends g {
|
|
|
2138
2126
|
o.version = e.string();
|
|
2139
2127
|
break;
|
|
2140
2128
|
default:
|
|
2141
|
-
let
|
|
2142
|
-
if (
|
|
2129
|
+
let l = n.readUnknownField;
|
|
2130
|
+
if (l === "throw")
|
|
2143
2131
|
throw new globalThis.Error(
|
|
2144
|
-
`Unknown field ${i} (wire type ${
|
|
2132
|
+
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
2145
2133
|
);
|
|
2146
|
-
let p = e.skip(
|
|
2147
|
-
|
|
2134
|
+
let p = e.skip(c);
|
|
2135
|
+
l !== !1 && (l === !0 ? u.onRead : l)(
|
|
2148
2136
|
this.typeName,
|
|
2149
2137
|
o,
|
|
2150
2138
|
i,
|
|
2151
|
-
|
|
2139
|
+
c,
|
|
2152
2140
|
p
|
|
2153
2141
|
);
|
|
2154
2142
|
}
|
|
@@ -2169,8 +2157,8 @@ class lr extends g {
|
|
|
2169
2157
|
), t;
|
|
2170
2158
|
}
|
|
2171
2159
|
}
|
|
2172
|
-
const H = new
|
|
2173
|
-
class
|
|
2160
|
+
const H = new hr();
|
|
2161
|
+
class ur extends g {
|
|
2174
2162
|
constructor() {
|
|
2175
2163
|
super("MiLaboratories.Controller.Shared.LsAPI.List", []);
|
|
2176
2164
|
}
|
|
@@ -2190,8 +2178,8 @@ class cr extends g {
|
|
|
2190
2178
|
), t;
|
|
2191
2179
|
}
|
|
2192
2180
|
}
|
|
2193
|
-
new
|
|
2194
|
-
class
|
|
2181
|
+
new ur();
|
|
2182
|
+
class pr extends g {
|
|
2195
2183
|
constructor() {
|
|
2196
2184
|
super("MiLaboratories.Controller.Shared.LsAPI.List.Request", [
|
|
2197
2185
|
{
|
|
@@ -2216,9 +2204,9 @@ class dr extends g {
|
|
|
2216
2204
|
return t.resourceId = 0n, t.location = "", e !== void 0 && f(this, t, e), t;
|
|
2217
2205
|
}
|
|
2218
2206
|
internalBinaryRead(e, t, n, r) {
|
|
2219
|
-
let o = r ?? this.create(),
|
|
2220
|
-
for (; e.pos <
|
|
2221
|
-
let [i,
|
|
2207
|
+
let o = r ?? this.create(), a = e.pos + t;
|
|
2208
|
+
for (; e.pos < a; ) {
|
|
2209
|
+
let [i, c] = e.tag();
|
|
2222
2210
|
switch (i) {
|
|
2223
2211
|
case /* uint64 resource_id */
|
|
2224
2212
|
1:
|
|
@@ -2229,17 +2217,17 @@ class dr extends g {
|
|
|
2229
2217
|
o.location = e.string();
|
|
2230
2218
|
break;
|
|
2231
2219
|
default:
|
|
2232
|
-
let
|
|
2233
|
-
if (
|
|
2220
|
+
let l = n.readUnknownField;
|
|
2221
|
+
if (l === "throw")
|
|
2234
2222
|
throw new globalThis.Error(
|
|
2235
|
-
`Unknown field ${i} (wire type ${
|
|
2223
|
+
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
2236
2224
|
);
|
|
2237
|
-
let p = e.skip(
|
|
2238
|
-
|
|
2225
|
+
let p = e.skip(c);
|
|
2226
|
+
l !== !1 && (l === !0 ? u.onRead : l)(
|
|
2239
2227
|
this.typeName,
|
|
2240
2228
|
o,
|
|
2241
2229
|
i,
|
|
2242
|
-
|
|
2230
|
+
c,
|
|
2243
2231
|
p
|
|
2244
2232
|
);
|
|
2245
2233
|
}
|
|
@@ -2256,8 +2244,8 @@ class dr extends g {
|
|
|
2256
2244
|
), t;
|
|
2257
2245
|
}
|
|
2258
2246
|
}
|
|
2259
|
-
const
|
|
2260
|
-
class
|
|
2247
|
+
const gr = new pr();
|
|
2248
|
+
class fr extends g {
|
|
2261
2249
|
constructor() {
|
|
2262
2250
|
super("MiLaboratories.Controller.Shared.LsAPI.List.Response", [
|
|
2263
2251
|
{
|
|
@@ -2281,9 +2269,9 @@ class ur extends g {
|
|
|
2281
2269
|
return t.items = [], t.delimiter = "", e !== void 0 && f(this, t, e), t;
|
|
2282
2270
|
}
|
|
2283
2271
|
internalBinaryRead(e, t, n, r) {
|
|
2284
|
-
let o = r ?? this.create(),
|
|
2285
|
-
for (; e.pos <
|
|
2286
|
-
let [i,
|
|
2272
|
+
let o = r ?? this.create(), a = e.pos + t;
|
|
2273
|
+
for (; e.pos < a; ) {
|
|
2274
|
+
let [i, c] = e.tag();
|
|
2287
2275
|
switch (i) {
|
|
2288
2276
|
case /* repeated MiLaboratories.Controller.Shared.LsAPI.ListItem items */
|
|
2289
2277
|
1:
|
|
@@ -2296,17 +2284,17 @@ class ur extends g {
|
|
|
2296
2284
|
o.delimiter = e.string();
|
|
2297
2285
|
break;
|
|
2298
2286
|
default:
|
|
2299
|
-
let
|
|
2300
|
-
if (
|
|
2287
|
+
let l = n.readUnknownField;
|
|
2288
|
+
if (l === "throw")
|
|
2301
2289
|
throw new globalThis.Error(
|
|
2302
|
-
`Unknown field ${i} (wire type ${
|
|
2290
|
+
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
2303
2291
|
);
|
|
2304
|
-
let p = e.skip(
|
|
2305
|
-
|
|
2292
|
+
let p = e.skip(c);
|
|
2293
|
+
l !== !1 && (l === !0 ? u.onRead : l)(
|
|
2306
2294
|
this.typeName,
|
|
2307
2295
|
o,
|
|
2308
2296
|
i,
|
|
2309
|
-
|
|
2297
|
+
c,
|
|
2310
2298
|
p
|
|
2311
2299
|
);
|
|
2312
2300
|
}
|
|
@@ -2329,10 +2317,10 @@ class ur extends g {
|
|
|
2329
2317
|
), t;
|
|
2330
2318
|
}
|
|
2331
2319
|
}
|
|
2332
|
-
const
|
|
2333
|
-
{ name: "List", options: {}, I:
|
|
2320
|
+
const mr = new fr(), j = new D("MiLaboratories.Controller.Shared.LS", [
|
|
2321
|
+
{ name: "List", options: {}, I: gr, O: mr }
|
|
2334
2322
|
]);
|
|
2335
|
-
class
|
|
2323
|
+
class wr {
|
|
2336
2324
|
constructor(e) {
|
|
2337
2325
|
d(this, "typeName", j.typeName);
|
|
2338
2326
|
d(this, "methods", j.methods);
|
|
@@ -2353,10 +2341,10 @@ class gr {
|
|
|
2353
2341
|
);
|
|
2354
2342
|
}
|
|
2355
2343
|
}
|
|
2356
|
-
class
|
|
2344
|
+
class yr {
|
|
2357
2345
|
constructor(e, t) {
|
|
2358
2346
|
d(this, "grpcClient");
|
|
2359
|
-
this.logger = t, this.grpcClient = new
|
|
2347
|
+
this.logger = t, this.grpcClient = new wr(e);
|
|
2360
2348
|
}
|
|
2361
2349
|
close() {
|
|
2362
2350
|
}
|
|
@@ -2370,7 +2358,7 @@ class fr {
|
|
|
2370
2358
|
).response;
|
|
2371
2359
|
}
|
|
2372
2360
|
}
|
|
2373
|
-
class
|
|
2361
|
+
class br extends g {
|
|
2374
2362
|
constructor() {
|
|
2375
2363
|
super("MiLaboratories.Controller.Shared.StreamingAPI", []);
|
|
2376
2364
|
}
|
|
@@ -2390,8 +2378,8 @@ class mr extends g {
|
|
|
2390
2378
|
), t;
|
|
2391
2379
|
}
|
|
2392
2380
|
}
|
|
2393
|
-
new
|
|
2394
|
-
class
|
|
2381
|
+
new br();
|
|
2382
|
+
class Tr extends g {
|
|
2395
2383
|
constructor() {
|
|
2396
2384
|
super("MiLaboratories.Controller.Shared.StreamingAPI.StreamBinary", [
|
|
2397
2385
|
{
|
|
@@ -2434,9 +2422,9 @@ class wr extends g {
|
|
|
2434
2422
|
return t.resourceId = 0n, t.offset = 0n, e !== void 0 && f(this, t, e), t;
|
|
2435
2423
|
}
|
|
2436
2424
|
internalBinaryRead(e, t, n, r) {
|
|
2437
|
-
let o = r ?? this.create(),
|
|
2438
|
-
for (; e.pos <
|
|
2439
|
-
let [i,
|
|
2425
|
+
let o = r ?? this.create(), a = e.pos + t;
|
|
2426
|
+
for (; e.pos < a; ) {
|
|
2427
|
+
let [i, c] = e.tag();
|
|
2440
2428
|
switch (i) {
|
|
2441
2429
|
case /* uint64 resource_id */
|
|
2442
2430
|
1:
|
|
@@ -2455,17 +2443,17 @@ class wr extends g {
|
|
|
2455
2443
|
o.readLimit = e.int64().toBigInt();
|
|
2456
2444
|
break;
|
|
2457
2445
|
default:
|
|
2458
|
-
let
|
|
2459
|
-
if (
|
|
2446
|
+
let l = n.readUnknownField;
|
|
2447
|
+
if (l === "throw")
|
|
2460
2448
|
throw new globalThis.Error(
|
|
2461
|
-
`Unknown field ${i} (wire type ${
|
|
2449
|
+
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
2462
2450
|
);
|
|
2463
|
-
let p = e.skip(
|
|
2464
|
-
|
|
2451
|
+
let p = e.skip(c);
|
|
2452
|
+
l !== !1 && (l === !0 ? u.onRead : l)(
|
|
2465
2453
|
this.typeName,
|
|
2466
2454
|
o,
|
|
2467
2455
|
i,
|
|
2468
|
-
|
|
2456
|
+
c,
|
|
2469
2457
|
p
|
|
2470
2458
|
);
|
|
2471
2459
|
}
|
|
@@ -2482,8 +2470,8 @@ class wr extends g {
|
|
|
2482
2470
|
), t;
|
|
2483
2471
|
}
|
|
2484
2472
|
}
|
|
2485
|
-
const
|
|
2486
|
-
class
|
|
2473
|
+
const kr = new Tr();
|
|
2474
|
+
class Lr extends g {
|
|
2487
2475
|
constructor() {
|
|
2488
2476
|
super("MiLaboratories.Controller.Shared.StreamingAPI.ReadBinary", [
|
|
2489
2477
|
{
|
|
@@ -2517,9 +2505,9 @@ class br extends g {
|
|
|
2517
2505
|
return t.resourceId = 0n, t.offset = 0n, e !== void 0 && f(this, t, e), t;
|
|
2518
2506
|
}
|
|
2519
2507
|
internalBinaryRead(e, t, n, r) {
|
|
2520
|
-
let o = r ?? this.create(),
|
|
2521
|
-
for (; e.pos <
|
|
2522
|
-
let [i,
|
|
2508
|
+
let o = r ?? this.create(), a = e.pos + t;
|
|
2509
|
+
for (; e.pos < a; ) {
|
|
2510
|
+
let [i, c] = e.tag();
|
|
2523
2511
|
switch (i) {
|
|
2524
2512
|
case /* uint64 resource_id */
|
|
2525
2513
|
1:
|
|
@@ -2534,17 +2522,17 @@ class br extends g {
|
|
|
2534
2522
|
o.chunkSize = e.uint32();
|
|
2535
2523
|
break;
|
|
2536
2524
|
default:
|
|
2537
|
-
let
|
|
2538
|
-
if (
|
|
2525
|
+
let l = n.readUnknownField;
|
|
2526
|
+
if (l === "throw")
|
|
2539
2527
|
throw new globalThis.Error(
|
|
2540
|
-
`Unknown field ${i} (wire type ${
|
|
2528
|
+
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
2541
2529
|
);
|
|
2542
|
-
let p = e.skip(
|
|
2543
|
-
|
|
2530
|
+
let p = e.skip(c);
|
|
2531
|
+
l !== !1 && (l === !0 ? u.onRead : l)(
|
|
2544
2532
|
this.typeName,
|
|
2545
2533
|
o,
|
|
2546
2534
|
i,
|
|
2547
|
-
|
|
2535
|
+
c,
|
|
2548
2536
|
p
|
|
2549
2537
|
);
|
|
2550
2538
|
}
|
|
@@ -2561,8 +2549,8 @@ class br extends g {
|
|
|
2561
2549
|
), t;
|
|
2562
2550
|
}
|
|
2563
2551
|
}
|
|
2564
|
-
const
|
|
2565
|
-
class
|
|
2552
|
+
const Pr = new Lr();
|
|
2553
|
+
class Ir extends g {
|
|
2566
2554
|
constructor() {
|
|
2567
2555
|
super("MiLaboratories.Controller.Shared.StreamingAPI.StreamText", [
|
|
2568
2556
|
{
|
|
@@ -2613,9 +2601,9 @@ class kr extends g {
|
|
|
2613
2601
|
return t.resourceId = 0n, t.offset = 0n, e !== void 0 && f(this, t, e), t;
|
|
2614
2602
|
}
|
|
2615
2603
|
internalBinaryRead(e, t, n, r) {
|
|
2616
|
-
let o = r ?? this.create(),
|
|
2617
|
-
for (; e.pos <
|
|
2618
|
-
let [i,
|
|
2604
|
+
let o = r ?? this.create(), a = e.pos + t;
|
|
2605
|
+
for (; e.pos < a; ) {
|
|
2606
|
+
let [i, c] = e.tag();
|
|
2619
2607
|
switch (i) {
|
|
2620
2608
|
case /* uint64 resource_id */
|
|
2621
2609
|
1:
|
|
@@ -2638,17 +2626,17 @@ class kr extends g {
|
|
|
2638
2626
|
o.searchRe = e.string();
|
|
2639
2627
|
break;
|
|
2640
2628
|
default:
|
|
2641
|
-
let
|
|
2642
|
-
if (
|
|
2629
|
+
let l = n.readUnknownField;
|
|
2630
|
+
if (l === "throw")
|
|
2643
2631
|
throw new globalThis.Error(
|
|
2644
|
-
`Unknown field ${i} (wire type ${
|
|
2632
|
+
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
2645
2633
|
);
|
|
2646
|
-
let p = e.skip(
|
|
2647
|
-
|
|
2634
|
+
let p = e.skip(c);
|
|
2635
|
+
l !== !1 && (l === !0 ? u.onRead : l)(
|
|
2648
2636
|
this.typeName,
|
|
2649
2637
|
o,
|
|
2650
2638
|
i,
|
|
2651
|
-
|
|
2639
|
+
c,
|
|
2652
2640
|
p
|
|
2653
2641
|
);
|
|
2654
2642
|
}
|
|
@@ -2665,8 +2653,8 @@ class kr extends g {
|
|
|
2665
2653
|
), t;
|
|
2666
2654
|
}
|
|
2667
2655
|
}
|
|
2668
|
-
const
|
|
2669
|
-
class
|
|
2656
|
+
const Rr = new Ir();
|
|
2657
|
+
class Sr extends g {
|
|
2670
2658
|
constructor() {
|
|
2671
2659
|
super("MiLaboratories.Controller.Shared.StreamingAPI.ReadText", [
|
|
2672
2660
|
{
|
|
@@ -2717,9 +2705,9 @@ class Pr extends g {
|
|
|
2717
2705
|
return t.resourceId = 0n, t.offset = 0n, e !== void 0 && f(this, t, e), t;
|
|
2718
2706
|
}
|
|
2719
2707
|
internalBinaryRead(e, t, n, r) {
|
|
2720
|
-
let o = r ?? this.create(),
|
|
2721
|
-
for (; e.pos <
|
|
2722
|
-
let [i,
|
|
2708
|
+
let o = r ?? this.create(), a = e.pos + t;
|
|
2709
|
+
for (; e.pos < a; ) {
|
|
2710
|
+
let [i, c] = e.tag();
|
|
2723
2711
|
switch (i) {
|
|
2724
2712
|
case /* uint64 resource_id */
|
|
2725
2713
|
1:
|
|
@@ -2742,17 +2730,17 @@ class Pr extends g {
|
|
|
2742
2730
|
o.searchRe = e.string();
|
|
2743
2731
|
break;
|
|
2744
2732
|
default:
|
|
2745
|
-
let
|
|
2746
|
-
if (
|
|
2733
|
+
let l = n.readUnknownField;
|
|
2734
|
+
if (l === "throw")
|
|
2747
2735
|
throw new globalThis.Error(
|
|
2748
|
-
`Unknown field ${i} (wire type ${
|
|
2736
|
+
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
2749
2737
|
);
|
|
2750
|
-
let p = e.skip(
|
|
2751
|
-
|
|
2738
|
+
let p = e.skip(c);
|
|
2739
|
+
l !== !1 && (l === !0 ? u.onRead : l)(
|
|
2752
2740
|
this.typeName,
|
|
2753
2741
|
o,
|
|
2754
2742
|
i,
|
|
2755
|
-
|
|
2743
|
+
c,
|
|
2756
2744
|
p
|
|
2757
2745
|
);
|
|
2758
2746
|
}
|
|
@@ -2769,8 +2757,8 @@ class Pr extends g {
|
|
|
2769
2757
|
), t;
|
|
2770
2758
|
}
|
|
2771
2759
|
}
|
|
2772
|
-
const
|
|
2773
|
-
class
|
|
2760
|
+
const Nr = new Sr();
|
|
2761
|
+
class Ur extends g {
|
|
2774
2762
|
constructor() {
|
|
2775
2763
|
super("MiLaboratories.Controller.Shared.StreamingAPI.LastLines", [
|
|
2776
2764
|
{
|
|
@@ -2821,9 +2809,9 @@ class Rr extends g {
|
|
|
2821
2809
|
return t.resourceId = 0n, e !== void 0 && f(this, t, e), t;
|
|
2822
2810
|
}
|
|
2823
2811
|
internalBinaryRead(e, t, n, r) {
|
|
2824
|
-
let o = r ?? this.create(),
|
|
2825
|
-
for (; e.pos <
|
|
2826
|
-
let [i,
|
|
2812
|
+
let o = r ?? this.create(), a = e.pos + t;
|
|
2813
|
+
for (; e.pos < a; ) {
|
|
2814
|
+
let [i, c] = e.tag();
|
|
2827
2815
|
switch (i) {
|
|
2828
2816
|
case /* uint64 resource_id */
|
|
2829
2817
|
1:
|
|
@@ -2846,17 +2834,17 @@ class Rr extends g {
|
|
|
2846
2834
|
o.searchRe = e.string();
|
|
2847
2835
|
break;
|
|
2848
2836
|
default:
|
|
2849
|
-
let
|
|
2850
|
-
if (
|
|
2837
|
+
let l = n.readUnknownField;
|
|
2838
|
+
if (l === "throw")
|
|
2851
2839
|
throw new globalThis.Error(
|
|
2852
|
-
`Unknown field ${i} (wire type ${
|
|
2840
|
+
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
2853
2841
|
);
|
|
2854
|
-
let p = e.skip(
|
|
2855
|
-
|
|
2842
|
+
let p = e.skip(c);
|
|
2843
|
+
l !== !1 && (l === !0 ? u.onRead : l)(
|
|
2856
2844
|
this.typeName,
|
|
2857
2845
|
o,
|
|
2858
2846
|
i,
|
|
2859
|
-
|
|
2847
|
+
c,
|
|
2860
2848
|
p
|
|
2861
2849
|
);
|
|
2862
2850
|
}
|
|
@@ -2873,8 +2861,8 @@ class Rr extends g {
|
|
|
2873
2861
|
), t;
|
|
2874
2862
|
}
|
|
2875
2863
|
}
|
|
2876
|
-
const
|
|
2877
|
-
class
|
|
2864
|
+
const Br = new Ur();
|
|
2865
|
+
class Dr extends g {
|
|
2878
2866
|
constructor() {
|
|
2879
2867
|
super("MiLaboratories.Controller.Shared.StreamingAPI.Response", [
|
|
2880
2868
|
{
|
|
@@ -2907,9 +2895,9 @@ class Nr extends g {
|
|
|
2907
2895
|
return t.data = new Uint8Array(0), t.size = 0n, t.newOffset = 0n, e !== void 0 && f(this, t, e), t;
|
|
2908
2896
|
}
|
|
2909
2897
|
internalBinaryRead(e, t, n, r) {
|
|
2910
|
-
let o = r ?? this.create(),
|
|
2911
|
-
for (; e.pos <
|
|
2912
|
-
let [i,
|
|
2898
|
+
let o = r ?? this.create(), a = e.pos + t;
|
|
2899
|
+
for (; e.pos < a; ) {
|
|
2900
|
+
let [i, c] = e.tag();
|
|
2913
2901
|
switch (i) {
|
|
2914
2902
|
case /* bytes data */
|
|
2915
2903
|
1:
|
|
@@ -2924,17 +2912,17 @@ class Nr extends g {
|
|
|
2924
2912
|
o.newOffset = e.uint64().toBigInt();
|
|
2925
2913
|
break;
|
|
2926
2914
|
default:
|
|
2927
|
-
let
|
|
2928
|
-
if (
|
|
2915
|
+
let l = n.readUnknownField;
|
|
2916
|
+
if (l === "throw")
|
|
2929
2917
|
throw new globalThis.Error(
|
|
2930
|
-
`Unknown field ${i} (wire type ${
|
|
2918
|
+
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
2931
2919
|
);
|
|
2932
|
-
let p = e.skip(
|
|
2933
|
-
|
|
2920
|
+
let p = e.skip(c);
|
|
2921
|
+
l !== !1 && (l === !0 ? u.onRead : l)(
|
|
2934
2922
|
this.typeName,
|
|
2935
2923
|
o,
|
|
2936
2924
|
i,
|
|
2937
|
-
|
|
2925
|
+
c,
|
|
2938
2926
|
p
|
|
2939
2927
|
);
|
|
2940
2928
|
}
|
|
@@ -2951,44 +2939,44 @@ class Nr extends g {
|
|
|
2951
2939
|
), t;
|
|
2952
2940
|
}
|
|
2953
2941
|
}
|
|
2954
|
-
const U = new
|
|
2942
|
+
const U = new Dr(), G = new D(
|
|
2955
2943
|
"MiLaboratories.Controller.Shared.Streaming",
|
|
2956
2944
|
[
|
|
2957
2945
|
{
|
|
2958
2946
|
name: "StreamBinary",
|
|
2959
2947
|
serverStreaming: !0,
|
|
2960
2948
|
options: {},
|
|
2961
|
-
I:
|
|
2949
|
+
I: kr,
|
|
2962
2950
|
O: U
|
|
2963
2951
|
},
|
|
2964
2952
|
{
|
|
2965
2953
|
name: "ReadBinary",
|
|
2966
2954
|
options: {},
|
|
2967
|
-
I:
|
|
2955
|
+
I: Pr,
|
|
2968
2956
|
O: U
|
|
2969
2957
|
},
|
|
2970
2958
|
{
|
|
2971
2959
|
name: "StreamText",
|
|
2972
2960
|
serverStreaming: !0,
|
|
2973
2961
|
options: {},
|
|
2974
|
-
I:
|
|
2962
|
+
I: Rr,
|
|
2975
2963
|
O: U
|
|
2976
2964
|
},
|
|
2977
2965
|
{
|
|
2978
2966
|
name: "ReadText",
|
|
2979
2967
|
options: {},
|
|
2980
|
-
I:
|
|
2968
|
+
I: Nr,
|
|
2981
2969
|
O: U
|
|
2982
2970
|
},
|
|
2983
2971
|
{
|
|
2984
2972
|
name: "LastLines",
|
|
2985
2973
|
options: {},
|
|
2986
|
-
I:
|
|
2974
|
+
I: Br,
|
|
2987
2975
|
O: U
|
|
2988
2976
|
}
|
|
2989
2977
|
]
|
|
2990
2978
|
);
|
|
2991
|
-
class
|
|
2979
|
+
class vr {
|
|
2992
2980
|
constructor(e) {
|
|
2993
2981
|
d(this, "typeName", G.typeName);
|
|
2994
2982
|
d(this, "methods", G.methods);
|
|
@@ -3087,17 +3075,17 @@ class Ur {
|
|
|
3087
3075
|
);
|
|
3088
3076
|
}
|
|
3089
3077
|
}
|
|
3090
|
-
class
|
|
3078
|
+
class $r {
|
|
3091
3079
|
constructor(e, t, n) {
|
|
3092
3080
|
d(this, "grpcClient");
|
|
3093
|
-
this.grpcTransport = e, this.httpClient = t, this.logger = n, this.grpcClient = new
|
|
3081
|
+
this.grpcTransport = e, this.httpClient = t, this.logger = n, this.grpcClient = new vr(this.grpcTransport);
|
|
3094
3082
|
}
|
|
3095
3083
|
close() {
|
|
3096
3084
|
}
|
|
3097
3085
|
/** Reads text back and returns the text,
|
|
3098
3086
|
* the new offset
|
|
3099
3087
|
* and the total size of the (currently existing) file. */
|
|
3100
|
-
async lastLines({ id: e, type: t }, n, r = 0n, o,
|
|
3088
|
+
async lastLines({ id: e, type: t }, n, r = 0n, o, a) {
|
|
3101
3089
|
return (await this.grpcClient.lastLines(
|
|
3102
3090
|
{
|
|
3103
3091
|
resourceId: e,
|
|
@@ -3105,13 +3093,13 @@ class Br {
|
|
|
3105
3093
|
offset: r,
|
|
3106
3094
|
search: o
|
|
3107
3095
|
},
|
|
3108
|
-
k(t,
|
|
3096
|
+
k(t, a)
|
|
3109
3097
|
)).response;
|
|
3110
3098
|
}
|
|
3111
3099
|
/** Reads the file forward and returns the text,
|
|
3112
3100
|
* the new offset
|
|
3113
3101
|
* and the total size of the (currently existing) file. */
|
|
3114
|
-
async readText({ id: e, type: t }, n, r = 0n, o,
|
|
3102
|
+
async readText({ id: e, type: t }, n, r = 0n, o, a) {
|
|
3115
3103
|
return (await this.grpcClient.readText(
|
|
3116
3104
|
{
|
|
3117
3105
|
resourceId: K(e),
|
|
@@ -3119,45 +3107,45 @@ class Br {
|
|
|
3119
3107
|
offset: r,
|
|
3120
3108
|
search: o
|
|
3121
3109
|
},
|
|
3122
|
-
k(t,
|
|
3110
|
+
k(t, a)
|
|
3123
3111
|
)).response;
|
|
3124
3112
|
}
|
|
3125
3113
|
}
|
|
3126
|
-
function
|
|
3114
|
+
function Cn(s, e, t) {
|
|
3127
3115
|
return e.getDriver({
|
|
3128
3116
|
name: "DownloadBlob",
|
|
3129
|
-
init: (n, r, o) => new
|
|
3117
|
+
init: (n, r, o) => new ir(r, o, s, t)
|
|
3130
3118
|
});
|
|
3131
3119
|
}
|
|
3132
|
-
function
|
|
3120
|
+
function On(s, e) {
|
|
3133
3121
|
return s.getDriver({
|
|
3134
3122
|
name: "StreamLogs",
|
|
3135
|
-
init: (t, n, r) => new
|
|
3123
|
+
init: (t, n, r) => new $r(n, r, e)
|
|
3136
3124
|
});
|
|
3137
3125
|
}
|
|
3138
|
-
function
|
|
3126
|
+
function Fn(s, e) {
|
|
3139
3127
|
return s.getDriver({
|
|
3140
3128
|
name: "UploadProgress",
|
|
3141
|
-
init: (t, n, r) => new
|
|
3129
|
+
init: (t, n, r) => new Qt(n, r, s, e)
|
|
3142
3130
|
});
|
|
3143
3131
|
}
|
|
3144
|
-
function
|
|
3132
|
+
function En(s, e) {
|
|
3145
3133
|
return s.getDriver({
|
|
3146
3134
|
name: "UploadBlob",
|
|
3147
|
-
init: (t, n, r) => new
|
|
3135
|
+
init: (t, n, r) => new Ot(n, r, s, e)
|
|
3148
3136
|
});
|
|
3149
3137
|
}
|
|
3150
|
-
function
|
|
3138
|
+
function _r(s, e) {
|
|
3151
3139
|
return s.getDriver({
|
|
3152
3140
|
name: "LsFiles",
|
|
3153
|
-
init: (t, n, r) => new
|
|
3141
|
+
init: (t, n, r) => new yr(n, e)
|
|
3154
3142
|
});
|
|
3155
3143
|
}
|
|
3156
|
-
class
|
|
3144
|
+
class Wn {
|
|
3157
3145
|
constructor(e, t) {
|
|
3158
3146
|
d(this, "updater");
|
|
3159
3147
|
d(this, "schedule", () => this.updater.schedule());
|
|
3160
|
-
this.onUpdate = e, this.sleepMs = t, this.updater = new
|
|
3148
|
+
this.onUpdate = e, this.sleepMs = t, this.updater = new Be(async () => {
|
|
3161
3149
|
for (; ; ) {
|
|
3162
3150
|
if (await this.onUpdate()) return;
|
|
3163
3151
|
await oe.wait(this.sleepMs);
|
|
@@ -3165,7 +3153,7 @@ class vn {
|
|
|
3165
3153
|
});
|
|
3166
3154
|
}
|
|
3167
3155
|
}
|
|
3168
|
-
class
|
|
3156
|
+
class Be {
|
|
3169
3157
|
constructor(e) {
|
|
3170
3158
|
d(this, "updating");
|
|
3171
3159
|
this.onUpdate = e;
|
|
@@ -3182,47 +3170,41 @@ class Ue {
|
|
|
3182
3170
|
})());
|
|
3183
3171
|
}
|
|
3184
3172
|
}
|
|
3185
|
-
async function
|
|
3173
|
+
async function An(s, e) {
|
|
3186
3174
|
return s.withReadTx("LogsDriverGetStream", async (t) => {
|
|
3187
|
-
const n = await t.getResourceData(e, !0), r = await
|
|
3175
|
+
const n = await t.getResourceData(e, !0), r = await Ge(t, Ve(n, "stream"));
|
|
3188
3176
|
if (r.error != "")
|
|
3189
3177
|
throw new Error(`while getting stream: ${r.error}`);
|
|
3190
|
-
if (!
|
|
3178
|
+
if (!qe(r.valueId))
|
|
3191
3179
|
return await t.getResourceData(r.valueId, !1);
|
|
3192
3180
|
});
|
|
3193
3181
|
}
|
|
3194
|
-
const
|
|
3195
|
-
function
|
|
3196
|
-
const t = s.replace(
|
|
3182
|
+
const De = "8C7#F1328%9E089B3D22", Cr = /(?<stage>.*):\s*(?<progress>[\d.]+%)\s.*(?<eta>ETA:.*)/g;
|
|
3183
|
+
function Or(s) {
|
|
3184
|
+
const t = s.replace(De, "").match(Cr);
|
|
3197
3185
|
if (t == null || t.length != 4)
|
|
3198
3186
|
return;
|
|
3199
|
-
const [n, r, o,
|
|
3187
|
+
const [n, r, o, a] = t;
|
|
3200
3188
|
return {
|
|
3201
3189
|
stage: r,
|
|
3202
3190
|
// For example, 'Building pre-clones from tag groups'
|
|
3203
3191
|
progress: o,
|
|
3204
3192
|
// 35.3%
|
|
3205
|
-
eta:
|
|
3193
|
+
eta: a
|
|
3206
3194
|
// ETA: 00:00:07
|
|
3207
3195
|
};
|
|
3208
3196
|
}
|
|
3209
|
-
async function
|
|
3210
|
-
const n = await e.lastLines(
|
|
3211
|
-
s,
|
|
3212
|
-
1,
|
|
3213
|
-
0n,
|
|
3214
|
-
Be,
|
|
3215
|
-
t
|
|
3216
|
-
);
|
|
3197
|
+
async function zn(s, e, t) {
|
|
3198
|
+
const n = await e.lastLines(s, 1, 0n, De, t);
|
|
3217
3199
|
if (n.data == null || n.data.length == 0)
|
|
3218
3200
|
return { found: !1 };
|
|
3219
3201
|
const r = n.data.toString().split(/\r?\n/)[0];
|
|
3220
3202
|
if (r == null)
|
|
3221
3203
|
return { found: !1 };
|
|
3222
|
-
const o =
|
|
3204
|
+
const o = Or(r);
|
|
3223
3205
|
return o === void 0 ? { found: !1 } : { found: !0, ...o };
|
|
3224
3206
|
}
|
|
3225
|
-
class
|
|
3207
|
+
class ve {
|
|
3226
3208
|
constructor(e) {
|
|
3227
3209
|
d(this, "cache", /* @__PURE__ */ new Map());
|
|
3228
3210
|
d(this, "totalSizeBytes", 0);
|
|
@@ -3245,7 +3227,7 @@ class De {
|
|
|
3245
3227
|
if (this.totalSizeBytes <= this.softSizeBytes) return [];
|
|
3246
3228
|
const e = [];
|
|
3247
3229
|
let t = 0;
|
|
3248
|
-
return
|
|
3230
|
+
return Qe(this.cache).filter(([n, r]) => r.counter.isZero()).forEach(([n, r]) => {
|
|
3249
3231
|
if (this.totalSizeBytes - t <= this.softSizeBytes) return;
|
|
3250
3232
|
const o = ce(this.cache, n);
|
|
3251
3233
|
t += o.sizeBytes, e.push(o);
|
|
@@ -3260,27 +3242,23 @@ class De {
|
|
|
3260
3242
|
this.cache.delete(e.path), this.totalSizeBytes -= e.sizeBytes;
|
|
3261
3243
|
}
|
|
3262
3244
|
}
|
|
3263
|
-
class
|
|
3245
|
+
class xn {
|
|
3264
3246
|
constructor(e, t) {
|
|
3265
3247
|
this.logsStreamDriver = e, this.downloadDriver = t;
|
|
3266
3248
|
}
|
|
3267
3249
|
getLastLogs(e, t, n) {
|
|
3268
|
-
if (n === void 0)
|
|
3269
|
-
return b.make((o) => this.getLastLogs(e, t, o));
|
|
3250
|
+
if (n === void 0) return b.make((o) => this.getLastLogs(e, t, o));
|
|
3270
3251
|
const r = q(n, e);
|
|
3271
3252
|
if (r === void 0) {
|
|
3272
3253
|
n.markUnstable("no stream in stream manager");
|
|
3273
3254
|
return;
|
|
3274
3255
|
}
|
|
3275
|
-
if (V(r))
|
|
3276
|
-
return this.downloadDriver.getLastLogs(r, t, n);
|
|
3256
|
+
if (V(r)) return this.downloadDriver.getLastLogs(r, t, n);
|
|
3277
3257
|
try {
|
|
3278
3258
|
return this.logsStreamDriver.getLastLogs(r, t, n);
|
|
3279
3259
|
} catch (o) {
|
|
3280
3260
|
if (o.name == "RpcError" && o.code == "NOT_FOUND") {
|
|
3281
|
-
n.markUnstable(
|
|
3282
|
-
`NOT_FOUND in logs stream driver while getting last logs: ${o}`
|
|
3283
|
-
);
|
|
3261
|
+
n.markUnstable(`NOT_FOUND in logs stream driver while getting last logs: ${o}`);
|
|
3284
3262
|
return;
|
|
3285
3263
|
}
|
|
3286
3264
|
throw o;
|
|
@@ -3288,31 +3266,25 @@ class Cn {
|
|
|
3288
3266
|
}
|
|
3289
3267
|
getProgressLog(e, t, n) {
|
|
3290
3268
|
if (n === void 0)
|
|
3291
|
-
return b.make(
|
|
3292
|
-
(o) => this.getProgressLog(e, t, o)
|
|
3293
|
-
);
|
|
3269
|
+
return b.make((o) => this.getProgressLog(e, t, o));
|
|
3294
3270
|
const r = q(n, e);
|
|
3295
3271
|
if (r === void 0) {
|
|
3296
3272
|
n.markUnstable("no stream in stream manager");
|
|
3297
3273
|
return;
|
|
3298
3274
|
}
|
|
3299
|
-
if (V(r))
|
|
3300
|
-
return this.downloadDriver.getProgressLog(r, t, n);
|
|
3275
|
+
if (V(r)) return this.downloadDriver.getProgressLog(r, t, n);
|
|
3301
3276
|
try {
|
|
3302
3277
|
return this.logsStreamDriver.getProgressLog(r, t, n);
|
|
3303
3278
|
} catch (o) {
|
|
3304
3279
|
if (o.name == "RpcError" && o.code == "NOT_FOUND") {
|
|
3305
|
-
n.markUnstable(
|
|
3306
|
-
`NOT_FOUND in logs stream driver while getting a progress log: ${o}`
|
|
3307
|
-
);
|
|
3280
|
+
n.markUnstable(`NOT_FOUND in logs stream driver while getting a progress log: ${o}`);
|
|
3308
3281
|
return;
|
|
3309
3282
|
}
|
|
3310
3283
|
throw o;
|
|
3311
3284
|
}
|
|
3312
3285
|
}
|
|
3313
3286
|
getLogHandle(e, t) {
|
|
3314
|
-
if (t === void 0)
|
|
3315
|
-
return b.make((r) => this.getLogHandle(e, r));
|
|
3287
|
+
if (t === void 0) return b.make((r) => this.getLogHandle(e, r));
|
|
3316
3288
|
const n = q(t, e);
|
|
3317
3289
|
if (n === void 0) {
|
|
3318
3290
|
t.markUnstable("no stream in stream manager");
|
|
@@ -3321,30 +3293,10 @@ class Cn {
|
|
|
3321
3293
|
return V(n) ? this.downloadDriver.getLogHandle(n, t) : this.logsStreamDriver.getLogHandle(n, t);
|
|
3322
3294
|
}
|
|
3323
3295
|
async lastLines(e, t, n, r) {
|
|
3324
|
-
return C(e) ? await this.logsStreamDriver.lastLines(
|
|
3325
|
-
e,
|
|
3326
|
-
t,
|
|
3327
|
-
n,
|
|
3328
|
-
r
|
|
3329
|
-
) : await this.downloadDriver.lastLines(
|
|
3330
|
-
e,
|
|
3331
|
-
t,
|
|
3332
|
-
n,
|
|
3333
|
-
r
|
|
3334
|
-
);
|
|
3296
|
+
return C(e) ? await this.logsStreamDriver.lastLines(e, t, n, r) : await this.downloadDriver.lastLines(e, t, n, r);
|
|
3335
3297
|
}
|
|
3336
3298
|
async readText(e, t, n, r) {
|
|
3337
|
-
return C(e) ? await this.logsStreamDriver.readText(
|
|
3338
|
-
e,
|
|
3339
|
-
t,
|
|
3340
|
-
n,
|
|
3341
|
-
r
|
|
3342
|
-
) : await this.downloadDriver.readText(
|
|
3343
|
-
e,
|
|
3344
|
-
t,
|
|
3345
|
-
n,
|
|
3346
|
-
r
|
|
3347
|
-
);
|
|
3299
|
+
return C(e) ? await this.logsStreamDriver.readText(e, t, n, r) : await this.downloadDriver.readText(e, t, n, r);
|
|
3348
3300
|
}
|
|
3349
3301
|
}
|
|
3350
3302
|
function V(s) {
|
|
@@ -3357,9 +3309,9 @@ function q(s, e) {
|
|
|
3357
3309
|
function _(s) {
|
|
3358
3310
|
let e;
|
|
3359
3311
|
if (C(s))
|
|
3360
|
-
e = s.match($e);
|
|
3361
|
-
else if (_r(s))
|
|
3362
3312
|
e = s.match(_e);
|
|
3313
|
+
else if (Fr(s))
|
|
3314
|
+
e = s.match(Ce);
|
|
3363
3315
|
else throw new Error(`Log handle is malformed: ${s}`);
|
|
3364
3316
|
if (e == null) throw new Error(`Log handle wasn't parsed: ${s}`);
|
|
3365
3317
|
const { resourceType: t, resourceVersion: n, resourceId: r } = e.groups;
|
|
@@ -3368,26 +3320,26 @@ function _(s) {
|
|
|
3368
3320
|
type: { name: t, version: n }
|
|
3369
3321
|
};
|
|
3370
3322
|
}
|
|
3371
|
-
function
|
|
3323
|
+
function $e(s, e) {
|
|
3372
3324
|
return s ? `log+live://log/${e.type.name}/${e.type.version}/${BigInt(e.id)}` : `log+ready://log/${e.type.name}/${e.type.version}/${BigInt(e.id)}`;
|
|
3373
3325
|
}
|
|
3374
|
-
const
|
|
3326
|
+
const _e = /^log\+live:\/\/log\/(?<resourceType>.*)\/(?<resourceVersion>.*)\/(?<resourceId>.*)$/;
|
|
3375
3327
|
function C(s) {
|
|
3376
|
-
return $e.test(s);
|
|
3377
|
-
}
|
|
3378
|
-
const _e = /^log\+ready:\/\/log\/(?<resourceType>.*)\/(?<resourceVersion>.*)\/(?<resourceId>.*)$/;
|
|
3379
|
-
function _r(s) {
|
|
3380
3328
|
return _e.test(s);
|
|
3381
3329
|
}
|
|
3382
|
-
const
|
|
3330
|
+
const Ce = /^log\+ready:\/\/log\/(?<resourceType>.*)\/(?<resourceVersion>.*)\/(?<resourceId>.*)$/;
|
|
3331
|
+
function Fr(s) {
|
|
3332
|
+
return Ce.test(s);
|
|
3333
|
+
}
|
|
3334
|
+
const Er = se({
|
|
3383
3335
|
kv: {
|
|
3384
3336
|
"ctl/file/blobInfo": T.object({
|
|
3385
3337
|
sizeBytes: T.coerce.number()
|
|
3386
3338
|
})
|
|
3387
3339
|
}
|
|
3388
3340
|
});
|
|
3389
|
-
class
|
|
3390
|
-
constructor(e, t, n, r, o,
|
|
3341
|
+
class Mn {
|
|
3342
|
+
constructor(e, t, n, r, o, a) {
|
|
3391
3343
|
/** Represents a Resource Id to the path of a blob as a map. */
|
|
3392
3344
|
d(this, "idToDownload", /* @__PURE__ */ new Map());
|
|
3393
3345
|
/** Writes and removes files to a hard drive and holds a counter for every
|
|
@@ -3399,46 +3351,37 @@ class On {
|
|
|
3399
3351
|
d(this, "idToLastLines", /* @__PURE__ */ new Map());
|
|
3400
3352
|
d(this, "idToProgressLog", /* @__PURE__ */ new Map());
|
|
3401
3353
|
d(this, "saveDir");
|
|
3402
|
-
this.logger = e, this.clientDownload = t, this.clientLogs = n, this.signer = o, this.cache = new
|
|
3403
|
-
this.logger,
|
|
3404
|
-
c.nConcurrentDownloads
|
|
3405
|
-
), this.saveDir = w.resolve(r);
|
|
3354
|
+
this.logger = e, this.clientDownload = t, this.clientLogs = n, this.signer = o, this.cache = new ve(a.cacheSoftSizeBytes), this.downloadQueue = new ee(this.logger, a.nConcurrentDownloads), this.saveDir = w.resolve(r);
|
|
3406
3355
|
}
|
|
3407
3356
|
getDownloadedBlob(e, t) {
|
|
3408
|
-
if (t === void 0)
|
|
3409
|
-
return b.make((c) => this.getDownloadedBlob(e, c));
|
|
3357
|
+
if (t === void 0) return b.make((a) => this.getDownloadedBlob(e, a));
|
|
3410
3358
|
const n = R(e, t), r = L();
|
|
3411
3359
|
t.addOnDestroy(() => this.releaseBlob(n.id, r));
|
|
3412
|
-
const o = this.getDownloadedBlobNoCtx(
|
|
3413
|
-
t.watcher,
|
|
3414
|
-
n,
|
|
3415
|
-
r
|
|
3416
|
-
);
|
|
3360
|
+
const o = this.getDownloadedBlobNoCtx(t.watcher, n, r);
|
|
3417
3361
|
return o == null && t.markUnstable("download blob is still undefined"), o;
|
|
3418
3362
|
}
|
|
3419
3363
|
getOnDemandBlob(e, t) {
|
|
3420
|
-
if (t === void 0)
|
|
3421
|
-
|
|
3422
|
-
const n = ie(e) ? Q(e, Cr, t) : e, r = L();
|
|
3364
|
+
if (t === void 0) return b.make((a) => this.getOnDemandBlob(e, a));
|
|
3365
|
+
const n = ie(e) ? Q(e, Er, t) : e, r = L();
|
|
3423
3366
|
return t.addOnDestroy(() => this.releaseOnDemandBlob(n.id, r)), this.getOnDemandBlobNoCtx(t.watcher, n, r);
|
|
3424
3367
|
}
|
|
3425
3368
|
getLocalPath(e) {
|
|
3426
3369
|
return J(e, this.signer);
|
|
3427
3370
|
}
|
|
3428
3371
|
async getContent(e) {
|
|
3429
|
-
if (
|
|
3430
|
-
if (!
|
|
3431
|
-
const t =
|
|
3432
|
-
return await
|
|
3372
|
+
if (Mr(e)) return await Ar(this.getLocalPath(e));
|
|
3373
|
+
if (!jr(e)) throw new Error("Malformed remote handle");
|
|
3374
|
+
const t = Gr(e, this.signer), { content: n } = await this.clientDownload.downloadBlob(t);
|
|
3375
|
+
return await ke(n);
|
|
3433
3376
|
}
|
|
3434
3377
|
getDownloadedBlobNoCtx(e, t, n) {
|
|
3435
3378
|
let r = this.idToDownload.get(t.id);
|
|
3436
3379
|
if (r === void 0) {
|
|
3437
|
-
const
|
|
3380
|
+
const a = this.setNewDownloadTask(e, t, n);
|
|
3438
3381
|
this.downloadQueue.push({
|
|
3439
|
-
fn: () => this.downloadBlob(
|
|
3382
|
+
fn: () => this.downloadBlob(a, n),
|
|
3440
3383
|
recoverableErrorPredicate: (i) => !0
|
|
3441
|
-
}), r =
|
|
3384
|
+
}), r = a;
|
|
3442
3385
|
}
|
|
3443
3386
|
r.attach(e, n);
|
|
3444
3387
|
const o = r.getBlob();
|
|
@@ -3448,11 +3391,11 @@ class On {
|
|
|
3448
3391
|
}
|
|
3449
3392
|
}
|
|
3450
3393
|
setNewDownloadTask(e, t, n) {
|
|
3451
|
-
const r = this.getFilePath(t.id), o = new
|
|
3394
|
+
const r = this.getFilePath(t.id), o = new xr(
|
|
3452
3395
|
this.clientDownload,
|
|
3453
3396
|
t,
|
|
3454
3397
|
r,
|
|
3455
|
-
|
|
3398
|
+
Hr(r, this.signer)
|
|
3456
3399
|
);
|
|
3457
3400
|
return this.idToDownload.set(t.id, o), o;
|
|
3458
3401
|
}
|
|
@@ -3462,75 +3405,64 @@ class On {
|
|
|
3462
3405
|
}
|
|
3463
3406
|
getOnDemandBlobNoCtx(e, t, n) {
|
|
3464
3407
|
let r = this.idToOnDemand.get(t.id);
|
|
3465
|
-
return r === void 0 && (r = new
|
|
3408
|
+
return r === void 0 && (r = new Wr(
|
|
3466
3409
|
t.kv["ctl/file/blobInfo"].sizeBytes,
|
|
3467
|
-
|
|
3410
|
+
Vr(t, this.signer)
|
|
3468
3411
|
), this.idToOnDemand.set(t.id, r)), r.attach(e, n), r.getHandle();
|
|
3469
3412
|
}
|
|
3470
3413
|
getLastLogs(e, t, n) {
|
|
3471
|
-
if (n == null)
|
|
3472
|
-
return b.make((i) => this.getLastLogs(e, t, i));
|
|
3414
|
+
if (n == null) return b.make((i) => this.getLastLogs(e, t, i));
|
|
3473
3415
|
const r = R(e, n), o = L();
|
|
3474
3416
|
n.addOnDestroy(() => this.releaseBlob(r.id, o));
|
|
3475
|
-
const
|
|
3476
|
-
|
|
3477
|
-
r,
|
|
3478
|
-
t,
|
|
3479
|
-
o
|
|
3480
|
-
);
|
|
3481
|
-
return c == null && n.markUnstable("either a file was not downloaded or logs was not read"), c;
|
|
3417
|
+
const a = this.getLastLogsNoCtx(n.watcher, r, t, o);
|
|
3418
|
+
return a == null && n.markUnstable("either a file was not downloaded or logs was not read"), a;
|
|
3482
3419
|
}
|
|
3483
3420
|
getLastLogsNoCtx(e, t, n, r) {
|
|
3484
3421
|
const o = this.getDownloadedBlobNoCtx(e, t, r);
|
|
3485
3422
|
if (o == null) return;
|
|
3486
|
-
const
|
|
3423
|
+
const a = J(o.handle, this.signer);
|
|
3487
3424
|
let i = this.idToLastLines.get(t.id);
|
|
3488
3425
|
if (i == null) {
|
|
3489
|
-
const
|
|
3490
|
-
this.idToLastLines.set(t.id,
|
|
3426
|
+
const l = new he(a, n);
|
|
3427
|
+
this.idToLastLines.set(t.id, l), i = l;
|
|
3491
3428
|
}
|
|
3492
|
-
const
|
|
3493
|
-
if (
|
|
3494
|
-
return
|
|
3429
|
+
const c = i.getOrSchedule(e);
|
|
3430
|
+
if (c.error) throw c.error;
|
|
3431
|
+
return c.log;
|
|
3495
3432
|
}
|
|
3496
3433
|
getProgressLog(e, t, n) {
|
|
3497
3434
|
if (n == null)
|
|
3498
|
-
return b.make(
|
|
3499
|
-
(i) => this.getProgressLog(e, t, i)
|
|
3500
|
-
);
|
|
3435
|
+
return b.make((i) => this.getProgressLog(e, t, i));
|
|
3501
3436
|
const r = R(e, n), o = L();
|
|
3502
3437
|
n.addOnDestroy(() => this.releaseBlob(r.id, o));
|
|
3503
|
-
const
|
|
3438
|
+
const a = this.getProgressLogNoCtx(
|
|
3504
3439
|
n.watcher,
|
|
3505
3440
|
r,
|
|
3506
3441
|
t,
|
|
3507
3442
|
o
|
|
3508
3443
|
);
|
|
3509
|
-
return
|
|
3510
|
-
"either a file was not downloaded or a progress log was not read"
|
|
3511
|
-
), c;
|
|
3444
|
+
return a === void 0 && n.markUnstable("either a file was not downloaded or a progress log was not read"), a;
|
|
3512
3445
|
}
|
|
3513
3446
|
getProgressLogNoCtx(e, t, n, r) {
|
|
3514
3447
|
const o = this.getDownloadedBlobNoCtx(e, t, r);
|
|
3515
3448
|
if (o == null) return;
|
|
3516
|
-
const
|
|
3449
|
+
const a = J(o.handle, this.signer);
|
|
3517
3450
|
let i = this.idToProgressLog.get(t.id);
|
|
3518
3451
|
if (i == null) {
|
|
3519
|
-
const
|
|
3520
|
-
this.idToProgressLog.set(t.id,
|
|
3452
|
+
const l = new he(a, 1, n);
|
|
3453
|
+
this.idToProgressLog.set(t.id, l), i = l;
|
|
3521
3454
|
}
|
|
3522
|
-
const
|
|
3523
|
-
if (
|
|
3524
|
-
return
|
|
3455
|
+
const c = i.getOrSchedule(e);
|
|
3456
|
+
if (c.error) throw c.error;
|
|
3457
|
+
return c.log;
|
|
3525
3458
|
}
|
|
3526
3459
|
getLogHandle(e, t) {
|
|
3527
|
-
if (t == null)
|
|
3528
|
-
return b.make((r) => this.getLogHandle(e, r));
|
|
3460
|
+
if (t == null) return b.make((r) => this.getLogHandle(e, r));
|
|
3529
3461
|
const n = R(e, t);
|
|
3530
3462
|
return this.getLogHandleNoCtx(n);
|
|
3531
3463
|
}
|
|
3532
3464
|
getLogHandleNoCtx(e) {
|
|
3533
|
-
return
|
|
3465
|
+
return $e(!1, e);
|
|
3534
3466
|
}
|
|
3535
3467
|
async lastLines(e, t, n, r) {
|
|
3536
3468
|
const o = await this.clientLogs.lastLines(
|
|
@@ -3571,7 +3503,7 @@ class On {
|
|
|
3571
3503
|
r.map(async (o) => {
|
|
3572
3504
|
await m.rm(o.path), this.cache.removeCache(o), this.removeTask(
|
|
3573
3505
|
o,
|
|
3574
|
-
`the task ${o.path} was removedfrom cache along with ${r.map((
|
|
3506
|
+
`the task ${o.path} was removedfrom cache along with ${r.map((a) => a.path)}`
|
|
3575
3507
|
);
|
|
3576
3508
|
})
|
|
3577
3509
|
);
|
|
@@ -3595,7 +3527,7 @@ class On {
|
|
|
3595
3527
|
return w.resolve(w.join(this.saveDir, String(BigInt(e))));
|
|
3596
3528
|
}
|
|
3597
3529
|
}
|
|
3598
|
-
class
|
|
3530
|
+
class Wr {
|
|
3599
3531
|
constructor(e, t) {
|
|
3600
3532
|
d(this, "change", new N());
|
|
3601
3533
|
d(this, "counter", new v());
|
|
@@ -3611,13 +3543,13 @@ class Or {
|
|
|
3611
3543
|
return this.counter.dec(e);
|
|
3612
3544
|
}
|
|
3613
3545
|
}
|
|
3614
|
-
class
|
|
3546
|
+
class he {
|
|
3615
3547
|
constructor(e, t, n) {
|
|
3616
3548
|
d(this, "updater");
|
|
3617
3549
|
d(this, "log");
|
|
3618
3550
|
d(this, "change", new N());
|
|
3619
3551
|
d(this, "error");
|
|
3620
|
-
this.path = e, this.lines = t, this.patternToSearch = n, this.updater = new
|
|
3552
|
+
this.path = e, this.lines = t, this.patternToSearch = n, this.updater = new Be(async () => this.update());
|
|
3621
3553
|
}
|
|
3622
3554
|
getOrSchedule(e) {
|
|
3623
3555
|
return this.change.attachWatcher(e), this.updater.schedule(), {
|
|
@@ -3627,11 +3559,7 @@ class de {
|
|
|
3627
3559
|
}
|
|
3628
3560
|
async update() {
|
|
3629
3561
|
try {
|
|
3630
|
-
const e = await
|
|
3631
|
-
this.path,
|
|
3632
|
-
this.lines,
|
|
3633
|
-
this.patternToSearch
|
|
3634
|
-
);
|
|
3562
|
+
const e = await zr(this.path, this.lines, this.patternToSearch);
|
|
3635
3563
|
this.log != e && this.change.markChanged(), this.log = e;
|
|
3636
3564
|
} catch (e) {
|
|
3637
3565
|
if (e.name == "RpcError" && e.code == "NOT_FOUND") {
|
|
@@ -3642,28 +3570,28 @@ class de {
|
|
|
3642
3570
|
}
|
|
3643
3571
|
}
|
|
3644
3572
|
}
|
|
3645
|
-
async function
|
|
3573
|
+
async function ue(s) {
|
|
3646
3574
|
try {
|
|
3647
3575
|
return await m.access(s), !0;
|
|
3648
3576
|
} catch {
|
|
3649
3577
|
return !1;
|
|
3650
3578
|
}
|
|
3651
3579
|
}
|
|
3652
|
-
async function
|
|
3653
|
-
return await
|
|
3580
|
+
async function Ar(s) {
|
|
3581
|
+
return await ke(re.toWeb(O.createReadStream(s)));
|
|
3654
3582
|
}
|
|
3655
|
-
function
|
|
3583
|
+
function zr(s, e, t) {
|
|
3656
3584
|
const n = O.createReadStream(s), r = new ne();
|
|
3657
|
-
return new Promise((o,
|
|
3658
|
-
const i = tt.createInterface(n, r),
|
|
3659
|
-
i.on("line", function(
|
|
3660
|
-
t != null && !
|
|
3661
|
-
}), i.on("error",
|
|
3662
|
-
o(
|
|
3585
|
+
return new Promise((o, a) => {
|
|
3586
|
+
const i = tt.createInterface(n, r), c = new rt();
|
|
3587
|
+
i.on("line", function(l) {
|
|
3588
|
+
t != null && !l.includes(t) || (c.push(l), c.length > e && c.shift());
|
|
3589
|
+
}), i.on("error", a), i.on("close", function() {
|
|
3590
|
+
o(c.toArray().join(de.EOL) + de.EOL);
|
|
3663
3591
|
});
|
|
3664
3592
|
});
|
|
3665
3593
|
}
|
|
3666
|
-
let
|
|
3594
|
+
let xr = class {
|
|
3667
3595
|
constructor(e, t, n, r) {
|
|
3668
3596
|
d(this, "counter", new v());
|
|
3669
3597
|
d(this, "change", new N());
|
|
@@ -3678,10 +3606,8 @@ let Wr = class {
|
|
|
3678
3606
|
}
|
|
3679
3607
|
async download() {
|
|
3680
3608
|
try {
|
|
3681
|
-
const { content: e, size: t } = await this.clientDownload.downloadBlob(
|
|
3682
|
-
|
|
3683
|
-
);
|
|
3684
|
-
if (await he(w.dirname(this.path)) || await m.mkdir(w.dirname(this.path), { recursive: !0 }), await he(this.path))
|
|
3609
|
+
const { content: e, size: t } = await this.clientDownload.downloadBlob(this.rInfo);
|
|
3610
|
+
if (await ue(w.dirname(this.path)) || await m.mkdir(w.dirname(this.path), { recursive: !0 }), await ue(this.path))
|
|
3685
3611
|
await e.cancel("the file already existed");
|
|
3686
3612
|
else {
|
|
3687
3613
|
const n = ne.toWeb(O.createWriteStream(this.path));
|
|
@@ -3689,7 +3615,7 @@ let Wr = class {
|
|
|
3689
3615
|
}
|
|
3690
3616
|
this.setDone(t);
|
|
3691
3617
|
} catch (e) {
|
|
3692
|
-
if (e instanceof
|
|
3618
|
+
if (e instanceof pe || e instanceof ae || e instanceof Ne || e instanceof Ue || e.code == "ENOENT") {
|
|
3693
3619
|
this.setError(e), await m.rm(this.path);
|
|
3694
3620
|
return;
|
|
3695
3621
|
}
|
|
@@ -3715,53 +3641,41 @@ let Wr = class {
|
|
|
3715
3641
|
this.done = !0, this.sizeBytes = e, this.change.markChanged();
|
|
3716
3642
|
}
|
|
3717
3643
|
abort(e) {
|
|
3718
|
-
this.signalCtl.abort(new
|
|
3644
|
+
this.signalCtl.abort(new pe(e));
|
|
3719
3645
|
}
|
|
3720
3646
|
setError(e) {
|
|
3721
3647
|
this.error = e, this.change.markChanged();
|
|
3722
3648
|
}
|
|
3723
3649
|
};
|
|
3724
|
-
class
|
|
3650
|
+
class pe extends Error {
|
|
3725
3651
|
}
|
|
3726
|
-
const
|
|
3727
|
-
function
|
|
3728
|
-
return !!s.match(
|
|
3652
|
+
const Oe = /^blob\+local:\/\/download\/(?<path>.*)#(?<signature>.*)$/;
|
|
3653
|
+
function Mr(s) {
|
|
3654
|
+
return !!s.match(Oe);
|
|
3729
3655
|
}
|
|
3730
3656
|
function J(s, e) {
|
|
3731
|
-
const t = s.match(
|
|
3732
|
-
if (t === null)
|
|
3733
|
-
throw new Error(`Local handle is malformed: ${s}, matches: ${t}`);
|
|
3657
|
+
const t = s.match(Oe);
|
|
3658
|
+
if (t === null) throw new Error(`Local handle is malformed: ${s}, matches: ${t}`);
|
|
3734
3659
|
const { path: n, signature: r } = t.groups;
|
|
3735
|
-
return e.verify(
|
|
3736
|
-
n,
|
|
3737
|
-
r,
|
|
3738
|
-
`Signature verification failed for: ${s}`
|
|
3739
|
-
), n;
|
|
3660
|
+
return e.verify(n, r, `Signature verification failed for: ${s}`), n;
|
|
3740
3661
|
}
|
|
3741
|
-
function
|
|
3662
|
+
function Hr(s, e) {
|
|
3742
3663
|
return `blob+local://download/${s}#${e.sign(s)}`;
|
|
3743
3664
|
}
|
|
3744
|
-
const
|
|
3745
|
-
function
|
|
3746
|
-
return !!s.match(
|
|
3665
|
+
const Fe = /^blob\+remote:\/\/download\/(?<content>(?<resourceType>.*)\/(?<resourceVersion>.*)\/(?<resourceId>.*))#(?<signature>.*)$/;
|
|
3666
|
+
function jr(s) {
|
|
3667
|
+
return !!s.match(Fe);
|
|
3747
3668
|
}
|
|
3748
|
-
function
|
|
3749
|
-
const t = s.match(
|
|
3750
|
-
if (t === null)
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
)
|
|
3754
|
-
const { content: n, resourceType: r, resourceVersion: o, resourceId: c, signature: i } = t.groups;
|
|
3755
|
-
return e.verify(
|
|
3756
|
-
n,
|
|
3757
|
-
i,
|
|
3758
|
-
`Signature verification failed for ${s}`
|
|
3759
|
-
), {
|
|
3760
|
-
id: Y(BigInt(c)),
|
|
3669
|
+
function Gr(s, e) {
|
|
3670
|
+
const t = s.match(Fe);
|
|
3671
|
+
if (t === null) throw new Error(`Remote handle is malformed: ${s}, matches: ${t}`);
|
|
3672
|
+
const { content: n, resourceType: r, resourceVersion: o, resourceId: a, signature: i } = t.groups;
|
|
3673
|
+
return e.verify(n, i, `Signature verification failed for ${s}`), {
|
|
3674
|
+
id: Y(BigInt(a)),
|
|
3761
3675
|
type: { name: r, version: o }
|
|
3762
3676
|
};
|
|
3763
3677
|
}
|
|
3764
|
-
function
|
|
3678
|
+
function Vr(s, e) {
|
|
3765
3679
|
const t = `${s.type.name}/${s.type.version}/${BigInt(s.id)}`;
|
|
3766
3680
|
return `blob+remote://download/${t}#${e.sign(t)}`;
|
|
3767
3681
|
}
|
|
@@ -3774,29 +3688,29 @@ const F = T.object({
|
|
|
3774
3688
|
sizeBytes: T.string(),
|
|
3775
3689
|
/** Modification time unix timestamp in seconds */
|
|
3776
3690
|
modificationTime: T.string()
|
|
3777
|
-
}),
|
|
3691
|
+
}), Ee = T.object({
|
|
3778
3692
|
/** Pl storage id */
|
|
3779
3693
|
storageId: T.string(),
|
|
3780
3694
|
/** Path inside storage */
|
|
3781
3695
|
path: T.string()
|
|
3782
|
-
}),
|
|
3696
|
+
}), jn = T.union([
|
|
3783
3697
|
F,
|
|
3784
|
-
|
|
3785
|
-
]),
|
|
3698
|
+
Ee
|
|
3699
|
+
]), qr = se({
|
|
3786
3700
|
data: F,
|
|
3787
3701
|
fields: {
|
|
3788
3702
|
blob: !1
|
|
3789
3703
|
}
|
|
3790
|
-
}),
|
|
3704
|
+
}), Jr = se({
|
|
3791
3705
|
fields: {
|
|
3792
3706
|
incarnation: !1
|
|
3793
3707
|
}
|
|
3794
3708
|
});
|
|
3795
|
-
function
|
|
3796
|
-
const t = ie(s) ? e.accessor(s).node() :
|
|
3797
|
-
return t.resourceType.name.startsWith("BlobUpload") ? Q(t,
|
|
3709
|
+
function Zr(s, e) {
|
|
3710
|
+
const t = ie(s) ? e.accessor(s).node() : st(s) ? s.node() : s;
|
|
3711
|
+
return t.resourceType.name.startsWith("BlobUpload") ? Q(t, qr) : Q(t, Jr);
|
|
3798
3712
|
}
|
|
3799
|
-
class
|
|
3713
|
+
class Gn {
|
|
3800
3714
|
constructor(e, t, n, r, o = {
|
|
3801
3715
|
nConcurrentPartUploads: 10,
|
|
3802
3716
|
nConcurrentGetProgresses: 10,
|
|
@@ -3819,25 +3733,25 @@ class Wn {
|
|
|
3819
3733
|
// 15 seconds
|
|
3820
3734
|
backoffMultiplier: 1.5,
|
|
3821
3735
|
jitter: 0.5
|
|
3822
|
-
}), this.hooks = new
|
|
3736
|
+
}), this.hooks = new Le(
|
|
3823
3737
|
() => this.startUpdating(),
|
|
3824
3738
|
() => this.stopUpdating(),
|
|
3825
3739
|
{ stopDebounce: o.stopPollingDelay },
|
|
3826
|
-
(
|
|
3740
|
+
(a, i) => this.scheduleOnNextState(a, i)
|
|
3827
3741
|
);
|
|
3828
3742
|
}
|
|
3829
3743
|
getProgressId(e, t) {
|
|
3830
|
-
if (t == null) return b.make((
|
|
3831
|
-
const n = ie(e) ?
|
|
3744
|
+
if (t == null) return b.make((a) => this.getProgressId(e, a));
|
|
3745
|
+
const n = ie(e) ? Zr(e, t) : e, r = L();
|
|
3832
3746
|
t.attacheHooks(this.hooks), t.addOnDestroy(() => this.release(n.id, r));
|
|
3833
3747
|
const o = this.getProgressIdNoCtx(t.watcher, n, r);
|
|
3834
|
-
return
|
|
3748
|
+
return ge(o) || t.markUnstable(`upload/index progress was got, but it's not stable: ${o}`), o;
|
|
3835
3749
|
}
|
|
3836
3750
|
getProgressIdNoCtx(e, t, n) {
|
|
3837
3751
|
const r = "blob" in t.fields ? t.fields.blob !== void 0 : t.fields.incarnation !== void 0, o = this.idToProgress.get(t.id);
|
|
3838
3752
|
if (o != null)
|
|
3839
3753
|
return o.attach(e, n), o.mustGetProgress(r);
|
|
3840
|
-
const
|
|
3754
|
+
const a = new Qr(
|
|
3841
3755
|
this.logger,
|
|
3842
3756
|
this.clientBlob,
|
|
3843
3757
|
this.clientProgress,
|
|
@@ -3845,10 +3759,10 @@ class Wn {
|
|
|
3845
3759
|
this.signer,
|
|
3846
3760
|
t
|
|
3847
3761
|
);
|
|
3848
|
-
return this.idToProgress.set(t.id,
|
|
3849
|
-
fn: () =>
|
|
3850
|
-
recoverableErrorPredicate: (i) => !
|
|
3851
|
-
}),
|
|
3762
|
+
return this.idToProgress.set(t.id, a), a.attach(e, n), a.progress.isUpload && a.progress.isUploadSignMatch && this.uploadQueue.push({
|
|
3763
|
+
fn: () => a.uploadBlobTask(),
|
|
3764
|
+
recoverableErrorPredicate: (i) => !We(i)
|
|
3765
|
+
}), a.mustGetProgress(r);
|
|
3852
3766
|
}
|
|
3853
3767
|
/** Decrement counters for the file and remove an uploading if counter == 0. */
|
|
3854
3768
|
async release(e, t) {
|
|
@@ -3889,21 +3803,21 @@ class Wn {
|
|
|
3889
3803
|
this.currentLoop = void 0;
|
|
3890
3804
|
}
|
|
3891
3805
|
getAllNotDoneProgresses() {
|
|
3892
|
-
return Array.from(this.idToProgress.entries()).filter(([e, t]) => !
|
|
3806
|
+
return Array.from(this.idToProgress.entries()).filter(([e, t]) => !ge(t.progress)).map(([e, t]) => t);
|
|
3893
3807
|
}
|
|
3894
3808
|
}
|
|
3895
|
-
class
|
|
3896
|
-
constructor(e, t, n, r, o,
|
|
3809
|
+
class Qr {
|
|
3810
|
+
constructor(e, t, n, r, o, a) {
|
|
3897
3811
|
d(this, "change", new N());
|
|
3898
3812
|
d(this, "counter", new v());
|
|
3899
3813
|
d(this, "progress");
|
|
3900
3814
|
/** If this is upload progress this field will be defined */
|
|
3901
3815
|
d(this, "uploadData");
|
|
3902
3816
|
d(this, "uploadingTerminallyFailed");
|
|
3903
|
-
this.logger = e, this.clientBlob = t, this.clientProgress = n, this.nConcurrentPartsUpload = r, this.res =
|
|
3904
|
-
const i =
|
|
3905
|
-
let
|
|
3906
|
-
i && (this.uploadData = F.parse(
|
|
3817
|
+
this.logger = e, this.clientBlob = t, this.clientProgress = n, this.nConcurrentPartsUpload = r, this.res = a;
|
|
3818
|
+
const i = a.type.name.startsWith("BlobUpload");
|
|
3819
|
+
let c;
|
|
3820
|
+
i && (this.uploadData = F.parse(a.data), c = Yr(
|
|
3907
3821
|
o,
|
|
3908
3822
|
this.uploadData.localPath,
|
|
3909
3823
|
this.uploadData.pathSignature
|
|
@@ -3911,7 +3825,7 @@ class qr {
|
|
|
3911
3825
|
done: !1,
|
|
3912
3826
|
status: void 0,
|
|
3913
3827
|
isUpload: i,
|
|
3914
|
-
isUploadSignMatch:
|
|
3828
|
+
isUploadSignMatch: c,
|
|
3915
3829
|
lastError: void 0
|
|
3916
3830
|
};
|
|
3917
3831
|
}
|
|
@@ -3933,11 +3847,11 @@ class qr {
|
|
|
3933
3847
|
try {
|
|
3934
3848
|
await this.uploadBlob();
|
|
3935
3849
|
} catch (e) {
|
|
3936
|
-
if (this.setLastError(e),
|
|
3850
|
+
if (this.setLastError(e), fe(e)) {
|
|
3937
3851
|
this.logger.warn(`resource was deleted while uploading a blob: ${e}`), this.change.markChanged(), this.setDone(!0);
|
|
3938
3852
|
return;
|
|
3939
3853
|
}
|
|
3940
|
-
throw this.logger.error(`error while uploading a blob: ${e}`), this.change.markChanged(),
|
|
3854
|
+
throw this.logger.error(`error while uploading a blob: ${e}`), this.change.markChanged(), We(e) && this.terminateWithError(e), e;
|
|
3941
3855
|
}
|
|
3942
3856
|
}
|
|
3943
3857
|
/** Uploads a blob using client. */
|
|
@@ -3968,15 +3882,15 @@ class qr {
|
|
|
3968
3882
|
async updateStatus() {
|
|
3969
3883
|
try {
|
|
3970
3884
|
const e = await this.clientProgress.getStatus(this.res), t = this.progress.status;
|
|
3971
|
-
this.progress.status =
|
|
3885
|
+
this.progress.status = Xr(e), this.setDone(e.done), (e.done || e.progress != (t == null ? void 0 : t.progress)) && this.change.markChanged();
|
|
3972
3886
|
} catch (e) {
|
|
3973
3887
|
if (this.setLastError(e), e.name == "RpcError" && e.code == "DEADLINE_EXCEEDED") {
|
|
3974
3888
|
this.logger.warn("deadline exceeded while getting a status of BlobImport");
|
|
3975
3889
|
return;
|
|
3976
3890
|
}
|
|
3977
|
-
if (
|
|
3891
|
+
if (fe(e)) {
|
|
3978
3892
|
this.logger.warn(
|
|
3979
|
-
`resource was not found while updating a status of BlobImport: ${e}, ${
|
|
3893
|
+
`resource was not found while updating a status of BlobImport: ${e}, ${Je(this.res)}`
|
|
3980
3894
|
), this.change.markChanged(), this.setDone(!0);
|
|
3981
3895
|
return;
|
|
3982
3896
|
}
|
|
@@ -3984,30 +3898,30 @@ class qr {
|
|
|
3984
3898
|
}
|
|
3985
3899
|
}
|
|
3986
3900
|
}
|
|
3987
|
-
function
|
|
3901
|
+
function ge(s) {
|
|
3988
3902
|
return s.done && s.status !== void 0 && s.status !== null && s.status.progress >= 1;
|
|
3989
3903
|
}
|
|
3990
|
-
function
|
|
3904
|
+
function Xr(s) {
|
|
3991
3905
|
return {
|
|
3992
3906
|
progress: s.progress ?? 0,
|
|
3993
3907
|
bytesProcessed: Number(s.bytesProcessed),
|
|
3994
3908
|
bytesTotal: Number(s.bytesTotal)
|
|
3995
3909
|
};
|
|
3996
3910
|
}
|
|
3997
|
-
function
|
|
3911
|
+
function Yr(s, e, t) {
|
|
3998
3912
|
try {
|
|
3999
3913
|
return s.verify(e, t), !0;
|
|
4000
3914
|
} catch {
|
|
4001
3915
|
return !1;
|
|
4002
3916
|
}
|
|
4003
3917
|
}
|
|
4004
|
-
function
|
|
4005
|
-
return s instanceof
|
|
3918
|
+
function We(s) {
|
|
3919
|
+
return s instanceof Pe || s instanceof Ie || s instanceof Re;
|
|
4006
3920
|
}
|
|
4007
|
-
function
|
|
3921
|
+
function fe(s) {
|
|
4008
3922
|
return s.name == "RpcError" && (s.code == "NOT_FOUND" || s.code == "ABORTED" || s.code == "ALREADY_EXISTS");
|
|
4009
3923
|
}
|
|
4010
|
-
class
|
|
3924
|
+
class Vn {
|
|
4011
3925
|
constructor(e, t = {
|
|
4012
3926
|
nConcurrentGetLogs: 10,
|
|
4013
3927
|
pollingInterval: 1e3,
|
|
@@ -4024,7 +3938,7 @@ class zn {
|
|
|
4024
3938
|
d(this, "keepRunning", !1);
|
|
4025
3939
|
/** Actual state of main loop. */
|
|
4026
3940
|
d(this, "currentLoop");
|
|
4027
|
-
this.clientLogs = e, this.opts = t, this.hooks = new
|
|
3941
|
+
this.clientLogs = e, this.opts = t, this.hooks = new Le(
|
|
4028
3942
|
() => this.startUpdating(),
|
|
4029
3943
|
() => this.stopUpdating(),
|
|
4030
3944
|
{ stopDebounce: t.stopPollingDelay },
|
|
@@ -4032,67 +3946,53 @@ class zn {
|
|
|
4032
3946
|
);
|
|
4033
3947
|
}
|
|
4034
3948
|
getLastLogs(e, t, n) {
|
|
4035
|
-
if (n == null)
|
|
4036
|
-
return b.make((i) => this.getLastLogs(e, t, i));
|
|
3949
|
+
if (n == null) return b.make((i) => this.getLastLogs(e, t, i));
|
|
4037
3950
|
const r = R(e, n), o = L();
|
|
4038
3951
|
n.attacheHooks(this.hooks), n.addOnDestroy(() => this.releaseLastLogs(r.id, o));
|
|
4039
|
-
const
|
|
3952
|
+
const a = this.getLastLogsNoCtx(n.watcher, r, t, o);
|
|
4040
3953
|
return n.markUnstable(
|
|
4041
3954
|
"The logs are from stream, so we consider them unstable. Final values will be got from blobs."
|
|
4042
|
-
),
|
|
3955
|
+
), a;
|
|
4043
3956
|
}
|
|
4044
3957
|
getLastLogsNoCtx(e, t, n, r) {
|
|
4045
3958
|
let o = this.idToLastLines.get(t.id);
|
|
4046
3959
|
if (o == null) {
|
|
4047
|
-
const i = new
|
|
3960
|
+
const i = new me(this.clientLogs, t, n);
|
|
4048
3961
|
this.idToLastLines.set(t.id, i), o = i;
|
|
4049
3962
|
}
|
|
4050
3963
|
o.attach(e, r);
|
|
4051
|
-
const
|
|
4052
|
-
if (
|
|
4053
|
-
return
|
|
3964
|
+
const a = o.getLog();
|
|
3965
|
+
if (a.error != null) throw a.error;
|
|
3966
|
+
return a.log;
|
|
4054
3967
|
}
|
|
4055
3968
|
getProgressLog(e, t, n) {
|
|
4056
3969
|
if (n == null)
|
|
4057
|
-
return b.make(
|
|
4058
|
-
(i) => this.getProgressLog(e, t, i)
|
|
4059
|
-
);
|
|
3970
|
+
return b.make((i) => this.getProgressLog(e, t, i));
|
|
4060
3971
|
const r = R(e, n), o = L();
|
|
4061
3972
|
n.attacheHooks(this.hooks), n.addOnDestroy(() => this.releaseProgressLog(r.id, o));
|
|
4062
|
-
const
|
|
4063
|
-
n.watcher,
|
|
4064
|
-
r,
|
|
4065
|
-
t,
|
|
4066
|
-
o
|
|
4067
|
-
);
|
|
3973
|
+
const a = this.getProgressLogNoCtx(n.watcher, r, t, o);
|
|
4068
3974
|
return n.markUnstable(
|
|
4069
3975
|
"The progress log is from the stream, so we consider it unstable. Final value will be got from blobs."
|
|
4070
|
-
),
|
|
3976
|
+
), a;
|
|
4071
3977
|
}
|
|
4072
3978
|
getProgressLogNoCtx(e, t, n, r) {
|
|
4073
3979
|
let o = this.idToProgressLog.get(t.id);
|
|
4074
3980
|
if (o == null) {
|
|
4075
|
-
const i = new
|
|
4076
|
-
this.clientLogs,
|
|
4077
|
-
t,
|
|
4078
|
-
1,
|
|
4079
|
-
n
|
|
4080
|
-
);
|
|
3981
|
+
const i = new me(this.clientLogs, t, 1, n);
|
|
4081
3982
|
this.idToProgressLog.set(t.id, i), o = i;
|
|
4082
3983
|
}
|
|
4083
3984
|
o.attach(e, r);
|
|
4084
|
-
const
|
|
4085
|
-
if (
|
|
4086
|
-
return
|
|
3985
|
+
const a = o.getLog();
|
|
3986
|
+
if (a.error) throw a.error;
|
|
3987
|
+
return a.log;
|
|
4087
3988
|
}
|
|
4088
3989
|
getLogHandle(e, t) {
|
|
4089
|
-
if (t == null)
|
|
4090
|
-
return b.make((o) => this.getLogHandle(e, o));
|
|
3990
|
+
if (t == null) return b.make((o) => this.getLogHandle(e, o));
|
|
4091
3991
|
const n = R(e, t), r = this.getLogHandleNoCtx(n);
|
|
4092
3992
|
return t.markUnstable(), r;
|
|
4093
3993
|
}
|
|
4094
3994
|
getLogHandleNoCtx(e) {
|
|
4095
|
-
return
|
|
3995
|
+
return $e(!0, e);
|
|
4096
3996
|
}
|
|
4097
3997
|
async lastLines(e, t, n, r) {
|
|
4098
3998
|
return await this.tryWithNotFound(
|
|
@@ -4108,19 +4008,12 @@ class zn {
|
|
|
4108
4008
|
async readText(e, t, n, r) {
|
|
4109
4009
|
return await this.tryWithNotFound(
|
|
4110
4010
|
e,
|
|
4111
|
-
() => this.clientLogs.readText(
|
|
4112
|
-
_(e),
|
|
4113
|
-
t,
|
|
4114
|
-
BigInt(n ?? 0),
|
|
4115
|
-
r
|
|
4116
|
-
)
|
|
4011
|
+
() => this.clientLogs.readText(_(e), t, BigInt(n ?? 0), r)
|
|
4117
4012
|
);
|
|
4118
4013
|
}
|
|
4119
4014
|
async tryWithNotFound(e, t) {
|
|
4120
4015
|
if (!C(e))
|
|
4121
|
-
throw new Error(
|
|
4122
|
-
`Not live log handle was passed to live log driver, handle: ${e}`
|
|
4123
|
-
);
|
|
4016
|
+
throw new Error(`Not live log handle was passed to live log driver, handle: ${e}`);
|
|
4124
4017
|
try {
|
|
4125
4018
|
const n = await t();
|
|
4126
4019
|
return {
|
|
@@ -4164,9 +4057,7 @@ class zn {
|
|
|
4164
4057
|
try {
|
|
4165
4058
|
await te(
|
|
4166
4059
|
this.opts.nConcurrentGetLogs,
|
|
4167
|
-
this.getAllNotDoneLogs().map(
|
|
4168
|
-
(t) => async () => await t.update()
|
|
4169
|
-
)
|
|
4060
|
+
this.getAllNotDoneLogs().map((t) => async () => await t.update())
|
|
4170
4061
|
), e.forEach((t) => t.resolve());
|
|
4171
4062
|
} catch (t) {
|
|
4172
4063
|
console.error(t), e.forEach((n) => n.reject(t));
|
|
@@ -4180,7 +4071,7 @@ class zn {
|
|
|
4180
4071
|
return Array.from(this.idToLastLines.entries()).concat(Array.from(this.idToProgressLog.entries())).filter(([e, t]) => !t.getLog().done).map(([e, t]) => t);
|
|
4181
4072
|
}
|
|
4182
4073
|
}
|
|
4183
|
-
class
|
|
4074
|
+
class me {
|
|
4184
4075
|
constructor(e, t, n, r) {
|
|
4185
4076
|
d(this, "logs");
|
|
4186
4077
|
d(this, "error");
|
|
@@ -4221,7 +4112,7 @@ class fe {
|
|
|
4221
4112
|
}
|
|
4222
4113
|
}
|
|
4223
4114
|
}
|
|
4224
|
-
class
|
|
4115
|
+
class qn {
|
|
4225
4116
|
constructor(e, t, n, r = {
|
|
4226
4117
|
cacheSoftSizeBytes: 50 * 1024 * 1024,
|
|
4227
4118
|
withGunzip: !0,
|
|
@@ -4233,10 +4124,7 @@ class An {
|
|
|
4233
4124
|
/** Writes and removes files to a hard drive and holds a counter for every
|
|
4234
4125
|
* file that should be kept. */
|
|
4235
4126
|
d(this, "cache");
|
|
4236
|
-
this.logger = e, this.saveDir = n, this.opts = r, this.downloadQueue = new ee(
|
|
4237
|
-
this.logger,
|
|
4238
|
-
this.opts.nConcurrentDownloads
|
|
4239
|
-
), this.cache = new De(this.opts.cacheSoftSizeBytes), this.downloadHelper = new Re(t);
|
|
4127
|
+
this.logger = e, this.saveDir = n, this.opts = r, this.downloadQueue = new ee(this.logger, this.opts.nConcurrentDownloads), this.cache = new ve(this.opts.cacheSoftSizeBytes), this.downloadHelper = new Se(t);
|
|
4240
4128
|
}
|
|
4241
4129
|
getPath(e, t) {
|
|
4242
4130
|
if (t === void 0) return b.make((o) => this.getPath(e, o));
|
|
@@ -4251,11 +4139,11 @@ class An {
|
|
|
4251
4139
|
const r = e.toString(), o = this.urlToDownload.get(r);
|
|
4252
4140
|
if (o != null)
|
|
4253
4141
|
return o.attach(t, n), o.getPath();
|
|
4254
|
-
const
|
|
4142
|
+
const a = this.setNewTask(t, e, n);
|
|
4255
4143
|
return this.downloadQueue.push({
|
|
4256
|
-
fn: async () => this.downloadUrl(
|
|
4144
|
+
fn: async () => this.downloadUrl(a, n),
|
|
4257
4145
|
recoverableErrorPredicate: (i) => !0
|
|
4258
|
-
}),
|
|
4146
|
+
}), a.getPath();
|
|
4259
4147
|
}
|
|
4260
4148
|
/** Downloads and extracts a tar archive if it wasn't downloaded yet. */
|
|
4261
4149
|
async downloadUrl(e, t) {
|
|
@@ -4270,43 +4158,37 @@ class An {
|
|
|
4270
4158
|
if (this.cache.existsFile(r.path)) {
|
|
4271
4159
|
const o = this.cache.removeFile(r.path, t);
|
|
4272
4160
|
await Promise.all(
|
|
4273
|
-
o.map(async (
|
|
4274
|
-
await X(
|
|
4275
|
-
|
|
4276
|
-
`the task ${JSON.stringify(
|
|
4161
|
+
o.map(async (a) => {
|
|
4162
|
+
await X(a.path), this.cache.removeCache(a), this.removeTask(
|
|
4163
|
+
a,
|
|
4164
|
+
`the task ${JSON.stringify(a)} was removedfrom cache along with ${JSON.stringify(o)}`
|
|
4277
4165
|
);
|
|
4278
4166
|
})
|
|
4279
4167
|
);
|
|
4280
4168
|
} else
|
|
4281
|
-
r.counter.dec(t) && this.removeTask(
|
|
4282
|
-
r,
|
|
4283
|
-
`the task ${JSON.stringify(r)} was removed from cache`
|
|
4284
|
-
);
|
|
4169
|
+
r.counter.dec(t) && this.removeTask(r, `the task ${JSON.stringify(r)} was removed from cache`);
|
|
4285
4170
|
}
|
|
4286
4171
|
/** Removes all files from a hard drive. */
|
|
4287
4172
|
async releaseAll() {
|
|
4288
4173
|
this.downloadQueue.stop(), await Promise.all(
|
|
4289
4174
|
Array.from(this.urlToDownload.entries()).map(async ([e, t]) => {
|
|
4290
|
-
await X(t.path), this.cache.removeCache(t), this.removeTask(
|
|
4291
|
-
t,
|
|
4292
|
-
`the task ${t} was released when the driver was closed`
|
|
4293
|
-
);
|
|
4175
|
+
await X(t.path), this.cache.removeCache(t), this.removeTask(t, `the task ${t} was released when the driver was closed`);
|
|
4294
4176
|
})
|
|
4295
4177
|
);
|
|
4296
4178
|
}
|
|
4297
4179
|
setNewTask(e, t, n) {
|
|
4298
|
-
const r = new
|
|
4180
|
+
const r = new Kr(this.getFilePath(t), t);
|
|
4299
4181
|
return r.attach(e, n), this.urlToDownload.set(t.toString(), r), r;
|
|
4300
4182
|
}
|
|
4301
4183
|
removeTask(e, t) {
|
|
4302
4184
|
e.abort(t), e.change.markChanged(), this.urlToDownload.delete(e.url.toString());
|
|
4303
4185
|
}
|
|
4304
4186
|
getFilePath(e) {
|
|
4305
|
-
const t =
|
|
4187
|
+
const t = ot("sha256").update(e.toString()).digest("hex");
|
|
4306
4188
|
return w.join(this.saveDir, t);
|
|
4307
4189
|
}
|
|
4308
4190
|
}
|
|
4309
|
-
class
|
|
4191
|
+
class Kr {
|
|
4310
4192
|
constructor(e, t) {
|
|
4311
4193
|
d(this, "counter", new v());
|
|
4312
4194
|
d(this, "change", new N());
|
|
@@ -4328,7 +4210,7 @@ class Qr {
|
|
|
4328
4210
|
);
|
|
4329
4211
|
this.setDone(n);
|
|
4330
4212
|
} catch (n) {
|
|
4331
|
-
if (n instanceof
|
|
4213
|
+
if (n instanceof we || n instanceof ae) {
|
|
4332
4214
|
this.setError(n), await X(this.path);
|
|
4333
4215
|
return;
|
|
4334
4216
|
}
|
|
@@ -4336,20 +4218,16 @@ class Qr {
|
|
|
4336
4218
|
}
|
|
4337
4219
|
}
|
|
4338
4220
|
async downloadAndUntar(e, t, n) {
|
|
4339
|
-
if (await
|
|
4340
|
-
return await
|
|
4341
|
-
const r = await e.downloadRemoteFile(
|
|
4342
|
-
this.url.toString(),
|
|
4343
|
-
{},
|
|
4344
|
-
n
|
|
4345
|
-
);
|
|
4221
|
+
if (await Xe(this.path))
|
|
4222
|
+
return await Ae(this.path);
|
|
4223
|
+
const r = await e.downloadRemoteFile(this.url.toString(), {}, n);
|
|
4346
4224
|
let o = r.content;
|
|
4347
4225
|
if (t) {
|
|
4348
|
-
const i =
|
|
4226
|
+
const i = Ke.toWeb(it.createGunzip());
|
|
4349
4227
|
o = o.pipeThrough(i, { signal: n });
|
|
4350
4228
|
}
|
|
4351
|
-
const
|
|
4352
|
-
return await o.pipeTo(
|
|
4229
|
+
const a = ne.toWeb(at.extract(this.path));
|
|
4230
|
+
return await o.pipeTo(a, { signal: n }), r.size;
|
|
4353
4231
|
}
|
|
4354
4232
|
getPath() {
|
|
4355
4233
|
if (this.done) return { path: K(this.path) };
|
|
@@ -4359,33 +4237,33 @@ class Qr {
|
|
|
4359
4237
|
this.done = !0, this.sizeBytes = e, this.change.markChanged();
|
|
4360
4238
|
}
|
|
4361
4239
|
abort(e) {
|
|
4362
|
-
this.signalCtl.abort(new
|
|
4240
|
+
this.signalCtl.abort(new we(e));
|
|
4363
4241
|
}
|
|
4364
4242
|
setError(e) {
|
|
4365
4243
|
this.error = String(e), this.change.markChanged();
|
|
4366
4244
|
}
|
|
4367
4245
|
}
|
|
4368
|
-
class
|
|
4246
|
+
class we extends Error {
|
|
4369
4247
|
}
|
|
4370
|
-
async function
|
|
4248
|
+
async function Ae(s) {
|
|
4371
4249
|
const e = await m.readdir(s, { withFileTypes: !0 });
|
|
4372
4250
|
return (await Promise.all(
|
|
4373
4251
|
e.map(async (n) => {
|
|
4374
4252
|
const r = w.join(s, n.name);
|
|
4375
|
-
return n.isDirectory() ? await
|
|
4253
|
+
return n.isDirectory() ? await Ae(r) : (await m.stat(r)).size;
|
|
4376
4254
|
})
|
|
4377
4255
|
)).reduce((n, r) => n + r, 0);
|
|
4378
4256
|
}
|
|
4379
4257
|
async function X(s) {
|
|
4380
4258
|
await m.rm(s, { recursive: !0, force: !0 });
|
|
4381
4259
|
}
|
|
4382
|
-
function
|
|
4260
|
+
function ye(s, e) {
|
|
4383
4261
|
return `index://index/${encodeURIComponent(JSON.stringify({
|
|
4384
4262
|
storageId: s,
|
|
4385
4263
|
path: e
|
|
4386
4264
|
}))}`;
|
|
4387
4265
|
}
|
|
4388
|
-
function
|
|
4266
|
+
function en(s, e, t, n) {
|
|
4389
4267
|
const r = {
|
|
4390
4268
|
localPath: s,
|
|
4391
4269
|
pathSignature: e.sign(s),
|
|
@@ -4394,31 +4272,31 @@ function Xr(s, e, t, n) {
|
|
|
4394
4272
|
};
|
|
4395
4273
|
return `upload://upload/${encodeURIComponent(JSON.stringify(r))}`;
|
|
4396
4274
|
}
|
|
4397
|
-
function
|
|
4275
|
+
function tn(s) {
|
|
4398
4276
|
const e = new URL(s);
|
|
4399
4277
|
return F.parse(
|
|
4400
4278
|
JSON.parse(decodeURIComponent(e.pathname.substring(1)))
|
|
4401
4279
|
);
|
|
4402
4280
|
}
|
|
4403
|
-
function
|
|
4281
|
+
function rn(s) {
|
|
4404
4282
|
const e = new URL(s);
|
|
4405
|
-
return
|
|
4283
|
+
return Ee.parse(JSON.parse(decodeURIComponent(e.pathname.substring(1))));
|
|
4406
4284
|
}
|
|
4407
|
-
function
|
|
4285
|
+
function nn(s) {
|
|
4286
|
+
if (ln(s))
|
|
4287
|
+
return dn(s);
|
|
4408
4288
|
if (on(s))
|
|
4409
4289
|
return an(s);
|
|
4410
|
-
|
|
4411
|
-
return nn(s);
|
|
4412
|
-
Xe(s);
|
|
4290
|
+
Ye(s);
|
|
4413
4291
|
}
|
|
4414
4292
|
const ze = /^local:\/\/(?<name>.*)\/(?<path>.*)$/;
|
|
4415
|
-
function
|
|
4293
|
+
function on(s) {
|
|
4416
4294
|
return ze.test(s);
|
|
4417
4295
|
}
|
|
4418
|
-
function
|
|
4296
|
+
function sn(s, e) {
|
|
4419
4297
|
return `local://${s}/${encodeURIComponent(e)}`;
|
|
4420
4298
|
}
|
|
4421
|
-
function
|
|
4299
|
+
function an(s) {
|
|
4422
4300
|
const e = s.match(ze);
|
|
4423
4301
|
if (e == null) throw new Error(`Local list handle wasn't parsed: ${s}`);
|
|
4424
4302
|
const { name: t, path: n } = e.groups;
|
|
@@ -4428,41 +4306,53 @@ function nn(s) {
|
|
|
4428
4306
|
isRemote: !1
|
|
4429
4307
|
};
|
|
4430
4308
|
}
|
|
4431
|
-
const
|
|
4432
|
-
function
|
|
4433
|
-
return
|
|
4309
|
+
const xe = /^remote:\/\/(?<name>.*)\/(?<resourceId>.*)$/;
|
|
4310
|
+
function ln(s) {
|
|
4311
|
+
return xe.test(s);
|
|
4434
4312
|
}
|
|
4435
|
-
function
|
|
4313
|
+
function cn(s, e) {
|
|
4436
4314
|
return `remote://${s}/${BigInt(e)}`;
|
|
4437
4315
|
}
|
|
4438
|
-
function
|
|
4439
|
-
const e = s.match(
|
|
4316
|
+
function dn(s) {
|
|
4317
|
+
const e = s.match(xe);
|
|
4440
4318
|
if (e == null) throw new Error(`Remote list handle wasn't parsed: ${s}`);
|
|
4441
4319
|
const { name: t, resourceId: n } = e.groups;
|
|
4442
4320
|
return {
|
|
4443
4321
|
id: Y(BigInt(n)),
|
|
4444
|
-
type:
|
|
4322
|
+
type: hn(t),
|
|
4445
4323
|
name: t,
|
|
4446
4324
|
isRemote: !0
|
|
4447
4325
|
};
|
|
4448
4326
|
}
|
|
4449
|
-
function
|
|
4327
|
+
function hn(s) {
|
|
4450
4328
|
return { name: `LS/${s}`, version: "1" };
|
|
4451
4329
|
}
|
|
4452
|
-
function
|
|
4453
|
-
const s =
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4330
|
+
async function un() {
|
|
4331
|
+
const s = nt.homedir();
|
|
4332
|
+
if (Z.sep == "/")
|
|
4333
|
+
return [
|
|
4334
|
+
{
|
|
4335
|
+
name: "local",
|
|
4336
|
+
root: "/",
|
|
4337
|
+
initialPath: s
|
|
4338
|
+
}
|
|
4339
|
+
];
|
|
4340
|
+
{
|
|
4341
|
+
const t = Z.parse(s).root.replaceAll(":\\", "");
|
|
4342
|
+
return (await ct.promisify(dt)("wmic logicaldisk get name")).stdout.split(`\r
|
|
4343
|
+
`).filter((o) => o.includes(":")).map((o) => o.trim().replaceAll(":", "")).map((o) => {
|
|
4344
|
+
const a = o == t;
|
|
4345
|
+
return {
|
|
4346
|
+
name: `local_disk_${o}`,
|
|
4347
|
+
root: `${o}:\\`,
|
|
4348
|
+
initialPath: a ? s : `${o}:\\`
|
|
4349
|
+
};
|
|
4350
|
+
});
|
|
4351
|
+
}
|
|
4462
4352
|
}
|
|
4463
|
-
class
|
|
4464
|
-
constructor(e, t, n, r, o,
|
|
4465
|
-
this.logger = e, this.lsClient = t, this.storageIdToResourceId = n, this.signer = r, this.virtualStoragesMap = o, this.localProjectionsMap =
|
|
4353
|
+
class Me {
|
|
4354
|
+
constructor(e, t, n, r, o, a, i) {
|
|
4355
|
+
this.logger = e, this.lsClient = t, this.storageIdToResourceId = n, this.signer = r, this.virtualStoragesMap = o, this.localProjectionsMap = a, this.openFileDialogCallback = i;
|
|
4466
4356
|
}
|
|
4467
4357
|
async getLocalFileContent(e, t) {
|
|
4468
4358
|
const n = await this.tryResolveLocalFileHandle(e);
|
|
@@ -4492,13 +4382,13 @@ class xe {
|
|
|
4492
4382
|
* @private
|
|
4493
4383
|
*/
|
|
4494
4384
|
async tryResolveLocalFileHandle(e) {
|
|
4495
|
-
if (
|
|
4496
|
-
const t =
|
|
4385
|
+
if (lt(e)) {
|
|
4386
|
+
const t = rn(e), n = this.localProjectionsMap.get(t.storageId);
|
|
4497
4387
|
if (!n)
|
|
4498
4388
|
throw new Error(`Storage ${t.storageId} is not mounted locally.`);
|
|
4499
4389
|
return w.join(n.localPath, t.path);
|
|
4500
4390
|
} else {
|
|
4501
|
-
const t =
|
|
4391
|
+
const t = tn(e);
|
|
4502
4392
|
this.signer.verify(
|
|
4503
4393
|
t.localPath,
|
|
4504
4394
|
t.pathSignature,
|
|
@@ -4515,13 +4405,13 @@ class xe {
|
|
|
4515
4405
|
for (const n of this.localProjectionsMap.values())
|
|
4516
4406
|
if (e.startsWith(n.localPath)) {
|
|
4517
4407
|
const r = n.localPath === "" ? e : w.relative(n.localPath, e);
|
|
4518
|
-
return
|
|
4408
|
+
return ye(
|
|
4519
4409
|
n.storageId,
|
|
4520
4410
|
r
|
|
4521
4411
|
);
|
|
4522
4412
|
}
|
|
4523
4413
|
const t = await m.stat(e, { bigint: !0 });
|
|
4524
|
-
return
|
|
4414
|
+
return en(
|
|
4525
4415
|
e,
|
|
4526
4416
|
this.signer,
|
|
4527
4417
|
t.size,
|
|
@@ -4530,40 +4420,41 @@ class xe {
|
|
|
4530
4420
|
);
|
|
4531
4421
|
}
|
|
4532
4422
|
async getStorageList() {
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
initialFullPath: ""
|
|
4423
|
+
const e = [...this.virtualStoragesMap.values()].map((r) => ({
|
|
4424
|
+
name: r.name,
|
|
4425
|
+
handle: sn(r.name, r.root),
|
|
4426
|
+
initialFullPath: r.initialPath
|
|
4427
|
+
})), n = Object.entries(this.storageIdToResourceId).map(
|
|
4428
|
+
([r, o]) => ({
|
|
4429
|
+
name: r,
|
|
4430
|
+
handle: cn(r, o),
|
|
4431
|
+
initialFullPath: "",
|
|
4543
4432
|
// we don't have any additional information from where to start browsing remote storages
|
|
4544
|
-
|
|
4545
|
-
|
|
4433
|
+
isInitialPathHome: !1
|
|
4434
|
+
})
|
|
4435
|
+
).filter((r) => r.name !== "root");
|
|
4436
|
+
return [...e, ...n];
|
|
4546
4437
|
}
|
|
4547
4438
|
async listFiles(e, t) {
|
|
4548
|
-
const n =
|
|
4439
|
+
const n = nn(e);
|
|
4549
4440
|
if (n.isRemote)
|
|
4550
4441
|
return {
|
|
4551
4442
|
entries: (await this.lsClient.list(n, t)).items.map((o) => ({
|
|
4552
4443
|
type: o.isDir ? "dir" : "file",
|
|
4553
4444
|
name: o.name,
|
|
4554
4445
|
fullPath: o.fullName,
|
|
4555
|
-
handle:
|
|
4446
|
+
handle: ye(n.name, o.fullName)
|
|
4556
4447
|
}))
|
|
4557
4448
|
};
|
|
4558
4449
|
{
|
|
4559
|
-
w.sep === "/" && t === "" && (t = "/");
|
|
4560
|
-
const r =
|
|
4561
|
-
for await (const
|
|
4562
|
-
if (!
|
|
4563
|
-
const i = w.join(r,
|
|
4450
|
+
w.sep === "/" && t === "" && (t = "/"), n.rootPath === "" && B(t);
|
|
4451
|
+
const r = w.isAbsolute(t) ? t : w.join(n.rootPath, t), o = [];
|
|
4452
|
+
for await (const a of await m.opendir(r)) {
|
|
4453
|
+
if (!a.isFile() && !a.isDirectory()) continue;
|
|
4454
|
+
const i = w.join(r, a.name);
|
|
4564
4455
|
o.push({
|
|
4565
|
-
type:
|
|
4566
|
-
name:
|
|
4456
|
+
type: a.isFile() ? "file" : "dir",
|
|
4457
|
+
name: a.name,
|
|
4567
4458
|
fullPath: i,
|
|
4568
4459
|
handle: await this.getLocalFileHandle(i)
|
|
4569
4460
|
});
|
|
@@ -4571,80 +4462,81 @@ class xe {
|
|
|
4571
4462
|
return { entries: o };
|
|
4572
4463
|
}
|
|
4573
4464
|
}
|
|
4574
|
-
static async init(e, t, n, r, o,
|
|
4575
|
-
const i =
|
|
4576
|
-
|
|
4577
|
-
for (const p of
|
|
4578
|
-
const
|
|
4579
|
-
|
|
4465
|
+
static async init(e, t, n, r, o, a) {
|
|
4466
|
+
const i = _r(t, e);
|
|
4467
|
+
a || (a = await un());
|
|
4468
|
+
for (const p of a) B(p.root);
|
|
4469
|
+
for (const p of r) p.localPath !== "" && B(p.localPath);
|
|
4470
|
+
const c = new Map(a.map((p) => [p.name, p])), l = new Map(r.map((p) => [p.storageId, p]));
|
|
4471
|
+
if ((/* @__PURE__ */ new Set([...c.keys(), ...l.keys()])).size !== c.size + l.size)
|
|
4580
4472
|
throw new Error(
|
|
4581
4473
|
"Intersection between local projection storage ids and virtual storages names detected."
|
|
4582
4474
|
);
|
|
4583
|
-
return new
|
|
4475
|
+
return new Me(
|
|
4584
4476
|
e,
|
|
4585
4477
|
i,
|
|
4586
|
-
await
|
|
4478
|
+
await pn(t),
|
|
4587
4479
|
n,
|
|
4480
|
+
c,
|
|
4588
4481
|
l,
|
|
4589
|
-
|
|
4590
|
-
c
|
|
4482
|
+
o
|
|
4591
4483
|
);
|
|
4592
4484
|
}
|
|
4593
4485
|
}
|
|
4594
|
-
async function
|
|
4486
|
+
async function pn(s) {
|
|
4595
4487
|
return s.withReadTx("GetAvailableStorageIds", async (e) => {
|
|
4596
4488
|
const t = await e.getResourceByName("LSProvider"), n = await e.getResourceData(t, !0);
|
|
4597
|
-
return
|
|
4489
|
+
return gn(n);
|
|
4598
4490
|
});
|
|
4599
4491
|
}
|
|
4600
|
-
function
|
|
4492
|
+
function gn(s) {
|
|
4601
4493
|
return Object.fromEntries(
|
|
4602
|
-
s.fields.filter((e) => e.type == "Dynamic" &&
|
|
4494
|
+
s.fields.filter((e) => e.type == "Dynamic" && Ze(e.value)).map((e) => [e.name.substring(8), e.value])
|
|
4603
4495
|
);
|
|
4604
4496
|
}
|
|
4605
4497
|
export {
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
|
|
4609
|
-
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
|
|
4616
|
-
|
|
4498
|
+
ir as ClientDownload,
|
|
4499
|
+
$r as ClientLogs,
|
|
4500
|
+
yr as ClientLs,
|
|
4501
|
+
Qt as ClientProgress,
|
|
4502
|
+
Ot as ClientUpload,
|
|
4503
|
+
un as DefaultVirtualLocalStorages,
|
|
4504
|
+
xr as Download,
|
|
4505
|
+
Mn as DownloadDriver,
|
|
4506
|
+
qn as DownloadUrlDriver,
|
|
4507
|
+
jn as ImportFileHandleData,
|
|
4508
|
+
Ee as ImportFileHandleIndexData,
|
|
4617
4509
|
F as ImportFileHandleUploadData,
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
|
|
4627
|
-
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4510
|
+
Jr as IndexResourceSnapshot,
|
|
4511
|
+
xn as LogsDriver,
|
|
4512
|
+
Vn as LogsStreamDriver,
|
|
4513
|
+
Wn as LongUpdater,
|
|
4514
|
+
Me as LsDriver,
|
|
4515
|
+
Pe as MTimeError,
|
|
4516
|
+
Ct as NetworkError,
|
|
4517
|
+
Re as NoFileForUploading,
|
|
4518
|
+
Er as OnDemandBlobResourceSnapshot,
|
|
4519
|
+
Ie as UnexpectedEOF,
|
|
4520
|
+
Ne as UnknownStorageError,
|
|
4521
|
+
Be as Updater,
|
|
4522
|
+
Gn as UploadDriver,
|
|
4523
|
+
qr as UploadResourceSnapshot,
|
|
4524
|
+
Ue as WrongLocalFileUrl,
|
|
4525
|
+
Cn as createDownloadClient,
|
|
4526
|
+
On as createLogsClient,
|
|
4527
|
+
_r as createLsFilesClient,
|
|
4528
|
+
En as createUploadBlobClient,
|
|
4529
|
+
Fn as createUploadProgressClient,
|
|
4530
|
+
$e as dataToHandle,
|
|
4531
|
+
An as getStream,
|
|
4640
4532
|
_ as handleToData,
|
|
4641
|
-
|
|
4533
|
+
lr as headersFromProto,
|
|
4642
4534
|
C as isLiveLogHandle,
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4535
|
+
Fr as isReadyLogHandle,
|
|
4536
|
+
Or as lineToProgress,
|
|
4537
|
+
Zr as makeBlobImportSnapshot,
|
|
4538
|
+
zn as mixcrProgressFromLogs,
|
|
4539
|
+
ar as parseLocalFileUrl,
|
|
4648
4540
|
B as validateAbsolute
|
|
4649
4541
|
};
|
|
4650
4542
|
//# sourceMappingURL=index.mjs.map
|