@milaboratories/pl-drivers 1.3.25 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/clients/constructors.d.ts +14 -0
- package/dist/clients/constructors.d.ts.map +1 -0
- package/dist/clients/download.d.ts +19 -14
- package/dist/clients/download.d.ts.map +1 -1
- package/dist/clients/helpers.d.ts +4 -13
- package/dist/clients/helpers.d.ts.map +1 -1
- package/dist/clients/upload.d.ts +15 -13
- package/dist/clients/upload.d.ts.map +1 -1
- package/dist/drivers/{download_and_logs_blob.d.ts → download_blob.d.ts} +13 -40
- package/dist/drivers/download_blob.d.ts.map +1 -0
- package/dist/drivers/download_blob_task.d.ts +34 -0
- package/dist/drivers/download_blob_task.d.ts.map +1 -0
- package/dist/drivers/download_url.d.ts +11 -9
- package/dist/drivers/download_url.d.ts.map +1 -1
- package/dist/drivers/helpers/download_local_handle.d.ts +9 -0
- package/dist/drivers/helpers/download_local_handle.d.ts.map +1 -0
- package/dist/drivers/helpers/download_remote_handle.d.ts +8 -0
- package/dist/drivers/helpers/download_remote_handle.d.ts.map +1 -0
- package/dist/drivers/helpers/files_cache.d.ts +2 -1
- package/dist/drivers/helpers/files_cache.d.ts.map +1 -1
- package/dist/drivers/helpers/helpers.d.ts +2 -24
- package/dist/drivers/helpers/helpers.d.ts.map +1 -1
- package/dist/drivers/helpers/logs_handle.d.ts +13 -0
- package/dist/drivers/helpers/logs_handle.d.ts.map +1 -0
- package/dist/drivers/helpers/ls_remote_import_handle.d.ts +8 -0
- package/dist/drivers/helpers/ls_remote_import_handle.d.ts.map +1 -0
- package/dist/drivers/logs.d.ts +1 -5
- 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.map +1 -1
- package/dist/drivers/types.d.ts +47 -4
- package/dist/drivers/types.d.ts.map +1 -1
- package/dist/drivers/upload.d.ts +2 -28
- package/dist/drivers/upload.d.ts.map +1 -1
- package/dist/drivers/upload_task.d.ts +41 -0
- package/dist/drivers/upload_task.d.ts.map +1 -0
- package/dist/helpers/download.d.ts +2 -2
- package/dist/helpers/download.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1537 -1526
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
- package/src/clients/constructors.ts +54 -0
- package/src/clients/download.test.ts +9 -6
- package/src/clients/download.ts +74 -64
- package/src/clients/helpers.ts +2 -53
- package/src/clients/upload.ts +136 -102
- package/src/drivers/download_blob.test.ts +12 -11
- package/src/drivers/{download_and_logs_blob.ts → download_blob.ts} +154 -290
- package/src/drivers/download_blob_task.ts +126 -0
- package/src/drivers/download_url.test.ts +1 -1
- package/src/drivers/download_url.ts +44 -37
- package/src/drivers/helpers/download_local_handle.ts +29 -0
- package/src/drivers/helpers/download_remote_handle.ts +40 -0
- package/src/drivers/helpers/files_cache.test.ts +7 -6
- package/src/drivers/helpers/files_cache.ts +6 -5
- package/src/drivers/helpers/helpers.ts +6 -100
- package/src/drivers/helpers/logs_handle.ts +52 -0
- package/src/drivers/helpers/ls_remote_import_handle.ts +43 -0
- package/src/drivers/logs.test.ts +14 -14
- package/src/drivers/logs.ts +3 -43
- package/src/drivers/logs_stream.ts +32 -6
- package/src/drivers/ls.test.ts +1 -2
- package/src/drivers/ls.ts +26 -28
- package/src/drivers/types.ts +48 -0
- package/src/drivers/upload.test.ts +8 -18
- package/src/drivers/upload.ts +38 -271
- package/src/drivers/upload_task.ts +251 -0
- package/src/helpers/download.ts +18 -15
- package/src/index.ts +2 -2
- package/dist/drivers/download_and_logs_blob.d.ts.map +0 -1
- package/dist/drivers/helpers/ls_list_entry.d.ts +0 -44
- package/dist/drivers/helpers/ls_list_entry.d.ts.map +0 -1
- package/src/drivers/helpers/ls_list_entry.test.ts +0 -55
- package/src/drivers/helpers/ls_list_entry.ts +0 -147
package/dist/index.mjs
CHANGED
|
@@ -1,32 +1,34 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var d = (s, e, t) =>
|
|
1
|
+
var Ze = Object.defineProperty;
|
|
2
|
+
var Qe = (s, e, t) => e in s ? Ze(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
+
var d = (s, e, t) => Qe(s, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { addRTypeToMetadata as T, bigintToResourceId as ee, stringifyWithResourceId as ye, resourceIdToString as Xe, isNotNullResourceId as Ye } from "@milaboratories/pl-client";
|
|
4
5
|
import * as m from "node:fs/promises";
|
|
5
|
-
import {
|
|
6
|
+
import { request as be } from "undici";
|
|
6
7
|
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
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import * as O from "node:fs";
|
|
8
|
+
import { MessageType as g, reflectionMergePartial as f, UnknownFieldHandler as u, WireType as h, PbLong as P, typeofJsonValue as ke } from "@protobuf-ts/runtime";
|
|
9
|
+
import { notEmpty as te, CallersCounter as B, ensureDirExists as Te, fileExists as Le, createPathAtomically as Pe, mapGet as he, mapEntries as Ke, TaskProcessor as re, asyncPool as ne, assertNever as et } from "@milaboratories/ts-helpers";
|
|
10
|
+
import * as oe from "node:fs";
|
|
11
|
+
import tt from "node:fs";
|
|
12
12
|
import * as w from "node:path";
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import { z as
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import {
|
|
29
|
-
|
|
13
|
+
import Q from "node:path";
|
|
14
|
+
import { Readable as se, Writable as ie, Transform as rt } from "node:stream";
|
|
15
|
+
import { text as nt, buffer as Ie } from "node:stream/consumers";
|
|
16
|
+
import { ChangeSource as v, Computable as b, PollingComputableHooks as Re } from "@milaboratories/computable";
|
|
17
|
+
import { rsSchema as ae, treeEntryToResourceInfo as I, isPlTreeEntry as le, makeResourceSnapshot as X, isPlTreeEntryAccessor as ot } from "@milaboratories/pl-tree";
|
|
18
|
+
import st from "denque";
|
|
19
|
+
import { randomUUID as L, createHash as it } from "node:crypto";
|
|
20
|
+
import * as ue from "node:os";
|
|
21
|
+
import at from "node:os";
|
|
22
|
+
import * as lt from "node:readline/promises";
|
|
23
|
+
import { z as k } from "zod";
|
|
24
|
+
import { scheduler as Se } from "node:timers/promises";
|
|
25
|
+
import ct from "node:assert";
|
|
26
|
+
import * as dt from "node:zlib";
|
|
27
|
+
import * as ht from "tar-fs";
|
|
28
|
+
import { isImportFileHandleIndex as ut } from "@milaboratories/pl-model-common";
|
|
29
|
+
import pt from "node:util";
|
|
30
|
+
import { exec as gt } from "node:child_process";
|
|
31
|
+
class ft extends g {
|
|
30
32
|
constructor() {
|
|
31
33
|
super("MiLaboratories.Controller.Shared.uploadapi", []);
|
|
32
34
|
}
|
|
@@ -34,20 +36,20 @@ class ut extends g {
|
|
|
34
36
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
35
37
|
return e !== void 0 && f(this, t, e), t;
|
|
36
38
|
}
|
|
37
|
-
internalBinaryRead(e, t,
|
|
38
|
-
return
|
|
39
|
+
internalBinaryRead(e, t, r, n) {
|
|
40
|
+
return n ?? this.create();
|
|
39
41
|
}
|
|
40
|
-
internalBinaryWrite(e, t,
|
|
41
|
-
let
|
|
42
|
-
return
|
|
42
|
+
internalBinaryWrite(e, t, r) {
|
|
43
|
+
let n = r.writeUnknownFields;
|
|
44
|
+
return n !== !1 && (n == !0 ? u.onWrite : n)(
|
|
43
45
|
this.typeName,
|
|
44
46
|
e,
|
|
45
47
|
t
|
|
46
48
|
), t;
|
|
47
49
|
}
|
|
48
50
|
}
|
|
49
|
-
new
|
|
50
|
-
class
|
|
51
|
+
new ft();
|
|
52
|
+
class mt extends g {
|
|
51
53
|
constructor() {
|
|
52
54
|
super("MiLaboratories.Controller.Shared.uploadapi.Init", []);
|
|
53
55
|
}
|
|
@@ -55,20 +57,20 @@ class pt extends g {
|
|
|
55
57
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
56
58
|
return e !== void 0 && f(this, t, e), t;
|
|
57
59
|
}
|
|
58
|
-
internalBinaryRead(e, t,
|
|
59
|
-
return
|
|
60
|
+
internalBinaryRead(e, t, r, n) {
|
|
61
|
+
return n ?? this.create();
|
|
60
62
|
}
|
|
61
|
-
internalBinaryWrite(e, t,
|
|
62
|
-
let
|
|
63
|
-
return
|
|
63
|
+
internalBinaryWrite(e, t, r) {
|
|
64
|
+
let n = r.writeUnknownFields;
|
|
65
|
+
return n !== !1 && (n == !0 ? u.onWrite : n)(
|
|
64
66
|
this.typeName,
|
|
65
67
|
e,
|
|
66
68
|
t
|
|
67
69
|
), t;
|
|
68
70
|
}
|
|
69
71
|
}
|
|
70
|
-
new
|
|
71
|
-
class
|
|
72
|
+
new mt();
|
|
73
|
+
class wt extends g {
|
|
72
74
|
constructor() {
|
|
73
75
|
super("MiLaboratories.Controller.Shared.uploadapi.Init.Request", [
|
|
74
76
|
{
|
|
@@ -85,9 +87,9 @@ class gt extends g {
|
|
|
85
87
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
86
88
|
return t.resourceId = 0n, e !== void 0 && f(this, t, e), t;
|
|
87
89
|
}
|
|
88
|
-
internalBinaryRead(e, t,
|
|
89
|
-
let o =
|
|
90
|
-
for (; e.pos <
|
|
90
|
+
internalBinaryRead(e, t, r, n) {
|
|
91
|
+
let o = n ?? this.create(), l = e.pos + t;
|
|
92
|
+
for (; e.pos < l; ) {
|
|
91
93
|
let [i, c] = e.tag();
|
|
92
94
|
switch (i) {
|
|
93
95
|
case /* uint64 resource_id */
|
|
@@ -95,13 +97,13 @@ class gt extends g {
|
|
|
95
97
|
o.resourceId = e.uint64().toBigInt();
|
|
96
98
|
break;
|
|
97
99
|
default:
|
|
98
|
-
let
|
|
99
|
-
if (
|
|
100
|
+
let a = r.readUnknownField;
|
|
101
|
+
if (a === "throw")
|
|
100
102
|
throw new globalThis.Error(
|
|
101
103
|
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
102
104
|
);
|
|
103
105
|
let p = e.skip(c);
|
|
104
|
-
|
|
106
|
+
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
105
107
|
this.typeName,
|
|
106
108
|
o,
|
|
107
109
|
i,
|
|
@@ -112,18 +114,18 @@ class gt extends g {
|
|
|
112
114
|
}
|
|
113
115
|
return o;
|
|
114
116
|
}
|
|
115
|
-
internalBinaryWrite(e, t,
|
|
117
|
+
internalBinaryWrite(e, t, r) {
|
|
116
118
|
e.resourceId !== 0n && t.tag(1, h.Varint).uint64(e.resourceId);
|
|
117
|
-
let
|
|
118
|
-
return
|
|
119
|
+
let n = r.writeUnknownFields;
|
|
120
|
+
return n !== !1 && (n == !0 ? u.onWrite : n)(
|
|
119
121
|
this.typeName,
|
|
120
122
|
e,
|
|
121
123
|
t
|
|
122
124
|
), t;
|
|
123
125
|
}
|
|
124
126
|
}
|
|
125
|
-
const
|
|
126
|
-
class
|
|
127
|
+
const yt = new wt();
|
|
128
|
+
class bt extends g {
|
|
127
129
|
constructor() {
|
|
128
130
|
super("MiLaboratories.Controller.Shared.uploadapi.Init.Response", [
|
|
129
131
|
{
|
|
@@ -149,9 +151,9 @@ class mt extends g {
|
|
|
149
151
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
150
152
|
return t.partsCount = 0n, t.uploadedParts = [], e !== void 0 && f(this, t, e), t;
|
|
151
153
|
}
|
|
152
|
-
internalBinaryRead(e, t,
|
|
153
|
-
let o =
|
|
154
|
-
for (; e.pos <
|
|
154
|
+
internalBinaryRead(e, t, r, n) {
|
|
155
|
+
let o = n ?? this.create(), l = e.pos + t;
|
|
156
|
+
for (; e.pos < l; ) {
|
|
155
157
|
let [i, c] = e.tag();
|
|
156
158
|
switch (i) {
|
|
157
159
|
case /* uint64 parts_count */
|
|
@@ -161,18 +163,18 @@ class mt extends g {
|
|
|
161
163
|
case /* repeated uint64 uploaded_parts */
|
|
162
164
|
2:
|
|
163
165
|
if (c === h.LengthDelimited)
|
|
164
|
-
for (let
|
|
166
|
+
for (let F = e.int32() + e.pos; e.pos < F; )
|
|
165
167
|
o.uploadedParts.push(e.uint64().toBigInt());
|
|
166
168
|
else o.uploadedParts.push(e.uint64().toBigInt());
|
|
167
169
|
break;
|
|
168
170
|
default:
|
|
169
|
-
let
|
|
170
|
-
if (
|
|
171
|
+
let a = r.readUnknownField;
|
|
172
|
+
if (a === "throw")
|
|
171
173
|
throw new globalThis.Error(
|
|
172
174
|
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
173
175
|
);
|
|
174
176
|
let p = e.skip(c);
|
|
175
|
-
|
|
177
|
+
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
176
178
|
this.typeName,
|
|
177
179
|
o,
|
|
178
180
|
i,
|
|
@@ -183,23 +185,23 @@ class mt extends g {
|
|
|
183
185
|
}
|
|
184
186
|
return o;
|
|
185
187
|
}
|
|
186
|
-
internalBinaryWrite(e, t,
|
|
188
|
+
internalBinaryWrite(e, t, r) {
|
|
187
189
|
if (e.partsCount !== 0n && t.tag(1, h.Varint).uint64(e.partsCount), e.uploadedParts.length) {
|
|
188
190
|
t.tag(2, h.LengthDelimited).fork();
|
|
189
191
|
for (let o = 0; o < e.uploadedParts.length; o++)
|
|
190
192
|
t.uint64(e.uploadedParts[o]);
|
|
191
193
|
t.join();
|
|
192
194
|
}
|
|
193
|
-
let
|
|
194
|
-
return
|
|
195
|
+
let n = r.writeUnknownFields;
|
|
196
|
+
return n !== !1 && (n == !0 ? u.onWrite : n)(
|
|
195
197
|
this.typeName,
|
|
196
198
|
e,
|
|
197
199
|
t
|
|
198
200
|
), t;
|
|
199
201
|
}
|
|
200
202
|
}
|
|
201
|
-
const
|
|
202
|
-
class
|
|
203
|
+
const kt = new bt();
|
|
204
|
+
class Tt extends g {
|
|
203
205
|
constructor() {
|
|
204
206
|
super("MiLaboratories.Controller.Shared.uploadapi.UpdateProgress", []);
|
|
205
207
|
}
|
|
@@ -207,20 +209,20 @@ class yt extends g {
|
|
|
207
209
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
208
210
|
return e !== void 0 && f(this, t, e), t;
|
|
209
211
|
}
|
|
210
|
-
internalBinaryRead(e, t,
|
|
211
|
-
return
|
|
212
|
+
internalBinaryRead(e, t, r, n) {
|
|
213
|
+
return n ?? this.create();
|
|
212
214
|
}
|
|
213
|
-
internalBinaryWrite(e, t,
|
|
214
|
-
let
|
|
215
|
-
return
|
|
215
|
+
internalBinaryWrite(e, t, r) {
|
|
216
|
+
let n = r.writeUnknownFields;
|
|
217
|
+
return n !== !1 && (n == !0 ? u.onWrite : n)(
|
|
216
218
|
this.typeName,
|
|
217
219
|
e,
|
|
218
220
|
t
|
|
219
221
|
), t;
|
|
220
222
|
}
|
|
221
223
|
}
|
|
222
|
-
new
|
|
223
|
-
class
|
|
224
|
+
new Tt();
|
|
225
|
+
class Lt extends g {
|
|
224
226
|
constructor() {
|
|
225
227
|
super("MiLaboratories.Controller.Shared.uploadapi.UpdateProgress.Request", [
|
|
226
228
|
{
|
|
@@ -249,9 +251,9 @@ class bt extends g {
|
|
|
249
251
|
e
|
|
250
252
|
), t;
|
|
251
253
|
}
|
|
252
|
-
internalBinaryRead(e, t,
|
|
253
|
-
let o =
|
|
254
|
-
for (; e.pos <
|
|
254
|
+
internalBinaryRead(e, t, r, n) {
|
|
255
|
+
let o = n ?? this.create(), l = e.pos + t;
|
|
256
|
+
for (; e.pos < l; ) {
|
|
255
257
|
let [i, c] = e.tag();
|
|
256
258
|
switch (i) {
|
|
257
259
|
case /* uint64 resource_id */
|
|
@@ -263,13 +265,13 @@ class bt extends g {
|
|
|
263
265
|
o.bytesProcessed = e.int64().toBigInt();
|
|
264
266
|
break;
|
|
265
267
|
default:
|
|
266
|
-
let
|
|
267
|
-
if (
|
|
268
|
+
let a = r.readUnknownField;
|
|
269
|
+
if (a === "throw")
|
|
268
270
|
throw new globalThis.Error(
|
|
269
271
|
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
270
272
|
);
|
|
271
273
|
let p = e.skip(c);
|
|
272
|
-
|
|
274
|
+
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
273
275
|
this.typeName,
|
|
274
276
|
o,
|
|
275
277
|
i,
|
|
@@ -280,18 +282,18 @@ class bt extends g {
|
|
|
280
282
|
}
|
|
281
283
|
return o;
|
|
282
284
|
}
|
|
283
|
-
internalBinaryWrite(e, t,
|
|
285
|
+
internalBinaryWrite(e, t, r) {
|
|
284
286
|
e.resourceId !== 0n && t.tag(1, h.Varint).uint64(e.resourceId), e.bytesProcessed !== 0n && t.tag(2, h.Varint).int64(e.bytesProcessed);
|
|
285
|
-
let
|
|
286
|
-
return
|
|
287
|
+
let n = r.writeUnknownFields;
|
|
288
|
+
return n !== !1 && (n == !0 ? u.onWrite : n)(
|
|
287
289
|
this.typeName,
|
|
288
290
|
e,
|
|
289
291
|
t
|
|
290
292
|
), t;
|
|
291
293
|
}
|
|
292
294
|
}
|
|
293
|
-
const
|
|
294
|
-
class
|
|
295
|
+
const Pt = new Lt();
|
|
296
|
+
class It extends g {
|
|
295
297
|
constructor() {
|
|
296
298
|
super(
|
|
297
299
|
"MiLaboratories.Controller.Shared.uploadapi.UpdateProgress.Response",
|
|
@@ -306,20 +308,20 @@ class kt extends g {
|
|
|
306
308
|
e
|
|
307
309
|
), t;
|
|
308
310
|
}
|
|
309
|
-
internalBinaryRead(e, t,
|
|
310
|
-
return
|
|
311
|
+
internalBinaryRead(e, t, r, n) {
|
|
312
|
+
return n ?? this.create();
|
|
311
313
|
}
|
|
312
|
-
internalBinaryWrite(e, t,
|
|
313
|
-
let
|
|
314
|
-
return
|
|
314
|
+
internalBinaryWrite(e, t, r) {
|
|
315
|
+
let n = r.writeUnknownFields;
|
|
316
|
+
return n !== !1 && (n == !0 ? u.onWrite : n)(
|
|
315
317
|
this.typeName,
|
|
316
318
|
e,
|
|
317
319
|
t
|
|
318
320
|
), t;
|
|
319
321
|
}
|
|
320
322
|
}
|
|
321
|
-
const
|
|
322
|
-
class
|
|
323
|
+
const Rt = new It();
|
|
324
|
+
class St extends g {
|
|
323
325
|
constructor() {
|
|
324
326
|
super("MiLaboratories.Controller.Shared.uploadapi.GetPartURL", []);
|
|
325
327
|
}
|
|
@@ -327,20 +329,20 @@ class Pt extends g {
|
|
|
327
329
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
328
330
|
return e !== void 0 && f(this, t, e), t;
|
|
329
331
|
}
|
|
330
|
-
internalBinaryRead(e, t,
|
|
331
|
-
return
|
|
332
|
+
internalBinaryRead(e, t, r, n) {
|
|
333
|
+
return n ?? this.create();
|
|
332
334
|
}
|
|
333
|
-
internalBinaryWrite(e, t,
|
|
334
|
-
let
|
|
335
|
-
return
|
|
335
|
+
internalBinaryWrite(e, t, r) {
|
|
336
|
+
let n = r.writeUnknownFields;
|
|
337
|
+
return n !== !1 && (n == !0 ? u.onWrite : n)(
|
|
336
338
|
this.typeName,
|
|
337
339
|
e,
|
|
338
340
|
t
|
|
339
341
|
), t;
|
|
340
342
|
}
|
|
341
343
|
}
|
|
342
|
-
new
|
|
343
|
-
class
|
|
344
|
+
new St();
|
|
345
|
+
class Ut extends g {
|
|
344
346
|
constructor() {
|
|
345
347
|
super("MiLaboratories.Controller.Shared.uploadapi.GetPartURL.Request", [
|
|
346
348
|
{
|
|
@@ -377,9 +379,9 @@ class It extends g {
|
|
|
377
379
|
e
|
|
378
380
|
), t;
|
|
379
381
|
}
|
|
380
|
-
internalBinaryRead(e, t,
|
|
381
|
-
let o =
|
|
382
|
-
for (; e.pos <
|
|
382
|
+
internalBinaryRead(e, t, r, n) {
|
|
383
|
+
let o = n ?? this.create(), l = e.pos + t;
|
|
384
|
+
for (; e.pos < l; ) {
|
|
383
385
|
let [i, c] = e.tag();
|
|
384
386
|
switch (i) {
|
|
385
387
|
case /* uint64 resource_id */
|
|
@@ -395,13 +397,13 @@ class It extends g {
|
|
|
395
397
|
o.uploadedPartSize = e.uint64().toBigInt();
|
|
396
398
|
break;
|
|
397
399
|
default:
|
|
398
|
-
let
|
|
399
|
-
if (
|
|
400
|
+
let a = r.readUnknownField;
|
|
401
|
+
if (a === "throw")
|
|
400
402
|
throw new globalThis.Error(
|
|
401
403
|
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
402
404
|
);
|
|
403
405
|
let p = e.skip(c);
|
|
404
|
-
|
|
406
|
+
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
405
407
|
this.typeName,
|
|
406
408
|
o,
|
|
407
409
|
i,
|
|
@@ -412,18 +414,18 @@ class It extends g {
|
|
|
412
414
|
}
|
|
413
415
|
return o;
|
|
414
416
|
}
|
|
415
|
-
internalBinaryWrite(e, t,
|
|
417
|
+
internalBinaryWrite(e, t, r) {
|
|
416
418
|
e.resourceId !== 0n && t.tag(1, h.Varint).uint64(e.resourceId), e.partNumber !== 0n && t.tag(2, h.Varint).uint64(e.partNumber), e.uploadedPartSize !== 0n && t.tag(3, h.Varint).uint64(e.uploadedPartSize);
|
|
417
|
-
let
|
|
418
|
-
return
|
|
419
|
+
let n = r.writeUnknownFields;
|
|
420
|
+
return n !== !1 && (n == !0 ? u.onWrite : n)(
|
|
419
421
|
this.typeName,
|
|
420
422
|
e,
|
|
421
423
|
t
|
|
422
424
|
), t;
|
|
423
425
|
}
|
|
424
426
|
}
|
|
425
|
-
const
|
|
426
|
-
class
|
|
427
|
+
const Nt = new Ut();
|
|
428
|
+
class Dt extends g {
|
|
427
429
|
constructor() {
|
|
428
430
|
super("MiLaboratories.Controller.Shared.uploadapi.GetPartURL.HTTPHeader", [
|
|
429
431
|
{
|
|
@@ -452,9 +454,9 @@ class St extends g {
|
|
|
452
454
|
e
|
|
453
455
|
), t;
|
|
454
456
|
}
|
|
455
|
-
internalBinaryRead(e, t,
|
|
456
|
-
let o =
|
|
457
|
-
for (; e.pos <
|
|
457
|
+
internalBinaryRead(e, t, r, n) {
|
|
458
|
+
let o = n ?? this.create(), l = e.pos + t;
|
|
459
|
+
for (; e.pos < l; ) {
|
|
458
460
|
let [i, c] = e.tag();
|
|
459
461
|
switch (i) {
|
|
460
462
|
case /* string Name = 1 [json_name = "Name"];*/
|
|
@@ -466,13 +468,13 @@ class St extends g {
|
|
|
466
468
|
o.value = e.string();
|
|
467
469
|
break;
|
|
468
470
|
default:
|
|
469
|
-
let
|
|
470
|
-
if (
|
|
471
|
+
let a = r.readUnknownField;
|
|
472
|
+
if (a === "throw")
|
|
471
473
|
throw new globalThis.Error(
|
|
472
474
|
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
473
475
|
);
|
|
474
476
|
let p = e.skip(c);
|
|
475
|
-
|
|
477
|
+
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
476
478
|
this.typeName,
|
|
477
479
|
o,
|
|
478
480
|
i,
|
|
@@ -483,18 +485,18 @@ class St extends g {
|
|
|
483
485
|
}
|
|
484
486
|
return o;
|
|
485
487
|
}
|
|
486
|
-
internalBinaryWrite(e, t,
|
|
488
|
+
internalBinaryWrite(e, t, r) {
|
|
487
489
|
e.name !== "" && t.tag(1, h.LengthDelimited).string(e.name), e.value !== "" && t.tag(2, h.LengthDelimited).string(e.value);
|
|
488
|
-
let
|
|
489
|
-
return
|
|
490
|
+
let n = r.writeUnknownFields;
|
|
491
|
+
return n !== !1 && (n == !0 ? u.onWrite : n)(
|
|
490
492
|
this.typeName,
|
|
491
493
|
e,
|
|
492
494
|
t
|
|
493
495
|
), t;
|
|
494
496
|
}
|
|
495
497
|
}
|
|
496
|
-
const E = new
|
|
497
|
-
class
|
|
498
|
+
const E = new Dt();
|
|
499
|
+
class Bt extends g {
|
|
498
500
|
constructor() {
|
|
499
501
|
super("MiLaboratories.Controller.Shared.uploadapi.GetPartURL.Response", [
|
|
500
502
|
{
|
|
@@ -544,9 +546,9 @@ class Nt extends g {
|
|
|
544
546
|
e
|
|
545
547
|
), t;
|
|
546
548
|
}
|
|
547
|
-
internalBinaryRead(e, t,
|
|
548
|
-
let o =
|
|
549
|
-
for (; e.pos <
|
|
549
|
+
internalBinaryRead(e, t, r, n) {
|
|
550
|
+
let o = n ?? this.create(), l = e.pos + t;
|
|
551
|
+
for (; e.pos < l; ) {
|
|
550
552
|
let [i, c] = e.tag();
|
|
551
553
|
switch (i) {
|
|
552
554
|
case /* string upload_url */
|
|
@@ -563,7 +565,7 @@ class Nt extends g {
|
|
|
563
565
|
E.internalBinaryRead(
|
|
564
566
|
e,
|
|
565
567
|
e.uint32(),
|
|
566
|
-
|
|
568
|
+
r
|
|
567
569
|
)
|
|
568
570
|
);
|
|
569
571
|
break;
|
|
@@ -576,13 +578,13 @@ class Nt extends g {
|
|
|
576
578
|
o.chunkEnd = e.uint64().toBigInt();
|
|
577
579
|
break;
|
|
578
580
|
default:
|
|
579
|
-
let
|
|
580
|
-
if (
|
|
581
|
+
let a = r.readUnknownField;
|
|
582
|
+
if (a === "throw")
|
|
581
583
|
throw new globalThis.Error(
|
|
582
584
|
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
583
585
|
);
|
|
584
586
|
let p = e.skip(c);
|
|
585
|
-
|
|
587
|
+
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
586
588
|
this.typeName,
|
|
587
589
|
o,
|
|
588
590
|
i,
|
|
@@ -593,25 +595,25 @@ class Nt extends g {
|
|
|
593
595
|
}
|
|
594
596
|
return o;
|
|
595
597
|
}
|
|
596
|
-
internalBinaryWrite(e, t,
|
|
598
|
+
internalBinaryWrite(e, t, r) {
|
|
597
599
|
e.uploadUrl !== "" && t.tag(1, h.LengthDelimited).string(e.uploadUrl), e.method !== "" && t.tag(2, h.LengthDelimited).string(e.method);
|
|
598
600
|
for (let o = 0; o < e.headers.length; o++)
|
|
599
601
|
E.internalBinaryWrite(
|
|
600
602
|
e.headers[o],
|
|
601
603
|
t.tag(3, h.LengthDelimited).fork(),
|
|
602
|
-
|
|
604
|
+
r
|
|
603
605
|
).join();
|
|
604
606
|
e.chunkStart !== 0n && t.tag(4, h.Varint).uint64(e.chunkStart), e.chunkEnd !== 0n && t.tag(5, h.Varint).uint64(e.chunkEnd);
|
|
605
|
-
let
|
|
606
|
-
return
|
|
607
|
+
let n = r.writeUnknownFields;
|
|
608
|
+
return n !== !1 && (n == !0 ? u.onWrite : n)(
|
|
607
609
|
this.typeName,
|
|
608
610
|
e,
|
|
609
611
|
t
|
|
610
612
|
), t;
|
|
611
613
|
}
|
|
612
614
|
}
|
|
613
|
-
const
|
|
614
|
-
class
|
|
615
|
+
const vt = new Bt();
|
|
616
|
+
class $t extends g {
|
|
615
617
|
constructor() {
|
|
616
618
|
super("MiLaboratories.Controller.Shared.uploadapi.Finalize", []);
|
|
617
619
|
}
|
|
@@ -619,20 +621,20 @@ class Bt extends g {
|
|
|
619
621
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
620
622
|
return e !== void 0 && f(this, t, e), t;
|
|
621
623
|
}
|
|
622
|
-
internalBinaryRead(e, t,
|
|
623
|
-
return
|
|
624
|
+
internalBinaryRead(e, t, r, n) {
|
|
625
|
+
return n ?? this.create();
|
|
624
626
|
}
|
|
625
|
-
internalBinaryWrite(e, t,
|
|
626
|
-
let
|
|
627
|
-
return
|
|
627
|
+
internalBinaryWrite(e, t, r) {
|
|
628
|
+
let n = r.writeUnknownFields;
|
|
629
|
+
return n !== !1 && (n == !0 ? u.onWrite : n)(
|
|
628
630
|
this.typeName,
|
|
629
631
|
e,
|
|
630
632
|
t
|
|
631
633
|
), t;
|
|
632
634
|
}
|
|
633
635
|
}
|
|
634
|
-
new
|
|
635
|
-
class
|
|
636
|
+
new $t();
|
|
637
|
+
class _t extends g {
|
|
636
638
|
constructor() {
|
|
637
639
|
super("MiLaboratories.Controller.Shared.uploadapi.Finalize.Request", [
|
|
638
640
|
{
|
|
@@ -649,9 +651,9 @@ class Dt extends g {
|
|
|
649
651
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
650
652
|
return t.resourceId = 0n, e !== void 0 && f(this, t, e), t;
|
|
651
653
|
}
|
|
652
|
-
internalBinaryRead(e, t,
|
|
653
|
-
let o =
|
|
654
|
-
for (; e.pos <
|
|
654
|
+
internalBinaryRead(e, t, r, n) {
|
|
655
|
+
let o = n ?? this.create(), l = e.pos + t;
|
|
656
|
+
for (; e.pos < l; ) {
|
|
655
657
|
let [i, c] = e.tag();
|
|
656
658
|
switch (i) {
|
|
657
659
|
case /* uint64 resource_id */
|
|
@@ -659,13 +661,13 @@ class Dt extends g {
|
|
|
659
661
|
o.resourceId = e.uint64().toBigInt();
|
|
660
662
|
break;
|
|
661
663
|
default:
|
|
662
|
-
let
|
|
663
|
-
if (
|
|
664
|
+
let a = r.readUnknownField;
|
|
665
|
+
if (a === "throw")
|
|
664
666
|
throw new globalThis.Error(
|
|
665
667
|
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
666
668
|
);
|
|
667
669
|
let p = e.skip(c);
|
|
668
|
-
|
|
670
|
+
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
669
671
|
this.typeName,
|
|
670
672
|
o,
|
|
671
673
|
i,
|
|
@@ -676,18 +678,18 @@ class Dt extends g {
|
|
|
676
678
|
}
|
|
677
679
|
return o;
|
|
678
680
|
}
|
|
679
|
-
internalBinaryWrite(e, t,
|
|
681
|
+
internalBinaryWrite(e, t, r) {
|
|
680
682
|
e.resourceId !== 0n && t.tag(1, h.Varint).uint64(e.resourceId);
|
|
681
|
-
let
|
|
682
|
-
return
|
|
683
|
+
let n = r.writeUnknownFields;
|
|
684
|
+
return n !== !1 && (n == !0 ? u.onWrite : n)(
|
|
683
685
|
this.typeName,
|
|
684
686
|
e,
|
|
685
687
|
t
|
|
686
688
|
), t;
|
|
687
689
|
}
|
|
688
690
|
}
|
|
689
|
-
const
|
|
690
|
-
class
|
|
691
|
+
const Ct = new _t();
|
|
692
|
+
class Ot extends g {
|
|
691
693
|
constructor() {
|
|
692
694
|
super("MiLaboratories.Controller.Shared.uploadapi.Finalize.Response", []);
|
|
693
695
|
}
|
|
@@ -695,48 +697,48 @@ class $t extends g {
|
|
|
695
697
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
696
698
|
return e !== void 0 && f(this, t, e), t;
|
|
697
699
|
}
|
|
698
|
-
internalBinaryRead(e, t,
|
|
699
|
-
return
|
|
700
|
+
internalBinaryRead(e, t, r, n) {
|
|
701
|
+
return n ?? this.create();
|
|
700
702
|
}
|
|
701
|
-
internalBinaryWrite(e, t,
|
|
702
|
-
let
|
|
703
|
-
return
|
|
703
|
+
internalBinaryWrite(e, t, r) {
|
|
704
|
+
let n = r.writeUnknownFields;
|
|
705
|
+
return n !== !1 && (n == !0 ? u.onWrite : n)(
|
|
704
706
|
this.typeName,
|
|
705
707
|
e,
|
|
706
708
|
t
|
|
707
709
|
), t;
|
|
708
710
|
}
|
|
709
711
|
}
|
|
710
|
-
const
|
|
712
|
+
const Ft = new Ot(), W = new D(
|
|
711
713
|
"MiLaboratories.Controller.Shared.Upload",
|
|
712
714
|
[
|
|
713
715
|
{
|
|
714
716
|
name: "Init",
|
|
715
717
|
options: {},
|
|
716
|
-
I:
|
|
717
|
-
O:
|
|
718
|
+
I: yt,
|
|
719
|
+
O: kt
|
|
718
720
|
},
|
|
719
721
|
{
|
|
720
722
|
name: "GetPartURL",
|
|
721
723
|
options: {},
|
|
722
|
-
I:
|
|
723
|
-
O:
|
|
724
|
+
I: Nt,
|
|
725
|
+
O: vt
|
|
724
726
|
},
|
|
725
727
|
{
|
|
726
728
|
name: "UpdateProgress",
|
|
727
729
|
options: {},
|
|
728
|
-
I:
|
|
729
|
-
O:
|
|
730
|
+
I: Pt,
|
|
731
|
+
O: Rt
|
|
730
732
|
},
|
|
731
733
|
{
|
|
732
734
|
name: "Finalize",
|
|
733
735
|
options: {},
|
|
734
|
-
I:
|
|
735
|
-
O:
|
|
736
|
+
I: Ct,
|
|
737
|
+
O: Ft
|
|
736
738
|
}
|
|
737
739
|
]
|
|
738
740
|
);
|
|
739
|
-
class
|
|
741
|
+
class Et {
|
|
740
742
|
constructor(e) {
|
|
741
743
|
d(this, "typeName", W.typeName);
|
|
742
744
|
d(this, "methods", W.methods);
|
|
@@ -751,12 +753,12 @@ class Ct {
|
|
|
751
753
|
* @generated from protobuf rpc: Init(MiLaboratories.Controller.Shared.uploadapi.Init.Request) returns (MiLaboratories.Controller.Shared.uploadapi.Init.Response);
|
|
752
754
|
*/
|
|
753
755
|
init(e, t) {
|
|
754
|
-
const
|
|
756
|
+
const r = this.methods[0], n = this._transport.mergeOptions(t);
|
|
755
757
|
return y(
|
|
756
758
|
"unary",
|
|
757
759
|
this._transport,
|
|
758
|
-
n,
|
|
759
760
|
r,
|
|
761
|
+
n,
|
|
760
762
|
e
|
|
761
763
|
);
|
|
762
764
|
}
|
|
@@ -769,8 +771,8 @@ class Ct {
|
|
|
769
771
|
* @generated from protobuf rpc: GetPartURL(MiLaboratories.Controller.Shared.uploadapi.GetPartURL.Request) returns (MiLaboratories.Controller.Shared.uploadapi.GetPartURL.Response);
|
|
770
772
|
*/
|
|
771
773
|
getPartURL(e, t) {
|
|
772
|
-
const
|
|
773
|
-
return y("unary", this._transport,
|
|
774
|
+
const r = this.methods[1], n = this._transport.mergeOptions(t);
|
|
775
|
+
return y("unary", this._transport, r, n, e);
|
|
774
776
|
}
|
|
775
777
|
/**
|
|
776
778
|
*
|
|
@@ -780,8 +782,8 @@ class Ct {
|
|
|
780
782
|
* @generated from protobuf rpc: UpdateProgress(MiLaboratories.Controller.Shared.uploadapi.UpdateProgress.Request) returns (MiLaboratories.Controller.Shared.uploadapi.UpdateProgress.Response);
|
|
781
783
|
*/
|
|
782
784
|
updateProgress(e, t) {
|
|
783
|
-
const
|
|
784
|
-
return y("unary", this._transport,
|
|
785
|
+
const r = this.methods[2], n = this._transport.mergeOptions(t);
|
|
786
|
+
return y("unary", this._transport, r, n, e);
|
|
785
787
|
}
|
|
786
788
|
/**
|
|
787
789
|
*
|
|
@@ -793,112 +795,128 @@ class Ct {
|
|
|
793
795
|
* @generated from protobuf rpc: Finalize(MiLaboratories.Controller.Shared.uploadapi.Finalize.Request) returns (MiLaboratories.Controller.Shared.uploadapi.Finalize.Response);
|
|
794
796
|
*/
|
|
795
797
|
finalize(e, t) {
|
|
796
|
-
const
|
|
797
|
-
return y("unary", this._transport,
|
|
798
|
+
const r = this.methods[3], n = this._transport.mergeOptions(t);
|
|
799
|
+
return y("unary", this._transport, r, n, e);
|
|
798
800
|
}
|
|
799
801
|
}
|
|
800
|
-
|
|
802
|
+
function Ue(s) {
|
|
803
|
+
return Object.fromEntries(s.map(({ name: e, value: t }) => [e, t]));
|
|
804
|
+
}
|
|
805
|
+
class Ne extends Error {
|
|
801
806
|
}
|
|
802
|
-
class
|
|
807
|
+
class De extends Error {
|
|
803
808
|
}
|
|
804
|
-
class
|
|
809
|
+
class Wt extends Error {
|
|
805
810
|
}
|
|
806
|
-
class
|
|
811
|
+
class Be extends Error {
|
|
807
812
|
}
|
|
808
|
-
class
|
|
809
|
-
constructor(e, t,
|
|
813
|
+
class At {
|
|
814
|
+
constructor(e, t, r, n) {
|
|
810
815
|
d(this, "grpcClient");
|
|
811
|
-
this.grpcTransport = e, this.httpClient = t, this.logger =
|
|
816
|
+
this.grpcTransport = e, this.httpClient = t, this.logger = n, this.grpcClient = new Et(this.grpcTransport);
|
|
812
817
|
}
|
|
813
818
|
close() {
|
|
814
819
|
}
|
|
815
|
-
async initUpload({ id: e, type: t },
|
|
816
|
-
const
|
|
817
|
-
return
|
|
820
|
+
async initUpload({ id: e, type: t }, r) {
|
|
821
|
+
const n = await this.grpcInit(e, t, r);
|
|
822
|
+
return {
|
|
823
|
+
overall: n.partsCount,
|
|
824
|
+
toUpload: this.partsToUpload(n.partsCount, n.uploadedParts)
|
|
825
|
+
};
|
|
818
826
|
}
|
|
819
|
-
async partUpload({ id: e, type: t },
|
|
820
|
-
const
|
|
821
|
-
{
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
827
|
+
async partUpload({ id: e, type: t }, r, n, o, l) {
|
|
828
|
+
const i = await this.grpcGetPartUrl(
|
|
829
|
+
{ id: e, type: t },
|
|
830
|
+
o,
|
|
831
|
+
0n,
|
|
832
|
+
// we update progress as a separate call later.
|
|
833
|
+
l
|
|
834
|
+
), c = await xt(r, i.chunkStart, i.chunkEnd);
|
|
835
|
+
await Mt(r, n);
|
|
836
|
+
const {
|
|
837
|
+
body: a,
|
|
838
|
+
statusCode: p,
|
|
839
|
+
headers: F
|
|
840
|
+
} = await be(i.uploadUrl, {
|
|
841
|
+
dispatcher: this.httpClient,
|
|
842
|
+
body: c,
|
|
843
|
+
headers: Ue(i.headers),
|
|
844
|
+
method: i.method.toUpperCase()
|
|
845
|
+
}), Je = await a.text();
|
|
846
|
+
Ht(p, Je, F, i), await this.grpcUpdateProgress({ id: e, type: t }, i.chunkEnd - i.chunkStart, l);
|
|
847
|
+
}
|
|
848
|
+
async finalize(e, t) {
|
|
849
|
+
return await this.grpcFinalize(e, t);
|
|
850
|
+
}
|
|
851
|
+
/** Calculates parts that need to be uploaded from the parts that were
|
|
852
|
+
* already uploaded. */
|
|
853
|
+
partsToUpload(e, t) {
|
|
854
|
+
const r = [], n = new Set(t);
|
|
855
|
+
for (let o = 1n; o <= e; o++)
|
|
856
|
+
n.has(o) || r.push(o);
|
|
857
|
+
return r;
|
|
858
|
+
}
|
|
859
|
+
async grpcInit(e, t, r) {
|
|
860
|
+
return await this.grpcClient.init({ resourceId: e }, T(t, r)).response;
|
|
861
|
+
}
|
|
862
|
+
async grpcGetPartUrl({ id: e, type: t }, r, n, o) {
|
|
863
|
+
return await this.grpcClient.getPartURL(
|
|
864
|
+
{ resourceId: e, partNumber: r, uploadedPartSize: n },
|
|
865
|
+
T(t, o)
|
|
866
|
+
).response;
|
|
867
|
+
}
|
|
868
|
+
async grpcUpdateProgress({ id: e, type: t }, r, n) {
|
|
840
869
|
await this.grpcClient.updateProgress(
|
|
841
870
|
{
|
|
842
871
|
resourceId: e,
|
|
843
|
-
bytesProcessed:
|
|
872
|
+
bytesProcessed: r
|
|
844
873
|
},
|
|
845
|
-
|
|
846
|
-
);
|
|
847
|
-
}
|
|
848
|
-
async finalizeUpload({ id: e, type: t }, n) {
|
|
849
|
-
return await this.grpcClient.finalize({ resourceId: e }, k(t, n));
|
|
850
|
-
}
|
|
851
|
-
async readChunk(e, t, n) {
|
|
852
|
-
let r;
|
|
853
|
-
try {
|
|
854
|
-
r = await m.open(e);
|
|
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);
|
|
856
|
-
return {
|
|
857
|
-
chunk: i.subarray(0, c),
|
|
858
|
-
mTime: BigInt(Math.floor(l.mtimeMs / 1e3))
|
|
859
|
-
};
|
|
860
|
-
} catch (o) {
|
|
861
|
-
throw o.code == "ENOENT" ? new Se(`there is no file ${e} for uploading`) : o;
|
|
862
|
-
} finally {
|
|
863
|
-
r == null || r.close();
|
|
864
|
-
}
|
|
874
|
+
T(t, n)
|
|
875
|
+
).response;
|
|
865
876
|
}
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
async readBytesFromPosition(e, t, n, r) {
|
|
869
|
-
let o = 0;
|
|
870
|
-
for (; o < n; ) {
|
|
871
|
-
const { bytesRead: a } = await e.read(
|
|
872
|
-
t,
|
|
873
|
-
o,
|
|
874
|
-
n - o,
|
|
875
|
-
r + o
|
|
876
|
-
);
|
|
877
|
-
if (a === 0)
|
|
878
|
-
throw new Re("file ended earlier than expected.");
|
|
879
|
-
o += a;
|
|
880
|
-
}
|
|
881
|
-
return o;
|
|
877
|
+
async grpcFinalize({ id: e, type: t }, r) {
|
|
878
|
+
return await this.grpcClient.finalize({ resourceId: e }, T(t, r)).response;
|
|
882
879
|
}
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
return
|
|
880
|
+
}
|
|
881
|
+
async function xt(s, e, t) {
|
|
882
|
+
let r;
|
|
883
|
+
try {
|
|
884
|
+
r = await m.open(s);
|
|
885
|
+
const n = Number(t - e), o = Number(e), l = Buffer.alloc(n), i = await zt(r, l, n, o);
|
|
886
|
+
return l.subarray(0, i);
|
|
887
|
+
} catch (n) {
|
|
888
|
+
throw n.code == "ENOENT" ? new Be(`there is no file ${s} for uploading`) : n;
|
|
889
|
+
} finally {
|
|
890
|
+
r == null || r.close();
|
|
890
891
|
}
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
892
|
+
}
|
|
893
|
+
async function zt(s, e, t, r) {
|
|
894
|
+
let n = 0;
|
|
895
|
+
for (; n < t; ) {
|
|
896
|
+
const { bytesRead: o } = await s.read(
|
|
897
|
+
e,
|
|
898
|
+
n,
|
|
899
|
+
t - n,
|
|
900
|
+
r + n
|
|
901
|
+
);
|
|
902
|
+
if (o === 0)
|
|
903
|
+
throw new De("file ended earlier than expected.");
|
|
904
|
+
n += o;
|
|
899
905
|
}
|
|
906
|
+
return n;
|
|
907
|
+
}
|
|
908
|
+
async function Mt(s, e) {
|
|
909
|
+
const t = BigInt(Math.floor((await m.stat(s)).mtimeMs / 1e3));
|
|
910
|
+
if (t > e)
|
|
911
|
+
throw new Ne(`file was modified, expected mtime: ${e}, got: ${t}.`);
|
|
900
912
|
}
|
|
901
|
-
|
|
913
|
+
function Ht(s, e, t, r) {
|
|
914
|
+
if (s != 200)
|
|
915
|
+
throw new Wt(
|
|
916
|
+
`response is not ok, status code: ${s}, body: ${e}, headers: ${t}, url: ${r.uploadUrl}`
|
|
917
|
+
);
|
|
918
|
+
}
|
|
919
|
+
class jt extends g {
|
|
902
920
|
constructor() {
|
|
903
921
|
super("google.protobuf.Duration", [
|
|
904
922
|
{
|
|
@@ -922,48 +940,48 @@ class Et extends g {
|
|
|
922
940
|
* Encode `Duration` to JSON string like "3.000001s".
|
|
923
941
|
*/
|
|
924
942
|
internalJsonWrite(e, t) {
|
|
925
|
-
let
|
|
926
|
-
if (
|
|
943
|
+
let r = P.from(e.seconds).toNumber();
|
|
944
|
+
if (r > 315576e6 || r < -315576e6)
|
|
927
945
|
throw new Error("Duration value out of range.");
|
|
928
|
-
let
|
|
929
|
-
if (
|
|
946
|
+
let n = e.seconds.toString();
|
|
947
|
+
if (r === 0 && e.nanos < 0 && (n = "-" + n), e.nanos !== 0) {
|
|
930
948
|
let o = Math.abs(e.nanos).toString();
|
|
931
|
-
o = "0".repeat(9 - o.length) + o, o.substring(3) === "000000" ? o = o.substring(0, 3) : o.substring(6) === "000" && (o = o.substring(0, 6)),
|
|
949
|
+
o = "0".repeat(9 - o.length) + o, o.substring(3) === "000000" ? o = o.substring(0, 3) : o.substring(6) === "000" && (o = o.substring(0, 6)), n += "." + o;
|
|
932
950
|
}
|
|
933
|
-
return
|
|
951
|
+
return n + "s";
|
|
934
952
|
}
|
|
935
953
|
/**
|
|
936
954
|
* Decode `Duration` from JSON string like "3.000001s"
|
|
937
955
|
*/
|
|
938
|
-
internalJsonRead(e, t,
|
|
956
|
+
internalJsonRead(e, t, r) {
|
|
939
957
|
if (typeof e != "string")
|
|
940
958
|
throw new Error(
|
|
941
|
-
"Unable to parse Duration from JSON " +
|
|
959
|
+
"Unable to parse Duration from JSON " + ke(e) + ". Expected string."
|
|
942
960
|
);
|
|
943
|
-
let
|
|
944
|
-
if (
|
|
961
|
+
let n = e.match(/^(-?)([0-9]+)(?:\.([0-9]+))?s/);
|
|
962
|
+
if (n === null)
|
|
945
963
|
throw new Error(
|
|
946
964
|
"Unable to parse Duration from JSON string. Invalid format."
|
|
947
965
|
);
|
|
948
|
-
|
|
949
|
-
let [, o,
|
|
966
|
+
r || (r = this.create());
|
|
967
|
+
let [, o, l, i] = n, c = P.from(o + l);
|
|
950
968
|
if (c.toNumber() > 315576e6 || c.toNumber() < -315576e6)
|
|
951
969
|
throw new Error(
|
|
952
970
|
"Unable to parse Duration from JSON string. Value out of range."
|
|
953
971
|
);
|
|
954
|
-
if (
|
|
955
|
-
let
|
|
956
|
-
|
|
972
|
+
if (r.seconds = c.toBigInt(), typeof i == "string") {
|
|
973
|
+
let a = o + i + "0".repeat(9 - i.length);
|
|
974
|
+
r.nanos = parseInt(a);
|
|
957
975
|
}
|
|
958
|
-
return
|
|
976
|
+
return r;
|
|
959
977
|
}
|
|
960
978
|
create(e) {
|
|
961
979
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
962
980
|
return t.seconds = 0n, t.nanos = 0, e !== void 0 && f(this, t, e), t;
|
|
963
981
|
}
|
|
964
|
-
internalBinaryRead(e, t,
|
|
965
|
-
let o =
|
|
966
|
-
for (; e.pos <
|
|
982
|
+
internalBinaryRead(e, t, r, n) {
|
|
983
|
+
let o = n ?? this.create(), l = e.pos + t;
|
|
984
|
+
for (; e.pos < l; ) {
|
|
967
985
|
let [i, c] = e.tag();
|
|
968
986
|
switch (i) {
|
|
969
987
|
case /* int64 seconds */
|
|
@@ -975,13 +993,13 @@ class Et extends g {
|
|
|
975
993
|
o.nanos = e.int32();
|
|
976
994
|
break;
|
|
977
995
|
default:
|
|
978
|
-
let
|
|
979
|
-
if (
|
|
996
|
+
let a = r.readUnknownField;
|
|
997
|
+
if (a === "throw")
|
|
980
998
|
throw new globalThis.Error(
|
|
981
999
|
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
982
1000
|
);
|
|
983
1001
|
let p = e.skip(c);
|
|
984
|
-
|
|
1002
|
+
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
985
1003
|
this.typeName,
|
|
986
1004
|
o,
|
|
987
1005
|
i,
|
|
@@ -992,18 +1010,18 @@ class Et extends g {
|
|
|
992
1010
|
}
|
|
993
1011
|
return o;
|
|
994
1012
|
}
|
|
995
|
-
internalBinaryWrite(e, t,
|
|
1013
|
+
internalBinaryWrite(e, t, r) {
|
|
996
1014
|
e.seconds !== 0n && t.tag(1, h.Varint).int64(e.seconds), e.nanos !== 0 && t.tag(2, h.Varint).int32(e.nanos);
|
|
997
|
-
let
|
|
998
|
-
return
|
|
1015
|
+
let n = r.writeUnknownFields;
|
|
1016
|
+
return n !== !1 && (n == !0 ? u.onWrite : n)(
|
|
999
1017
|
this.typeName,
|
|
1000
1018
|
e,
|
|
1001
1019
|
t
|
|
1002
1020
|
), t;
|
|
1003
1021
|
}
|
|
1004
1022
|
}
|
|
1005
|
-
const $ = new
|
|
1006
|
-
class
|
|
1023
|
+
const $ = new jt();
|
|
1024
|
+
class Gt extends g {
|
|
1007
1025
|
constructor() {
|
|
1008
1026
|
super("MiLaboratories.Controller.Shared.ProgressAPI", []);
|
|
1009
1027
|
}
|
|
@@ -1011,20 +1029,20 @@ class Wt extends g {
|
|
|
1011
1029
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
1012
1030
|
return e !== void 0 && f(this, t, e), t;
|
|
1013
1031
|
}
|
|
1014
|
-
internalBinaryRead(e, t,
|
|
1015
|
-
return
|
|
1032
|
+
internalBinaryRead(e, t, r, n) {
|
|
1033
|
+
return n ?? this.create();
|
|
1016
1034
|
}
|
|
1017
|
-
internalBinaryWrite(e, t,
|
|
1018
|
-
let
|
|
1019
|
-
return
|
|
1035
|
+
internalBinaryWrite(e, t, r) {
|
|
1036
|
+
let n = r.writeUnknownFields;
|
|
1037
|
+
return n !== !1 && (n == !0 ? u.onWrite : n)(
|
|
1020
1038
|
this.typeName,
|
|
1021
1039
|
e,
|
|
1022
1040
|
t
|
|
1023
1041
|
), t;
|
|
1024
1042
|
}
|
|
1025
1043
|
}
|
|
1026
|
-
new
|
|
1027
|
-
class
|
|
1044
|
+
new Gt();
|
|
1045
|
+
class Vt extends g {
|
|
1028
1046
|
constructor() {
|
|
1029
1047
|
super("MiLaboratories.Controller.Shared.ProgressAPI.Report", [
|
|
1030
1048
|
{
|
|
@@ -1070,9 +1088,9 @@ class At extends g {
|
|
|
1070
1088
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
1071
1089
|
return t.progress = 0, t.bytesProcessed = 0n, t.bytesTotal = 0n, t.done = !1, t.name = "", e !== void 0 && f(this, t, e), t;
|
|
1072
1090
|
}
|
|
1073
|
-
internalBinaryRead(e, t,
|
|
1074
|
-
let o =
|
|
1075
|
-
for (; e.pos <
|
|
1091
|
+
internalBinaryRead(e, t, r, n) {
|
|
1092
|
+
let o = n ?? this.create(), l = e.pos + t;
|
|
1093
|
+
for (; e.pos < l; ) {
|
|
1076
1094
|
let [i, c] = e.tag();
|
|
1077
1095
|
switch (i) {
|
|
1078
1096
|
case /* float progress */
|
|
@@ -1096,13 +1114,13 @@ class At extends g {
|
|
|
1096
1114
|
o.name = e.string();
|
|
1097
1115
|
break;
|
|
1098
1116
|
default:
|
|
1099
|
-
let
|
|
1100
|
-
if (
|
|
1117
|
+
let a = r.readUnknownField;
|
|
1118
|
+
if (a === "throw")
|
|
1101
1119
|
throw new globalThis.Error(
|
|
1102
1120
|
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
1103
1121
|
);
|
|
1104
1122
|
let p = e.skip(c);
|
|
1105
|
-
|
|
1123
|
+
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
1106
1124
|
this.typeName,
|
|
1107
1125
|
o,
|
|
1108
1126
|
i,
|
|
@@ -1113,18 +1131,18 @@ class At extends g {
|
|
|
1113
1131
|
}
|
|
1114
1132
|
return o;
|
|
1115
1133
|
}
|
|
1116
|
-
internalBinaryWrite(e, t,
|
|
1134
|
+
internalBinaryWrite(e, t, r) {
|
|
1117
1135
|
e.progress !== 0 && t.tag(1, h.Bit32).float(e.progress), e.bytesProcessed !== 0n && t.tag(2, h.Varint).uint64(e.bytesProcessed), e.bytesTotal !== 0n && t.tag(3, h.Varint).uint64(e.bytesTotal), e.done !== !1 && t.tag(4, h.Varint).bool(e.done), e.name !== "" && t.tag(5, h.LengthDelimited).string(e.name);
|
|
1118
|
-
let
|
|
1119
|
-
return
|
|
1136
|
+
let n = r.writeUnknownFields;
|
|
1137
|
+
return n !== !1 && (n == !0 ? u.onWrite : n)(
|
|
1120
1138
|
this.typeName,
|
|
1121
1139
|
e,
|
|
1122
1140
|
t
|
|
1123
1141
|
), t;
|
|
1124
1142
|
}
|
|
1125
1143
|
}
|
|
1126
|
-
const
|
|
1127
|
-
class
|
|
1144
|
+
const R = new Vt();
|
|
1145
|
+
class qt extends g {
|
|
1128
1146
|
constructor() {
|
|
1129
1147
|
super("MiLaboratories.Controller.Shared.ProgressAPI.GetStatus", []);
|
|
1130
1148
|
}
|
|
@@ -1132,20 +1150,20 @@ class zt extends g {
|
|
|
1132
1150
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
1133
1151
|
return e !== void 0 && f(this, t, e), t;
|
|
1134
1152
|
}
|
|
1135
|
-
internalBinaryRead(e, t,
|
|
1136
|
-
return
|
|
1153
|
+
internalBinaryRead(e, t, r, n) {
|
|
1154
|
+
return n ?? this.create();
|
|
1137
1155
|
}
|
|
1138
|
-
internalBinaryWrite(e, t,
|
|
1139
|
-
let
|
|
1140
|
-
return
|
|
1156
|
+
internalBinaryWrite(e, t, r) {
|
|
1157
|
+
let n = r.writeUnknownFields;
|
|
1158
|
+
return n !== !1 && (n == !0 ? u.onWrite : n)(
|
|
1141
1159
|
this.typeName,
|
|
1142
1160
|
e,
|
|
1143
1161
|
t
|
|
1144
1162
|
), t;
|
|
1145
1163
|
}
|
|
1146
1164
|
}
|
|
1147
|
-
new
|
|
1148
|
-
class
|
|
1165
|
+
new qt();
|
|
1166
|
+
class Jt extends g {
|
|
1149
1167
|
constructor() {
|
|
1150
1168
|
super("MiLaboratories.Controller.Shared.ProgressAPI.GetStatus.Request", [
|
|
1151
1169
|
{
|
|
@@ -1166,9 +1184,9 @@ class xt extends g {
|
|
|
1166
1184
|
e
|
|
1167
1185
|
), t;
|
|
1168
1186
|
}
|
|
1169
|
-
internalBinaryRead(e, t,
|
|
1170
|
-
let o =
|
|
1171
|
-
for (; e.pos <
|
|
1187
|
+
internalBinaryRead(e, t, r, n) {
|
|
1188
|
+
let o = n ?? this.create(), l = e.pos + t;
|
|
1189
|
+
for (; e.pos < l; ) {
|
|
1172
1190
|
let [i, c] = e.tag();
|
|
1173
1191
|
switch (i) {
|
|
1174
1192
|
case /* uint64 resource_id */
|
|
@@ -1176,13 +1194,13 @@ class xt extends g {
|
|
|
1176
1194
|
o.resourceId = e.uint64().toBigInt();
|
|
1177
1195
|
break;
|
|
1178
1196
|
default:
|
|
1179
|
-
let
|
|
1180
|
-
if (
|
|
1197
|
+
let a = r.readUnknownField;
|
|
1198
|
+
if (a === "throw")
|
|
1181
1199
|
throw new globalThis.Error(
|
|
1182
1200
|
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
1183
1201
|
);
|
|
1184
1202
|
let p = e.skip(c);
|
|
1185
|
-
|
|
1203
|
+
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
1186
1204
|
this.typeName,
|
|
1187
1205
|
o,
|
|
1188
1206
|
i,
|
|
@@ -1193,21 +1211,21 @@ class xt extends g {
|
|
|
1193
1211
|
}
|
|
1194
1212
|
return o;
|
|
1195
1213
|
}
|
|
1196
|
-
internalBinaryWrite(e, t,
|
|
1214
|
+
internalBinaryWrite(e, t, r) {
|
|
1197
1215
|
e.resourceId !== 0n && t.tag(1, h.Varint).uint64(e.resourceId);
|
|
1198
|
-
let
|
|
1199
|
-
return
|
|
1216
|
+
let n = r.writeUnknownFields;
|
|
1217
|
+
return n !== !1 && (n == !0 ? u.onWrite : n)(
|
|
1200
1218
|
this.typeName,
|
|
1201
1219
|
e,
|
|
1202
1220
|
t
|
|
1203
1221
|
), t;
|
|
1204
1222
|
}
|
|
1205
1223
|
}
|
|
1206
|
-
const
|
|
1207
|
-
class
|
|
1224
|
+
const Zt = new Jt();
|
|
1225
|
+
class Qt extends g {
|
|
1208
1226
|
constructor() {
|
|
1209
1227
|
super("MiLaboratories.Controller.Shared.ProgressAPI.GetStatus.Response", [
|
|
1210
|
-
{ no: 1, name: "report", kind: "message", T: () =>
|
|
1228
|
+
{ no: 1, name: "report", kind: "message", T: () => R }
|
|
1211
1229
|
]);
|
|
1212
1230
|
}
|
|
1213
1231
|
create(e) {
|
|
@@ -1218,28 +1236,28 @@ class Ht extends g {
|
|
|
1218
1236
|
e
|
|
1219
1237
|
), t;
|
|
1220
1238
|
}
|
|
1221
|
-
internalBinaryRead(e, t,
|
|
1222
|
-
let o =
|
|
1223
|
-
for (; e.pos <
|
|
1239
|
+
internalBinaryRead(e, t, r, n) {
|
|
1240
|
+
let o = n ?? this.create(), l = e.pos + t;
|
|
1241
|
+
for (; e.pos < l; ) {
|
|
1224
1242
|
let [i, c] = e.tag();
|
|
1225
1243
|
switch (i) {
|
|
1226
1244
|
case /* MiLaboratories.Controller.Shared.ProgressAPI.Report report */
|
|
1227
1245
|
1:
|
|
1228
|
-
o.report =
|
|
1246
|
+
o.report = R.internalBinaryRead(
|
|
1229
1247
|
e,
|
|
1230
1248
|
e.uint32(),
|
|
1231
|
-
|
|
1249
|
+
r,
|
|
1232
1250
|
o.report
|
|
1233
1251
|
);
|
|
1234
1252
|
break;
|
|
1235
1253
|
default:
|
|
1236
|
-
let
|
|
1237
|
-
if (
|
|
1254
|
+
let a = r.readUnknownField;
|
|
1255
|
+
if (a === "throw")
|
|
1238
1256
|
throw new globalThis.Error(
|
|
1239
1257
|
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
1240
1258
|
);
|
|
1241
1259
|
let p = e.skip(c);
|
|
1242
|
-
|
|
1260
|
+
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
1243
1261
|
this.typeName,
|
|
1244
1262
|
o,
|
|
1245
1263
|
i,
|
|
@@ -1250,22 +1268,22 @@ class Ht extends g {
|
|
|
1250
1268
|
}
|
|
1251
1269
|
return o;
|
|
1252
1270
|
}
|
|
1253
|
-
internalBinaryWrite(e, t,
|
|
1254
|
-
e.report &&
|
|
1271
|
+
internalBinaryWrite(e, t, r) {
|
|
1272
|
+
e.report && R.internalBinaryWrite(
|
|
1255
1273
|
e.report,
|
|
1256
1274
|
t.tag(1, h.LengthDelimited).fork(),
|
|
1257
|
-
|
|
1275
|
+
r
|
|
1258
1276
|
).join();
|
|
1259
|
-
let
|
|
1260
|
-
return
|
|
1277
|
+
let n = r.writeUnknownFields;
|
|
1278
|
+
return n !== !1 && (n == !0 ? u.onWrite : n)(
|
|
1261
1279
|
this.typeName,
|
|
1262
1280
|
e,
|
|
1263
1281
|
t
|
|
1264
1282
|
), t;
|
|
1265
1283
|
}
|
|
1266
1284
|
}
|
|
1267
|
-
const
|
|
1268
|
-
class
|
|
1285
|
+
const Xt = new Qt();
|
|
1286
|
+
class Yt extends g {
|
|
1269
1287
|
constructor() {
|
|
1270
1288
|
super("MiLaboratories.Controller.Shared.ProgressAPI.RealtimeStatus", []);
|
|
1271
1289
|
}
|
|
@@ -1273,20 +1291,20 @@ class Gt extends g {
|
|
|
1273
1291
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
1274
1292
|
return e !== void 0 && f(this, t, e), t;
|
|
1275
1293
|
}
|
|
1276
|
-
internalBinaryRead(e, t,
|
|
1277
|
-
return
|
|
1294
|
+
internalBinaryRead(e, t, r, n) {
|
|
1295
|
+
return n ?? this.create();
|
|
1278
1296
|
}
|
|
1279
|
-
internalBinaryWrite(e, t,
|
|
1280
|
-
let
|
|
1281
|
-
return
|
|
1297
|
+
internalBinaryWrite(e, t, r) {
|
|
1298
|
+
let n = r.writeUnknownFields;
|
|
1299
|
+
return n !== !1 && (n == !0 ? u.onWrite : n)(
|
|
1282
1300
|
this.typeName,
|
|
1283
1301
|
e,
|
|
1284
1302
|
t
|
|
1285
1303
|
), t;
|
|
1286
1304
|
}
|
|
1287
1305
|
}
|
|
1288
|
-
new
|
|
1289
|
-
class
|
|
1306
|
+
new Yt();
|
|
1307
|
+
class Kt extends g {
|
|
1290
1308
|
constructor() {
|
|
1291
1309
|
super(
|
|
1292
1310
|
"MiLaboratories.Controller.Shared.ProgressAPI.RealtimeStatus.Request",
|
|
@@ -1311,9 +1329,9 @@ class Vt extends g {
|
|
|
1311
1329
|
e
|
|
1312
1330
|
), t;
|
|
1313
1331
|
}
|
|
1314
|
-
internalBinaryRead(e, t,
|
|
1315
|
-
let o =
|
|
1316
|
-
for (; e.pos <
|
|
1332
|
+
internalBinaryRead(e, t, r, n) {
|
|
1333
|
+
let o = n ?? this.create(), l = e.pos + t;
|
|
1334
|
+
for (; e.pos < l; ) {
|
|
1317
1335
|
let [i, c] = e.tag();
|
|
1318
1336
|
switch (i) {
|
|
1319
1337
|
case /* uint64 resource_id */
|
|
@@ -1325,18 +1343,18 @@ class Vt extends g {
|
|
|
1325
1343
|
o.updateInterval = $.internalBinaryRead(
|
|
1326
1344
|
e,
|
|
1327
1345
|
e.uint32(),
|
|
1328
|
-
|
|
1346
|
+
r,
|
|
1329
1347
|
o.updateInterval
|
|
1330
1348
|
);
|
|
1331
1349
|
break;
|
|
1332
1350
|
default:
|
|
1333
|
-
let
|
|
1334
|
-
if (
|
|
1351
|
+
let a = r.readUnknownField;
|
|
1352
|
+
if (a === "throw")
|
|
1335
1353
|
throw new globalThis.Error(
|
|
1336
1354
|
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
1337
1355
|
);
|
|
1338
1356
|
let p = e.skip(c);
|
|
1339
|
-
|
|
1357
|
+
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
1340
1358
|
this.typeName,
|
|
1341
1359
|
o,
|
|
1342
1360
|
i,
|
|
@@ -1347,26 +1365,26 @@ class Vt extends g {
|
|
|
1347
1365
|
}
|
|
1348
1366
|
return o;
|
|
1349
1367
|
}
|
|
1350
|
-
internalBinaryWrite(e, t,
|
|
1368
|
+
internalBinaryWrite(e, t, r) {
|
|
1351
1369
|
e.resourceId !== 0n && t.tag(1, h.Varint).uint64(e.resourceId), e.updateInterval && $.internalBinaryWrite(
|
|
1352
1370
|
e.updateInterval,
|
|
1353
1371
|
t.tag(2, h.LengthDelimited).fork(),
|
|
1354
|
-
|
|
1372
|
+
r
|
|
1355
1373
|
).join();
|
|
1356
|
-
let
|
|
1357
|
-
return
|
|
1374
|
+
let n = r.writeUnknownFields;
|
|
1375
|
+
return n !== !1 && (n == !0 ? u.onWrite : n)(
|
|
1358
1376
|
this.typeName,
|
|
1359
1377
|
e,
|
|
1360
1378
|
t
|
|
1361
1379
|
), t;
|
|
1362
1380
|
}
|
|
1363
1381
|
}
|
|
1364
|
-
const
|
|
1365
|
-
class
|
|
1382
|
+
const er = new Kt();
|
|
1383
|
+
class tr extends g {
|
|
1366
1384
|
constructor() {
|
|
1367
1385
|
super(
|
|
1368
1386
|
"MiLaboratories.Controller.Shared.ProgressAPI.RealtimeStatus.Response",
|
|
1369
|
-
[{ no: 1, name: "report", kind: "message", T: () =>
|
|
1387
|
+
[{ no: 1, name: "report", kind: "message", T: () => R }]
|
|
1370
1388
|
);
|
|
1371
1389
|
}
|
|
1372
1390
|
create(e) {
|
|
@@ -1377,28 +1395,28 @@ class Jt extends g {
|
|
|
1377
1395
|
e
|
|
1378
1396
|
), t;
|
|
1379
1397
|
}
|
|
1380
|
-
internalBinaryRead(e, t,
|
|
1381
|
-
let o =
|
|
1382
|
-
for (; e.pos <
|
|
1398
|
+
internalBinaryRead(e, t, r, n) {
|
|
1399
|
+
let o = n ?? this.create(), l = e.pos + t;
|
|
1400
|
+
for (; e.pos < l; ) {
|
|
1383
1401
|
let [i, c] = e.tag();
|
|
1384
1402
|
switch (i) {
|
|
1385
1403
|
case /* MiLaboratories.Controller.Shared.ProgressAPI.Report report */
|
|
1386
1404
|
1:
|
|
1387
|
-
o.report =
|
|
1405
|
+
o.report = R.internalBinaryRead(
|
|
1388
1406
|
e,
|
|
1389
1407
|
e.uint32(),
|
|
1390
|
-
|
|
1408
|
+
r,
|
|
1391
1409
|
o.report
|
|
1392
1410
|
);
|
|
1393
1411
|
break;
|
|
1394
1412
|
default:
|
|
1395
|
-
let
|
|
1396
|
-
if (
|
|
1413
|
+
let a = r.readUnknownField;
|
|
1414
|
+
if (a === "throw")
|
|
1397
1415
|
throw new globalThis.Error(
|
|
1398
1416
|
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
1399
1417
|
);
|
|
1400
1418
|
let p = e.skip(c);
|
|
1401
|
-
|
|
1419
|
+
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
1402
1420
|
this.typeName,
|
|
1403
1421
|
o,
|
|
1404
1422
|
i,
|
|
@@ -1409,21 +1427,21 @@ class Jt extends g {
|
|
|
1409
1427
|
}
|
|
1410
1428
|
return o;
|
|
1411
1429
|
}
|
|
1412
|
-
internalBinaryWrite(e, t,
|
|
1413
|
-
e.report &&
|
|
1430
|
+
internalBinaryWrite(e, t, r) {
|
|
1431
|
+
e.report && R.internalBinaryWrite(
|
|
1414
1432
|
e.report,
|
|
1415
1433
|
t.tag(1, h.LengthDelimited).fork(),
|
|
1416
|
-
|
|
1434
|
+
r
|
|
1417
1435
|
).join();
|
|
1418
|
-
let
|
|
1419
|
-
return
|
|
1436
|
+
let n = r.writeUnknownFields;
|
|
1437
|
+
return n !== !1 && (n == !0 ? u.onWrite : n)(
|
|
1420
1438
|
this.typeName,
|
|
1421
1439
|
e,
|
|
1422
1440
|
t
|
|
1423
1441
|
), t;
|
|
1424
1442
|
}
|
|
1425
1443
|
}
|
|
1426
|
-
const
|
|
1444
|
+
const rr = new tr(), A = new D(
|
|
1427
1445
|
"MiLaboratories.Controller.Shared.Progress",
|
|
1428
1446
|
[
|
|
1429
1447
|
{
|
|
@@ -1431,19 +1449,19 @@ const Zt = new Jt(), A = new D(
|
|
|
1431
1449
|
options: {
|
|
1432
1450
|
"google.api.http": { get: "/resources/{resource_id}/get-progress" }
|
|
1433
1451
|
},
|
|
1434
|
-
I:
|
|
1435
|
-
O:
|
|
1452
|
+
I: Zt,
|
|
1453
|
+
O: Xt
|
|
1436
1454
|
},
|
|
1437
1455
|
{
|
|
1438
1456
|
name: "RealtimeStatus",
|
|
1439
1457
|
serverStreaming: !0,
|
|
1440
1458
|
options: {},
|
|
1441
|
-
I:
|
|
1442
|
-
O:
|
|
1459
|
+
I: er,
|
|
1460
|
+
O: rr
|
|
1443
1461
|
}
|
|
1444
1462
|
]
|
|
1445
1463
|
);
|
|
1446
|
-
class
|
|
1464
|
+
class nr {
|
|
1447
1465
|
constructor(e) {
|
|
1448
1466
|
d(this, "typeName", A.typeName);
|
|
1449
1467
|
d(this, "methods", A.methods);
|
|
@@ -1454,30 +1472,30 @@ class Qt {
|
|
|
1454
1472
|
* @generated from protobuf rpc: GetStatus(MiLaboratories.Controller.Shared.ProgressAPI.GetStatus.Request) returns (MiLaboratories.Controller.Shared.ProgressAPI.GetStatus.Response);
|
|
1455
1473
|
*/
|
|
1456
1474
|
getStatus(e, t) {
|
|
1457
|
-
const
|
|
1458
|
-
return y("unary", this._transport,
|
|
1475
|
+
const r = this.methods[0], n = this._transport.mergeOptions(t);
|
|
1476
|
+
return y("unary", this._transport, r, n, e);
|
|
1459
1477
|
}
|
|
1460
1478
|
/**
|
|
1461
1479
|
* @generated from protobuf rpc: RealtimeStatus(MiLaboratories.Controller.Shared.ProgressAPI.RealtimeStatus.Request) returns (stream MiLaboratories.Controller.Shared.ProgressAPI.RealtimeStatus.Response);
|
|
1462
1480
|
*/
|
|
1463
1481
|
realtimeStatus(e, t) {
|
|
1464
|
-
const
|
|
1465
|
-
return y("serverStreaming", this._transport,
|
|
1482
|
+
const r = this.methods[1], n = this._transport.mergeOptions(t);
|
|
1483
|
+
return y("serverStreaming", this._transport, r, n, e);
|
|
1466
1484
|
}
|
|
1467
1485
|
}
|
|
1468
|
-
class
|
|
1469
|
-
constructor(e, t,
|
|
1486
|
+
class or {
|
|
1487
|
+
constructor(e, t, r, n) {
|
|
1470
1488
|
d(this, "grpcClient");
|
|
1471
|
-
this.grpcTransport = e, this.client =
|
|
1489
|
+
this.grpcTransport = e, this.client = r, this.logger = n, this.grpcClient = new nr(this.grpcTransport);
|
|
1472
1490
|
}
|
|
1473
1491
|
close() {
|
|
1474
1492
|
}
|
|
1475
1493
|
/** getStatus gets a progress status by given rId and rType. */
|
|
1476
|
-
async getStatus({ id: e, type: t },
|
|
1477
|
-
const
|
|
1494
|
+
async getStatus({ id: e, type: t }, r) {
|
|
1495
|
+
const n = await this.grpcClient.getStatus(
|
|
1478
1496
|
{ resourceId: e },
|
|
1479
|
-
|
|
1480
|
-
), o =
|
|
1497
|
+
T(t, r)
|
|
1498
|
+
), o = te(n.response.report);
|
|
1481
1499
|
return {
|
|
1482
1500
|
done: o.done,
|
|
1483
1501
|
progress: o.progress,
|
|
@@ -1487,11 +1505,11 @@ class Xt {
|
|
|
1487
1505
|
}
|
|
1488
1506
|
// realtimeStatus returns a async generator that takes statuses from
|
|
1489
1507
|
// GRPC stream every updateIntervalMs milliseconds.
|
|
1490
|
-
async *realtimeStatus({ id: e, type: t },
|
|
1491
|
-
|
|
1492
|
-
const o = Math.floor(
|
|
1508
|
+
async *realtimeStatus({ id: e, type: t }, r = 100, n) {
|
|
1509
|
+
n = T(t, n);
|
|
1510
|
+
const o = Math.floor(r / 1e3), l = (r - o * 1e3) * 1e6, i = $.create({
|
|
1493
1511
|
seconds: BigInt(o),
|
|
1494
|
-
nanos:
|
|
1512
|
+
nanos: l
|
|
1495
1513
|
});
|
|
1496
1514
|
try {
|
|
1497
1515
|
const { responses: c } = this.grpcClient.realtimeStatus(
|
|
@@ -1499,7 +1517,7 @@ class Xt {
|
|
|
1499
1517
|
resourceId: e,
|
|
1500
1518
|
updateInterval: i
|
|
1501
1519
|
},
|
|
1502
|
-
|
|
1520
|
+
n
|
|
1503
1521
|
);
|
|
1504
1522
|
yield* c;
|
|
1505
1523
|
} catch (c) {
|
|
@@ -1507,7 +1525,37 @@ class Xt {
|
|
|
1507
1525
|
}
|
|
1508
1526
|
}
|
|
1509
1527
|
}
|
|
1510
|
-
class
|
|
1528
|
+
class ce extends Error {
|
|
1529
|
+
}
|
|
1530
|
+
class ve {
|
|
1531
|
+
constructor(e) {
|
|
1532
|
+
this.httpClient = e;
|
|
1533
|
+
}
|
|
1534
|
+
async download(e, t, r) {
|
|
1535
|
+
const { statusCode: n, body: o, headers: l } = await be(e, {
|
|
1536
|
+
dispatcher: this.httpClient,
|
|
1537
|
+
headers: t,
|
|
1538
|
+
signal: r
|
|
1539
|
+
}), i = se.toWeb(o);
|
|
1540
|
+
return await sr(n, i, e), {
|
|
1541
|
+
content: i,
|
|
1542
|
+
size: Number(l["content-length"])
|
|
1543
|
+
};
|
|
1544
|
+
}
|
|
1545
|
+
}
|
|
1546
|
+
async function sr(s, e, t) {
|
|
1547
|
+
if (s != 200) {
|
|
1548
|
+
const r = (await nt(e)).substring(0, 1e3);
|
|
1549
|
+
throw 400 <= s && s < 500 ? new ce(
|
|
1550
|
+
`Http error: statusCode: ${s} url: ${t.toString()}, beginning of body: ${r}`
|
|
1551
|
+
) : new Error(`Http error: statusCode: ${s} url: ${t.toString()}`);
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1554
|
+
function N(s) {
|
|
1555
|
+
if (!Q.isAbsolute(s)) throw new Error(`Path ${s} is not absolute.`);
|
|
1556
|
+
return s;
|
|
1557
|
+
}
|
|
1558
|
+
class ir extends g {
|
|
1511
1559
|
constructor() {
|
|
1512
1560
|
super("MiLaboratories.Controller.Shared.DownloadAPI", []);
|
|
1513
1561
|
}
|
|
@@ -1515,20 +1563,20 @@ class Yt extends g {
|
|
|
1515
1563
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
1516
1564
|
return e !== void 0 && f(this, t, e), t;
|
|
1517
1565
|
}
|
|
1518
|
-
internalBinaryRead(e, t,
|
|
1519
|
-
return
|
|
1566
|
+
internalBinaryRead(e, t, r, n) {
|
|
1567
|
+
return n ?? this.create();
|
|
1520
1568
|
}
|
|
1521
|
-
internalBinaryWrite(e, t,
|
|
1522
|
-
let
|
|
1523
|
-
return
|
|
1569
|
+
internalBinaryWrite(e, t, r) {
|
|
1570
|
+
let n = r.writeUnknownFields;
|
|
1571
|
+
return n !== !1 && (n == !0 ? u.onWrite : n)(
|
|
1524
1572
|
this.typeName,
|
|
1525
1573
|
e,
|
|
1526
1574
|
t
|
|
1527
1575
|
), t;
|
|
1528
1576
|
}
|
|
1529
1577
|
}
|
|
1530
|
-
new
|
|
1531
|
-
class
|
|
1578
|
+
new ir();
|
|
1579
|
+
class ar extends g {
|
|
1532
1580
|
constructor() {
|
|
1533
1581
|
super("MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL", []);
|
|
1534
1582
|
}
|
|
@@ -1536,20 +1584,20 @@ class Kt extends g {
|
|
|
1536
1584
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
1537
1585
|
return e !== void 0 && f(this, t, e), t;
|
|
1538
1586
|
}
|
|
1539
|
-
internalBinaryRead(e, t,
|
|
1540
|
-
return
|
|
1587
|
+
internalBinaryRead(e, t, r, n) {
|
|
1588
|
+
return n ?? this.create();
|
|
1541
1589
|
}
|
|
1542
|
-
internalBinaryWrite(e, t,
|
|
1543
|
-
let
|
|
1544
|
-
return
|
|
1590
|
+
internalBinaryWrite(e, t, r) {
|
|
1591
|
+
let n = r.writeUnknownFields;
|
|
1592
|
+
return n !== !1 && (n == !0 ? u.onWrite : n)(
|
|
1545
1593
|
this.typeName,
|
|
1546
1594
|
e,
|
|
1547
1595
|
t
|
|
1548
1596
|
), t;
|
|
1549
1597
|
}
|
|
1550
1598
|
}
|
|
1551
|
-
new
|
|
1552
|
-
class
|
|
1599
|
+
new ar();
|
|
1600
|
+
class lr extends g {
|
|
1553
1601
|
constructor() {
|
|
1554
1602
|
super(
|
|
1555
1603
|
"MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL.Request",
|
|
@@ -1573,9 +1621,9 @@ class er extends g {
|
|
|
1573
1621
|
e
|
|
1574
1622
|
), t;
|
|
1575
1623
|
}
|
|
1576
|
-
internalBinaryRead(e, t,
|
|
1577
|
-
let o =
|
|
1578
|
-
for (; e.pos <
|
|
1624
|
+
internalBinaryRead(e, t, r, n) {
|
|
1625
|
+
let o = n ?? this.create(), l = e.pos + t;
|
|
1626
|
+
for (; e.pos < l; ) {
|
|
1579
1627
|
let [i, c] = e.tag();
|
|
1580
1628
|
switch (i) {
|
|
1581
1629
|
case /* uint64 resource_id */
|
|
@@ -1583,13 +1631,13 @@ class er extends g {
|
|
|
1583
1631
|
o.resourceId = e.uint64().toBigInt();
|
|
1584
1632
|
break;
|
|
1585
1633
|
default:
|
|
1586
|
-
let
|
|
1587
|
-
if (
|
|
1634
|
+
let a = r.readUnknownField;
|
|
1635
|
+
if (a === "throw")
|
|
1588
1636
|
throw new globalThis.Error(
|
|
1589
1637
|
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
1590
1638
|
);
|
|
1591
1639
|
let p = e.skip(c);
|
|
1592
|
-
|
|
1640
|
+
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
1593
1641
|
this.typeName,
|
|
1594
1642
|
o,
|
|
1595
1643
|
i,
|
|
@@ -1600,18 +1648,18 @@ class er extends g {
|
|
|
1600
1648
|
}
|
|
1601
1649
|
return o;
|
|
1602
1650
|
}
|
|
1603
|
-
internalBinaryWrite(e, t,
|
|
1651
|
+
internalBinaryWrite(e, t, r) {
|
|
1604
1652
|
e.resourceId !== 0n && t.tag(1, h.Varint).uint64(e.resourceId);
|
|
1605
|
-
let
|
|
1606
|
-
return
|
|
1653
|
+
let n = r.writeUnknownFields;
|
|
1654
|
+
return n !== !1 && (n == !0 ? u.onWrite : n)(
|
|
1607
1655
|
this.typeName,
|
|
1608
1656
|
e,
|
|
1609
1657
|
t
|
|
1610
1658
|
), t;
|
|
1611
1659
|
}
|
|
1612
1660
|
}
|
|
1613
|
-
const
|
|
1614
|
-
class
|
|
1661
|
+
const cr = new lr();
|
|
1662
|
+
class dr extends g {
|
|
1615
1663
|
constructor() {
|
|
1616
1664
|
super(
|
|
1617
1665
|
"MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL.HTTPHeader",
|
|
@@ -1643,9 +1691,9 @@ class rr extends g {
|
|
|
1643
1691
|
e
|
|
1644
1692
|
), t;
|
|
1645
1693
|
}
|
|
1646
|
-
internalBinaryRead(e, t,
|
|
1647
|
-
let o =
|
|
1648
|
-
for (; e.pos <
|
|
1694
|
+
internalBinaryRead(e, t, r, n) {
|
|
1695
|
+
let o = n ?? this.create(), l = e.pos + t;
|
|
1696
|
+
for (; e.pos < l; ) {
|
|
1649
1697
|
let [i, c] = e.tag();
|
|
1650
1698
|
switch (i) {
|
|
1651
1699
|
case /* string Name = 1 [json_name = "Name"];*/
|
|
@@ -1657,13 +1705,13 @@ class rr extends g {
|
|
|
1657
1705
|
o.value = e.string();
|
|
1658
1706
|
break;
|
|
1659
1707
|
default:
|
|
1660
|
-
let
|
|
1661
|
-
if (
|
|
1708
|
+
let a = r.readUnknownField;
|
|
1709
|
+
if (a === "throw")
|
|
1662
1710
|
throw new globalThis.Error(
|
|
1663
1711
|
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
1664
1712
|
);
|
|
1665
1713
|
let p = e.skip(c);
|
|
1666
|
-
|
|
1714
|
+
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
1667
1715
|
this.typeName,
|
|
1668
1716
|
o,
|
|
1669
1717
|
i,
|
|
@@ -1674,18 +1722,18 @@ class rr extends g {
|
|
|
1674
1722
|
}
|
|
1675
1723
|
return o;
|
|
1676
1724
|
}
|
|
1677
|
-
internalBinaryWrite(e, t,
|
|
1725
|
+
internalBinaryWrite(e, t, r) {
|
|
1678
1726
|
e.name !== "" && t.tag(1, h.LengthDelimited).string(e.name), e.value !== "" && t.tag(2, h.LengthDelimited).string(e.value);
|
|
1679
|
-
let
|
|
1680
|
-
return
|
|
1727
|
+
let n = r.writeUnknownFields;
|
|
1728
|
+
return n !== !1 && (n == !0 ? u.onWrite : n)(
|
|
1681
1729
|
this.typeName,
|
|
1682
1730
|
e,
|
|
1683
1731
|
t
|
|
1684
1732
|
), t;
|
|
1685
1733
|
}
|
|
1686
1734
|
}
|
|
1687
|
-
const
|
|
1688
|
-
class
|
|
1735
|
+
const x = new dr();
|
|
1736
|
+
class hr extends g {
|
|
1689
1737
|
constructor() {
|
|
1690
1738
|
super(
|
|
1691
1739
|
"MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL.Response",
|
|
@@ -1702,7 +1750,7 @@ class nr extends g {
|
|
|
1702
1750
|
name: "headers",
|
|
1703
1751
|
kind: "message",
|
|
1704
1752
|
repeat: 1,
|
|
1705
|
-
T: () =>
|
|
1753
|
+
T: () => x
|
|
1706
1754
|
}
|
|
1707
1755
|
]
|
|
1708
1756
|
);
|
|
@@ -1715,9 +1763,9 @@ class nr extends g {
|
|
|
1715
1763
|
e
|
|
1716
1764
|
), t;
|
|
1717
1765
|
}
|
|
1718
|
-
internalBinaryRead(e, t,
|
|
1719
|
-
let o =
|
|
1720
|
-
for (; e.pos <
|
|
1766
|
+
internalBinaryRead(e, t, r, n) {
|
|
1767
|
+
let o = n ?? this.create(), l = e.pos + t;
|
|
1768
|
+
for (; e.pos < l; ) {
|
|
1721
1769
|
let [i, c] = e.tag();
|
|
1722
1770
|
switch (i) {
|
|
1723
1771
|
case /* string download_url */
|
|
@@ -1727,21 +1775,21 @@ class nr extends g {
|
|
|
1727
1775
|
case /* repeated MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL.HTTPHeader headers */
|
|
1728
1776
|
2:
|
|
1729
1777
|
o.headers.push(
|
|
1730
|
-
|
|
1778
|
+
x.internalBinaryRead(
|
|
1731
1779
|
e,
|
|
1732
1780
|
e.uint32(),
|
|
1733
|
-
|
|
1781
|
+
r
|
|
1734
1782
|
)
|
|
1735
1783
|
);
|
|
1736
1784
|
break;
|
|
1737
1785
|
default:
|
|
1738
|
-
let
|
|
1739
|
-
if (
|
|
1786
|
+
let a = r.readUnknownField;
|
|
1787
|
+
if (a === "throw")
|
|
1740
1788
|
throw new globalThis.Error(
|
|
1741
1789
|
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
1742
1790
|
);
|
|
1743
1791
|
let p = e.skip(c);
|
|
1744
|
-
|
|
1792
|
+
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
1745
1793
|
this.typeName,
|
|
1746
1794
|
o,
|
|
1747
1795
|
i,
|
|
@@ -1752,23 +1800,23 @@ class nr extends g {
|
|
|
1752
1800
|
}
|
|
1753
1801
|
return o;
|
|
1754
1802
|
}
|
|
1755
|
-
internalBinaryWrite(e, t,
|
|
1803
|
+
internalBinaryWrite(e, t, r) {
|
|
1756
1804
|
e.downloadUrl !== "" && t.tag(1, h.LengthDelimited).string(e.downloadUrl);
|
|
1757
1805
|
for (let o = 0; o < e.headers.length; o++)
|
|
1758
|
-
|
|
1806
|
+
x.internalBinaryWrite(
|
|
1759
1807
|
e.headers[o],
|
|
1760
1808
|
t.tag(2, h.LengthDelimited).fork(),
|
|
1761
|
-
|
|
1809
|
+
r
|
|
1762
1810
|
).join();
|
|
1763
|
-
let
|
|
1764
|
-
return
|
|
1811
|
+
let n = r.writeUnknownFields;
|
|
1812
|
+
return n !== !1 && (n == !0 ? u.onWrite : n)(
|
|
1765
1813
|
this.typeName,
|
|
1766
1814
|
e,
|
|
1767
1815
|
t
|
|
1768
1816
|
), t;
|
|
1769
1817
|
}
|
|
1770
1818
|
}
|
|
1771
|
-
const
|
|
1819
|
+
const ur = new hr(), z = new D(
|
|
1772
1820
|
"MiLaboratories.Controller.Shared.Download",
|
|
1773
1821
|
[
|
|
1774
1822
|
{
|
|
@@ -1776,110 +1824,84 @@ const or = new nr(), x = new D(
|
|
|
1776
1824
|
options: {
|
|
1777
1825
|
"google.api.http": { get: "/resources/{resource_id}/get-download-url" }
|
|
1778
1826
|
},
|
|
1779
|
-
I:
|
|
1780
|
-
O:
|
|
1827
|
+
I: cr,
|
|
1828
|
+
O: ur
|
|
1781
1829
|
}
|
|
1782
1830
|
]
|
|
1783
1831
|
);
|
|
1784
|
-
class
|
|
1832
|
+
class pr {
|
|
1785
1833
|
constructor(e) {
|
|
1786
|
-
d(this, "typeName",
|
|
1787
|
-
d(this, "methods",
|
|
1788
|
-
d(this, "options",
|
|
1834
|
+
d(this, "typeName", z.typeName);
|
|
1835
|
+
d(this, "methods", z.methods);
|
|
1836
|
+
d(this, "options", z.options);
|
|
1789
1837
|
this._transport = e;
|
|
1790
1838
|
}
|
|
1791
1839
|
/**
|
|
1792
1840
|
* @generated from protobuf rpc: GetDownloadURL(MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL.Request) returns (MiLaboratories.Controller.Shared.DownloadAPI.GetDownloadURL.Response);
|
|
1793
1841
|
*/
|
|
1794
1842
|
getDownloadURL(e, t) {
|
|
1795
|
-
const
|
|
1796
|
-
return y("unary", this._transport,
|
|
1797
|
-
}
|
|
1798
|
-
}
|
|
1799
|
-
class ae extends Error {
|
|
1800
|
-
}
|
|
1801
|
-
class Ne {
|
|
1802
|
-
constructor(e) {
|
|
1803
|
-
this.httpClient = e;
|
|
1804
|
-
}
|
|
1805
|
-
async downloadRemoteFile(e, t, n) {
|
|
1806
|
-
const { statusCode: r, body: o, headers: a } = await ke(e, {
|
|
1807
|
-
dispatcher: this.httpClient,
|
|
1808
|
-
headers: t,
|
|
1809
|
-
signal: n
|
|
1810
|
-
}), i = re.toWeb(o);
|
|
1811
|
-
if (r != 200) {
|
|
1812
|
-
const c = await tt(i), l = c.substring(0, Math.min(c.length, 1e3));
|
|
1813
|
-
throw 400 <= r && r < 500 ? new ae(
|
|
1814
|
-
`Http error: statusCode: ${r} url: ${e.toString()}, beginning of body: ${l}`
|
|
1815
|
-
) : new Error(`Http error: statusCode: ${r} url: ${e.toString()}`);
|
|
1816
|
-
}
|
|
1817
|
-
return {
|
|
1818
|
-
content: i,
|
|
1819
|
-
size: Number(a["content-length"])
|
|
1820
|
-
};
|
|
1843
|
+
const r = this.methods[0], n = this._transport.mergeOptions(t);
|
|
1844
|
+
return y("unary", this._transport, r, n, e);
|
|
1821
1845
|
}
|
|
1822
1846
|
}
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
return s;
|
|
1826
|
-
}
|
|
1827
|
-
const ir = "storage://";
|
|
1828
|
-
class Ue extends Error {
|
|
1829
|
-
}
|
|
1830
|
-
class Be extends Error {
|
|
1831
|
-
}
|
|
1832
|
-
class ar {
|
|
1833
|
-
constructor(e, t, n, r) {
|
|
1847
|
+
class gr {
|
|
1848
|
+
constructor(e, t, r, n) {
|
|
1834
1849
|
d(this, "grpcClient");
|
|
1835
|
-
d(this, "
|
|
1850
|
+
d(this, "remoteFileDownloader");
|
|
1851
|
+
/** Helps to find a storage root directory by a storage id from URL scheme. */
|
|
1836
1852
|
d(this, "localStorageIdsToRoot");
|
|
1837
|
-
|
|
1838
|
-
this.grpcTransport = e, this.httpClient = t, this.logger = n;
|
|
1839
|
-
for (const o of r) o.localPath !== "" && B(o.localPath);
|
|
1840
|
-
this.grpcClient = new sr(this.grpcTransport), this.downloadHelper = new Ne(t), this.localStorageIdsToRoot = new Map(
|
|
1841
|
-
r.map((o) => [o.storageId, o.localPath])
|
|
1842
|
-
);
|
|
1853
|
+
this.grpcTransport = e, this.httpClient = t, this.logger = r, this.grpcClient = new pr(this.grpcTransport), this.remoteFileDownloader = new ve(t), this.localStorageIdsToRoot = br(n);
|
|
1843
1854
|
}
|
|
1844
1855
|
close() {
|
|
1845
1856
|
}
|
|
1846
|
-
async
|
|
1847
|
-
const o =
|
|
1848
|
-
return
|
|
1849
|
-
{ resourceId: e },
|
|
1850
|
-
k(t, o)
|
|
1851
|
-
).response;
|
|
1852
|
-
}
|
|
1853
|
-
async downloadBlob(e, t, n) {
|
|
1854
|
-
const { downloadUrl: r, headers: o } = await this.getUrl(e, t, n);
|
|
1855
|
-
return this.logger.info(`download from url ${r}`), this.isLocal(r) ? await this.readLocalFile(r) : await this.downloadHelper.downloadRemoteFile(
|
|
1856
|
-
r,
|
|
1857
|
-
cr(o),
|
|
1858
|
-
n
|
|
1859
|
-
);
|
|
1857
|
+
async downloadBlob(e, t, r) {
|
|
1858
|
+
const { downloadUrl: n, headers: o } = await this.grpcGetDownloadUrl(e, t, r);
|
|
1859
|
+
return this.logger.info(`download blob from url ${n}`), yr(n) ? await this.readLocalFile(n) : await this.remoteFileDownloader.download(n, Ue(o), r);
|
|
1860
1860
|
}
|
|
1861
1861
|
async readLocalFile(e) {
|
|
1862
|
-
const t =
|
|
1862
|
+
const { storageId: t, relativePath: r } = fr(e), n = mr(t, this.localStorageIdsToRoot, r);
|
|
1863
1863
|
return {
|
|
1864
|
-
content:
|
|
1865
|
-
size:
|
|
1864
|
+
content: se.toWeb(oe.createReadStream(n)),
|
|
1865
|
+
size: (await m.stat(n)).size
|
|
1866
1866
|
};
|
|
1867
1867
|
}
|
|
1868
|
+
async grpcGetDownloadUrl({ id: e, type: t }, r, n) {
|
|
1869
|
+
const o = r ?? {};
|
|
1870
|
+
return o.abort = n, await this.grpcClient.getDownloadURL(
|
|
1871
|
+
{ resourceId: e },
|
|
1872
|
+
T(t, o)
|
|
1873
|
+
).response;
|
|
1874
|
+
}
|
|
1875
|
+
}
|
|
1876
|
+
function fr(s) {
|
|
1877
|
+
const e = new URL(s);
|
|
1878
|
+
if (e.pathname == "")
|
|
1879
|
+
throw new $e(`url for local filepath ${s} does not match url scheme`);
|
|
1880
|
+
return {
|
|
1881
|
+
storageId: e.host,
|
|
1882
|
+
relativePath: decodeURIComponent(e.pathname.slice(1))
|
|
1883
|
+
};
|
|
1868
1884
|
}
|
|
1869
|
-
function
|
|
1870
|
-
const
|
|
1871
|
-
if (
|
|
1872
|
-
|
|
1873
|
-
const n = t.host, r = e.get(n);
|
|
1874
|
-
if (r === void 0)
|
|
1875
|
-
throw new Ue(`Unknown storage location: ${n}`);
|
|
1876
|
-
const o = decodeURIComponent(t.pathname.slice(1));
|
|
1877
|
-
return r === "" ? o : w.join(r, o);
|
|
1885
|
+
function mr(s, e, t) {
|
|
1886
|
+
const r = e.get(s);
|
|
1887
|
+
if (r === void 0) throw new _e(`Unknown storage location: ${s}`);
|
|
1888
|
+
return r === "" ? t : w.join(r, t);
|
|
1878
1889
|
}
|
|
1879
|
-
|
|
1880
|
-
|
|
1890
|
+
const wr = "storage://";
|
|
1891
|
+
function yr(s) {
|
|
1892
|
+
return s.startsWith(wr);
|
|
1881
1893
|
}
|
|
1882
|
-
class
|
|
1894
|
+
class $e extends Error {
|
|
1895
|
+
}
|
|
1896
|
+
class _e extends Error {
|
|
1897
|
+
}
|
|
1898
|
+
function br(s) {
|
|
1899
|
+
const e = /* @__PURE__ */ new Map();
|
|
1900
|
+
for (const t of s)
|
|
1901
|
+
t.localPath !== "" && N(t.localPath), e.set(t.storageId, t.localPath);
|
|
1902
|
+
return e;
|
|
1903
|
+
}
|
|
1904
|
+
class kr extends g {
|
|
1883
1905
|
constructor() {
|
|
1884
1906
|
super("google.protobuf.Timestamp", [
|
|
1885
1907
|
{
|
|
@@ -1904,30 +1926,30 @@ class dr extends g {
|
|
|
1904
1926
|
*/
|
|
1905
1927
|
now() {
|
|
1906
1928
|
const e = this.create(), t = Date.now();
|
|
1907
|
-
return e.seconds =
|
|
1929
|
+
return e.seconds = P.from(Math.floor(t / 1e3)).toBigInt(), e.nanos = t % 1e3 * 1e6, e;
|
|
1908
1930
|
}
|
|
1909
1931
|
/**
|
|
1910
1932
|
* Converts a `Timestamp` to a JavaScript Date.
|
|
1911
1933
|
*/
|
|
1912
1934
|
toDate(e) {
|
|
1913
1935
|
return new Date(
|
|
1914
|
-
|
|
1936
|
+
P.from(e.seconds).toNumber() * 1e3 + Math.ceil(e.nanos / 1e6)
|
|
1915
1937
|
);
|
|
1916
1938
|
}
|
|
1917
1939
|
/**
|
|
1918
1940
|
* Converts a JavaScript Date to a `Timestamp`.
|
|
1919
1941
|
*/
|
|
1920
1942
|
fromDate(e) {
|
|
1921
|
-
const t = this.create(),
|
|
1922
|
-
return t.seconds =
|
|
1943
|
+
const t = this.create(), r = e.getTime();
|
|
1944
|
+
return t.seconds = P.from(Math.floor(r / 1e3)).toBigInt(), t.nanos = r % 1e3 * 1e6, t;
|
|
1923
1945
|
}
|
|
1924
1946
|
/**
|
|
1925
1947
|
* In JSON format, the `Timestamp` type is encoded as a string
|
|
1926
1948
|
* in the RFC 3339 format.
|
|
1927
1949
|
*/
|
|
1928
1950
|
internalJsonWrite(e, t) {
|
|
1929
|
-
let
|
|
1930
|
-
if (
|
|
1951
|
+
let r = P.from(e.seconds).toNumber() * 1e3;
|
|
1952
|
+
if (r < Date.parse("0001-01-01T00:00:00Z") || r > Date.parse("9999-12-31T23:59:59Z"))
|
|
1931
1953
|
throw new Error(
|
|
1932
1954
|
"Unable to encode Timestamp to JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive."
|
|
1933
1955
|
);
|
|
@@ -1935,29 +1957,29 @@ class dr extends g {
|
|
|
1935
1957
|
throw new Error(
|
|
1936
1958
|
"Unable to encode invalid Timestamp to JSON. Nanos must not be negative."
|
|
1937
1959
|
);
|
|
1938
|
-
let
|
|
1960
|
+
let n = "Z";
|
|
1939
1961
|
if (e.nanos > 0) {
|
|
1940
1962
|
let o = (e.nanos + 1e9).toString().substring(1);
|
|
1941
|
-
o.substring(3) === "000000" ?
|
|
1963
|
+
o.substring(3) === "000000" ? n = "." + o.substring(0, 3) + "Z" : o.substring(6) === "000" ? n = "." + o.substring(0, 6) + "Z" : n = "." + o + "Z";
|
|
1942
1964
|
}
|
|
1943
|
-
return new Date(
|
|
1965
|
+
return new Date(r).toISOString().replace(".000Z", n);
|
|
1944
1966
|
}
|
|
1945
1967
|
/**
|
|
1946
1968
|
* In JSON format, the `Timestamp` type is encoded as a string
|
|
1947
1969
|
* in the RFC 3339 format.
|
|
1948
1970
|
*/
|
|
1949
|
-
internalJsonRead(e, t,
|
|
1971
|
+
internalJsonRead(e, t, r) {
|
|
1950
1972
|
if (typeof e != "string")
|
|
1951
1973
|
throw new Error(
|
|
1952
|
-
"Unable to parse Timestamp from JSON " +
|
|
1974
|
+
"Unable to parse Timestamp from JSON " + ke(e) + "."
|
|
1953
1975
|
);
|
|
1954
|
-
let
|
|
1976
|
+
let n = e.match(
|
|
1955
1977
|
/^([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]))$/
|
|
1956
1978
|
);
|
|
1957
|
-
if (!
|
|
1979
|
+
if (!n)
|
|
1958
1980
|
throw new Error("Unable to parse Timestamp from JSON. Invalid format.");
|
|
1959
1981
|
let o = Date.parse(
|
|
1960
|
-
|
|
1982
|
+
n[1] + "-" + n[2] + "-" + n[3] + "T" + n[4] + ":" + n[5] + ":" + n[6] + (n[8] ? n[8] : "Z")
|
|
1961
1983
|
);
|
|
1962
1984
|
if (Number.isNaN(o))
|
|
1963
1985
|
throw new Error("Unable to parse Timestamp from JSON. Invalid value.");
|
|
@@ -1965,15 +1987,15 @@ class dr extends g {
|
|
|
1965
1987
|
throw new globalThis.Error(
|
|
1966
1988
|
"Unable to parse Timestamp from JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive."
|
|
1967
1989
|
);
|
|
1968
|
-
return
|
|
1990
|
+
return r || (r = this.create()), r.seconds = P.from(o / 1e3).toBigInt(), r.nanos = 0, n[7] && (r.nanos = parseInt("1" + n[7] + "0".repeat(9 - n[7].length)) - 1e9), r;
|
|
1969
1991
|
}
|
|
1970
1992
|
create(e) {
|
|
1971
1993
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
1972
1994
|
return t.seconds = 0n, t.nanos = 0, e !== void 0 && f(this, t, e), t;
|
|
1973
1995
|
}
|
|
1974
|
-
internalBinaryRead(e, t,
|
|
1975
|
-
let o =
|
|
1976
|
-
for (; e.pos <
|
|
1996
|
+
internalBinaryRead(e, t, r, n) {
|
|
1997
|
+
let o = n ?? this.create(), l = e.pos + t;
|
|
1998
|
+
for (; e.pos < l; ) {
|
|
1977
1999
|
let [i, c] = e.tag();
|
|
1978
2000
|
switch (i) {
|
|
1979
2001
|
case /* int64 seconds */
|
|
@@ -1985,13 +2007,13 @@ class dr extends g {
|
|
|
1985
2007
|
o.nanos = e.int32();
|
|
1986
2008
|
break;
|
|
1987
2009
|
default:
|
|
1988
|
-
let
|
|
1989
|
-
if (
|
|
2010
|
+
let a = r.readUnknownField;
|
|
2011
|
+
if (a === "throw")
|
|
1990
2012
|
throw new globalThis.Error(
|
|
1991
2013
|
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
1992
2014
|
);
|
|
1993
2015
|
let p = e.skip(c);
|
|
1994
|
-
|
|
2016
|
+
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
1995
2017
|
this.typeName,
|
|
1996
2018
|
o,
|
|
1997
2019
|
i,
|
|
@@ -2002,18 +2024,18 @@ class dr extends g {
|
|
|
2002
2024
|
}
|
|
2003
2025
|
return o;
|
|
2004
2026
|
}
|
|
2005
|
-
internalBinaryWrite(e, t,
|
|
2027
|
+
internalBinaryWrite(e, t, r) {
|
|
2006
2028
|
e.seconds !== 0n && t.tag(1, h.Varint).int64(e.seconds), e.nanos !== 0 && t.tag(2, h.Varint).int32(e.nanos);
|
|
2007
|
-
let
|
|
2008
|
-
return
|
|
2029
|
+
let n = r.writeUnknownFields;
|
|
2030
|
+
return n !== !1 && (n == !0 ? u.onWrite : n)(
|
|
2009
2031
|
this.typeName,
|
|
2010
2032
|
e,
|
|
2011
2033
|
t
|
|
2012
2034
|
), t;
|
|
2013
2035
|
}
|
|
2014
2036
|
}
|
|
2015
|
-
const M = new
|
|
2016
|
-
class
|
|
2037
|
+
const M = new kr();
|
|
2038
|
+
class Tr extends g {
|
|
2017
2039
|
constructor() {
|
|
2018
2040
|
super("MiLaboratories.Controller.Shared.LsAPI", []);
|
|
2019
2041
|
}
|
|
@@ -2021,20 +2043,20 @@ class hr extends g {
|
|
|
2021
2043
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
2022
2044
|
return e !== void 0 && f(this, t, e), t;
|
|
2023
2045
|
}
|
|
2024
|
-
internalBinaryRead(e, t,
|
|
2025
|
-
return
|
|
2046
|
+
internalBinaryRead(e, t, r, n) {
|
|
2047
|
+
return n ?? this.create();
|
|
2026
2048
|
}
|
|
2027
|
-
internalBinaryWrite(e, t,
|
|
2028
|
-
let
|
|
2029
|
-
return
|
|
2049
|
+
internalBinaryWrite(e, t, r) {
|
|
2050
|
+
let n = r.writeUnknownFields;
|
|
2051
|
+
return n !== !1 && (n == !0 ? u.onWrite : n)(
|
|
2030
2052
|
this.typeName,
|
|
2031
2053
|
e,
|
|
2032
2054
|
t
|
|
2033
2055
|
), t;
|
|
2034
2056
|
}
|
|
2035
2057
|
}
|
|
2036
|
-
new
|
|
2037
|
-
class
|
|
2058
|
+
new Tr();
|
|
2059
|
+
class Lr extends g {
|
|
2038
2060
|
constructor() {
|
|
2039
2061
|
super("MiLaboratories.Controller.Shared.LsAPI.ListItem", [
|
|
2040
2062
|
{
|
|
@@ -2087,9 +2109,9 @@ class ur extends g {
|
|
|
2087
2109
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
2088
2110
|
return t.name = "", t.size = 0n, t.isDir = !1, t.fullName = "", t.directory = "", t.version = "", e !== void 0 && f(this, t, e), t;
|
|
2089
2111
|
}
|
|
2090
|
-
internalBinaryRead(e, t,
|
|
2091
|
-
let o =
|
|
2092
|
-
for (; e.pos <
|
|
2112
|
+
internalBinaryRead(e, t, r, n) {
|
|
2113
|
+
let o = n ?? this.create(), l = e.pos + t;
|
|
2114
|
+
for (; e.pos < l; ) {
|
|
2093
2115
|
let [i, c] = e.tag();
|
|
2094
2116
|
switch (i) {
|
|
2095
2117
|
case /* string name */
|
|
@@ -2117,7 +2139,7 @@ class ur extends g {
|
|
|
2117
2139
|
o.lastModified = M.internalBinaryRead(
|
|
2118
2140
|
e,
|
|
2119
2141
|
e.uint32(),
|
|
2120
|
-
|
|
2142
|
+
r,
|
|
2121
2143
|
o.lastModified
|
|
2122
2144
|
);
|
|
2123
2145
|
break;
|
|
@@ -2126,13 +2148,13 @@ class ur extends g {
|
|
|
2126
2148
|
o.version = e.string();
|
|
2127
2149
|
break;
|
|
2128
2150
|
default:
|
|
2129
|
-
let
|
|
2130
|
-
if (
|
|
2151
|
+
let a = r.readUnknownField;
|
|
2152
|
+
if (a === "throw")
|
|
2131
2153
|
throw new globalThis.Error(
|
|
2132
2154
|
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
2133
2155
|
);
|
|
2134
2156
|
let p = e.skip(c);
|
|
2135
|
-
|
|
2157
|
+
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
2136
2158
|
this.typeName,
|
|
2137
2159
|
o,
|
|
2138
2160
|
i,
|
|
@@ -2143,22 +2165,22 @@ class ur extends g {
|
|
|
2143
2165
|
}
|
|
2144
2166
|
return o;
|
|
2145
2167
|
}
|
|
2146
|
-
internalBinaryWrite(e, t,
|
|
2168
|
+
internalBinaryWrite(e, t, r) {
|
|
2147
2169
|
e.name !== "" && t.tag(1, h.LengthDelimited).string(e.name), e.size !== 0n && t.tag(2, h.Varint).uint64(e.size), e.isDir !== !1 && t.tag(3, h.Varint).bool(e.isDir), e.fullName !== "" && t.tag(10, h.LengthDelimited).string(e.fullName), e.directory !== "" && t.tag(11, h.LengthDelimited).string(e.directory), e.lastModified && M.internalBinaryWrite(
|
|
2148
2170
|
e.lastModified,
|
|
2149
2171
|
t.tag(12, h.LengthDelimited).fork(),
|
|
2150
|
-
|
|
2172
|
+
r
|
|
2151
2173
|
).join(), e.version !== "" && t.tag(13, h.LengthDelimited).string(e.version);
|
|
2152
|
-
let
|
|
2153
|
-
return
|
|
2174
|
+
let n = r.writeUnknownFields;
|
|
2175
|
+
return n !== !1 && (n == !0 ? u.onWrite : n)(
|
|
2154
2176
|
this.typeName,
|
|
2155
2177
|
e,
|
|
2156
2178
|
t
|
|
2157
2179
|
), t;
|
|
2158
2180
|
}
|
|
2159
2181
|
}
|
|
2160
|
-
const H = new
|
|
2161
|
-
class
|
|
2182
|
+
const H = new Lr();
|
|
2183
|
+
class Pr extends g {
|
|
2162
2184
|
constructor() {
|
|
2163
2185
|
super("MiLaboratories.Controller.Shared.LsAPI.List", []);
|
|
2164
2186
|
}
|
|
@@ -2166,20 +2188,20 @@ class pr extends g {
|
|
|
2166
2188
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
2167
2189
|
return e !== void 0 && f(this, t, e), t;
|
|
2168
2190
|
}
|
|
2169
|
-
internalBinaryRead(e, t,
|
|
2170
|
-
return
|
|
2191
|
+
internalBinaryRead(e, t, r, n) {
|
|
2192
|
+
return n ?? this.create();
|
|
2171
2193
|
}
|
|
2172
|
-
internalBinaryWrite(e, t,
|
|
2173
|
-
let
|
|
2174
|
-
return
|
|
2194
|
+
internalBinaryWrite(e, t, r) {
|
|
2195
|
+
let n = r.writeUnknownFields;
|
|
2196
|
+
return n !== !1 && (n == !0 ? u.onWrite : n)(
|
|
2175
2197
|
this.typeName,
|
|
2176
2198
|
e,
|
|
2177
2199
|
t
|
|
2178
2200
|
), t;
|
|
2179
2201
|
}
|
|
2180
2202
|
}
|
|
2181
|
-
new
|
|
2182
|
-
class
|
|
2203
|
+
new Pr();
|
|
2204
|
+
class Ir extends g {
|
|
2183
2205
|
constructor() {
|
|
2184
2206
|
super("MiLaboratories.Controller.Shared.LsAPI.List.Request", [
|
|
2185
2207
|
{
|
|
@@ -2203,9 +2225,9 @@ class gr extends g {
|
|
|
2203
2225
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
2204
2226
|
return t.resourceId = 0n, t.location = "", e !== void 0 && f(this, t, e), t;
|
|
2205
2227
|
}
|
|
2206
|
-
internalBinaryRead(e, t,
|
|
2207
|
-
let o =
|
|
2208
|
-
for (; e.pos <
|
|
2228
|
+
internalBinaryRead(e, t, r, n) {
|
|
2229
|
+
let o = n ?? this.create(), l = e.pos + t;
|
|
2230
|
+
for (; e.pos < l; ) {
|
|
2209
2231
|
let [i, c] = e.tag();
|
|
2210
2232
|
switch (i) {
|
|
2211
2233
|
case /* uint64 resource_id */
|
|
@@ -2217,13 +2239,13 @@ class gr extends g {
|
|
|
2217
2239
|
o.location = e.string();
|
|
2218
2240
|
break;
|
|
2219
2241
|
default:
|
|
2220
|
-
let
|
|
2221
|
-
if (
|
|
2242
|
+
let a = r.readUnknownField;
|
|
2243
|
+
if (a === "throw")
|
|
2222
2244
|
throw new globalThis.Error(
|
|
2223
2245
|
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
2224
2246
|
);
|
|
2225
2247
|
let p = e.skip(c);
|
|
2226
|
-
|
|
2248
|
+
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
2227
2249
|
this.typeName,
|
|
2228
2250
|
o,
|
|
2229
2251
|
i,
|
|
@@ -2234,18 +2256,18 @@ class gr extends g {
|
|
|
2234
2256
|
}
|
|
2235
2257
|
return o;
|
|
2236
2258
|
}
|
|
2237
|
-
internalBinaryWrite(e, t,
|
|
2259
|
+
internalBinaryWrite(e, t, r) {
|
|
2238
2260
|
e.resourceId !== 0n && t.tag(1, h.Varint).uint64(e.resourceId), e.location !== "" && t.tag(2, h.LengthDelimited).string(e.location);
|
|
2239
|
-
let
|
|
2240
|
-
return
|
|
2261
|
+
let n = r.writeUnknownFields;
|
|
2262
|
+
return n !== !1 && (n == !0 ? u.onWrite : n)(
|
|
2241
2263
|
this.typeName,
|
|
2242
2264
|
e,
|
|
2243
2265
|
t
|
|
2244
2266
|
), t;
|
|
2245
2267
|
}
|
|
2246
2268
|
}
|
|
2247
|
-
const
|
|
2248
|
-
class
|
|
2269
|
+
const Rr = new Ir();
|
|
2270
|
+
class Sr extends g {
|
|
2249
2271
|
constructor() {
|
|
2250
2272
|
super("MiLaboratories.Controller.Shared.LsAPI.List.Response", [
|
|
2251
2273
|
{
|
|
@@ -2268,15 +2290,15 @@ class mr extends g {
|
|
|
2268
2290
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
2269
2291
|
return t.items = [], t.delimiter = "", e !== void 0 && f(this, t, e), t;
|
|
2270
2292
|
}
|
|
2271
|
-
internalBinaryRead(e, t,
|
|
2272
|
-
let o =
|
|
2273
|
-
for (; e.pos <
|
|
2293
|
+
internalBinaryRead(e, t, r, n) {
|
|
2294
|
+
let o = n ?? this.create(), l = e.pos + t;
|
|
2295
|
+
for (; e.pos < l; ) {
|
|
2274
2296
|
let [i, c] = e.tag();
|
|
2275
2297
|
switch (i) {
|
|
2276
2298
|
case /* repeated MiLaboratories.Controller.Shared.LsAPI.ListItem items */
|
|
2277
2299
|
1:
|
|
2278
2300
|
o.items.push(
|
|
2279
|
-
H.internalBinaryRead(e, e.uint32(),
|
|
2301
|
+
H.internalBinaryRead(e, e.uint32(), r)
|
|
2280
2302
|
);
|
|
2281
2303
|
break;
|
|
2282
2304
|
case /* string delimiter */
|
|
@@ -2284,13 +2306,13 @@ class mr extends g {
|
|
|
2284
2306
|
o.delimiter = e.string();
|
|
2285
2307
|
break;
|
|
2286
2308
|
default:
|
|
2287
|
-
let
|
|
2288
|
-
if (
|
|
2309
|
+
let a = r.readUnknownField;
|
|
2310
|
+
if (a === "throw")
|
|
2289
2311
|
throw new globalThis.Error(
|
|
2290
2312
|
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
2291
2313
|
);
|
|
2292
2314
|
let p = e.skip(c);
|
|
2293
|
-
|
|
2315
|
+
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
2294
2316
|
this.typeName,
|
|
2295
2317
|
o,
|
|
2296
2318
|
i,
|
|
@@ -2301,26 +2323,26 @@ class mr extends g {
|
|
|
2301
2323
|
}
|
|
2302
2324
|
return o;
|
|
2303
2325
|
}
|
|
2304
|
-
internalBinaryWrite(e, t,
|
|
2326
|
+
internalBinaryWrite(e, t, r) {
|
|
2305
2327
|
for (let o = 0; o < e.items.length; o++)
|
|
2306
2328
|
H.internalBinaryWrite(
|
|
2307
2329
|
e.items[o],
|
|
2308
2330
|
t.tag(1, h.LengthDelimited).fork(),
|
|
2309
|
-
|
|
2331
|
+
r
|
|
2310
2332
|
).join();
|
|
2311
2333
|
e.delimiter !== "" && t.tag(2, h.LengthDelimited).string(e.delimiter);
|
|
2312
|
-
let
|
|
2313
|
-
return
|
|
2334
|
+
let n = r.writeUnknownFields;
|
|
2335
|
+
return n !== !1 && (n == !0 ? u.onWrite : n)(
|
|
2314
2336
|
this.typeName,
|
|
2315
2337
|
e,
|
|
2316
2338
|
t
|
|
2317
2339
|
), t;
|
|
2318
2340
|
}
|
|
2319
2341
|
}
|
|
2320
|
-
const
|
|
2321
|
-
{ name: "List", options: {}, I:
|
|
2342
|
+
const Ur = new Sr(), j = new D("MiLaboratories.Controller.Shared.LS", [
|
|
2343
|
+
{ name: "List", options: {}, I: Rr, O: Ur }
|
|
2322
2344
|
]);
|
|
2323
|
-
class
|
|
2345
|
+
class Nr {
|
|
2324
2346
|
constructor(e) {
|
|
2325
2347
|
d(this, "typeName", j.typeName);
|
|
2326
2348
|
d(this, "methods", j.methods);
|
|
@@ -2331,34 +2353,34 @@ class yr {
|
|
|
2331
2353
|
* @generated from protobuf rpc: List(MiLaboratories.Controller.Shared.LsAPI.List.Request) returns (MiLaboratories.Controller.Shared.LsAPI.List.Response);
|
|
2332
2354
|
*/
|
|
2333
2355
|
list(e, t) {
|
|
2334
|
-
const
|
|
2356
|
+
const r = this.methods[0], n = this._transport.mergeOptions(t);
|
|
2335
2357
|
return y(
|
|
2336
2358
|
"unary",
|
|
2337
2359
|
this._transport,
|
|
2338
|
-
n,
|
|
2339
2360
|
r,
|
|
2361
|
+
n,
|
|
2340
2362
|
e
|
|
2341
2363
|
);
|
|
2342
2364
|
}
|
|
2343
2365
|
}
|
|
2344
|
-
class
|
|
2366
|
+
class Dr {
|
|
2345
2367
|
constructor(e, t) {
|
|
2346
2368
|
d(this, "grpcClient");
|
|
2347
|
-
this.logger = t, this.grpcClient = new
|
|
2369
|
+
this.logger = t, this.grpcClient = new Nr(e);
|
|
2348
2370
|
}
|
|
2349
2371
|
close() {
|
|
2350
2372
|
}
|
|
2351
|
-
async list(e, t,
|
|
2373
|
+
async list(e, t, r) {
|
|
2352
2374
|
return await this.grpcClient.list(
|
|
2353
2375
|
{
|
|
2354
2376
|
resourceId: e.id,
|
|
2355
2377
|
location: t
|
|
2356
2378
|
},
|
|
2357
|
-
|
|
2379
|
+
T(e.type, r)
|
|
2358
2380
|
).response;
|
|
2359
2381
|
}
|
|
2360
2382
|
}
|
|
2361
|
-
class
|
|
2383
|
+
class Br extends g {
|
|
2362
2384
|
constructor() {
|
|
2363
2385
|
super("MiLaboratories.Controller.Shared.StreamingAPI", []);
|
|
2364
2386
|
}
|
|
@@ -2366,20 +2388,20 @@ class Tr extends g {
|
|
|
2366
2388
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
2367
2389
|
return e !== void 0 && f(this, t, e), t;
|
|
2368
2390
|
}
|
|
2369
|
-
internalBinaryRead(e, t,
|
|
2370
|
-
return
|
|
2391
|
+
internalBinaryRead(e, t, r, n) {
|
|
2392
|
+
return n ?? this.create();
|
|
2371
2393
|
}
|
|
2372
|
-
internalBinaryWrite(e, t,
|
|
2373
|
-
let
|
|
2374
|
-
return
|
|
2394
|
+
internalBinaryWrite(e, t, r) {
|
|
2395
|
+
let n = r.writeUnknownFields;
|
|
2396
|
+
return n !== !1 && (n == !0 ? u.onWrite : n)(
|
|
2375
2397
|
this.typeName,
|
|
2376
2398
|
e,
|
|
2377
2399
|
t
|
|
2378
2400
|
), t;
|
|
2379
2401
|
}
|
|
2380
2402
|
}
|
|
2381
|
-
new
|
|
2382
|
-
class
|
|
2403
|
+
new Br();
|
|
2404
|
+
class vr extends g {
|
|
2383
2405
|
constructor() {
|
|
2384
2406
|
super("MiLaboratories.Controller.Shared.StreamingAPI.StreamBinary", [
|
|
2385
2407
|
{
|
|
@@ -2421,9 +2443,9 @@ class kr extends g {
|
|
|
2421
2443
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
2422
2444
|
return t.resourceId = 0n, t.offset = 0n, e !== void 0 && f(this, t, e), t;
|
|
2423
2445
|
}
|
|
2424
|
-
internalBinaryRead(e, t,
|
|
2425
|
-
let o =
|
|
2426
|
-
for (; e.pos <
|
|
2446
|
+
internalBinaryRead(e, t, r, n) {
|
|
2447
|
+
let o = n ?? this.create(), l = e.pos + t;
|
|
2448
|
+
for (; e.pos < l; ) {
|
|
2427
2449
|
let [i, c] = e.tag();
|
|
2428
2450
|
switch (i) {
|
|
2429
2451
|
case /* uint64 resource_id */
|
|
@@ -2443,13 +2465,13 @@ class kr extends g {
|
|
|
2443
2465
|
o.readLimit = e.int64().toBigInt();
|
|
2444
2466
|
break;
|
|
2445
2467
|
default:
|
|
2446
|
-
let
|
|
2447
|
-
if (
|
|
2468
|
+
let a = r.readUnknownField;
|
|
2469
|
+
if (a === "throw")
|
|
2448
2470
|
throw new globalThis.Error(
|
|
2449
2471
|
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
2450
2472
|
);
|
|
2451
2473
|
let p = e.skip(c);
|
|
2452
|
-
|
|
2474
|
+
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
2453
2475
|
this.typeName,
|
|
2454
2476
|
o,
|
|
2455
2477
|
i,
|
|
@@ -2460,18 +2482,18 @@ class kr extends g {
|
|
|
2460
2482
|
}
|
|
2461
2483
|
return o;
|
|
2462
2484
|
}
|
|
2463
|
-
internalBinaryWrite(e, t,
|
|
2485
|
+
internalBinaryWrite(e, t, r) {
|
|
2464
2486
|
e.resourceId !== 0n && t.tag(1, h.Varint).uint64(e.resourceId), e.offset !== 0n && t.tag(2, h.Varint).int64(e.offset), e.chunkSize !== void 0 && t.tag(11, h.Varint).uint32(e.chunkSize), e.readLimit !== void 0 && t.tag(20, h.Varint).int64(e.readLimit);
|
|
2465
|
-
let
|
|
2466
|
-
return
|
|
2487
|
+
let n = r.writeUnknownFields;
|
|
2488
|
+
return n !== !1 && (n == !0 ? u.onWrite : n)(
|
|
2467
2489
|
this.typeName,
|
|
2468
2490
|
e,
|
|
2469
2491
|
t
|
|
2470
2492
|
), t;
|
|
2471
2493
|
}
|
|
2472
2494
|
}
|
|
2473
|
-
const
|
|
2474
|
-
class
|
|
2495
|
+
const $r = new vr();
|
|
2496
|
+
class _r extends g {
|
|
2475
2497
|
constructor() {
|
|
2476
2498
|
super("MiLaboratories.Controller.Shared.StreamingAPI.ReadBinary", [
|
|
2477
2499
|
{
|
|
@@ -2504,9 +2526,9 @@ class Pr extends g {
|
|
|
2504
2526
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
2505
2527
|
return t.resourceId = 0n, t.offset = 0n, e !== void 0 && f(this, t, e), t;
|
|
2506
2528
|
}
|
|
2507
|
-
internalBinaryRead(e, t,
|
|
2508
|
-
let o =
|
|
2509
|
-
for (; e.pos <
|
|
2529
|
+
internalBinaryRead(e, t, r, n) {
|
|
2530
|
+
let o = n ?? this.create(), l = e.pos + t;
|
|
2531
|
+
for (; e.pos < l; ) {
|
|
2510
2532
|
let [i, c] = e.tag();
|
|
2511
2533
|
switch (i) {
|
|
2512
2534
|
case /* uint64 resource_id */
|
|
@@ -2522,13 +2544,13 @@ class Pr extends g {
|
|
|
2522
2544
|
o.chunkSize = e.uint32();
|
|
2523
2545
|
break;
|
|
2524
2546
|
default:
|
|
2525
|
-
let
|
|
2526
|
-
if (
|
|
2547
|
+
let a = r.readUnknownField;
|
|
2548
|
+
if (a === "throw")
|
|
2527
2549
|
throw new globalThis.Error(
|
|
2528
2550
|
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
2529
2551
|
);
|
|
2530
2552
|
let p = e.skip(c);
|
|
2531
|
-
|
|
2553
|
+
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
2532
2554
|
this.typeName,
|
|
2533
2555
|
o,
|
|
2534
2556
|
i,
|
|
@@ -2539,18 +2561,18 @@ class Pr extends g {
|
|
|
2539
2561
|
}
|
|
2540
2562
|
return o;
|
|
2541
2563
|
}
|
|
2542
|
-
internalBinaryWrite(e, t,
|
|
2564
|
+
internalBinaryWrite(e, t, r) {
|
|
2543
2565
|
e.resourceId !== 0n && t.tag(1, h.Varint).uint64(e.resourceId), e.offset !== 0n && t.tag(2, h.Varint).int64(e.offset), e.chunkSize !== void 0 && t.tag(11, h.Varint).uint32(e.chunkSize);
|
|
2544
|
-
let
|
|
2545
|
-
return
|
|
2566
|
+
let n = r.writeUnknownFields;
|
|
2567
|
+
return n !== !1 && (n == !0 ? u.onWrite : n)(
|
|
2546
2568
|
this.typeName,
|
|
2547
2569
|
e,
|
|
2548
2570
|
t
|
|
2549
2571
|
), t;
|
|
2550
2572
|
}
|
|
2551
2573
|
}
|
|
2552
|
-
const
|
|
2553
|
-
class
|
|
2574
|
+
const Cr = new _r();
|
|
2575
|
+
class Or extends g {
|
|
2554
2576
|
constructor() {
|
|
2555
2577
|
super("MiLaboratories.Controller.Shared.StreamingAPI.StreamText", [
|
|
2556
2578
|
{
|
|
@@ -2600,9 +2622,9 @@ class Rr extends g {
|
|
|
2600
2622
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
2601
2623
|
return t.resourceId = 0n, t.offset = 0n, e !== void 0 && f(this, t, e), t;
|
|
2602
2624
|
}
|
|
2603
|
-
internalBinaryRead(e, t,
|
|
2604
|
-
let o =
|
|
2605
|
-
for (; e.pos <
|
|
2625
|
+
internalBinaryRead(e, t, r, n) {
|
|
2626
|
+
let o = n ?? this.create(), l = e.pos + t;
|
|
2627
|
+
for (; e.pos < l; ) {
|
|
2606
2628
|
let [i, c] = e.tag();
|
|
2607
2629
|
switch (i) {
|
|
2608
2630
|
case /* uint64 resource_id */
|
|
@@ -2626,13 +2648,13 @@ class Rr extends g {
|
|
|
2626
2648
|
o.searchRe = e.string();
|
|
2627
2649
|
break;
|
|
2628
2650
|
default:
|
|
2629
|
-
let
|
|
2630
|
-
if (
|
|
2651
|
+
let a = r.readUnknownField;
|
|
2652
|
+
if (a === "throw")
|
|
2631
2653
|
throw new globalThis.Error(
|
|
2632
2654
|
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
2633
2655
|
);
|
|
2634
2656
|
let p = e.skip(c);
|
|
2635
|
-
|
|
2657
|
+
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
2636
2658
|
this.typeName,
|
|
2637
2659
|
o,
|
|
2638
2660
|
i,
|
|
@@ -2643,18 +2665,18 @@ class Rr extends g {
|
|
|
2643
2665
|
}
|
|
2644
2666
|
return o;
|
|
2645
2667
|
}
|
|
2646
|
-
internalBinaryWrite(e, t,
|
|
2668
|
+
internalBinaryWrite(e, t, r) {
|
|
2647
2669
|
e.resourceId !== 0n && t.tag(1, h.Varint).uint64(e.resourceId), e.offset !== 0n && t.tag(2, h.Varint).int64(e.offset), e.readLimit !== void 0 && t.tag(20, h.Varint).int64(e.readLimit), e.search !== void 0 && t.tag(21, h.LengthDelimited).string(e.search), e.searchRe !== void 0 && t.tag(22, h.LengthDelimited).string(e.searchRe);
|
|
2648
|
-
let
|
|
2649
|
-
return
|
|
2670
|
+
let n = r.writeUnknownFields;
|
|
2671
|
+
return n !== !1 && (n == !0 ? u.onWrite : n)(
|
|
2650
2672
|
this.typeName,
|
|
2651
2673
|
e,
|
|
2652
2674
|
t
|
|
2653
2675
|
), t;
|
|
2654
2676
|
}
|
|
2655
2677
|
}
|
|
2656
|
-
const
|
|
2657
|
-
class
|
|
2678
|
+
const Fr = new Or();
|
|
2679
|
+
class Er extends g {
|
|
2658
2680
|
constructor() {
|
|
2659
2681
|
super("MiLaboratories.Controller.Shared.StreamingAPI.ReadText", [
|
|
2660
2682
|
{
|
|
@@ -2704,9 +2726,9 @@ class Nr extends g {
|
|
|
2704
2726
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
2705
2727
|
return t.resourceId = 0n, t.offset = 0n, e !== void 0 && f(this, t, e), t;
|
|
2706
2728
|
}
|
|
2707
|
-
internalBinaryRead(e, t,
|
|
2708
|
-
let o =
|
|
2709
|
-
for (; e.pos <
|
|
2729
|
+
internalBinaryRead(e, t, r, n) {
|
|
2730
|
+
let o = n ?? this.create(), l = e.pos + t;
|
|
2731
|
+
for (; e.pos < l; ) {
|
|
2710
2732
|
let [i, c] = e.tag();
|
|
2711
2733
|
switch (i) {
|
|
2712
2734
|
case /* uint64 resource_id */
|
|
@@ -2730,13 +2752,13 @@ class Nr extends g {
|
|
|
2730
2752
|
o.searchRe = e.string();
|
|
2731
2753
|
break;
|
|
2732
2754
|
default:
|
|
2733
|
-
let
|
|
2734
|
-
if (
|
|
2755
|
+
let a = r.readUnknownField;
|
|
2756
|
+
if (a === "throw")
|
|
2735
2757
|
throw new globalThis.Error(
|
|
2736
2758
|
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
2737
2759
|
);
|
|
2738
2760
|
let p = e.skip(c);
|
|
2739
|
-
|
|
2761
|
+
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
2740
2762
|
this.typeName,
|
|
2741
2763
|
o,
|
|
2742
2764
|
i,
|
|
@@ -2747,18 +2769,18 @@ class Nr extends g {
|
|
|
2747
2769
|
}
|
|
2748
2770
|
return o;
|
|
2749
2771
|
}
|
|
2750
|
-
internalBinaryWrite(e, t,
|
|
2772
|
+
internalBinaryWrite(e, t, r) {
|
|
2751
2773
|
e.resourceId !== 0n && t.tag(1, h.Varint).uint64(e.resourceId), e.offset !== 0n && t.tag(2, h.Varint).int64(e.offset), e.readLimit !== void 0 && t.tag(20, h.Varint).int64(e.readLimit), e.search !== void 0 && t.tag(21, h.LengthDelimited).string(e.search), e.searchRe !== void 0 && t.tag(22, h.LengthDelimited).string(e.searchRe);
|
|
2752
|
-
let
|
|
2753
|
-
return
|
|
2774
|
+
let n = r.writeUnknownFields;
|
|
2775
|
+
return n !== !1 && (n == !0 ? u.onWrite : n)(
|
|
2754
2776
|
this.typeName,
|
|
2755
2777
|
e,
|
|
2756
2778
|
t
|
|
2757
2779
|
), t;
|
|
2758
2780
|
}
|
|
2759
2781
|
}
|
|
2760
|
-
const
|
|
2761
|
-
class
|
|
2782
|
+
const Wr = new Er();
|
|
2783
|
+
class Ar extends g {
|
|
2762
2784
|
constructor() {
|
|
2763
2785
|
super("MiLaboratories.Controller.Shared.StreamingAPI.LastLines", [
|
|
2764
2786
|
{
|
|
@@ -2808,9 +2830,9 @@ class Br extends g {
|
|
|
2808
2830
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
2809
2831
|
return t.resourceId = 0n, e !== void 0 && f(this, t, e), t;
|
|
2810
2832
|
}
|
|
2811
|
-
internalBinaryRead(e, t,
|
|
2812
|
-
let o =
|
|
2813
|
-
for (; e.pos <
|
|
2833
|
+
internalBinaryRead(e, t, r, n) {
|
|
2834
|
+
let o = n ?? this.create(), l = e.pos + t;
|
|
2835
|
+
for (; e.pos < l; ) {
|
|
2814
2836
|
let [i, c] = e.tag();
|
|
2815
2837
|
switch (i) {
|
|
2816
2838
|
case /* uint64 resource_id */
|
|
@@ -2834,13 +2856,13 @@ class Br extends g {
|
|
|
2834
2856
|
o.searchRe = e.string();
|
|
2835
2857
|
break;
|
|
2836
2858
|
default:
|
|
2837
|
-
let
|
|
2838
|
-
if (
|
|
2859
|
+
let a = r.readUnknownField;
|
|
2860
|
+
if (a === "throw")
|
|
2839
2861
|
throw new globalThis.Error(
|
|
2840
2862
|
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
2841
2863
|
);
|
|
2842
2864
|
let p = e.skip(c);
|
|
2843
|
-
|
|
2865
|
+
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
2844
2866
|
this.typeName,
|
|
2845
2867
|
o,
|
|
2846
2868
|
i,
|
|
@@ -2851,18 +2873,18 @@ class Br extends g {
|
|
|
2851
2873
|
}
|
|
2852
2874
|
return o;
|
|
2853
2875
|
}
|
|
2854
|
-
internalBinaryWrite(e, t,
|
|
2876
|
+
internalBinaryWrite(e, t, r) {
|
|
2855
2877
|
e.resourceId !== 0n && t.tag(1, h.Varint).uint64(e.resourceId), e.offset !== void 0 && t.tag(2, h.Varint).int64(e.offset), e.lineCount !== void 0 && t.tag(3, h.Varint).int32(e.lineCount), e.search !== void 0 && t.tag(21, h.LengthDelimited).string(e.search), e.searchRe !== void 0 && t.tag(22, h.LengthDelimited).string(e.searchRe);
|
|
2856
|
-
let
|
|
2857
|
-
return
|
|
2878
|
+
let n = r.writeUnknownFields;
|
|
2879
|
+
return n !== !1 && (n == !0 ? u.onWrite : n)(
|
|
2858
2880
|
this.typeName,
|
|
2859
2881
|
e,
|
|
2860
2882
|
t
|
|
2861
2883
|
), t;
|
|
2862
2884
|
}
|
|
2863
2885
|
}
|
|
2864
|
-
const
|
|
2865
|
-
class
|
|
2886
|
+
const xr = new Ar();
|
|
2887
|
+
class zr extends g {
|
|
2866
2888
|
constructor() {
|
|
2867
2889
|
super("MiLaboratories.Controller.Shared.StreamingAPI.Response", [
|
|
2868
2890
|
{
|
|
@@ -2894,9 +2916,9 @@ class vr extends g {
|
|
|
2894
2916
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
2895
2917
|
return t.data = new Uint8Array(0), t.size = 0n, t.newOffset = 0n, e !== void 0 && f(this, t, e), t;
|
|
2896
2918
|
}
|
|
2897
|
-
internalBinaryRead(e, t,
|
|
2898
|
-
let o =
|
|
2899
|
-
for (; e.pos <
|
|
2919
|
+
internalBinaryRead(e, t, r, n) {
|
|
2920
|
+
let o = n ?? this.create(), l = e.pos + t;
|
|
2921
|
+
for (; e.pos < l; ) {
|
|
2900
2922
|
let [i, c] = e.tag();
|
|
2901
2923
|
switch (i) {
|
|
2902
2924
|
case /* bytes data */
|
|
@@ -2912,13 +2934,13 @@ class vr extends g {
|
|
|
2912
2934
|
o.newOffset = e.uint64().toBigInt();
|
|
2913
2935
|
break;
|
|
2914
2936
|
default:
|
|
2915
|
-
let
|
|
2916
|
-
if (
|
|
2937
|
+
let a = r.readUnknownField;
|
|
2938
|
+
if (a === "throw")
|
|
2917
2939
|
throw new globalThis.Error(
|
|
2918
2940
|
`Unknown field ${i} (wire type ${c}) for ${this.typeName}`
|
|
2919
2941
|
);
|
|
2920
2942
|
let p = e.skip(c);
|
|
2921
|
-
|
|
2943
|
+
a !== !1 && (a === !0 ? u.onRead : a)(
|
|
2922
2944
|
this.typeName,
|
|
2923
2945
|
o,
|
|
2924
2946
|
i,
|
|
@@ -2929,54 +2951,54 @@ class vr extends g {
|
|
|
2929
2951
|
}
|
|
2930
2952
|
return o;
|
|
2931
2953
|
}
|
|
2932
|
-
internalBinaryWrite(e, t,
|
|
2954
|
+
internalBinaryWrite(e, t, r) {
|
|
2933
2955
|
e.data.length && t.tag(1, h.LengthDelimited).bytes(e.data), e.size !== 0n && t.tag(2, h.Varint).uint64(e.size), e.newOffset !== 0n && t.tag(3, h.Varint).uint64(e.newOffset);
|
|
2934
|
-
let
|
|
2935
|
-
return
|
|
2956
|
+
let n = r.writeUnknownFields;
|
|
2957
|
+
return n !== !1 && (n == !0 ? u.onWrite : n)(
|
|
2936
2958
|
this.typeName,
|
|
2937
2959
|
e,
|
|
2938
2960
|
t
|
|
2939
2961
|
), t;
|
|
2940
2962
|
}
|
|
2941
2963
|
}
|
|
2942
|
-
const
|
|
2964
|
+
const S = new zr(), G = new D(
|
|
2943
2965
|
"MiLaboratories.Controller.Shared.Streaming",
|
|
2944
2966
|
[
|
|
2945
2967
|
{
|
|
2946
2968
|
name: "StreamBinary",
|
|
2947
2969
|
serverStreaming: !0,
|
|
2948
2970
|
options: {},
|
|
2949
|
-
I:
|
|
2950
|
-
O:
|
|
2971
|
+
I: $r,
|
|
2972
|
+
O: S
|
|
2951
2973
|
},
|
|
2952
2974
|
{
|
|
2953
2975
|
name: "ReadBinary",
|
|
2954
2976
|
options: {},
|
|
2955
|
-
I:
|
|
2956
|
-
O:
|
|
2977
|
+
I: Cr,
|
|
2978
|
+
O: S
|
|
2957
2979
|
},
|
|
2958
2980
|
{
|
|
2959
2981
|
name: "StreamText",
|
|
2960
2982
|
serverStreaming: !0,
|
|
2961
2983
|
options: {},
|
|
2962
|
-
I:
|
|
2963
|
-
O:
|
|
2984
|
+
I: Fr,
|
|
2985
|
+
O: S
|
|
2964
2986
|
},
|
|
2965
2987
|
{
|
|
2966
2988
|
name: "ReadText",
|
|
2967
2989
|
options: {},
|
|
2968
|
-
I:
|
|
2969
|
-
O:
|
|
2990
|
+
I: Wr,
|
|
2991
|
+
O: S
|
|
2970
2992
|
},
|
|
2971
2993
|
{
|
|
2972
2994
|
name: "LastLines",
|
|
2973
2995
|
options: {},
|
|
2974
|
-
I:
|
|
2975
|
-
O:
|
|
2996
|
+
I: xr,
|
|
2997
|
+
O: S
|
|
2976
2998
|
}
|
|
2977
2999
|
]
|
|
2978
3000
|
);
|
|
2979
|
-
class
|
|
3001
|
+
class Mr {
|
|
2980
3002
|
constructor(e) {
|
|
2981
3003
|
d(this, "typeName", G.typeName);
|
|
2982
3004
|
d(this, "methods", G.methods);
|
|
@@ -2991,12 +3013,12 @@ class $r {
|
|
|
2991
3013
|
* @generated from protobuf rpc: StreamBinary(MiLaboratories.Controller.Shared.StreamingAPI.StreamBinary) returns (stream MiLaboratories.Controller.Shared.StreamingAPI.Response);
|
|
2992
3014
|
*/
|
|
2993
3015
|
streamBinary(e, t) {
|
|
2994
|
-
const
|
|
3016
|
+
const r = this.methods[0], n = this._transport.mergeOptions(t);
|
|
2995
3017
|
return y(
|
|
2996
3018
|
"serverStreaming",
|
|
2997
3019
|
this._transport,
|
|
2998
|
-
n,
|
|
2999
3020
|
r,
|
|
3021
|
+
n,
|
|
3000
3022
|
e
|
|
3001
3023
|
);
|
|
3002
3024
|
}
|
|
@@ -3009,12 +3031,12 @@ class $r {
|
|
|
3009
3031
|
* @generated from protobuf rpc: ReadBinary(MiLaboratories.Controller.Shared.StreamingAPI.ReadBinary) returns (MiLaboratories.Controller.Shared.StreamingAPI.Response);
|
|
3010
3032
|
*/
|
|
3011
3033
|
readBinary(e, t) {
|
|
3012
|
-
const
|
|
3034
|
+
const r = this.methods[1], n = this._transport.mergeOptions(t);
|
|
3013
3035
|
return y(
|
|
3014
3036
|
"unary",
|
|
3015
3037
|
this._transport,
|
|
3016
|
-
n,
|
|
3017
3038
|
r,
|
|
3039
|
+
n,
|
|
3018
3040
|
e
|
|
3019
3041
|
);
|
|
3020
3042
|
}
|
|
@@ -3025,12 +3047,12 @@ class $r {
|
|
|
3025
3047
|
* @generated from protobuf rpc: StreamText(MiLaboratories.Controller.Shared.StreamingAPI.StreamText) returns (stream MiLaboratories.Controller.Shared.StreamingAPI.Response);
|
|
3026
3048
|
*/
|
|
3027
3049
|
streamText(e, t) {
|
|
3028
|
-
const
|
|
3050
|
+
const r = this.methods[2], n = this._transport.mergeOptions(t);
|
|
3029
3051
|
return y(
|
|
3030
3052
|
"serverStreaming",
|
|
3031
3053
|
this._transport,
|
|
3032
|
-
n,
|
|
3033
3054
|
r,
|
|
3055
|
+
n,
|
|
3034
3056
|
e
|
|
3035
3057
|
);
|
|
3036
3058
|
}
|
|
@@ -3043,12 +3065,12 @@ class $r {
|
|
|
3043
3065
|
* @generated from protobuf rpc: ReadText(MiLaboratories.Controller.Shared.StreamingAPI.ReadText) returns (MiLaboratories.Controller.Shared.StreamingAPI.Response);
|
|
3044
3066
|
*/
|
|
3045
3067
|
readText(e, t) {
|
|
3046
|
-
const
|
|
3068
|
+
const r = this.methods[3], n = this._transport.mergeOptions(t);
|
|
3047
3069
|
return y(
|
|
3048
3070
|
"unary",
|
|
3049
3071
|
this._transport,
|
|
3050
|
-
n,
|
|
3051
3072
|
r,
|
|
3073
|
+
n,
|
|
3052
3074
|
e
|
|
3053
3075
|
);
|
|
3054
3076
|
}
|
|
@@ -3065,146 +3087,141 @@ class $r {
|
|
|
3065
3087
|
* @generated from protobuf rpc: LastLines(MiLaboratories.Controller.Shared.StreamingAPI.LastLines) returns (MiLaboratories.Controller.Shared.StreamingAPI.Response);
|
|
3066
3088
|
*/
|
|
3067
3089
|
lastLines(e, t) {
|
|
3068
|
-
const
|
|
3090
|
+
const r = this.methods[4], n = this._transport.mergeOptions(t);
|
|
3069
3091
|
return y(
|
|
3070
3092
|
"unary",
|
|
3071
3093
|
this._transport,
|
|
3072
|
-
n,
|
|
3073
3094
|
r,
|
|
3095
|
+
n,
|
|
3074
3096
|
e
|
|
3075
3097
|
);
|
|
3076
3098
|
}
|
|
3077
3099
|
}
|
|
3078
|
-
class
|
|
3079
|
-
constructor(e, t,
|
|
3100
|
+
class Hr {
|
|
3101
|
+
constructor(e, t, r) {
|
|
3080
3102
|
d(this, "grpcClient");
|
|
3081
|
-
this.grpcTransport = e, this.httpClient = t, this.logger =
|
|
3103
|
+
this.grpcTransport = e, this.httpClient = t, this.logger = r, this.grpcClient = new Mr(this.grpcTransport);
|
|
3082
3104
|
}
|
|
3083
3105
|
close() {
|
|
3084
3106
|
}
|
|
3085
3107
|
/** Reads text back and returns the text,
|
|
3086
3108
|
* the new offset
|
|
3087
3109
|
* and the total size of the (currently existing) file. */
|
|
3088
|
-
async lastLines({ id: e, type: t },
|
|
3110
|
+
async lastLines({ id: e, type: t }, r, n = 0n, o, l) {
|
|
3089
3111
|
return (await this.grpcClient.lastLines(
|
|
3090
3112
|
{
|
|
3091
3113
|
resourceId: e,
|
|
3092
|
-
lineCount:
|
|
3093
|
-
offset:
|
|
3114
|
+
lineCount: r,
|
|
3115
|
+
offset: n,
|
|
3094
3116
|
search: o
|
|
3095
3117
|
},
|
|
3096
|
-
|
|
3118
|
+
T(t, l)
|
|
3097
3119
|
)).response;
|
|
3098
3120
|
}
|
|
3099
3121
|
/** Reads the file forward and returns the text,
|
|
3100
3122
|
* the new offset
|
|
3101
3123
|
* and the total size of the (currently existing) file. */
|
|
3102
|
-
async readText({ id: e, type: t },
|
|
3124
|
+
async readText({ id: e, type: t }, r, n = 0n, o, l) {
|
|
3103
3125
|
return (await this.grpcClient.readText(
|
|
3104
3126
|
{
|
|
3105
|
-
resourceId:
|
|
3106
|
-
readLimit: BigInt(
|
|
3107
|
-
offset:
|
|
3127
|
+
resourceId: te(e),
|
|
3128
|
+
readLimit: BigInt(r),
|
|
3129
|
+
offset: n,
|
|
3108
3130
|
search: o
|
|
3109
3131
|
},
|
|
3110
|
-
|
|
3132
|
+
T(t, l)
|
|
3111
3133
|
)).response;
|
|
3112
3134
|
}
|
|
3113
3135
|
}
|
|
3114
|
-
function
|
|
3136
|
+
function Yn(s, e, t) {
|
|
3115
3137
|
return e.getDriver({
|
|
3116
3138
|
name: "DownloadBlob",
|
|
3117
|
-
init: (
|
|
3139
|
+
init: (r, n, o) => new gr(n, o, s, t)
|
|
3118
3140
|
});
|
|
3119
3141
|
}
|
|
3120
|
-
function
|
|
3142
|
+
function Kn(s, e) {
|
|
3121
3143
|
return s.getDriver({
|
|
3122
3144
|
name: "StreamLogs",
|
|
3123
|
-
init: (t,
|
|
3145
|
+
init: (t, r, n) => new Hr(r, n, e)
|
|
3124
3146
|
});
|
|
3125
3147
|
}
|
|
3126
|
-
function
|
|
3148
|
+
function eo(s, e) {
|
|
3127
3149
|
return s.getDriver({
|
|
3128
3150
|
name: "UploadProgress",
|
|
3129
|
-
init: (t,
|
|
3151
|
+
init: (t, r, n) => new or(r, n, s, e)
|
|
3130
3152
|
});
|
|
3131
3153
|
}
|
|
3132
|
-
function
|
|
3154
|
+
function to(s, e) {
|
|
3133
3155
|
return s.getDriver({
|
|
3134
3156
|
name: "UploadBlob",
|
|
3135
|
-
init: (t,
|
|
3157
|
+
init: (t, r, n) => new At(r, n, s, e)
|
|
3136
3158
|
});
|
|
3137
3159
|
}
|
|
3138
|
-
function
|
|
3160
|
+
function jr(s, e) {
|
|
3139
3161
|
return s.getDriver({
|
|
3140
3162
|
name: "LsFiles",
|
|
3141
|
-
init: (t,
|
|
3163
|
+
init: (t, r, n) => new Dr(r, e)
|
|
3142
3164
|
});
|
|
3143
3165
|
}
|
|
3144
|
-
class
|
|
3145
|
-
constructor(e, t) {
|
|
3146
|
-
d(this, "
|
|
3147
|
-
d(this, "
|
|
3148
|
-
this
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3166
|
+
class Gr {
|
|
3167
|
+
constructor(e, t, r, n, o) {
|
|
3168
|
+
d(this, "counter", new B());
|
|
3169
|
+
d(this, "change", new v());
|
|
3170
|
+
d(this, "signalCtl", new AbortController());
|
|
3171
|
+
d(this, "error");
|
|
3172
|
+
d(this, "done", !1);
|
|
3173
|
+
/** Represents a size in bytes of the downloaded blob. */
|
|
3174
|
+
d(this, "size", 0);
|
|
3175
|
+
this.logger = e, this.clientDownload = t, this.rInfo = r, this.path = n, this.handle = o;
|
|
3154
3176
|
}
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
constructor(e) {
|
|
3158
|
-
d(this, "updating");
|
|
3159
|
-
this.onUpdate = e;
|
|
3177
|
+
attach(e, t) {
|
|
3178
|
+
this.counter.inc(t), this.done || this.change.attachWatcher(e);
|
|
3160
3179
|
}
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3180
|
+
async download() {
|
|
3181
|
+
try {
|
|
3182
|
+
await Te(w.dirname(this.path));
|
|
3183
|
+
const { content: e, size: t } = await this.clientDownload.downloadBlob(this.rInfo);
|
|
3184
|
+
await Le(this.path) ? await e.cancel("the file already exists.") : await Pe(this.logger, this.path, async (r) => {
|
|
3185
|
+
const n = ie.toWeb(tt.createWriteStream(r, { flags: "wx" }));
|
|
3186
|
+
await e.pipeTo(n);
|
|
3187
|
+
}), this.setDone(t), this.change.markChanged();
|
|
3188
|
+
} catch (e) {
|
|
3189
|
+
throw Ce(e) && (this.setError(e), this.change.markChanged(), await m.rm(this.path)), e;
|
|
3190
|
+
}
|
|
3191
|
+
}
|
|
3192
|
+
abort(e) {
|
|
3193
|
+
this.signalCtl.abort(new Oe(e));
|
|
3194
|
+
}
|
|
3195
|
+
getBlob() {
|
|
3196
|
+
return this.done ? this.error ? {
|
|
3197
|
+
done: !0,
|
|
3198
|
+
result: { ok: !1, error: this.error }
|
|
3199
|
+
} : {
|
|
3200
|
+
done: !0,
|
|
3201
|
+
result: {
|
|
3202
|
+
ok: !0,
|
|
3203
|
+
value: {
|
|
3204
|
+
handle: this.handle,
|
|
3205
|
+
size: this.size
|
|
3206
|
+
}
|
|
3169
3207
|
}
|
|
3170
|
-
}
|
|
3208
|
+
} : { done: !1 };
|
|
3209
|
+
}
|
|
3210
|
+
setDone(e) {
|
|
3211
|
+
this.done = !0, this.size = e;
|
|
3212
|
+
}
|
|
3213
|
+
setError(e) {
|
|
3214
|
+
this.done = !0, this.error = e;
|
|
3171
3215
|
}
|
|
3172
3216
|
}
|
|
3173
|
-
|
|
3174
|
-
return s
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
throw new Error(`while getting stream: ${r.error}`);
|
|
3178
|
-
if (!Je(r.valueId))
|
|
3179
|
-
return await t.getResourceData(r.valueId, !1);
|
|
3180
|
-
});
|
|
3217
|
+
function Ce(s) {
|
|
3218
|
+
return s instanceof Oe || s instanceof ce || s instanceof _e || s instanceof $e || // file that we downloads from was moved or deleted.
|
|
3219
|
+
(s == null ? void 0 : s.code) == "ENOENT" || // A resource was deleted.
|
|
3220
|
+
s.name == "RpcError" && (s.code == "NOT_FOUND" || s.code == "ABORTED");
|
|
3181
3221
|
}
|
|
3182
|
-
|
|
3183
|
-
function Fr(s) {
|
|
3184
|
-
const t = s.replace(ve, "").match(Or);
|
|
3185
|
-
if (t == null || t.length != 4)
|
|
3186
|
-
return;
|
|
3187
|
-
const [n, r, o, a] = t;
|
|
3188
|
-
return {
|
|
3189
|
-
stage: r,
|
|
3190
|
-
// For example, 'Building pre-clones from tag groups'
|
|
3191
|
-
progress: o,
|
|
3192
|
-
// 35.3%
|
|
3193
|
-
eta: a
|
|
3194
|
-
// ETA: 00:00:07
|
|
3195
|
-
};
|
|
3222
|
+
class Oe extends Error {
|
|
3196
3223
|
}
|
|
3197
|
-
|
|
3198
|
-
const n = await e.lastLines(s, 1, 0n, ve, t);
|
|
3199
|
-
if (n.data == null || n.data.length == 0)
|
|
3200
|
-
return { found: !1 };
|
|
3201
|
-
const r = n.data.toString().split(/\r?\n/)[0];
|
|
3202
|
-
if (r == null)
|
|
3203
|
-
return { found: !1 };
|
|
3204
|
-
const o = Fr(r);
|
|
3205
|
-
return o === void 0 ? { found: !1 } : { found: !0, ...o };
|
|
3206
|
-
}
|
|
3207
|
-
class $e {
|
|
3224
|
+
class Fe {
|
|
3208
3225
|
constructor(e) {
|
|
3209
3226
|
d(this, "cache", /* @__PURE__ */ new Map());
|
|
3210
3227
|
d(this, "totalSizeBytes", 0);
|
|
@@ -3214,132 +3231,148 @@ class $e {
|
|
|
3214
3231
|
return this.cache.get(e) != null;
|
|
3215
3232
|
}
|
|
3216
3233
|
getFile(e, t) {
|
|
3217
|
-
const
|
|
3218
|
-
return
|
|
3234
|
+
const r = this.cache.get(e);
|
|
3235
|
+
return r != null && r.counter.inc(t), r;
|
|
3219
3236
|
}
|
|
3220
3237
|
/** Decrements a counter in a cache and if we exceeds
|
|
3221
3238
|
* a soft limit, removes files with zero counters. */
|
|
3222
3239
|
removeFile(e, t) {
|
|
3223
|
-
return
|
|
3240
|
+
return he(this.cache, e).counter.dec(t), this.toDelete();
|
|
3224
3241
|
}
|
|
3225
3242
|
/** Returns what results should be deleted to comply with the soft limit. */
|
|
3226
3243
|
toDelete() {
|
|
3227
3244
|
if (this.totalSizeBytes <= this.softSizeBytes) return [];
|
|
3228
3245
|
const e = [];
|
|
3229
3246
|
let t = 0;
|
|
3230
|
-
return
|
|
3247
|
+
return Ke(this.cache).filter(([r, n]) => n.counter.isZero()).forEach(([r, n]) => {
|
|
3231
3248
|
if (this.totalSizeBytes - t <= this.softSizeBytes) return;
|
|
3232
|
-
const o =
|
|
3233
|
-
t += o.
|
|
3249
|
+
const o = he(this.cache, r);
|
|
3250
|
+
t += o.size, e.push(o);
|
|
3234
3251
|
}), e;
|
|
3235
3252
|
}
|
|
3236
3253
|
addCache(e, t) {
|
|
3237
|
-
const
|
|
3238
|
-
if (this.cache.set(e.path, e), e.counter.inc(t), e.
|
|
3239
|
-
|
|
3254
|
+
const r = this.cache.get(e.path) == null;
|
|
3255
|
+
if (this.cache.set(e.path, e), e.counter.inc(t), e.size < 0) throw new Error(`empty sizeBytes: ${e}`);
|
|
3256
|
+
r && (this.totalSizeBytes += e.size);
|
|
3240
3257
|
}
|
|
3241
3258
|
removeCache(e) {
|
|
3242
|
-
this.cache.delete(e.path), this.totalSizeBytes -= e.
|
|
3259
|
+
this.cache.delete(e.path), this.totalSizeBytes -= e.size;
|
|
3243
3260
|
}
|
|
3244
3261
|
}
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
}
|
|
3249
|
-
getLastLogs(e, t, n) {
|
|
3250
|
-
if (n === void 0) return b.make((o) => this.getLastLogs(e, t, o));
|
|
3251
|
-
const r = q(n, e);
|
|
3252
|
-
if (r === void 0) {
|
|
3253
|
-
n.markUnstable("no stream in stream manager");
|
|
3254
|
-
return;
|
|
3255
|
-
}
|
|
3256
|
-
if (V(r)) return this.downloadDriver.getLastLogs(r, t, n);
|
|
3257
|
-
try {
|
|
3258
|
-
return this.logsStreamDriver.getLastLogs(r, t, n);
|
|
3259
|
-
} catch (o) {
|
|
3260
|
-
if (o.name == "RpcError" && o.code == "NOT_FOUND") {
|
|
3261
|
-
n.markUnstable(`NOT_FOUND in logs stream driver while getting last logs: ${o}`);
|
|
3262
|
-
return;
|
|
3263
|
-
}
|
|
3264
|
-
throw o;
|
|
3265
|
-
}
|
|
3266
|
-
}
|
|
3267
|
-
getProgressLog(e, t, n) {
|
|
3268
|
-
if (n === void 0)
|
|
3269
|
-
return b.make((o) => this.getProgressLog(e, t, o));
|
|
3270
|
-
const r = q(n, e);
|
|
3271
|
-
if (r === void 0) {
|
|
3272
|
-
n.markUnstable("no stream in stream manager");
|
|
3273
|
-
return;
|
|
3274
|
-
}
|
|
3275
|
-
if (V(r)) return this.downloadDriver.getProgressLog(r, t, n);
|
|
3276
|
-
try {
|
|
3277
|
-
return this.logsStreamDriver.getProgressLog(r, t, n);
|
|
3278
|
-
} catch (o) {
|
|
3279
|
-
if (o.name == "RpcError" && o.code == "NOT_FOUND") {
|
|
3280
|
-
n.markUnstable(`NOT_FOUND in logs stream driver while getting a progress log: ${o}`);
|
|
3281
|
-
return;
|
|
3282
|
-
}
|
|
3283
|
-
throw o;
|
|
3284
|
-
}
|
|
3285
|
-
}
|
|
3286
|
-
getLogHandle(e, t) {
|
|
3287
|
-
if (t === void 0) return b.make((r) => this.getLogHandle(e, r));
|
|
3288
|
-
const n = q(t, e);
|
|
3289
|
-
if (n === void 0) {
|
|
3290
|
-
t.markUnstable("no stream in stream manager");
|
|
3291
|
-
return;
|
|
3292
|
-
}
|
|
3293
|
-
return V(n) ? this.downloadDriver.getLogHandle(n, t) : this.logsStreamDriver.getLogHandle(n, t);
|
|
3294
|
-
}
|
|
3295
|
-
async lastLines(e, t, n, r) {
|
|
3296
|
-
return C(e) ? await this.logsStreamDriver.lastLines(e, t, n, r) : await this.downloadDriver.lastLines(e, t, n, r);
|
|
3297
|
-
}
|
|
3298
|
-
async readText(e, t, n, r) {
|
|
3299
|
-
return C(e) ? await this.logsStreamDriver.readText(e, t, n, r) : await this.downloadDriver.readText(e, t, n, r);
|
|
3300
|
-
}
|
|
3262
|
+
const Ee = /^blob\+local:\/\/download\/(?<path>.*)#(?<signature>.*)$/;
|
|
3263
|
+
function Vr(s, e) {
|
|
3264
|
+
return `blob+local://download/${s}#${e.sign(s)}`;
|
|
3301
3265
|
}
|
|
3302
|
-
function
|
|
3303
|
-
return
|
|
3266
|
+
function qr(s) {
|
|
3267
|
+
return !!s.match(Ee);
|
|
3304
3268
|
}
|
|
3305
|
-
function
|
|
3306
|
-
|
|
3307
|
-
|
|
3269
|
+
function V(s, e) {
|
|
3270
|
+
const t = s.match(Ee);
|
|
3271
|
+
if (t === null)
|
|
3272
|
+
throw new Error(`Local handle is malformed: ${s}, matches: ${t}`);
|
|
3273
|
+
const { path: r, signature: n } = t.groups;
|
|
3274
|
+
return e.verify(r, n, `Signature verification failed for: ${s}`), { path: r, signature: n };
|
|
3308
3275
|
}
|
|
3276
|
+
const Jr = ae({
|
|
3277
|
+
kv: {
|
|
3278
|
+
"ctl/file/blobInfo": k.object({
|
|
3279
|
+
sizeBytes: k.coerce.number()
|
|
3280
|
+
})
|
|
3281
|
+
}
|
|
3282
|
+
});
|
|
3283
|
+
function Zr(s) {
|
|
3284
|
+
return s.kv["ctl/file/blobInfo"].sizeBytes;
|
|
3285
|
+
}
|
|
3286
|
+
const O = k.object({
|
|
3287
|
+
/** Local file path, to take data for upload */
|
|
3288
|
+
localPath: k.string(),
|
|
3289
|
+
/** Path signature, to check this data was generated by us */
|
|
3290
|
+
pathSignature: k.string(),
|
|
3291
|
+
/** File size in bytes */
|
|
3292
|
+
sizeBytes: k.string(),
|
|
3293
|
+
/** Modification time unix timestamp in seconds */
|
|
3294
|
+
modificationTime: k.string()
|
|
3295
|
+
}), We = k.object({
|
|
3296
|
+
/** Pl storage id */
|
|
3297
|
+
storageId: k.string(),
|
|
3298
|
+
/** Path inside storage */
|
|
3299
|
+
path: k.string()
|
|
3300
|
+
}), ro = k.union([
|
|
3301
|
+
O,
|
|
3302
|
+
We
|
|
3303
|
+
]), Qr = ae({
|
|
3304
|
+
data: O,
|
|
3305
|
+
fields: {
|
|
3306
|
+
blob: !1
|
|
3307
|
+
}
|
|
3308
|
+
}), Xr = ae({
|
|
3309
|
+
fields: {
|
|
3310
|
+
incarnation: !1
|
|
3311
|
+
}
|
|
3312
|
+
}), Ae = /^blob\+remote:\/\/download\/(?<content>(?<resourceType>.*)\/(?<resourceVersion>.*)\/(?<resourceId>.*))#(?<signature>.*)$/;
|
|
3313
|
+
function Yr(s, e) {
|
|
3314
|
+
const t = `${s.type.name}/${s.type.version}/${BigInt(s.id)}`;
|
|
3315
|
+
return `blob+remote://download/${t}#${e.sign(t)}`;
|
|
3316
|
+
}
|
|
3317
|
+
function Kr(s) {
|
|
3318
|
+
return !!s.match(Ae);
|
|
3319
|
+
}
|
|
3320
|
+
function en(s, e) {
|
|
3321
|
+
const t = s.match(Ae);
|
|
3322
|
+
if (t === null)
|
|
3323
|
+
throw new Error(`Remote handle is malformed: ${s}, matches: ${t}`);
|
|
3324
|
+
const { content: r, resourceType: n, resourceVersion: o, resourceId: l, signature: i } = t.groups;
|
|
3325
|
+
return e.verify(r, i, `Signature verification failed for ${s}`), {
|
|
3326
|
+
id: ee(BigInt(l)),
|
|
3327
|
+
type: { name: n, version: o }
|
|
3328
|
+
};
|
|
3329
|
+
}
|
|
3330
|
+
function xe(s, e) {
|
|
3331
|
+
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)}`;
|
|
3332
|
+
}
|
|
3333
|
+
const ze = /^log\+live:\/\/log\/(?<resourceType>.*)\/(?<resourceVersion>.*)\/(?<resourceId>.*)$/;
|
|
3309
3334
|
function _(s) {
|
|
3335
|
+
return ze.test(s);
|
|
3336
|
+
}
|
|
3337
|
+
const Me = /^log\+ready:\/\/log\/(?<resourceType>.*)\/(?<resourceVersion>.*)\/(?<resourceId>.*)$/;
|
|
3338
|
+
function tn(s) {
|
|
3339
|
+
return Me.test(s);
|
|
3340
|
+
}
|
|
3341
|
+
function C(s) {
|
|
3310
3342
|
let e;
|
|
3311
|
-
if (
|
|
3312
|
-
e = s.match(
|
|
3313
|
-
else if (
|
|
3314
|
-
e = s.match(
|
|
3343
|
+
if (_(s))
|
|
3344
|
+
e = s.match(ze);
|
|
3345
|
+
else if (tn(s))
|
|
3346
|
+
e = s.match(Me);
|
|
3315
3347
|
else throw new Error(`Log handle is malformed: ${s}`);
|
|
3316
3348
|
if (e == null) throw new Error(`Log handle wasn't parsed: ${s}`);
|
|
3317
|
-
const { resourceType: t, resourceVersion:
|
|
3349
|
+
const { resourceType: t, resourceVersion: r, resourceId: n } = e.groups;
|
|
3318
3350
|
return {
|
|
3319
|
-
id:
|
|
3320
|
-
type: { name: t, version:
|
|
3351
|
+
id: ee(BigInt(n)),
|
|
3352
|
+
type: { name: t, version: r }
|
|
3321
3353
|
};
|
|
3322
3354
|
}
|
|
3323
|
-
|
|
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)}`;
|
|
3355
|
+
class de extends Error {
|
|
3325
3356
|
}
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
const Oe = /^log\+ready:\/\/log\/(?<resourceType>.*)\/(?<resourceVersion>.*)\/(?<resourceId>.*)$/;
|
|
3331
|
-
function Er(s) {
|
|
3332
|
-
return Oe.test(s);
|
|
3333
|
-
}
|
|
3334
|
-
const Wr = se({
|
|
3335
|
-
kv: {
|
|
3336
|
-
"ctl/file/blobInfo": T.object({
|
|
3337
|
-
sizeBytes: T.coerce.number()
|
|
3338
|
-
})
|
|
3357
|
+
class rn {
|
|
3358
|
+
constructor(e) {
|
|
3359
|
+
d(this, "updating");
|
|
3360
|
+
this.onUpdate = e;
|
|
3339
3361
|
}
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3362
|
+
schedule() {
|
|
3363
|
+
this.updating == null && (this.updating = (async () => {
|
|
3364
|
+
try {
|
|
3365
|
+
await this.onUpdate();
|
|
3366
|
+
} catch (e) {
|
|
3367
|
+
console.log(`error while updating in Updater: ${e}`);
|
|
3368
|
+
} finally {
|
|
3369
|
+
this.updating = void 0;
|
|
3370
|
+
}
|
|
3371
|
+
})());
|
|
3372
|
+
}
|
|
3373
|
+
}
|
|
3374
|
+
class no {
|
|
3375
|
+
constructor(e, t, r, n, o, l) {
|
|
3343
3376
|
/** Represents a Resource Id to the path of a blob as a map. */
|
|
3344
3377
|
d(this, "idToDownload", /* @__PURE__ */ new Map());
|
|
3345
3378
|
/** Writes and removes files to a hard drive and holds a counter for every
|
|
@@ -3351,125 +3384,134 @@ class Hn {
|
|
|
3351
3384
|
d(this, "idToLastLines", /* @__PURE__ */ new Map());
|
|
3352
3385
|
d(this, "idToProgressLog", /* @__PURE__ */ new Map());
|
|
3353
3386
|
d(this, "saveDir");
|
|
3354
|
-
this.logger = e, this.clientDownload = t, this.clientLogs =
|
|
3387
|
+
this.logger = e, this.clientDownload = t, this.clientLogs = r, this.signer = o, this.cache = new Fe(l.cacheSoftSizeBytes), this.downloadQueue = new re(this.logger, l.nConcurrentDownloads), this.saveDir = w.resolve(n);
|
|
3355
3388
|
}
|
|
3356
3389
|
getDownloadedBlob(e, t) {
|
|
3357
|
-
if (t === void 0) return b.make((
|
|
3358
|
-
const
|
|
3359
|
-
t.addOnDestroy(() => this.releaseBlob(
|
|
3360
|
-
const o = this.getDownloadedBlobNoCtx(t.watcher,
|
|
3390
|
+
if (t === void 0) return b.make((l) => this.getDownloadedBlob(e, l));
|
|
3391
|
+
const r = I(e, t), n = L();
|
|
3392
|
+
t.addOnDestroy(() => this.releaseBlob(r.id, n));
|
|
3393
|
+
const o = this.getDownloadedBlobNoCtx(t.watcher, r, n);
|
|
3361
3394
|
return o == null && t.markUnstable("download blob is still undefined"), o;
|
|
3362
3395
|
}
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
getLocalPath(e) {
|
|
3369
|
-
return J(e, this.signer);
|
|
3370
|
-
}
|
|
3371
|
-
async getContent(e) {
|
|
3372
|
-
if (Hr(e)) return await zr(this.getLocalPath(e));
|
|
3373
|
-
if (!Gr(e)) throw new Error("Malformed remote handle");
|
|
3374
|
-
const t = Vr(e, this.signer), { content: n } = await this.clientDownload.downloadBlob(t);
|
|
3375
|
-
return await Le(n);
|
|
3376
|
-
}
|
|
3377
|
-
getDownloadedBlobNoCtx(e, t, n) {
|
|
3378
|
-
let r = this.idToDownload.get(t.id);
|
|
3379
|
-
if (r === void 0) {
|
|
3380
|
-
const a = this.setNewDownloadTask(e, t, n);
|
|
3396
|
+
getDownloadedBlobNoCtx(e, t, r) {
|
|
3397
|
+
U("getDownloadedBlob", t.type);
|
|
3398
|
+
let n = this.idToDownload.get(t.id);
|
|
3399
|
+
if (n === void 0) {
|
|
3400
|
+
const l = this.setNewDownloadTask(t);
|
|
3381
3401
|
this.downloadQueue.push({
|
|
3382
|
-
fn: () => this.downloadBlob(
|
|
3383
|
-
recoverableErrorPredicate: (i) => !
|
|
3384
|
-
}),
|
|
3402
|
+
fn: () => this.downloadBlob(l, r),
|
|
3403
|
+
recoverableErrorPredicate: (i) => !Ce(i)
|
|
3404
|
+
}), n = l;
|
|
3385
3405
|
}
|
|
3386
|
-
|
|
3387
|
-
const o =
|
|
3388
|
-
if (o
|
|
3389
|
-
if (o.ok) return o.value;
|
|
3390
|
-
throw o.error;
|
|
3406
|
+
n.attach(e, r);
|
|
3407
|
+
const o = n.getBlob();
|
|
3408
|
+
if (o.done) {
|
|
3409
|
+
if (o.result.ok) return o.result.value;
|
|
3410
|
+
throw o.result.error;
|
|
3391
3411
|
}
|
|
3392
3412
|
}
|
|
3393
|
-
setNewDownloadTask(e
|
|
3394
|
-
const
|
|
3413
|
+
setNewDownloadTask(e) {
|
|
3414
|
+
const t = this.getFilePath(e.id), r = new Gr(
|
|
3415
|
+
this.logger,
|
|
3395
3416
|
this.clientDownload,
|
|
3417
|
+
e,
|
|
3396
3418
|
t,
|
|
3397
|
-
|
|
3398
|
-
jr(r, this.signer)
|
|
3419
|
+
Vr(t, this.signer)
|
|
3399
3420
|
);
|
|
3400
|
-
return this.idToDownload.set(
|
|
3421
|
+
return this.idToDownload.set(e.id, r), r;
|
|
3401
3422
|
}
|
|
3402
3423
|
async downloadBlob(e, t) {
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3424
|
+
await e.download();
|
|
3425
|
+
const r = e.getBlob();
|
|
3426
|
+
r.done && r.result.ok && this.cache.addCache(e, t);
|
|
3427
|
+
}
|
|
3428
|
+
getOnDemandBlob(e, t) {
|
|
3429
|
+
if (t === void 0) return b.make((l) => this.getOnDemandBlob(e, l));
|
|
3430
|
+
const r = le(e) ? X(e, Jr, t) : e, n = L();
|
|
3431
|
+
return t.addOnDestroy(() => this.releaseOnDemandBlob(r.id, n)), this.getOnDemandBlobNoCtx(r, n);
|
|
3432
|
+
}
|
|
3433
|
+
getOnDemandBlobNoCtx(e, t) {
|
|
3434
|
+
U("getOnDemandBlob", e.type);
|
|
3435
|
+
let r = this.idToOnDemand.get(e.id);
|
|
3436
|
+
return r === void 0 && (r = new nn(Zr(e), Yr(e, this.signer)), this.idToOnDemand.set(e.id, r)), r.attach(t), r.getHandle();
|
|
3437
|
+
}
|
|
3438
|
+
/** Gets a path from a handle. */
|
|
3439
|
+
getLocalPath(e) {
|
|
3440
|
+
const { path: t } = V(e, this.signer);
|
|
3441
|
+
return t;
|
|
3442
|
+
}
|
|
3443
|
+
/** Gets a content of a blob by a handle. */
|
|
3444
|
+
async getContent(e) {
|
|
3445
|
+
if (qr(e))
|
|
3446
|
+
return await sn(this.getLocalPath(e));
|
|
3447
|
+
if (Kr(e)) {
|
|
3448
|
+
const t = en(e, this.signer), { content: r } = await this.clientDownload.downloadBlob(t);
|
|
3449
|
+
return await Ie(r);
|
|
3450
|
+
}
|
|
3451
|
+
throw new Error("Malformed remote handle");
|
|
3452
|
+
}
|
|
3453
|
+
getLastLogs(e, t, r) {
|
|
3454
|
+
if (r == null) return b.make((i) => this.getLastLogs(e, t, i));
|
|
3455
|
+
const n = I(e, r), o = L();
|
|
3456
|
+
r.addOnDestroy(() => this.releaseBlob(n.id, o));
|
|
3457
|
+
const l = this.getLastLogsNoCtx(r.watcher, n, t, o);
|
|
3458
|
+
return l == null && r.markUnstable("either a file was not downloaded or logs was not read"), l;
|
|
3459
|
+
}
|
|
3460
|
+
getLastLogsNoCtx(e, t, r, n) {
|
|
3461
|
+
U("getLastLogs", t.type);
|
|
3462
|
+
const o = this.getDownloadedBlobNoCtx(e, t, n);
|
|
3422
3463
|
if (o == null) return;
|
|
3423
|
-
const
|
|
3464
|
+
const { path: l } = V(o.handle, this.signer);
|
|
3424
3465
|
let i = this.idToLastLines.get(t.id);
|
|
3425
3466
|
if (i == null) {
|
|
3426
|
-
const
|
|
3427
|
-
this.idToLastLines.set(t.id,
|
|
3467
|
+
const a = new pe(l, r);
|
|
3468
|
+
this.idToLastLines.set(t.id, a), i = a;
|
|
3428
3469
|
}
|
|
3429
3470
|
const c = i.getOrSchedule(e);
|
|
3430
3471
|
if (c.error) throw c.error;
|
|
3431
3472
|
return c.log;
|
|
3432
3473
|
}
|
|
3433
|
-
getProgressLog(e, t,
|
|
3434
|
-
if (
|
|
3474
|
+
getProgressLog(e, t, r) {
|
|
3475
|
+
if (r == null)
|
|
3435
3476
|
return b.make((i) => this.getProgressLog(e, t, i));
|
|
3436
|
-
const
|
|
3437
|
-
|
|
3438
|
-
const
|
|
3439
|
-
|
|
3440
|
-
|
|
3477
|
+
const n = I(e, r), o = L();
|
|
3478
|
+
r.addOnDestroy(() => this.releaseBlob(n.id, o));
|
|
3479
|
+
const l = this.getProgressLogNoCtx(
|
|
3480
|
+
r.watcher,
|
|
3481
|
+
n,
|
|
3441
3482
|
t,
|
|
3442
3483
|
o
|
|
3443
3484
|
);
|
|
3444
|
-
return
|
|
3485
|
+
return l === void 0 && r.markUnstable("either a file was not downloaded or a progress log was not read"), l;
|
|
3445
3486
|
}
|
|
3446
|
-
getProgressLogNoCtx(e, t,
|
|
3447
|
-
|
|
3487
|
+
getProgressLogNoCtx(e, t, r, n) {
|
|
3488
|
+
U("getProgressLog", t.type);
|
|
3489
|
+
const o = this.getDownloadedBlobNoCtx(e, t, n);
|
|
3448
3490
|
if (o == null) return;
|
|
3449
|
-
const
|
|
3491
|
+
const { path: l } = V(o.handle, this.signer);
|
|
3450
3492
|
let i = this.idToProgressLog.get(t.id);
|
|
3451
3493
|
if (i == null) {
|
|
3452
|
-
const
|
|
3453
|
-
this.idToProgressLog.set(t.id,
|
|
3494
|
+
const a = new pe(l, 1, r);
|
|
3495
|
+
this.idToProgressLog.set(t.id, a), i = a;
|
|
3454
3496
|
}
|
|
3455
3497
|
const c = i.getOrSchedule(e);
|
|
3456
3498
|
if (c.error) throw c.error;
|
|
3457
3499
|
return c.log;
|
|
3458
3500
|
}
|
|
3459
3501
|
getLogHandle(e, t) {
|
|
3460
|
-
if (t == null) return b.make((
|
|
3461
|
-
const
|
|
3462
|
-
return this.getLogHandleNoCtx(
|
|
3502
|
+
if (t == null) return b.make((n) => this.getLogHandle(e, n));
|
|
3503
|
+
const r = I(e, t);
|
|
3504
|
+
return this.getLogHandleNoCtx(r);
|
|
3463
3505
|
}
|
|
3464
3506
|
getLogHandleNoCtx(e) {
|
|
3465
|
-
return
|
|
3507
|
+
return U("getLogHandle", e.type), xe(!1, e);
|
|
3466
3508
|
}
|
|
3467
|
-
async lastLines(e, t,
|
|
3509
|
+
async lastLines(e, t, r, n) {
|
|
3468
3510
|
const o = await this.clientLogs.lastLines(
|
|
3469
|
-
|
|
3511
|
+
C(e),
|
|
3470
3512
|
t,
|
|
3471
|
-
BigInt(
|
|
3472
|
-
|
|
3513
|
+
BigInt(r ?? 0),
|
|
3514
|
+
n
|
|
3473
3515
|
);
|
|
3474
3516
|
return {
|
|
3475
3517
|
live: !1,
|
|
@@ -3479,12 +3521,12 @@ class Hn {
|
|
|
3479
3521
|
newOffset: Number(o.newOffset)
|
|
3480
3522
|
};
|
|
3481
3523
|
}
|
|
3482
|
-
async readText(e, t,
|
|
3524
|
+
async readText(e, t, r, n) {
|
|
3483
3525
|
const o = await this.clientLogs.readText(
|
|
3484
|
-
|
|
3526
|
+
C(e),
|
|
3485
3527
|
t,
|
|
3486
|
-
BigInt(
|
|
3487
|
-
|
|
3528
|
+
BigInt(r ?? 0),
|
|
3529
|
+
n
|
|
3488
3530
|
);
|
|
3489
3531
|
return {
|
|
3490
3532
|
live: !1,
|
|
@@ -3495,27 +3537,27 @@ class Hn {
|
|
|
3495
3537
|
};
|
|
3496
3538
|
}
|
|
3497
3539
|
async releaseBlob(e, t) {
|
|
3498
|
-
const
|
|
3499
|
-
if (
|
|
3500
|
-
if (this.cache.existsFile(
|
|
3501
|
-
const
|
|
3540
|
+
const r = this.idToDownload.get(e);
|
|
3541
|
+
if (r != null)
|
|
3542
|
+
if (this.cache.existsFile(r.path)) {
|
|
3543
|
+
const n = this.cache.removeFile(r.path, t);
|
|
3502
3544
|
await Promise.all(
|
|
3503
|
-
|
|
3545
|
+
n.map(async (o) => {
|
|
3504
3546
|
await m.rm(o.path), this.cache.removeCache(o), this.removeTask(
|
|
3505
3547
|
o,
|
|
3506
|
-
`the task ${o.path} was removedfrom cache along with ${
|
|
3548
|
+
`the task ${o.path} was removedfrom cache along with ${n.map((l) => l.path)}`
|
|
3507
3549
|
);
|
|
3508
3550
|
})
|
|
3509
3551
|
);
|
|
3510
3552
|
} else
|
|
3511
|
-
|
|
3553
|
+
r.counter.dec(t) && this.removeTask(r, `the task ${r.path} was removed from cache`);
|
|
3512
3554
|
}
|
|
3513
3555
|
removeTask(e, t) {
|
|
3514
3556
|
e.abort(t), e.change.markChanged(), this.idToDownload.delete(e.rInfo.id), this.idToLastLines.delete(e.rInfo.id), this.idToProgressLog.delete(e.rInfo.id);
|
|
3515
3557
|
}
|
|
3516
3558
|
async releaseOnDemandBlob(e, t) {
|
|
3517
|
-
var
|
|
3518
|
-
(((
|
|
3559
|
+
var n;
|
|
3560
|
+
(((n = this.idToOnDemand.get(e)) == null ? void 0 : n.release(t)) ?? !1) && this.idToOnDemand.delete(e);
|
|
3519
3561
|
}
|
|
3520
3562
|
/** Removes all files from a hard drive. */
|
|
3521
3563
|
async releaseAll() {
|
|
@@ -3524,32 +3566,31 @@ class Hn {
|
|
|
3524
3566
|
});
|
|
3525
3567
|
}
|
|
3526
3568
|
getFilePath(e) {
|
|
3527
|
-
return w.resolve(
|
|
3569
|
+
return w.resolve(this.saveDir, String(BigInt(e)));
|
|
3528
3570
|
}
|
|
3529
3571
|
}
|
|
3530
|
-
class
|
|
3572
|
+
class nn {
|
|
3531
3573
|
constructor(e, t) {
|
|
3532
|
-
d(this, "
|
|
3533
|
-
d(this, "counter", new v());
|
|
3574
|
+
d(this, "counter", new B());
|
|
3534
3575
|
this.size = e, this.handle = t;
|
|
3535
3576
|
}
|
|
3536
3577
|
getHandle() {
|
|
3537
3578
|
return { handle: this.handle, size: this.size };
|
|
3538
3579
|
}
|
|
3539
|
-
attach(e
|
|
3540
|
-
this.counter.inc(
|
|
3580
|
+
attach(e) {
|
|
3581
|
+
this.counter.inc(e);
|
|
3541
3582
|
}
|
|
3542
3583
|
release(e) {
|
|
3543
3584
|
return this.counter.dec(e);
|
|
3544
3585
|
}
|
|
3545
3586
|
}
|
|
3546
|
-
class
|
|
3547
|
-
constructor(e, t,
|
|
3587
|
+
class pe {
|
|
3588
|
+
constructor(e, t, r) {
|
|
3548
3589
|
d(this, "updater");
|
|
3549
3590
|
d(this, "log");
|
|
3550
|
-
d(this, "change", new
|
|
3591
|
+
d(this, "change", new v());
|
|
3551
3592
|
d(this, "error");
|
|
3552
|
-
this.path = e, this.lines = t, this.patternToSearch =
|
|
3593
|
+
this.path = e, this.lines = t, this.patternToSearch = r, this.updater = new rn(async () => this.update());
|
|
3553
3594
|
}
|
|
3554
3595
|
getOrSchedule(e) {
|
|
3555
3596
|
return this.change.attachWatcher(e), this.updater.schedule(), {
|
|
@@ -3559,7 +3600,7 @@ class he {
|
|
|
3559
3600
|
}
|
|
3560
3601
|
async update() {
|
|
3561
3602
|
try {
|
|
3562
|
-
const e = await
|
|
3603
|
+
const e = await on(this.path, this.lines, this.patternToSearch);
|
|
3563
3604
|
this.log != e && this.change.markChanged(), this.log = e;
|
|
3564
3605
|
} catch (e) {
|
|
3565
3606
|
if (e.name == "RpcError" && e.code == "NOT_FOUND") {
|
|
@@ -3570,148 +3611,168 @@ class he {
|
|
|
3570
3611
|
}
|
|
3571
3612
|
}
|
|
3572
3613
|
}
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
}
|
|
3580
|
-
|
|
3581
|
-
return await Le(re.toWeb(O.createReadStream(s)));
|
|
3582
|
-
}
|
|
3583
|
-
function xr(s, e, t) {
|
|
3584
|
-
const n = O.createReadStream(s), r = new ne();
|
|
3585
|
-
return new Promise((o, a) => {
|
|
3586
|
-
const i = rt.createInterface(n, r), c = new nt();
|
|
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);
|
|
3614
|
+
function on(s, e, t) {
|
|
3615
|
+
const r = oe.createReadStream(s), n = new ie();
|
|
3616
|
+
return new Promise((o, l) => {
|
|
3617
|
+
const i = lt.createInterface(r, n), c = new st();
|
|
3618
|
+
i.on("line", function(a) {
|
|
3619
|
+
t != null && !a.includes(t) || (c.push(a), c.length > e && c.shift());
|
|
3620
|
+
}), i.on("error", l), i.on("close", function() {
|
|
3621
|
+
o(c.toArray().join(ue.EOL) + ue.EOL);
|
|
3591
3622
|
});
|
|
3592
3623
|
});
|
|
3593
3624
|
}
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
d(this, "sizeBytes", 0);
|
|
3602
|
-
this.clientDownload = e, this.rInfo = t, this.path = n, this.handle = r;
|
|
3625
|
+
async function sn(s) {
|
|
3626
|
+
return await Ie(se.toWeb(oe.createReadStream(s)));
|
|
3627
|
+
}
|
|
3628
|
+
function U(s, e) {
|
|
3629
|
+
if (!e.name.startsWith("Blob/")) {
|
|
3630
|
+
let t = `${s}: wrong resource type: ${e.name}, expected: a resource of type that starts with 'Blob/'.`;
|
|
3631
|
+
throw e.name == "Blob" && (t += " If it's called from workflow, should a file be exported with 'file.exportFile' function?"), new de(t);
|
|
3603
3632
|
}
|
|
3604
|
-
|
|
3605
|
-
|
|
3633
|
+
}
|
|
3634
|
+
class an {
|
|
3635
|
+
constructor(e, t, r, n, o, l) {
|
|
3636
|
+
d(this, "change", new v());
|
|
3637
|
+
d(this, "counter", new B());
|
|
3638
|
+
/** If this is upload progress this field will be defined */
|
|
3639
|
+
d(this, "uploadData");
|
|
3640
|
+
d(this, "progress");
|
|
3641
|
+
/** If failed, then getting a progress is terminally failed. */
|
|
3642
|
+
d(this, "failed");
|
|
3643
|
+
this.logger = e, this.clientBlob = t, this.clientProgress = r, this.nConcurrentPartsUpload = n, this.res = l;
|
|
3644
|
+
const { uploadData: i, progress: c } = ln(l, o);
|
|
3645
|
+
this.uploadData = i, this.progress = c;
|
|
3646
|
+
}
|
|
3647
|
+
getProgress(e, t) {
|
|
3648
|
+
if (this.incCounter(e, t), this.failed)
|
|
3649
|
+
throw this.logger.error(`Uploading terminally failed: ${this.progress.lastError}`), new Error(this.progress.lastError);
|
|
3650
|
+
return cn(this.progress);
|
|
3606
3651
|
}
|
|
3607
|
-
|
|
3652
|
+
shouldScheduleUpload() {
|
|
3653
|
+
return this.progress.isUpload && this.progress.isUploadSignMatch;
|
|
3654
|
+
}
|
|
3655
|
+
/** Uploads a blob if it's not BlobIndex. */
|
|
3656
|
+
async uploadBlobTask() {
|
|
3657
|
+
ct(Y(this.res), "the upload operation can be done only for BlobUploads");
|
|
3608
3658
|
try {
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3659
|
+
if (this.isComputableDone()) return;
|
|
3660
|
+
const e = await this.clientBlob.initUpload(this.res);
|
|
3661
|
+
this.logger.info(
|
|
3662
|
+
`started to upload blob ${this.res.id}, parts overall: ${e.overall}, parts remained: ${e.toUpload.length}`
|
|
3663
|
+
);
|
|
3664
|
+
const t = (r) => async () => {
|
|
3665
|
+
this.isComputableDone() || (await this.clientBlob.partUpload(
|
|
3666
|
+
this.res,
|
|
3667
|
+
this.uploadData.localPath,
|
|
3668
|
+
BigInt(this.uploadData.modificationTime),
|
|
3669
|
+
r
|
|
3670
|
+
), this.logger.info(`uploaded chunk ${r}/${e.overall} of resource: ${this.res.id}`));
|
|
3671
|
+
};
|
|
3672
|
+
if (await ne(this.nConcurrentPartsUpload, e.toUpload.map(t)), this.isComputableDone()) return;
|
|
3673
|
+
await this.clientBlob.finalize(this.res), this.logger.info(`uploading of resource ${this.res.id} finished.`), this.change.markChanged();
|
|
3617
3674
|
} catch (e) {
|
|
3618
|
-
if (e
|
|
3619
|
-
this.
|
|
3675
|
+
if (this.setRetriableError(e), ge(e)) {
|
|
3676
|
+
this.logger.warn(`resource was deleted while uploading a blob: ${e}`), this.change.markChanged(), this.setDone(!0);
|
|
3677
|
+
return;
|
|
3678
|
+
}
|
|
3679
|
+
if (this.logger.error(`error while uploading a blob: ${e}`), this.change.markChanged(), He(e)) {
|
|
3680
|
+
this.setTerminalError(e);
|
|
3620
3681
|
return;
|
|
3621
3682
|
}
|
|
3622
3683
|
throw e;
|
|
3623
3684
|
}
|
|
3624
3685
|
}
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
}
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3686
|
+
async updateStatus() {
|
|
3687
|
+
try {
|
|
3688
|
+
const e = await this.clientProgress.getStatus(this.res), t = this.progress.status;
|
|
3689
|
+
this.progress.status = un(e), this.setDone(e.done), (e.done || e.progress != (t == null ? void 0 : t.progress)) && this.change.markChanged();
|
|
3690
|
+
} catch (e) {
|
|
3691
|
+
if (this.setRetriableError(e), e.name == "RpcError" && e.code == "DEADLINE_EXCEEDED") {
|
|
3692
|
+
this.logger.warn("deadline exceeded while getting a status of BlobImport");
|
|
3693
|
+
return;
|
|
3694
|
+
}
|
|
3695
|
+
if (ge(e)) {
|
|
3696
|
+
this.logger.warn(
|
|
3697
|
+
`resource was not found while updating a status of BlobImport: ${e}, ${ye(this.res)}`
|
|
3698
|
+
), this.change.markChanged(), this.setDone(!0);
|
|
3699
|
+
return;
|
|
3700
|
+
}
|
|
3701
|
+
this.logger.error(`error while updating a status of BlobImport: ${e}`), this.change.markChanged(), this.setTerminalError(e);
|
|
3702
|
+
}
|
|
3703
|
+
}
|
|
3704
|
+
/** Set non-terminal error, that task can be retried. */
|
|
3705
|
+
setRetriableError(e) {
|
|
3706
|
+
this.progress.lastError = String(e);
|
|
3707
|
+
}
|
|
3708
|
+
/** Set a terminal error, the task will throw a error instead of a progress. */
|
|
3709
|
+
setTerminalError(e) {
|
|
3710
|
+
this.progress.lastError = String(e), this.progress.done = !1, this.failed = !0;
|
|
3711
|
+
}
|
|
3712
|
+
setDoneIfOutputSet(e) {
|
|
3713
|
+
dn(e) && this.setDone(!0);
|
|
3639
3714
|
}
|
|
3640
3715
|
setDone(e) {
|
|
3641
|
-
this.done =
|
|
3716
|
+
this.progress.done = e, e && (this.progress.lastError = void 0);
|
|
3642
3717
|
}
|
|
3643
|
-
|
|
3644
|
-
this.
|
|
3718
|
+
incCounter(e, t) {
|
|
3719
|
+
this.change.attachWatcher(e), this.counter.inc(t);
|
|
3645
3720
|
}
|
|
3646
|
-
|
|
3647
|
-
|
|
3721
|
+
decCounter(e) {
|
|
3722
|
+
return this.counter.dec(e);
|
|
3723
|
+
}
|
|
3724
|
+
isComputableDone() {
|
|
3725
|
+
return this.counter.isZero();
|
|
3648
3726
|
}
|
|
3649
|
-
};
|
|
3650
|
-
class pe extends Error {
|
|
3651
3727
|
}
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
return
|
|
3728
|
+
function ln(s, e) {
|
|
3729
|
+
let t, r;
|
|
3730
|
+
return Y(s) && (r = O.parse(s.data), t = hn(e, r.localPath, r.pathSignature)), {
|
|
3731
|
+
uploadData: r,
|
|
3732
|
+
progress: {
|
|
3733
|
+
done: !1,
|
|
3734
|
+
status: void 0,
|
|
3735
|
+
isUpload: Y(s),
|
|
3736
|
+
isUploadSignMatch: t,
|
|
3737
|
+
lastError: void 0
|
|
3738
|
+
}
|
|
3739
|
+
};
|
|
3655
3740
|
}
|
|
3656
|
-
function
|
|
3657
|
-
|
|
3658
|
-
if (t === null) throw new Error(`Local handle is malformed: ${s}, matches: ${t}`);
|
|
3659
|
-
const { path: n, signature: r } = t.groups;
|
|
3660
|
-
return e.verify(n, r, `Signature verification failed for: ${s}`), n;
|
|
3741
|
+
function cn(s) {
|
|
3742
|
+
return s.done, s.isUpload, s.isUploadSignMatch, s.lastError, s.status && (s.status.progress, s.status.bytesProcessed, s.status.bytesTotal), s;
|
|
3661
3743
|
}
|
|
3662
|
-
function
|
|
3663
|
-
return
|
|
3744
|
+
function dn(s) {
|
|
3745
|
+
return "blob" in s.fields ? s.fields.blob !== void 0 : s.fields.incarnation !== void 0;
|
|
3664
3746
|
}
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
return !!s.match(Ee);
|
|
3747
|
+
function Y(s) {
|
|
3748
|
+
return s.type.name.startsWith("BlobUpload");
|
|
3668
3749
|
}
|
|
3669
|
-
function
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3750
|
+
function hn(s, e, t) {
|
|
3751
|
+
try {
|
|
3752
|
+
return s.verify(e, t), !0;
|
|
3753
|
+
} catch {
|
|
3754
|
+
return !1;
|
|
3755
|
+
}
|
|
3756
|
+
}
|
|
3757
|
+
function un(s) {
|
|
3758
|
+
return {
|
|
3759
|
+
progress: s.progress ?? 0,
|
|
3760
|
+
bytesProcessed: Number(s.bytesProcessed),
|
|
3761
|
+
bytesTotal: Number(s.bytesTotal)
|
|
3676
3762
|
};
|
|
3677
3763
|
}
|
|
3678
|
-
function
|
|
3679
|
-
|
|
3680
|
-
return `blob+remote://download/${t}#${e.sign(t)}`;
|
|
3764
|
+
function ge(s) {
|
|
3765
|
+
return s.name == "RpcError" && (s.code == "NOT_FOUND" || s.code == "ABORTED" || s.code == "ALREADY_EXISTS");
|
|
3681
3766
|
}
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
sizeBytes: T.string(),
|
|
3689
|
-
/** Modification time unix timestamp in seconds */
|
|
3690
|
-
modificationTime: T.string()
|
|
3691
|
-
}), We = T.object({
|
|
3692
|
-
/** Pl storage id */
|
|
3693
|
-
storageId: T.string(),
|
|
3694
|
-
/** Path inside storage */
|
|
3695
|
-
path: T.string()
|
|
3696
|
-
}), Gn = T.union([
|
|
3697
|
-
F,
|
|
3698
|
-
We
|
|
3699
|
-
]), Jr = se({
|
|
3700
|
-
data: F,
|
|
3701
|
-
fields: {
|
|
3702
|
-
blob: !1
|
|
3703
|
-
}
|
|
3704
|
-
}), Zr = se({
|
|
3705
|
-
fields: {
|
|
3706
|
-
incarnation: !1
|
|
3707
|
-
}
|
|
3708
|
-
});
|
|
3709
|
-
function Qr(s, e) {
|
|
3710
|
-
const t = ie(s) ? e.accessor(s).node() : it(s) ? s.node() : s;
|
|
3711
|
-
return t.resourceType.name.startsWith("BlobUpload") ? Q(t, Jr) : Q(t, Zr);
|
|
3767
|
+
function He(s) {
|
|
3768
|
+
return s instanceof Ne || s instanceof De || s instanceof Be;
|
|
3769
|
+
}
|
|
3770
|
+
function pn(s, e) {
|
|
3771
|
+
const t = le(s) ? e.accessor(s).node() : ot(s) ? s.node() : s;
|
|
3772
|
+
return t.resourceType.name.startsWith("BlobUpload") ? X(t, Qr) : X(t, Xr);
|
|
3712
3773
|
}
|
|
3713
|
-
class
|
|
3714
|
-
constructor(e, t,
|
|
3774
|
+
class oo {
|
|
3775
|
+
constructor(e, t, r, n, o = {
|
|
3715
3776
|
nConcurrentPartUploads: 10,
|
|
3716
3777
|
nConcurrentGetProgresses: 10,
|
|
3717
3778
|
pollingInterval: 1e3,
|
|
@@ -3726,34 +3787,31 @@ class Vn {
|
|
|
3726
3787
|
d(this, "keepRunning", !1);
|
|
3727
3788
|
/** Actual state of main loop. */
|
|
3728
3789
|
d(this, "currentLoop");
|
|
3729
|
-
this.logger = e, this.signer = t, this.clientBlob =
|
|
3790
|
+
this.logger = e, this.signer = t, this.clientBlob = r, this.clientProgress = n, this.opts = o, this.uploadQueue = new re(this.logger, 1, {
|
|
3730
3791
|
type: "exponentialWithMaxDelayBackoff",
|
|
3731
3792
|
initialDelay: 20,
|
|
3732
3793
|
maxDelay: 15e3,
|
|
3733
3794
|
// 15 seconds
|
|
3734
3795
|
backoffMultiplier: 1.5,
|
|
3735
3796
|
jitter: 0.5
|
|
3736
|
-
}), this.hooks = new
|
|
3797
|
+
}), this.hooks = new Re(
|
|
3737
3798
|
() => this.startUpdating(),
|
|
3738
3799
|
() => this.stopUpdating(),
|
|
3739
3800
|
{ stopDebounce: o.stopPollingDelay },
|
|
3740
|
-
(
|
|
3801
|
+
(l, i) => this.scheduleOnNextState(l, i)
|
|
3741
3802
|
);
|
|
3742
3803
|
}
|
|
3743
3804
|
getProgressId(e, t) {
|
|
3744
|
-
if (t == null) return b.make((
|
|
3745
|
-
const
|
|
3746
|
-
t.attacheHooks(this.hooks), t.addOnDestroy(() => this.release(
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
)
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
const
|
|
3754
|
-
if (o != null)
|
|
3755
|
-
return o.attach(e, n), o.mustGetProgress(r);
|
|
3756
|
-
const a = new Xr(
|
|
3805
|
+
if (t == null) return b.make((l) => this.getProgressId(e, l));
|
|
3806
|
+
const r = le(e) ? pn(e, t) : e, n = L();
|
|
3807
|
+
return t.attacheHooks(this.hooks), t.addOnDestroy(() => this.release(r.id, n)), this.getProgressIdNoCtx(t.watcher, r, n);
|
|
3808
|
+
}
|
|
3809
|
+
getProgressIdNoCtx(e, t, r) {
|
|
3810
|
+
fn("getProgressId", t.type);
|
|
3811
|
+
const n = this.idToProgress.get(t.id);
|
|
3812
|
+
if (n != null)
|
|
3813
|
+
return n.setDoneIfOutputSet(t), n.getProgress(e, r);
|
|
3814
|
+
const o = new an(
|
|
3757
3815
|
this.logger,
|
|
3758
3816
|
this.clientBlob,
|
|
3759
3817
|
this.clientProgress,
|
|
@@ -3761,16 +3819,16 @@ class Vn {
|
|
|
3761
3819
|
this.signer,
|
|
3762
3820
|
t
|
|
3763
3821
|
);
|
|
3764
|
-
return this.idToProgress.set(t.id,
|
|
3765
|
-
fn: () =>
|
|
3766
|
-
recoverableErrorPredicate: (
|
|
3767
|
-
}),
|
|
3822
|
+
return this.idToProgress.set(t.id, o), o.shouldScheduleUpload() && this.uploadQueue.push({
|
|
3823
|
+
fn: () => o.uploadBlobTask(),
|
|
3824
|
+
recoverableErrorPredicate: (l) => !He(l)
|
|
3825
|
+
}), o.setDoneIfOutputSet(t), o.getProgress(e, r);
|
|
3768
3826
|
}
|
|
3769
3827
|
/** Decrement counters for the file and remove an uploading if counter == 0. */
|
|
3770
3828
|
async release(e, t) {
|
|
3771
|
-
const
|
|
3772
|
-
if (
|
|
3773
|
-
|
|
3829
|
+
const r = this.idToProgress.get(e);
|
|
3830
|
+
if (r === void 0) return;
|
|
3831
|
+
r.decCounter(t) && this.idToProgress.delete(e);
|
|
3774
3832
|
}
|
|
3775
3833
|
/** Must be called when the driver is closing. */
|
|
3776
3834
|
async releaseAll() {
|
|
@@ -3792,149 +3850,34 @@ class Vn {
|
|
|
3792
3850
|
const e = this.scheduledOnNextState;
|
|
3793
3851
|
this.scheduledOnNextState = [];
|
|
3794
3852
|
try {
|
|
3795
|
-
await
|
|
3853
|
+
await ne(
|
|
3796
3854
|
this.opts.nConcurrentGetProgresses,
|
|
3797
3855
|
this.getAllNotDoneProgresses().map((t) => async () => await t.updateStatus())
|
|
3798
3856
|
), e.forEach((t) => t.resolve());
|
|
3799
3857
|
} catch (t) {
|
|
3800
|
-
console.error(t), e.forEach((
|
|
3858
|
+
console.error(t), e.forEach((r) => r.reject(t));
|
|
3801
3859
|
}
|
|
3802
3860
|
if (!this.keepRunning) break;
|
|
3803
|
-
await
|
|
3861
|
+
await Se.wait(this.opts.pollingInterval);
|
|
3804
3862
|
}
|
|
3805
3863
|
this.currentLoop = void 0;
|
|
3806
3864
|
}
|
|
3807
3865
|
getAllNotDoneProgresses() {
|
|
3808
|
-
return Array.from(this.idToProgress.entries()).filter(([e, t]) => !
|
|
3809
|
-
}
|
|
3810
|
-
}
|
|
3811
|
-
class Xr {
|
|
3812
|
-
constructor(e, t, n, r, o, a) {
|
|
3813
|
-
d(this, "change", new N());
|
|
3814
|
-
d(this, "counter", new v());
|
|
3815
|
-
d(this, "progress");
|
|
3816
|
-
/** If this is upload progress this field will be defined */
|
|
3817
|
-
d(this, "uploadData");
|
|
3818
|
-
d(this, "uploadingTerminallyFailed");
|
|
3819
|
-
this.logger = e, this.clientBlob = t, this.clientProgress = n, this.nConcurrentPartsUpload = r, this.res = a;
|
|
3820
|
-
const i = a.type.name.startsWith("BlobUpload");
|
|
3821
|
-
let c;
|
|
3822
|
-
i && (this.uploadData = F.parse(a.data), c = Kr(
|
|
3823
|
-
o,
|
|
3824
|
-
this.uploadData.localPath,
|
|
3825
|
-
this.uploadData.pathSignature
|
|
3826
|
-
)), this.progress = {
|
|
3827
|
-
done: !1,
|
|
3828
|
-
status: void 0,
|
|
3829
|
-
isUpload: i,
|
|
3830
|
-
isUploadSignMatch: c,
|
|
3831
|
-
lastError: void 0
|
|
3832
|
-
};
|
|
3833
|
-
}
|
|
3834
|
-
mustGetProgress(e) {
|
|
3835
|
-
const t = {
|
|
3836
|
-
done: this.progress.done,
|
|
3837
|
-
isUpload: this.progress.isUpload,
|
|
3838
|
-
isUploadSignMatch: this.progress.isUploadSignMatch,
|
|
3839
|
-
lastError: this.progress.lastError
|
|
3840
|
-
};
|
|
3841
|
-
if (this.progress.status && (t.status = {
|
|
3842
|
-
progress: this.progress.status.progress,
|
|
3843
|
-
bytesProcessed: this.progress.status.bytesProcessed,
|
|
3844
|
-
bytesTotal: this.progress.status.bytesTotal
|
|
3845
|
-
}), e)
|
|
3846
|
-
return this.setDone(e), t;
|
|
3847
|
-
if (this.uploadingTerminallyFailed)
|
|
3848
|
-
throw this.logger.error(`Uploading terminally failed: ${this.progress.lastError}`), new Error(this.progress.lastError);
|
|
3849
|
-
return t;
|
|
3850
|
-
}
|
|
3851
|
-
attach(e, t) {
|
|
3852
|
-
this.change.attachWatcher(e), this.counter.inc(t);
|
|
3853
|
-
}
|
|
3854
|
-
decCounter(e) {
|
|
3855
|
-
return this.counter.dec(e);
|
|
3856
|
-
}
|
|
3857
|
-
/** Uploads a blob if it's not BlobIndex. */
|
|
3858
|
-
async uploadBlobTask() {
|
|
3859
|
-
try {
|
|
3860
|
-
await this.uploadBlob();
|
|
3861
|
-
} catch (e) {
|
|
3862
|
-
if (this.setLastError(e), fe(e)) {
|
|
3863
|
-
this.logger.warn(`resource was deleted while uploading a blob: ${e}`), this.change.markChanged(), this.setDone(!0);
|
|
3864
|
-
return;
|
|
3865
|
-
}
|
|
3866
|
-
throw this.logger.error(`error while uploading a blob: ${e}`), this.change.markChanged(), Ae(e) && this.terminateWithError(e), e;
|
|
3867
|
-
}
|
|
3868
|
-
}
|
|
3869
|
-
/** Uploads a blob using client. */
|
|
3870
|
-
async uploadBlob() {
|
|
3871
|
-
if (this.counter.isZero()) return;
|
|
3872
|
-
const e = await this.clientBlob.initUpload(this.res);
|
|
3873
|
-
this.logger.info(`start to upload blob ${this.res.id}, parts count: ${e.length}`);
|
|
3874
|
-
const t = (n) => async () => {
|
|
3875
|
-
this.counter.isZero() || await this.clientBlob.partUpload(
|
|
3876
|
-
this.res,
|
|
3877
|
-
this.uploadData.localPath,
|
|
3878
|
-
n,
|
|
3879
|
-
e.length,
|
|
3880
|
-
BigInt(this.uploadData.modificationTime)
|
|
3881
|
-
);
|
|
3882
|
-
};
|
|
3883
|
-
await te(this.nConcurrentPartsUpload, e.map(t)), !this.counter.isZero() && (await this.clientBlob.finalizeUpload(this.res), this.logger.info(`uploading of resource ${this.res.id} finished.`), this.change.markChanged());
|
|
3884
|
-
}
|
|
3885
|
-
terminateWithError(e) {
|
|
3886
|
-
this.progress.lastError = String(e), this.progress.done = !1, this.uploadingTerminallyFailed = !0;
|
|
3887
|
-
}
|
|
3888
|
-
setLastError(e) {
|
|
3889
|
-
this.progress.lastError = String(e);
|
|
3890
|
-
}
|
|
3891
|
-
setDone(e) {
|
|
3892
|
-
this.progress.done = e, e && (this.progress.lastError = void 0);
|
|
3893
|
-
}
|
|
3894
|
-
async updateStatus() {
|
|
3895
|
-
try {
|
|
3896
|
-
const e = await this.clientProgress.getStatus(this.res), t = this.progress.status;
|
|
3897
|
-
this.progress.status = Yr(e), this.setDone(e.done), (e.done || e.progress != (t == null ? void 0 : t.progress)) && this.change.markChanged();
|
|
3898
|
-
} catch (e) {
|
|
3899
|
-
if (this.setLastError(e), e.name == "RpcError" && e.code == "DEADLINE_EXCEEDED") {
|
|
3900
|
-
this.logger.warn("deadline exceeded while getting a status of BlobImport");
|
|
3901
|
-
return;
|
|
3902
|
-
}
|
|
3903
|
-
if (fe(e)) {
|
|
3904
|
-
this.logger.warn(
|
|
3905
|
-
`resource was not found while updating a status of BlobImport: ${e}, ${be(this.res)}`
|
|
3906
|
-
), this.change.markChanged(), this.setDone(!0);
|
|
3907
|
-
return;
|
|
3908
|
-
}
|
|
3909
|
-
this.logger.error(`error while updating a status of BlobImport: ${e}`), this.change.markChanged(), this.terminateWithError(e);
|
|
3910
|
-
}
|
|
3911
|
-
}
|
|
3912
|
-
}
|
|
3913
|
-
function ge(s) {
|
|
3914
|
-
return s.done && s.status !== void 0 && s.status !== null && s.status.progress >= 1;
|
|
3915
|
-
}
|
|
3916
|
-
function Yr(s) {
|
|
3917
|
-
return {
|
|
3918
|
-
progress: s.progress ?? 0,
|
|
3919
|
-
bytesProcessed: Number(s.bytesProcessed),
|
|
3920
|
-
bytesTotal: Number(s.bytesTotal)
|
|
3921
|
-
};
|
|
3922
|
-
}
|
|
3923
|
-
function Kr(s, e, t) {
|
|
3924
|
-
try {
|
|
3925
|
-
return s.verify(e, t), !0;
|
|
3926
|
-
} catch {
|
|
3927
|
-
return !1;
|
|
3866
|
+
return Array.from(this.idToProgress.entries()).filter(([e, t]) => !gn(t.progress)).map(([e, t]) => t);
|
|
3928
3867
|
}
|
|
3929
3868
|
}
|
|
3930
|
-
function
|
|
3931
|
-
|
|
3869
|
+
function gn(s) {
|
|
3870
|
+
var e;
|
|
3871
|
+
return s.done && (((e = s.status) == null ? void 0 : e.progress) ?? 0) >= 1;
|
|
3932
3872
|
}
|
|
3933
|
-
function
|
|
3934
|
-
|
|
3873
|
+
function fn(s, e) {
|
|
3874
|
+
if (!e.name.startsWith("BlobUpload") && !e.name.startsWith("BlobIndex"))
|
|
3875
|
+
throw new de(
|
|
3876
|
+
`${s}: wrong resource type: ${e.name}, expected: a resource of either type 'BlobUpload' or 'BlobIndex'.`
|
|
3877
|
+
);
|
|
3935
3878
|
}
|
|
3936
|
-
class
|
|
3937
|
-
constructor(e, t,
|
|
3879
|
+
class so {
|
|
3880
|
+
constructor(e, t, r = {
|
|
3938
3881
|
nConcurrentGetLogs: 10,
|
|
3939
3882
|
pollingInterval: 1e3,
|
|
3940
3883
|
stopPollingDelay: 1e3
|
|
@@ -3950,104 +3893,111 @@ class qn {
|
|
|
3950
3893
|
d(this, "keepRunning", !1);
|
|
3951
3894
|
/** Actual state of main loop. */
|
|
3952
3895
|
d(this, "currentLoop");
|
|
3953
|
-
this.logger = e, this.clientLogs = t, this.opts =
|
|
3896
|
+
this.logger = e, this.clientLogs = t, this.opts = r, this.hooks = new Re(
|
|
3954
3897
|
() => this.startUpdating(),
|
|
3955
3898
|
() => this.stopUpdating(),
|
|
3956
|
-
{ stopDebounce:
|
|
3957
|
-
(
|
|
3899
|
+
{ stopDebounce: r.stopPollingDelay },
|
|
3900
|
+
(n, o) => this.scheduleOnNextState(n, o)
|
|
3958
3901
|
);
|
|
3959
3902
|
}
|
|
3960
|
-
getLastLogs(e, t,
|
|
3961
|
-
if (
|
|
3962
|
-
const
|
|
3963
|
-
|
|
3964
|
-
const
|
|
3965
|
-
return
|
|
3903
|
+
getLastLogs(e, t, r) {
|
|
3904
|
+
if (r == null) return b.make((i) => this.getLastLogs(e, t, i));
|
|
3905
|
+
const n = I(e, r), o = L();
|
|
3906
|
+
r.attacheHooks(this.hooks), r.addOnDestroy(() => this.releaseLastLogs(n.id, o));
|
|
3907
|
+
const l = this.getLastLogsNoCtx(r.watcher, n, t, o);
|
|
3908
|
+
return r.markUnstable(
|
|
3966
3909
|
"The logs are from stream, so we consider them unstable. Final values will be got from blobs."
|
|
3967
|
-
),
|
|
3910
|
+
), l;
|
|
3968
3911
|
}
|
|
3969
|
-
getLastLogsNoCtx(e, t,
|
|
3912
|
+
getLastLogsNoCtx(e, t, r, n) {
|
|
3913
|
+
q("getLastLogs", t.type);
|
|
3970
3914
|
let o = this.idToLastLines.get(t.id);
|
|
3971
3915
|
if (o == null) {
|
|
3972
|
-
const i = new
|
|
3916
|
+
const i = new fe(this.logger, this.clientLogs, t, r);
|
|
3973
3917
|
this.idToLastLines.set(t.id, i), o = i;
|
|
3974
3918
|
}
|
|
3975
|
-
o.attach(e,
|
|
3976
|
-
const
|
|
3977
|
-
if (
|
|
3978
|
-
return
|
|
3919
|
+
o.attach(e, n);
|
|
3920
|
+
const l = o.getLog();
|
|
3921
|
+
if (l.error != null) throw l.error;
|
|
3922
|
+
return l.log;
|
|
3979
3923
|
}
|
|
3980
|
-
getProgressLog(e, t,
|
|
3981
|
-
if (
|
|
3924
|
+
getProgressLog(e, t, r) {
|
|
3925
|
+
if (r == null)
|
|
3982
3926
|
return b.make((i) => this.getProgressLog(e, t, i));
|
|
3983
|
-
const
|
|
3984
|
-
|
|
3985
|
-
const
|
|
3986
|
-
return
|
|
3927
|
+
const n = I(e, r), o = L();
|
|
3928
|
+
r.attacheHooks(this.hooks), r.addOnDestroy(() => this.releaseProgressLog(n.id, o));
|
|
3929
|
+
const l = this.getProgressLogNoCtx(r.watcher, n, t, o);
|
|
3930
|
+
return r.markUnstable(
|
|
3987
3931
|
"The progress log is from the stream, so we consider it unstable. Final value will be got from blobs."
|
|
3988
|
-
),
|
|
3932
|
+
), l;
|
|
3989
3933
|
}
|
|
3990
|
-
getProgressLogNoCtx(e, t,
|
|
3934
|
+
getProgressLogNoCtx(e, t, r, n) {
|
|
3935
|
+
q("getProgressLog", t.type);
|
|
3991
3936
|
let o = this.idToProgressLog.get(t.id);
|
|
3992
3937
|
if (o == null) {
|
|
3993
|
-
const i = new
|
|
3938
|
+
const i = new fe(this.logger, this.clientLogs, t, 1, r);
|
|
3994
3939
|
this.idToProgressLog.set(t.id, i), o = i;
|
|
3995
3940
|
}
|
|
3996
|
-
o.attach(e,
|
|
3997
|
-
const
|
|
3998
|
-
if (
|
|
3999
|
-
return
|
|
3941
|
+
o.attach(e, n);
|
|
3942
|
+
const l = o.getLog();
|
|
3943
|
+
if (l.error) throw l.error;
|
|
3944
|
+
return l.log;
|
|
4000
3945
|
}
|
|
4001
3946
|
getLogHandle(e, t) {
|
|
4002
3947
|
if (t == null) return b.make((o) => this.getLogHandle(e, o));
|
|
4003
|
-
const
|
|
4004
|
-
return t.markUnstable(`live_log:${
|
|
3948
|
+
const r = I(e, t), n = this.getLogHandleNoCtx(r);
|
|
3949
|
+
return t.markUnstable(`live_log:${Xe(r.id)}`), n;
|
|
4005
3950
|
}
|
|
4006
3951
|
getLogHandleNoCtx(e) {
|
|
4007
|
-
return
|
|
3952
|
+
return q("getLogHandle", e.type), xe(!0, e);
|
|
4008
3953
|
}
|
|
4009
|
-
async lastLines(e, t,
|
|
3954
|
+
async lastLines(e, t, r, n) {
|
|
4010
3955
|
return await this.tryWithNotFound(
|
|
4011
3956
|
e,
|
|
4012
3957
|
() => this.clientLogs.lastLines(
|
|
4013
|
-
|
|
3958
|
+
C(e),
|
|
4014
3959
|
t,
|
|
4015
|
-
BigInt(
|
|
4016
|
-
|
|
3960
|
+
BigInt(r ?? 0),
|
|
3961
|
+
n
|
|
4017
3962
|
)
|
|
4018
3963
|
);
|
|
4019
3964
|
}
|
|
4020
|
-
async readText(e, t,
|
|
3965
|
+
async readText(e, t, r, n) {
|
|
4021
3966
|
return await this.tryWithNotFound(
|
|
4022
3967
|
e,
|
|
4023
|
-
() => this.clientLogs.readText(
|
|
3968
|
+
() => this.clientLogs.readText(
|
|
3969
|
+
C(e),
|
|
3970
|
+
t,
|
|
3971
|
+
BigInt(r ?? 0),
|
|
3972
|
+
n
|
|
3973
|
+
)
|
|
4024
3974
|
);
|
|
4025
3975
|
}
|
|
4026
3976
|
async tryWithNotFound(e, t) {
|
|
4027
|
-
if (!
|
|
3977
|
+
if (!_(e))
|
|
4028
3978
|
throw new Error(`Not live log handle was passed to live log driver, handle: ${e}`);
|
|
4029
3979
|
try {
|
|
4030
|
-
const
|
|
3980
|
+
const r = await t();
|
|
4031
3981
|
return {
|
|
4032
3982
|
live: !0,
|
|
4033
3983
|
shouldUpdateHandle: !1,
|
|
4034
|
-
data:
|
|
4035
|
-
size: Number(
|
|
4036
|
-
newOffset: Number(
|
|
3984
|
+
data: r.data,
|
|
3985
|
+
size: Number(r.size),
|
|
3986
|
+
newOffset: Number(r.newOffset)
|
|
4037
3987
|
};
|
|
4038
|
-
} catch (
|
|
4039
|
-
if (
|
|
3988
|
+
} catch (r) {
|
|
3989
|
+
if (r.name == "RpcError" && r.code == "NOT_FOUND")
|
|
4040
3990
|
return { shouldUpdateHandle: !0 };
|
|
4041
|
-
throw
|
|
3991
|
+
throw r;
|
|
4042
3992
|
}
|
|
4043
3993
|
}
|
|
4044
3994
|
async releaseLastLogs(e, t) {
|
|
4045
|
-
var
|
|
4046
|
-
((
|
|
3995
|
+
var n;
|
|
3996
|
+
((n = this.idToLastLines.get(e)) == null ? void 0 : n.release(t)) && this.idToLastLines.delete(e);
|
|
4047
3997
|
}
|
|
4048
3998
|
async releaseProgressLog(e, t) {
|
|
4049
|
-
var
|
|
4050
|
-
((
|
|
3999
|
+
var n;
|
|
4000
|
+
((n = this.idToProgressLog.get(e)) == null ? void 0 : n.release(t)) && this.idToProgressLog.delete(e);
|
|
4051
4001
|
}
|
|
4052
4002
|
async releaseAll() {
|
|
4053
4003
|
}
|
|
@@ -4068,15 +4018,15 @@ class qn {
|
|
|
4068
4018
|
this.scheduledOnNextState = [];
|
|
4069
4019
|
try {
|
|
4070
4020
|
const t = this.getAllLogs();
|
|
4071
|
-
await
|
|
4021
|
+
await ne(
|
|
4072
4022
|
this.opts.nConcurrentGetLogs,
|
|
4073
|
-
t.map((
|
|
4074
|
-
), e.forEach((
|
|
4023
|
+
t.map((r) => async () => await r.update())
|
|
4024
|
+
), e.forEach((r) => r.resolve());
|
|
4075
4025
|
} catch (t) {
|
|
4076
|
-
console.error(t), e.forEach((
|
|
4026
|
+
console.error(t), e.forEach((r) => r.reject(t));
|
|
4077
4027
|
}
|
|
4078
4028
|
if (!this.keepRunning) break;
|
|
4079
|
-
await
|
|
4029
|
+
await Se.wait(this.opts.pollingInterval);
|
|
4080
4030
|
}
|
|
4081
4031
|
this.currentLoop = void 0;
|
|
4082
4032
|
}
|
|
@@ -4084,13 +4034,13 @@ class qn {
|
|
|
4084
4034
|
return Array.from(this.idToLastLines.entries()).concat(Array.from(this.idToProgressLog.entries())).map(([e, t]) => t);
|
|
4085
4035
|
}
|
|
4086
4036
|
}
|
|
4087
|
-
class
|
|
4088
|
-
constructor(e, t,
|
|
4037
|
+
class fe {
|
|
4038
|
+
constructor(e, t, r, n, o) {
|
|
4089
4039
|
d(this, "logs");
|
|
4090
4040
|
d(this, "error");
|
|
4091
|
-
d(this, "change", new
|
|
4092
|
-
d(this, "counter", new
|
|
4093
|
-
this.logger = e, this.clientLogs = t, this.rInfo =
|
|
4041
|
+
d(this, "change", new v());
|
|
4042
|
+
d(this, "counter", new B());
|
|
4043
|
+
this.logger = e, this.clientLogs = t, this.rInfo = r, this.lines = n, this.patternToSearch = o;
|
|
4094
4044
|
}
|
|
4095
4045
|
getLog() {
|
|
4096
4046
|
return {
|
|
@@ -4120,13 +4070,83 @@ class me {
|
|
|
4120
4070
|
return;
|
|
4121
4071
|
}
|
|
4122
4072
|
throw this.logger.error(
|
|
4123
|
-
`Stream log lines for ${
|
|
4073
|
+
`Stream log lines for ${ye(this.rInfo.id)} failed, reason: ${e}`
|
|
4124
4074
|
), e;
|
|
4125
4075
|
}
|
|
4126
4076
|
}
|
|
4127
4077
|
}
|
|
4128
|
-
|
|
4129
|
-
|
|
4078
|
+
function q(s, e) {
|
|
4079
|
+
if (!e.name.startsWith("StreamWorkdir"))
|
|
4080
|
+
throw new de(
|
|
4081
|
+
`${s}: wrong resource type: ${e.name}, expected: a resource of type 'StreamWorkdir'.`
|
|
4082
|
+
);
|
|
4083
|
+
}
|
|
4084
|
+
class io {
|
|
4085
|
+
constructor(e, t, r) {
|
|
4086
|
+
this.logger = e, this.logsStreamDriver = t, this.downloadDriver = r;
|
|
4087
|
+
}
|
|
4088
|
+
getLastLogs(e, t, r) {
|
|
4089
|
+
if (r === void 0) return b.make((o) => this.getLastLogs(e, t, o));
|
|
4090
|
+
const n = Z(r, e);
|
|
4091
|
+
if (n === void 0) {
|
|
4092
|
+
r.markUnstable("no stream in stream manager");
|
|
4093
|
+
return;
|
|
4094
|
+
}
|
|
4095
|
+
if (J(n)) return this.downloadDriver.getLastLogs(n, t, r);
|
|
4096
|
+
try {
|
|
4097
|
+
return this.logsStreamDriver.getLastLogs(n, t, r);
|
|
4098
|
+
} catch (o) {
|
|
4099
|
+
if (o.name == "RpcError" && o.code == "NOT_FOUND") {
|
|
4100
|
+
r.markUnstable(`NOT_FOUND in logs stream driver while getting last logs: ${o}`);
|
|
4101
|
+
return;
|
|
4102
|
+
}
|
|
4103
|
+
throw o;
|
|
4104
|
+
}
|
|
4105
|
+
}
|
|
4106
|
+
getProgressLog(e, t, r) {
|
|
4107
|
+
if (r === void 0)
|
|
4108
|
+
return b.make((o) => this.getProgressLog(e, t, o));
|
|
4109
|
+
const n = Z(r, e);
|
|
4110
|
+
if (n === void 0) {
|
|
4111
|
+
r.markUnstable("no stream in stream manager");
|
|
4112
|
+
return;
|
|
4113
|
+
}
|
|
4114
|
+
if (J(n)) return this.downloadDriver.getProgressLog(n, t, r);
|
|
4115
|
+
try {
|
|
4116
|
+
return this.logsStreamDriver.getProgressLog(n, t, r);
|
|
4117
|
+
} catch (o) {
|
|
4118
|
+
if (o.name == "RpcError" && o.code == "NOT_FOUND") {
|
|
4119
|
+
r.markUnstable(`NOT_FOUND in logs stream driver while getting a progress log: ${o}`);
|
|
4120
|
+
return;
|
|
4121
|
+
}
|
|
4122
|
+
throw o;
|
|
4123
|
+
}
|
|
4124
|
+
}
|
|
4125
|
+
getLogHandle(e, t) {
|
|
4126
|
+
if (t === void 0) return b.make((n) => this.getLogHandle(e, n));
|
|
4127
|
+
const r = Z(t, e);
|
|
4128
|
+
if (r === void 0) {
|
|
4129
|
+
t.markUnstable("no stream in stream manager");
|
|
4130
|
+
return;
|
|
4131
|
+
}
|
|
4132
|
+
return J(r) ? this.downloadDriver.getLogHandle(r, t) : this.logsStreamDriver.getLogHandle(r, t);
|
|
4133
|
+
}
|
|
4134
|
+
async lastLines(e, t, r, n) {
|
|
4135
|
+
return _(e) ? await this.logsStreamDriver.lastLines(e, t, r, n) : await this.downloadDriver.lastLines(e, t, r, n);
|
|
4136
|
+
}
|
|
4137
|
+
async readText(e, t, r, n) {
|
|
4138
|
+
return _(e) ? await this.logsStreamDriver.readText(e, t, r, n) : await this.downloadDriver.readText(e, t, r, n);
|
|
4139
|
+
}
|
|
4140
|
+
}
|
|
4141
|
+
function J(s) {
|
|
4142
|
+
return !s.type.name.startsWith("StreamWorkdir");
|
|
4143
|
+
}
|
|
4144
|
+
function Z(s, e) {
|
|
4145
|
+
var t;
|
|
4146
|
+
return (t = s.accessor(e).node().traverse("stream")) == null ? void 0 : t.resourceInfo;
|
|
4147
|
+
}
|
|
4148
|
+
class ao {
|
|
4149
|
+
constructor(e, t, r, n = {
|
|
4130
4150
|
cacheSoftSizeBytes: 50 * 1024 * 1024,
|
|
4131
4151
|
withGunzip: !0,
|
|
4132
4152
|
nConcurrentDownloads: 50
|
|
@@ -4137,212 +4157,211 @@ class Jn {
|
|
|
4137
4157
|
/** Writes and removes files to a hard drive and holds a counter for every
|
|
4138
4158
|
* file that should be kept. */
|
|
4139
4159
|
d(this, "cache");
|
|
4140
|
-
this.logger = e, this.saveDir =
|
|
4160
|
+
this.logger = e, this.saveDir = r, this.opts = n, this.downloadQueue = new re(this.logger, this.opts.nConcurrentDownloads), this.cache = new Fe(this.opts.cacheSoftSizeBytes), this.downloadHelper = new ve(t);
|
|
4141
4161
|
}
|
|
4142
4162
|
getPath(e, t) {
|
|
4143
4163
|
if (t === void 0) return b.make((o) => this.getPath(e, o));
|
|
4144
|
-
const
|
|
4145
|
-
t.addOnDestroy(() => this.releasePath(e,
|
|
4146
|
-
const
|
|
4147
|
-
return (
|
|
4148
|
-
`a path to the downloaded and untared archive might be undefined. The current result: ${
|
|
4149
|
-
),
|
|
4150
|
-
}
|
|
4151
|
-
getPathNoCtx(e, t,
|
|
4152
|
-
const
|
|
4164
|
+
const r = L();
|
|
4165
|
+
t.addOnDestroy(() => this.releasePath(e, r));
|
|
4166
|
+
const n = this.getPathNoCtx(e, t.watcher, r);
|
|
4167
|
+
return (n == null ? void 0 : n.path) === void 0 && t.markUnstable(
|
|
4168
|
+
`a path to the downloaded and untared archive might be undefined. The current result: ${n}`
|
|
4169
|
+
), n;
|
|
4170
|
+
}
|
|
4171
|
+
getPathNoCtx(e, t, r) {
|
|
4172
|
+
const n = e.toString(), o = this.urlToDownload.get(n);
|
|
4153
4173
|
if (o != null)
|
|
4154
|
-
return o.attach(t,
|
|
4155
|
-
const
|
|
4174
|
+
return o.attach(t, r), o.getPath();
|
|
4175
|
+
const l = this.setNewTask(t, e, r);
|
|
4156
4176
|
return this.downloadQueue.push({
|
|
4157
|
-
fn: async () => this.downloadUrl(
|
|
4177
|
+
fn: async () => this.downloadUrl(l, r),
|
|
4158
4178
|
recoverableErrorPredicate: (i) => !0
|
|
4159
|
-
}),
|
|
4179
|
+
}), l.getPath();
|
|
4160
4180
|
}
|
|
4161
4181
|
/** Downloads and extracts a tar archive if it wasn't downloaded yet. */
|
|
4162
4182
|
async downloadUrl(e, t) {
|
|
4163
|
-
var
|
|
4164
|
-
await e.download(this.downloadHelper, this.opts.withGunzip), ((
|
|
4183
|
+
var r;
|
|
4184
|
+
await e.download(this.downloadHelper, this.opts.withGunzip), ((r = e.getPath()) == null ? void 0 : r.path) != null && this.cache.addCache(e, t);
|
|
4165
4185
|
}
|
|
4166
4186
|
/** Removes a directory and aborts a downloading task when all callers
|
|
4167
4187
|
* are not interested in it. */
|
|
4168
4188
|
async releasePath(e, t) {
|
|
4169
|
-
const
|
|
4170
|
-
if (
|
|
4171
|
-
if (this.cache.existsFile(
|
|
4172
|
-
const o = this.cache.removeFile(
|
|
4189
|
+
const r = e.toString(), n = this.urlToDownload.get(r);
|
|
4190
|
+
if (n != null)
|
|
4191
|
+
if (this.cache.existsFile(n.path)) {
|
|
4192
|
+
const o = this.cache.removeFile(n.path, t);
|
|
4173
4193
|
await Promise.all(
|
|
4174
|
-
o.map(async (
|
|
4175
|
-
await
|
|
4176
|
-
|
|
4177
|
-
`the task ${JSON.stringify(
|
|
4194
|
+
o.map(async (l) => {
|
|
4195
|
+
await K(l.path), this.cache.removeCache(l), this.removeTask(
|
|
4196
|
+
l,
|
|
4197
|
+
`the task ${JSON.stringify(l)} was removedfrom cache along with ${JSON.stringify(o)}`
|
|
4178
4198
|
);
|
|
4179
4199
|
})
|
|
4180
4200
|
);
|
|
4181
4201
|
} else
|
|
4182
|
-
|
|
4202
|
+
n.counter.dec(t) && this.removeTask(n, `the task ${JSON.stringify(n)} was removed from cache`);
|
|
4183
4203
|
}
|
|
4184
4204
|
/** Removes all files from a hard drive. */
|
|
4185
4205
|
async releaseAll() {
|
|
4186
4206
|
this.downloadQueue.stop(), await Promise.all(
|
|
4187
4207
|
Array.from(this.urlToDownload.entries()).map(async ([e, t]) => {
|
|
4188
|
-
await
|
|
4208
|
+
await K(t.path), this.cache.removeCache(t), this.removeTask(t, `the task ${t} was released when the driver was closed`);
|
|
4189
4209
|
})
|
|
4190
4210
|
);
|
|
4191
4211
|
}
|
|
4192
|
-
setNewTask(e, t,
|
|
4193
|
-
const
|
|
4194
|
-
return
|
|
4212
|
+
setNewTask(e, t, r) {
|
|
4213
|
+
const n = new mn(this.logger, this.getFilePath(t), t);
|
|
4214
|
+
return n.attach(e, r), this.urlToDownload.set(t.toString(), n), n;
|
|
4195
4215
|
}
|
|
4196
4216
|
removeTask(e, t) {
|
|
4197
4217
|
e.abort(t), e.change.markChanged(), this.urlToDownload.delete(e.url.toString());
|
|
4198
4218
|
}
|
|
4199
4219
|
getFilePath(e) {
|
|
4200
|
-
const t =
|
|
4220
|
+
const t = it("sha256").update(e.toString()).digest("hex");
|
|
4201
4221
|
return w.join(this.saveDir, t);
|
|
4202
4222
|
}
|
|
4203
4223
|
}
|
|
4204
|
-
class
|
|
4205
|
-
constructor(e, t) {
|
|
4206
|
-
d(this, "counter", new
|
|
4207
|
-
d(this, "change", new
|
|
4224
|
+
class mn {
|
|
4225
|
+
constructor(e, t, r) {
|
|
4226
|
+
d(this, "counter", new B());
|
|
4227
|
+
d(this, "change", new v());
|
|
4208
4228
|
d(this, "signalCtl", new AbortController());
|
|
4209
4229
|
d(this, "error");
|
|
4210
4230
|
d(this, "done", !1);
|
|
4211
|
-
d(this, "
|
|
4212
|
-
this.
|
|
4231
|
+
d(this, "size", 0);
|
|
4232
|
+
this.logger = e, this.path = t, this.url = r;
|
|
4213
4233
|
}
|
|
4214
4234
|
attach(e, t) {
|
|
4215
4235
|
this.counter.inc(t), this.done || this.change.attachWatcher(e);
|
|
4216
4236
|
}
|
|
4217
4237
|
async download(e, t) {
|
|
4218
4238
|
try {
|
|
4219
|
-
const
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
this.setDone(n);
|
|
4225
|
-
} catch (n) {
|
|
4226
|
-
if (n instanceof we || n instanceof ae) {
|
|
4227
|
-
this.setError(n), await X(this.path);
|
|
4239
|
+
const r = await this.downloadAndUntar(e, t, this.signalCtl.signal);
|
|
4240
|
+
this.setDone(r), this.change.markChanged();
|
|
4241
|
+
} catch (r) {
|
|
4242
|
+
if (r instanceof me || r instanceof ce) {
|
|
4243
|
+
this.setError(r), this.change.markChanged(), await K(this.path);
|
|
4228
4244
|
return;
|
|
4229
4245
|
}
|
|
4230
|
-
throw
|
|
4246
|
+
throw r;
|
|
4231
4247
|
}
|
|
4232
4248
|
}
|
|
4233
|
-
async downloadAndUntar(e, t,
|
|
4234
|
-
if (await
|
|
4235
|
-
return await
|
|
4236
|
-
const
|
|
4237
|
-
let o =
|
|
4249
|
+
async downloadAndUntar(e, t, r) {
|
|
4250
|
+
if (await Te(w.dirname(this.path)), await Le(this.path))
|
|
4251
|
+
return await je(this.path);
|
|
4252
|
+
const n = await e.download(this.url.toString(), {}, r);
|
|
4253
|
+
let o = n.content;
|
|
4238
4254
|
if (t) {
|
|
4239
|
-
const
|
|
4240
|
-
o = o.pipeThrough(
|
|
4255
|
+
const l = rt.toWeb(dt.createGunzip());
|
|
4256
|
+
o = o.pipeThrough(l, { signal: r });
|
|
4241
4257
|
}
|
|
4242
|
-
|
|
4243
|
-
|
|
4258
|
+
return await Pe(this.logger, this.path, async (l) => {
|
|
4259
|
+
await m.mkdir(l);
|
|
4260
|
+
const i = ie.toWeb(ht.extract(l));
|
|
4261
|
+
await o.pipeTo(i, { signal: r });
|
|
4262
|
+
}), n.size;
|
|
4244
4263
|
}
|
|
4245
4264
|
getPath() {
|
|
4246
|
-
if (this.done) return { path:
|
|
4265
|
+
if (this.done) return { path: te(this.path) };
|
|
4247
4266
|
if (this.error) return { error: this.error };
|
|
4248
4267
|
}
|
|
4249
4268
|
setDone(e) {
|
|
4250
|
-
this.done = !0, this.
|
|
4251
|
-
}
|
|
4252
|
-
abort(e) {
|
|
4253
|
-
this.signalCtl.abort(new we(e));
|
|
4269
|
+
this.done = !0, this.size = e;
|
|
4254
4270
|
}
|
|
4255
4271
|
setError(e) {
|
|
4256
|
-
this.error = String(e)
|
|
4272
|
+
this.error = String(e);
|
|
4273
|
+
}
|
|
4274
|
+
abort(e) {
|
|
4275
|
+
this.signalCtl.abort(new me(e));
|
|
4257
4276
|
}
|
|
4258
4277
|
}
|
|
4259
|
-
class
|
|
4278
|
+
class me extends Error {
|
|
4260
4279
|
}
|
|
4261
|
-
async function
|
|
4280
|
+
async function je(s) {
|
|
4262
4281
|
const e = await m.readdir(s, { withFileTypes: !0 });
|
|
4263
4282
|
return (await Promise.all(
|
|
4264
|
-
e.map(async (
|
|
4265
|
-
const
|
|
4266
|
-
return
|
|
4283
|
+
e.map(async (r) => {
|
|
4284
|
+
const n = w.join(s, r.name);
|
|
4285
|
+
return r.isDirectory() ? await je(n) : (await m.stat(n)).size;
|
|
4267
4286
|
})
|
|
4268
|
-
)).reduce((
|
|
4287
|
+
)).reduce((r, n) => r + n, 0);
|
|
4269
4288
|
}
|
|
4270
|
-
async function
|
|
4289
|
+
async function K(s) {
|
|
4271
4290
|
await m.rm(s, { recursive: !0, force: !0 });
|
|
4272
4291
|
}
|
|
4273
|
-
function
|
|
4292
|
+
function we(s, e) {
|
|
4274
4293
|
return `index://index/${encodeURIComponent(JSON.stringify({
|
|
4275
4294
|
storageId: s,
|
|
4276
4295
|
path: e
|
|
4277
4296
|
}))}`;
|
|
4278
4297
|
}
|
|
4279
|
-
function
|
|
4280
|
-
const
|
|
4298
|
+
function wn(s, e, t, r) {
|
|
4299
|
+
const n = {
|
|
4281
4300
|
localPath: s,
|
|
4282
4301
|
pathSignature: e.sign(s),
|
|
4283
4302
|
sizeBytes: String(t),
|
|
4284
|
-
modificationTime: String(
|
|
4303
|
+
modificationTime: String(r)
|
|
4285
4304
|
};
|
|
4286
|
-
return `upload://upload/${encodeURIComponent(JSON.stringify(
|
|
4305
|
+
return `upload://upload/${encodeURIComponent(JSON.stringify(n))}`;
|
|
4287
4306
|
}
|
|
4288
|
-
function
|
|
4307
|
+
function yn(s) {
|
|
4289
4308
|
const e = new URL(s);
|
|
4290
|
-
return
|
|
4309
|
+
return O.parse(
|
|
4291
4310
|
JSON.parse(decodeURIComponent(e.pathname.substring(1)))
|
|
4292
4311
|
);
|
|
4293
4312
|
}
|
|
4294
|
-
function
|
|
4313
|
+
function bn(s) {
|
|
4295
4314
|
const e = new URL(s);
|
|
4296
4315
|
return We.parse(JSON.parse(decodeURIComponent(e.pathname.substring(1))));
|
|
4297
4316
|
}
|
|
4298
|
-
function
|
|
4299
|
-
if (
|
|
4300
|
-
return
|
|
4301
|
-
if (
|
|
4302
|
-
return
|
|
4303
|
-
|
|
4317
|
+
function kn(s) {
|
|
4318
|
+
if (In(s))
|
|
4319
|
+
return Sn(s);
|
|
4320
|
+
if (Tn(s))
|
|
4321
|
+
return Pn(s);
|
|
4322
|
+
et(s);
|
|
4304
4323
|
}
|
|
4305
|
-
const
|
|
4306
|
-
function
|
|
4307
|
-
return
|
|
4324
|
+
const Ge = /^local:\/\/(?<name>.*)\/(?<path>.*)$/;
|
|
4325
|
+
function Tn(s) {
|
|
4326
|
+
return Ge.test(s);
|
|
4308
4327
|
}
|
|
4309
|
-
function
|
|
4328
|
+
function Ln(s, e) {
|
|
4310
4329
|
return `local://${s}/${encodeURIComponent(e)}`;
|
|
4311
4330
|
}
|
|
4312
|
-
function
|
|
4313
|
-
const e = s.match(
|
|
4331
|
+
function Pn(s) {
|
|
4332
|
+
const e = s.match(Ge);
|
|
4314
4333
|
if (e == null) throw new Error(`Local list handle wasn't parsed: ${s}`);
|
|
4315
|
-
const { name: t, path:
|
|
4334
|
+
const { name: t, path: r } = e.groups;
|
|
4316
4335
|
return {
|
|
4317
|
-
rootPath: decodeURIComponent(
|
|
4336
|
+
rootPath: decodeURIComponent(r),
|
|
4318
4337
|
name: t,
|
|
4319
4338
|
isRemote: !1
|
|
4320
4339
|
};
|
|
4321
4340
|
}
|
|
4322
|
-
const
|
|
4323
|
-
function
|
|
4324
|
-
return
|
|
4341
|
+
const Ve = /^remote:\/\/(?<name>.*)\/(?<resourceId>.*)$/;
|
|
4342
|
+
function In(s) {
|
|
4343
|
+
return Ve.test(s);
|
|
4325
4344
|
}
|
|
4326
|
-
function
|
|
4345
|
+
function Rn(s, e) {
|
|
4327
4346
|
return `remote://${s}/${BigInt(e)}`;
|
|
4328
4347
|
}
|
|
4329
|
-
function
|
|
4330
|
-
const e = s.match(
|
|
4348
|
+
function Sn(s) {
|
|
4349
|
+
const e = s.match(Ve);
|
|
4331
4350
|
if (e == null) throw new Error(`Remote list handle wasn't parsed: ${s}`);
|
|
4332
|
-
const { name: t, resourceId:
|
|
4351
|
+
const { name: t, resourceId: r } = e.groups;
|
|
4333
4352
|
return {
|
|
4334
|
-
id:
|
|
4335
|
-
type:
|
|
4353
|
+
id: ee(BigInt(r)),
|
|
4354
|
+
type: Un(t),
|
|
4336
4355
|
name: t,
|
|
4337
4356
|
isRemote: !0
|
|
4338
4357
|
};
|
|
4339
4358
|
}
|
|
4340
|
-
function
|
|
4359
|
+
function Un(s) {
|
|
4341
4360
|
return { name: `LS/${s}`, version: "1" };
|
|
4342
4361
|
}
|
|
4343
|
-
async function
|
|
4344
|
-
const s =
|
|
4345
|
-
if (
|
|
4362
|
+
async function Nn() {
|
|
4363
|
+
const s = at.homedir();
|
|
4364
|
+
if (Q.sep == "/")
|
|
4346
4365
|
return [
|
|
4347
4366
|
{
|
|
4348
4367
|
name: "local",
|
|
@@ -4351,15 +4370,15 @@ async function pn() {
|
|
|
4351
4370
|
}
|
|
4352
4371
|
];
|
|
4353
4372
|
{
|
|
4354
|
-
const t =
|
|
4373
|
+
const t = Q.parse(s).root.replaceAll(":\\", "");
|
|
4355
4374
|
try {
|
|
4356
|
-
return (await
|
|
4375
|
+
return (await pt.promisify(gt)("wmic logicaldisk get name")).stdout.split(`\r
|
|
4357
4376
|
`).filter((o) => o.includes(":")).map((o) => o.trim().replaceAll(":", "")).map((o) => {
|
|
4358
|
-
const
|
|
4377
|
+
const l = o == t;
|
|
4359
4378
|
return {
|
|
4360
4379
|
name: `local_disk_${o}`,
|
|
4361
4380
|
root: `${o}:\\`,
|
|
4362
|
-
initialPath:
|
|
4381
|
+
initialPath: l ? s : `${o}:\\`
|
|
4363
4382
|
};
|
|
4364
4383
|
});
|
|
4365
4384
|
} catch {
|
|
@@ -4373,14 +4392,14 @@ async function pn() {
|
|
|
4373
4392
|
}
|
|
4374
4393
|
}
|
|
4375
4394
|
}
|
|
4376
|
-
class
|
|
4377
|
-
constructor(e, t,
|
|
4378
|
-
this.logger = e, this.lsClient = t, this.storageIdToResourceId =
|
|
4395
|
+
class qe {
|
|
4396
|
+
constructor(e, t, r, n, o, l, i) {
|
|
4397
|
+
this.logger = e, this.lsClient = t, this.storageIdToResourceId = r, this.signer = n, this.virtualStoragesMap = o, this.localProjectionsMap = l, this.openFileDialogCallback = i;
|
|
4379
4398
|
}
|
|
4380
4399
|
async getLocalFileContent(e, t) {
|
|
4381
|
-
const
|
|
4400
|
+
const r = await this.tryResolveLocalFileHandle(e);
|
|
4382
4401
|
if (t) throw new Error("Range request not yet supported.");
|
|
4383
|
-
return await m.readFile(
|
|
4402
|
+
return await m.readFile(r);
|
|
4384
4403
|
}
|
|
4385
4404
|
async getLocalFileSize(e) {
|
|
4386
4405
|
const t = await this.tryResolveLocalFileHandle(e);
|
|
@@ -4389,7 +4408,7 @@ class He {
|
|
|
4389
4408
|
async showOpenMultipleFilesDialog(e) {
|
|
4390
4409
|
const t = await this.openFileDialogCallback(!0, e);
|
|
4391
4410
|
return t === void 0 ? {} : {
|
|
4392
|
-
files: await Promise.all(t.map((
|
|
4411
|
+
files: await Promise.all(t.map((r) => this.getLocalFileHandle(r)))
|
|
4393
4412
|
};
|
|
4394
4413
|
}
|
|
4395
4414
|
async showOpenSingleFileDialog(e) {
|
|
@@ -4405,36 +4424,36 @@ class He {
|
|
|
4405
4424
|
* @private
|
|
4406
4425
|
*/
|
|
4407
4426
|
async tryResolveLocalFileHandle(e) {
|
|
4408
|
-
if (
|
|
4409
|
-
const t =
|
|
4410
|
-
if (!
|
|
4427
|
+
if (ut(e)) {
|
|
4428
|
+
const t = bn(e), r = this.localProjectionsMap.get(t.storageId);
|
|
4429
|
+
if (!r)
|
|
4411
4430
|
throw new Error(`Storage ${t.storageId} is not mounted locally.`);
|
|
4412
|
-
return w.join(
|
|
4431
|
+
return w.join(r.localPath, t.path);
|
|
4413
4432
|
} else {
|
|
4414
|
-
const t =
|
|
4433
|
+
const t = yn(e);
|
|
4415
4434
|
this.signer.verify(
|
|
4416
4435
|
t.localPath,
|
|
4417
4436
|
t.pathSignature,
|
|
4418
4437
|
"Failed to validate local file handle signature."
|
|
4419
4438
|
);
|
|
4420
|
-
const
|
|
4421
|
-
if (String(
|
|
4439
|
+
const r = t.localPath, n = await m.stat(r, { bigint: !0 });
|
|
4440
|
+
if (String(n.mtimeMs / 1000n) !== t.modificationTime)
|
|
4422
4441
|
throw new Error("File has changed since the handle was created.");
|
|
4423
|
-
return
|
|
4442
|
+
return r;
|
|
4424
4443
|
}
|
|
4425
4444
|
}
|
|
4426
4445
|
async getLocalFileHandle(e) {
|
|
4427
|
-
|
|
4428
|
-
for (const
|
|
4429
|
-
if (e.startsWith(
|
|
4430
|
-
const
|
|
4431
|
-
return
|
|
4432
|
-
|
|
4433
|
-
|
|
4446
|
+
N(e);
|
|
4447
|
+
for (const r of this.localProjectionsMap.values())
|
|
4448
|
+
if (e.startsWith(r.localPath)) {
|
|
4449
|
+
const n = r.localPath === "" ? e : w.relative(r.localPath, e);
|
|
4450
|
+
return we(
|
|
4451
|
+
r.storageId,
|
|
4452
|
+
n
|
|
4434
4453
|
);
|
|
4435
4454
|
}
|
|
4436
4455
|
const t = await m.stat(e, { bigint: !0 });
|
|
4437
|
-
return
|
|
4456
|
+
return wn(
|
|
4438
4457
|
e,
|
|
4439
4458
|
this.signer,
|
|
4440
4459
|
t.size,
|
|
@@ -4443,128 +4462,120 @@ class He {
|
|
|
4443
4462
|
);
|
|
4444
4463
|
}
|
|
4445
4464
|
async getStorageList() {
|
|
4446
|
-
const e = [...this.virtualStoragesMap.values()].map((
|
|
4447
|
-
name:
|
|
4448
|
-
handle:
|
|
4449
|
-
initialFullPath:
|
|
4450
|
-
})),
|
|
4451
|
-
([
|
|
4452
|
-
name:
|
|
4453
|
-
handle:
|
|
4465
|
+
const e = [...this.virtualStoragesMap.values()].map((n) => ({
|
|
4466
|
+
name: n.name,
|
|
4467
|
+
handle: Ln(n.name, n.root),
|
|
4468
|
+
initialFullPath: n.initialPath
|
|
4469
|
+
})), r = Object.entries(this.storageIdToResourceId).map(
|
|
4470
|
+
([n, o]) => ({
|
|
4471
|
+
name: n,
|
|
4472
|
+
handle: Rn(n, o),
|
|
4454
4473
|
initialFullPath: "",
|
|
4455
4474
|
// we don't have any additional information from where to start browsing remote storages
|
|
4456
4475
|
isInitialPathHome: !1
|
|
4457
4476
|
})
|
|
4458
|
-
).filter((
|
|
4459
|
-
return [...e, ...
|
|
4477
|
+
).filter((n) => n.name !== "root");
|
|
4478
|
+
return [...e, ...r];
|
|
4460
4479
|
}
|
|
4461
4480
|
async listFiles(e, t) {
|
|
4462
|
-
const
|
|
4463
|
-
if (
|
|
4481
|
+
const r = kn(e);
|
|
4482
|
+
if (r.isRemote)
|
|
4464
4483
|
return {
|
|
4465
|
-
entries: (await this.lsClient.list(
|
|
4466
|
-
type:
|
|
4467
|
-
name:
|
|
4468
|
-
fullPath:
|
|
4469
|
-
handle:
|
|
4484
|
+
entries: (await this.lsClient.list(r, t)).items.map((i) => ({
|
|
4485
|
+
type: i.isDir ? "dir" : "file",
|
|
4486
|
+
name: i.name,
|
|
4487
|
+
fullPath: i.fullName,
|
|
4488
|
+
handle: we(r.name, i.fullName)
|
|
4470
4489
|
}))
|
|
4471
4490
|
};
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
});
|
|
4484
|
-
}
|
|
4485
|
-
return { entries: o };
|
|
4491
|
+
w.sep === "/" && t === "" && (t = "/"), r.rootPath === "" && N(t);
|
|
4492
|
+
const n = w.isAbsolute(t) ? t : w.join(r.rootPath, t), o = [];
|
|
4493
|
+
for await (const l of await m.opendir(n)) {
|
|
4494
|
+
if (!l.isFile() && !l.isDirectory()) continue;
|
|
4495
|
+
const i = w.join(n, l.name);
|
|
4496
|
+
o.push({
|
|
4497
|
+
type: l.isFile() ? "file" : "dir",
|
|
4498
|
+
name: l.name,
|
|
4499
|
+
fullPath: i,
|
|
4500
|
+
handle: await this.getLocalFileHandle(i)
|
|
4501
|
+
});
|
|
4486
4502
|
}
|
|
4503
|
+
return { entries: o };
|
|
4487
4504
|
}
|
|
4488
4505
|
async fileToImportHandle(e) {
|
|
4489
4506
|
throw new Error(
|
|
4490
4507
|
"Not implemented. This method must be implemented and intercepted in desktop preload script."
|
|
4491
4508
|
);
|
|
4492
4509
|
}
|
|
4493
|
-
static async init(e, t,
|
|
4494
|
-
const i =
|
|
4495
|
-
|
|
4496
|
-
for (const p of
|
|
4497
|
-
for (const p of
|
|
4498
|
-
const c = new Map(
|
|
4499
|
-
if ((/* @__PURE__ */ new Set([...c.keys(), ...
|
|
4510
|
+
static async init(e, t, r, n, o, l) {
|
|
4511
|
+
const i = jr(t, e);
|
|
4512
|
+
l || (l = await Nn());
|
|
4513
|
+
for (const p of l) N(p.root);
|
|
4514
|
+
for (const p of n) p.localPath !== "" && N(p.localPath);
|
|
4515
|
+
const c = new Map(l.map((p) => [p.name, p])), a = new Map(n.map((p) => [p.storageId, p]));
|
|
4516
|
+
if ((/* @__PURE__ */ new Set([...c.keys(), ...a.keys()])).size !== c.size + a.size)
|
|
4500
4517
|
throw new Error(
|
|
4501
4518
|
"Intersection between local projection storage ids and virtual storages names detected."
|
|
4502
4519
|
);
|
|
4503
|
-
return new
|
|
4520
|
+
return new qe(
|
|
4504
4521
|
e,
|
|
4505
4522
|
i,
|
|
4506
|
-
await
|
|
4507
|
-
|
|
4523
|
+
await Dn(t),
|
|
4524
|
+
r,
|
|
4508
4525
|
c,
|
|
4509
|
-
|
|
4526
|
+
a,
|
|
4510
4527
|
o
|
|
4511
4528
|
);
|
|
4512
4529
|
}
|
|
4513
4530
|
}
|
|
4514
|
-
async function
|
|
4531
|
+
async function Dn(s) {
|
|
4515
4532
|
return s.withReadTx("GetAvailableStorageIds", async (e) => {
|
|
4516
|
-
const t = await e.getResourceByName("LSProvider"),
|
|
4517
|
-
return
|
|
4533
|
+
const t = await e.getResourceByName("LSProvider"), r = await e.getResourceData(t, !0);
|
|
4534
|
+
return Bn(r);
|
|
4518
4535
|
});
|
|
4519
4536
|
}
|
|
4520
|
-
function
|
|
4537
|
+
function Bn(s) {
|
|
4521
4538
|
return Object.fromEntries(
|
|
4522
|
-
s.fields.filter((e) => e.type == "Dynamic" &&
|
|
4539
|
+
s.fields.filter((e) => e.type == "Dynamic" && Ye(e.value)).map((e) => [e.name.substring(8), e.value])
|
|
4523
4540
|
);
|
|
4524
4541
|
}
|
|
4525
4542
|
export {
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
Gn as ImportFileHandleData,
|
|
4543
|
+
gr as ClientDownload,
|
|
4544
|
+
Hr as ClientLogs,
|
|
4545
|
+
Dr as ClientLs,
|
|
4546
|
+
or as ClientProgress,
|
|
4547
|
+
At as ClientUpload,
|
|
4548
|
+
Nn as DefaultVirtualLocalStorages,
|
|
4549
|
+
no as DownloadDriver,
|
|
4550
|
+
ao as DownloadUrlDriver,
|
|
4551
|
+
ro as ImportFileHandleData,
|
|
4536
4552
|
We as ImportFileHandleIndexData,
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
Fr as lineToProgress,
|
|
4565
|
-
Qr as makeBlobImportSnapshot,
|
|
4566
|
-
xn as mixcrProgressFromLogs,
|
|
4567
|
-
lr as parseLocalFileUrl,
|
|
4568
|
-
B as validateAbsolute
|
|
4553
|
+
O as ImportFileHandleUploadData,
|
|
4554
|
+
Xr as IndexResourceSnapshot,
|
|
4555
|
+
io as LogsDriver,
|
|
4556
|
+
so as LogsStreamDriver,
|
|
4557
|
+
qe as LsDriver,
|
|
4558
|
+
Ne as MTimeError,
|
|
4559
|
+
Wt as NetworkError,
|
|
4560
|
+
Be as NoFileForUploading,
|
|
4561
|
+
Jr as OnDemandBlobResourceSnapshot,
|
|
4562
|
+
De as UnexpectedEOF,
|
|
4563
|
+
_e as UnknownStorageError,
|
|
4564
|
+
rn as Updater,
|
|
4565
|
+
oo as UploadDriver,
|
|
4566
|
+
Qr as UploadResourceSnapshot,
|
|
4567
|
+
$e as WrongLocalFileUrl,
|
|
4568
|
+
de as WrongResourceTypeError,
|
|
4569
|
+
Yn as createDownloadClient,
|
|
4570
|
+
Kn as createLogsClient,
|
|
4571
|
+
jr as createLsFilesClient,
|
|
4572
|
+
to as createUploadBlobClient,
|
|
4573
|
+
eo as createUploadProgressClient,
|
|
4574
|
+
mr as getFullPath,
|
|
4575
|
+
Zr as getSize,
|
|
4576
|
+
pn as makeBlobImportSnapshot,
|
|
4577
|
+
br as newLocalStorageIdsToRoot,
|
|
4578
|
+
fr as parseLocalUrl,
|
|
4579
|
+
N as validateAbsolute
|
|
4569
4580
|
};
|
|
4570
4581
|
//# sourceMappingURL=index.mjs.map
|