@dxos/teleport 0.1.56-main.e47dfd1 → 0.1.56-main.ed2f871
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/lib/browser/{chunk-GGVQ27WJ.mjs → chunk-2MN5W64H.mjs} +353 -117
- package/dist/lib/browser/chunk-2MN5W64H.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +13 -5
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +1 -1
- package/dist/lib/node/index.cjs +364 -120
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +352 -116
- package/dist/lib/node/testing/index.cjs.map +3 -3
- package/dist/types/src/muxing/framer.d.ts.map +1 -1
- package/dist/types/src/muxing/muxer.d.ts +5 -0
- package/dist/types/src/muxing/muxer.d.ts.map +1 -1
- package/dist/types/src/rpc-extension.d.ts.map +1 -1
- package/dist/types/src/teleport.d.ts.map +1 -1
- package/dist/types/src/testing/test-extension-with-streams.d.ts.map +1 -1
- package/dist/types/src/testing/test-extension.d.ts.map +1 -1
- package/package.json +12 -12
- package/src/muxing/framer.ts +2 -1
- package/src/muxing/muxer.ts +84 -52
- package/src/rpc-extension.ts +1 -2
- package/src/teleport.ts +6 -1
- package/src/testing/test-builder.ts +1 -1
- package/src/testing/test-extension-with-streams.ts +5 -5
- package/src/testing/test-extension.ts +1 -2
- package/dist/lib/browser/chunk-GGVQ27WJ.mjs.map +0 -7
|
@@ -2,15 +2,15 @@ import "@dxos/node-std/globals";
|
|
|
2
2
|
|
|
3
3
|
// packages/core/mesh/teleport/src/testing/test-builder.ts
|
|
4
4
|
import { pipeline } from "@dxos/node-std/stream";
|
|
5
|
-
import invariant4 from "
|
|
5
|
+
import { invariant as invariant4 } from "@dxos/invariant";
|
|
6
6
|
import { PublicKey as PublicKey2 } from "@dxos/keys";
|
|
7
7
|
import { log as log4 } from "@dxos/log";
|
|
8
8
|
|
|
9
9
|
// packages/core/mesh/teleport/src/teleport.ts
|
|
10
|
-
import invariant3 from "tiny-invariant";
|
|
11
10
|
import { asyncTimeout, scheduleTaskInterval as scheduleTaskInterval2, runInContextAsync, synchronized, scheduleTask } from "@dxos/async";
|
|
12
11
|
import { Context as Context2 } from "@dxos/context";
|
|
13
12
|
import { failUndefined as failUndefined2 } from "@dxos/debug";
|
|
13
|
+
import { invariant as invariant3 } from "@dxos/invariant";
|
|
14
14
|
import { PublicKey } from "@dxos/keys";
|
|
15
15
|
import { log as log3 } from "@dxos/log";
|
|
16
16
|
import { schema as schema2, RpcClosedError } from "@dxos/protocols";
|
|
@@ -19,7 +19,8 @@ import { Callback } from "@dxos/util";
|
|
|
19
19
|
|
|
20
20
|
// packages/core/mesh/teleport/src/muxing/framer.ts
|
|
21
21
|
import { Duplex } from "@dxos/node-std/stream";
|
|
22
|
-
import invariant from "
|
|
22
|
+
import { invariant } from "@dxos/invariant";
|
|
23
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/mesh/teleport/src/muxing/framer.ts";
|
|
23
24
|
var FRAME_LENGTH_SIZE = 2;
|
|
24
25
|
var Framer = class {
|
|
25
26
|
constructor() {
|
|
@@ -32,7 +33,15 @@ var Framer = class {
|
|
|
32
33
|
this._processResponseQueue();
|
|
33
34
|
},
|
|
34
35
|
write: (chunk, encoding, callback) => {
|
|
35
|
-
invariant(!this._subscribeCb, "Internal Framer bug. Concurrent writes detected."
|
|
36
|
+
invariant(!this._subscribeCb, "Internal Framer bug. Concurrent writes detected.", {
|
|
37
|
+
F: __dxlog_file,
|
|
38
|
+
L: 34,
|
|
39
|
+
S: this,
|
|
40
|
+
A: [
|
|
41
|
+
"!this._subscribeCb",
|
|
42
|
+
"'Internal Framer bug. Concurrent writes detected.'"
|
|
43
|
+
]
|
|
44
|
+
});
|
|
36
45
|
this._bytesReceived += chunk.length;
|
|
37
46
|
if (this._buffer && this._buffer.length > 0) {
|
|
38
47
|
this._buffer = Buffer.concat([
|
|
@@ -68,10 +77,17 @@ var Framer = class {
|
|
|
68
77
|
});
|
|
69
78
|
},
|
|
70
79
|
subscribe: (callback) => {
|
|
71
|
-
|
|
72
|
-
|
|
80
|
+
invariant(!this._messageCb, "Rpc port already has a message listener.", {
|
|
81
|
+
F: __dxlog_file,
|
|
82
|
+
L: 73,
|
|
83
|
+
S: this,
|
|
84
|
+
A: [
|
|
85
|
+
"!this._messageCb",
|
|
86
|
+
"'Rpc port already has a message listener.'"
|
|
87
|
+
]
|
|
88
|
+
});
|
|
73
89
|
this._messageCb = callback;
|
|
74
|
-
|
|
90
|
+
this._subscribeCb?.();
|
|
75
91
|
return () => {
|
|
76
92
|
this._messageCb = void 0;
|
|
77
93
|
};
|
|
@@ -139,10 +155,10 @@ var encodeFrame = (payload) => {
|
|
|
139
155
|
|
|
140
156
|
// packages/core/mesh/teleport/src/muxing/muxer.ts
|
|
141
157
|
import { Duplex as Duplex2 } from "@dxos/node-std/stream";
|
|
142
|
-
import invariant2 from "tiny-invariant";
|
|
143
158
|
import { scheduleTaskInterval, Event as Event2, Trigger } from "@dxos/async";
|
|
144
159
|
import { Context } from "@dxos/context";
|
|
145
160
|
import { failUndefined } from "@dxos/debug";
|
|
161
|
+
import { invariant as invariant2 } from "@dxos/invariant";
|
|
146
162
|
import { log as log2 } from "@dxos/log";
|
|
147
163
|
import { schema } from "@dxos/protocols";
|
|
148
164
|
|
|
@@ -150,7 +166,7 @@ import { schema } from "@dxos/protocols";
|
|
|
150
166
|
import * as varint from "varint";
|
|
151
167
|
import { Event } from "@dxos/async";
|
|
152
168
|
import { log } from "@dxos/log";
|
|
153
|
-
var
|
|
169
|
+
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/core/mesh/teleport/src/muxing/balancer.ts";
|
|
154
170
|
var MAX_CHUNK_SIZE = 8192;
|
|
155
171
|
var Balancer = class {
|
|
156
172
|
constructor(_sysChannelId) {
|
|
@@ -200,7 +216,7 @@ var Balancer = class {
|
|
|
200
216
|
});
|
|
201
217
|
if (noCalls) {
|
|
202
218
|
this._sendChunks().catch((err) => log.catch(err, void 0, {
|
|
203
|
-
F:
|
|
219
|
+
F: __dxlog_file2,
|
|
204
220
|
L: 96,
|
|
205
221
|
S: this,
|
|
206
222
|
C: (f, a) => f(...a)
|
|
@@ -260,16 +276,15 @@ var Balancer = class {
|
|
|
260
276
|
return chunk;
|
|
261
277
|
}
|
|
262
278
|
async _sendChunks() {
|
|
263
|
-
var _a, _b;
|
|
264
279
|
if (this._sendBuffers.size === 0) {
|
|
265
280
|
return;
|
|
266
281
|
}
|
|
267
282
|
const chunk = this._getNextChunk();
|
|
268
283
|
try {
|
|
269
284
|
await this._framer.port.send(chunk.msg);
|
|
270
|
-
|
|
285
|
+
chunk.trigger?.wake();
|
|
271
286
|
} catch (err) {
|
|
272
|
-
|
|
287
|
+
chunk.trigger?.throw(err);
|
|
273
288
|
}
|
|
274
289
|
await this._sendChunks();
|
|
275
290
|
}
|
|
@@ -302,7 +317,7 @@ var decodeChunk = (data, withLength) => {
|
|
|
302
317
|
};
|
|
303
318
|
|
|
304
319
|
// packages/core/mesh/teleport/src/muxing/muxer.ts
|
|
305
|
-
var
|
|
320
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/mesh/teleport/src/muxing/muxer.ts";
|
|
306
321
|
var Command = schema.getCodecForType("dxos.mesh.muxer.Command");
|
|
307
322
|
var STATS_INTERVAL = 1e3;
|
|
308
323
|
var MAX_SAFE_FRAME_SIZE = 1e6;
|
|
@@ -319,6 +334,7 @@ var Muxer = class {
|
|
|
319
334
|
this.close = new Event2();
|
|
320
335
|
this.statsUpdated = new Event2();
|
|
321
336
|
this.stream = this._balancer.stream;
|
|
337
|
+
this._lastChannelStats = /* @__PURE__ */ new Map();
|
|
322
338
|
this._balancer.incomingData.on(async (msg) => {
|
|
323
339
|
await this._handleCommand(Command.decode(msg));
|
|
324
340
|
});
|
|
@@ -335,7 +351,15 @@ var Muxer = class {
|
|
|
335
351
|
tag,
|
|
336
352
|
contentType: opts.contentType
|
|
337
353
|
});
|
|
338
|
-
invariant2(!channel.push, `Channel already open: ${tag}
|
|
354
|
+
invariant2(!channel.push, `Channel already open: ${tag}`, {
|
|
355
|
+
F: __dxlog_file3,
|
|
356
|
+
L: 131,
|
|
357
|
+
S: this,
|
|
358
|
+
A: [
|
|
359
|
+
"!channel.push",
|
|
360
|
+
"`Channel already open: ${tag}`"
|
|
361
|
+
]
|
|
362
|
+
});
|
|
339
363
|
const stream = new Duplex2({
|
|
340
364
|
write: (data, encoding, callback) => {
|
|
341
365
|
this._sendData(channel, data).then(() => callback()).catch(callback);
|
|
@@ -375,7 +399,15 @@ var Muxer = class {
|
|
|
375
399
|
tag,
|
|
376
400
|
contentType: opts.contentType
|
|
377
401
|
});
|
|
378
|
-
invariant2(!channel.push, `Channel already open: ${tag}
|
|
402
|
+
invariant2(!channel.push, `Channel already open: ${tag}`, {
|
|
403
|
+
F: __dxlog_file3,
|
|
404
|
+
L: 183,
|
|
405
|
+
S: this,
|
|
406
|
+
A: [
|
|
407
|
+
"!channel.push",
|
|
408
|
+
"`Channel already open: ${tag}`"
|
|
409
|
+
]
|
|
410
|
+
});
|
|
379
411
|
let inboundBuffer = [];
|
|
380
412
|
let callback;
|
|
381
413
|
channel.push = (data) => {
|
|
@@ -391,7 +423,15 @@ var Muxer = class {
|
|
|
391
423
|
await this._sendData(channel, data);
|
|
392
424
|
},
|
|
393
425
|
subscribe: (cb) => {
|
|
394
|
-
invariant2(!callback, "Only one subscriber is allowed"
|
|
426
|
+
invariant2(!callback, "Only one subscriber is allowed", {
|
|
427
|
+
F: __dxlog_file3,
|
|
428
|
+
L: 205,
|
|
429
|
+
S: this,
|
|
430
|
+
A: [
|
|
431
|
+
"!callback",
|
|
432
|
+
"'Only one subscriber is allowed'"
|
|
433
|
+
]
|
|
434
|
+
});
|
|
395
435
|
callback = cb;
|
|
396
436
|
for (const data of inboundBuffer) {
|
|
397
437
|
cb(data);
|
|
@@ -423,7 +463,7 @@ var Muxer = class {
|
|
|
423
463
|
this._destroying = true;
|
|
424
464
|
this._sendCommand({
|
|
425
465
|
destroy: {
|
|
426
|
-
error: err
|
|
466
|
+
error: err?.message
|
|
427
467
|
}
|
|
428
468
|
}, SYSTEM_CHANNEL_ID).then(() => {
|
|
429
469
|
this._dispose();
|
|
@@ -433,35 +473,36 @@ var Muxer = class {
|
|
|
433
473
|
void this._ctx.dispose();
|
|
434
474
|
}
|
|
435
475
|
_dispose(err) {
|
|
436
|
-
var _a;
|
|
437
476
|
if (this._destroyed) {
|
|
438
477
|
return;
|
|
439
478
|
}
|
|
440
479
|
this._destroyed = true;
|
|
441
480
|
this._balancer.destroy();
|
|
442
481
|
for (const channel of this._channelsByTag.values()) {
|
|
443
|
-
|
|
482
|
+
channel.destroy?.(err);
|
|
444
483
|
}
|
|
445
484
|
this.close.emit(err);
|
|
446
485
|
this._channelsByLocalId.clear();
|
|
447
486
|
this._channelsByTag.clear();
|
|
448
487
|
}
|
|
449
488
|
async _handleCommand(cmd) {
|
|
450
|
-
var _a;
|
|
451
489
|
log2("Received command", {
|
|
452
490
|
cmd
|
|
453
491
|
}, {
|
|
454
|
-
F:
|
|
455
|
-
L:
|
|
492
|
+
F: __dxlog_file3,
|
|
493
|
+
L: 280,
|
|
456
494
|
S: this,
|
|
457
495
|
C: (f, a) => f(...a)
|
|
458
496
|
});
|
|
459
497
|
if (this._destroyed || this._destroying) {
|
|
498
|
+
if (cmd.destroy) {
|
|
499
|
+
return;
|
|
500
|
+
}
|
|
460
501
|
log2.warn("Received command after destroy", {
|
|
461
502
|
cmd
|
|
462
503
|
}, {
|
|
463
|
-
F:
|
|
464
|
-
L:
|
|
504
|
+
F: __dxlog_file3,
|
|
505
|
+
L: 287,
|
|
465
506
|
S: this,
|
|
466
507
|
C: (f, a) => f(...a)
|
|
467
508
|
});
|
|
@@ -483,13 +524,13 @@ var Muxer = class {
|
|
|
483
524
|
}
|
|
484
525
|
channel.buffer = [];
|
|
485
526
|
} else if (cmd.data) {
|
|
486
|
-
const stream =
|
|
527
|
+
const stream = this._channelsByLocalId.get(cmd.data.channelId) ?? failUndefined();
|
|
487
528
|
if (!stream.push) {
|
|
488
529
|
log2.warn("Received data for channel before it was opened", {
|
|
489
530
|
tag: stream.tag
|
|
490
531
|
}, {
|
|
491
|
-
F:
|
|
492
|
-
L:
|
|
532
|
+
F: __dxlog_file3,
|
|
533
|
+
L: 314,
|
|
493
534
|
S: this,
|
|
494
535
|
C: (f, a) => f(...a)
|
|
495
536
|
});
|
|
@@ -537,8 +578,8 @@ var Muxer = class {
|
|
|
537
578
|
size: data.length,
|
|
538
579
|
threshold: MAX_SAFE_FRAME_SIZE
|
|
539
580
|
}, {
|
|
540
|
-
F:
|
|
541
|
-
L:
|
|
581
|
+
F: __dxlog_file3,
|
|
582
|
+
L: 359,
|
|
542
583
|
S: this,
|
|
543
584
|
C: (f, a) => f(...a)
|
|
544
585
|
});
|
|
@@ -564,21 +605,40 @@ var Muxer = class {
|
|
|
564
605
|
}
|
|
565
606
|
async _emitStats() {
|
|
566
607
|
if (this._destroyed || this._destroying) {
|
|
608
|
+
this._lastStats = void 0;
|
|
609
|
+
this._lastChannelStats.clear();
|
|
567
610
|
return;
|
|
568
611
|
}
|
|
569
612
|
const bytesSent = this._balancer.bytesSent;
|
|
570
613
|
const bytesReceived = this._balancer.bytesReceived;
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
614
|
+
const now = Date.now();
|
|
615
|
+
const interval = this._lastStats ? (now - this._lastStats.timestamp) / 1e3 : 0;
|
|
616
|
+
const calculateThroughput = (current, last) => last ? {
|
|
617
|
+
bytesSentRate: interval ? (current.bytesSent - last.bytesSent) / interval : void 0,
|
|
618
|
+
bytesReceivedRate: interval ? (current.bytesReceived - last.bytesReceived) / interval : void 0
|
|
619
|
+
} : {};
|
|
620
|
+
this._lastStats = {
|
|
621
|
+
timestamp: now,
|
|
622
|
+
channels: Array.from(this._channelsByTag.values()).map((channel) => {
|
|
623
|
+
const stats = {
|
|
624
|
+
id: channel.id,
|
|
625
|
+
tag: channel.tag,
|
|
626
|
+
contentType: channel.contentType,
|
|
627
|
+
bytesSent: channel.stats.bytesSent,
|
|
628
|
+
bytesReceived: channel.stats.bytesReceived,
|
|
629
|
+
...calculateThroughput(channel.stats, this._lastChannelStats.get(channel.id))
|
|
630
|
+
};
|
|
631
|
+
this._lastChannelStats.set(channel.id, stats);
|
|
632
|
+
return stats;
|
|
633
|
+
}),
|
|
579
634
|
bytesSent,
|
|
580
|
-
bytesReceived
|
|
581
|
-
|
|
635
|
+
bytesReceived,
|
|
636
|
+
...calculateThroughput({
|
|
637
|
+
bytesSent,
|
|
638
|
+
bytesReceived
|
|
639
|
+
}, this._lastStats)
|
|
640
|
+
};
|
|
641
|
+
this.statsUpdated.emit(this._lastStats);
|
|
582
642
|
}
|
|
583
643
|
};
|
|
584
644
|
|
|
@@ -593,14 +653,14 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
593
653
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
594
654
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
595
655
|
}
|
|
596
|
-
var
|
|
656
|
+
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/core/mesh/teleport/src/teleport.ts";
|
|
597
657
|
var Teleport = class {
|
|
598
658
|
constructor({ initiator, localPeerId, remotePeerId }) {
|
|
599
659
|
this._ctx = new Context2({
|
|
600
660
|
onError: (err) => {
|
|
601
661
|
void this.destroy(err).catch(() => {
|
|
602
662
|
log3.error("Error during destroy", err, {
|
|
603
|
-
F:
|
|
663
|
+
F: __dxlog_file4,
|
|
604
664
|
L: 34,
|
|
605
665
|
S: this,
|
|
606
666
|
C: (f, a) => f(...a)
|
|
@@ -614,7 +674,7 @@ var Teleport = class {
|
|
|
614
674
|
heartbeatTimeout: 1e4,
|
|
615
675
|
onTimeout: () => {
|
|
616
676
|
this.destroy(new Error("Connection timed out")).catch((err) => log3.catch(err, void 0, {
|
|
617
|
-
F:
|
|
677
|
+
F: __dxlog_file4,
|
|
618
678
|
L: 45,
|
|
619
679
|
S: this,
|
|
620
680
|
C: (f, a) => f(...a)
|
|
@@ -624,9 +684,33 @@ var Teleport = class {
|
|
|
624
684
|
this._extensions = /* @__PURE__ */ new Map();
|
|
625
685
|
this._remoteExtensions = /* @__PURE__ */ new Set();
|
|
626
686
|
this._open = false;
|
|
627
|
-
invariant3(typeof initiator === "boolean"
|
|
628
|
-
|
|
629
|
-
|
|
687
|
+
invariant3(typeof initiator === "boolean", void 0, {
|
|
688
|
+
F: __dxlog_file4,
|
|
689
|
+
L: 55,
|
|
690
|
+
S: this,
|
|
691
|
+
A: [
|
|
692
|
+
"typeof initiator === 'boolean'",
|
|
693
|
+
""
|
|
694
|
+
]
|
|
695
|
+
});
|
|
696
|
+
invariant3(PublicKey.isPublicKey(localPeerId), void 0, {
|
|
697
|
+
F: __dxlog_file4,
|
|
698
|
+
L: 56,
|
|
699
|
+
S: this,
|
|
700
|
+
A: [
|
|
701
|
+
"PublicKey.isPublicKey(localPeerId)",
|
|
702
|
+
""
|
|
703
|
+
]
|
|
704
|
+
});
|
|
705
|
+
invariant3(PublicKey.isPublicKey(remotePeerId), void 0, {
|
|
706
|
+
F: __dxlog_file4,
|
|
707
|
+
L: 57,
|
|
708
|
+
S: this,
|
|
709
|
+
A: [
|
|
710
|
+
"PublicKey.isPublicKey(remotePeerId)",
|
|
711
|
+
""
|
|
712
|
+
]
|
|
713
|
+
});
|
|
630
714
|
this.initiator = initiator;
|
|
631
715
|
this.localPeerId = localPeerId;
|
|
632
716
|
this.remotePeerId = remotePeerId;
|
|
@@ -634,12 +718,20 @@ var Teleport = class {
|
|
|
634
718
|
log3("remote extension", {
|
|
635
719
|
name
|
|
636
720
|
}, {
|
|
637
|
-
F:
|
|
721
|
+
F: __dxlog_file4,
|
|
638
722
|
L: 63,
|
|
639
723
|
S: this,
|
|
640
724
|
C: (f, a) => f(...a)
|
|
641
725
|
});
|
|
642
|
-
invariant3(!this._remoteExtensions.has(name), "Remote extension already exists"
|
|
726
|
+
invariant3(!this._remoteExtensions.has(name), "Remote extension already exists", {
|
|
727
|
+
F: __dxlog_file4,
|
|
728
|
+
L: 64,
|
|
729
|
+
S: this,
|
|
730
|
+
A: [
|
|
731
|
+
"!this._remoteExtensions.has(name)",
|
|
732
|
+
"'Remote extension already exists'"
|
|
733
|
+
]
|
|
734
|
+
});
|
|
643
735
|
this._remoteExtensions.add(name);
|
|
644
736
|
if (this._extensions.has(name)) {
|
|
645
737
|
try {
|
|
@@ -662,11 +754,13 @@ var Teleport = class {
|
|
|
662
754
|
localPeerId,
|
|
663
755
|
remotePeerId,
|
|
664
756
|
bytesSent: stats.bytesSent,
|
|
757
|
+
bytesSentRate: stats.bytesSentRate,
|
|
665
758
|
bytesReceived: stats.bytesReceived,
|
|
759
|
+
bytesReceivedRate: stats.bytesReceivedRate,
|
|
666
760
|
channels: stats.channels
|
|
667
761
|
}, {
|
|
668
|
-
F:
|
|
669
|
-
L:
|
|
762
|
+
F: __dxlog_file4,
|
|
763
|
+
L: 89,
|
|
670
764
|
S: this,
|
|
671
765
|
C: (f, a) => f(...a)
|
|
672
766
|
});
|
|
@@ -699,8 +793,8 @@ var Teleport = class {
|
|
|
699
793
|
await extension.onClose(err);
|
|
700
794
|
} catch (err2) {
|
|
701
795
|
log3.catch(err2, void 0, {
|
|
702
|
-
F:
|
|
703
|
-
L:
|
|
796
|
+
F: __dxlog_file4,
|
|
797
|
+
L: 137,
|
|
704
798
|
S: this,
|
|
705
799
|
C: (f, a) => f(...a)
|
|
706
800
|
});
|
|
@@ -715,8 +809,8 @@ var Teleport = class {
|
|
|
715
809
|
log3("addExtension", {
|
|
716
810
|
name
|
|
717
811
|
}, {
|
|
718
|
-
F:
|
|
719
|
-
L:
|
|
812
|
+
F: __dxlog_file4,
|
|
813
|
+
L: 149,
|
|
720
814
|
S: this,
|
|
721
815
|
C: (f, a) => f(...a)
|
|
722
816
|
});
|
|
@@ -738,31 +832,62 @@ var Teleport = class {
|
|
|
738
832
|
}
|
|
739
833
|
}
|
|
740
834
|
_setExtension(extensionName, extension) {
|
|
741
|
-
invariant3(!extensionName.includes("/"), "Invalid extension name"
|
|
742
|
-
|
|
835
|
+
invariant3(!extensionName.includes("/"), "Invalid extension name", {
|
|
836
|
+
F: __dxlog_file4,
|
|
837
|
+
L: 173,
|
|
838
|
+
S: this,
|
|
839
|
+
A: [
|
|
840
|
+
"!extensionName.includes('/')",
|
|
841
|
+
"'Invalid extension name'"
|
|
842
|
+
]
|
|
843
|
+
});
|
|
844
|
+
invariant3(!this._extensions.has(extensionName), "Extension already exists", {
|
|
845
|
+
F: __dxlog_file4,
|
|
846
|
+
L: 174,
|
|
847
|
+
S: this,
|
|
848
|
+
A: [
|
|
849
|
+
"!this._extensions.has(extensionName)",
|
|
850
|
+
"'Extension already exists'"
|
|
851
|
+
]
|
|
852
|
+
});
|
|
743
853
|
this._extensions.set(extensionName, extension);
|
|
744
854
|
}
|
|
745
855
|
async _openExtension(extensionName) {
|
|
746
|
-
var _a;
|
|
747
856
|
log3("open extension", {
|
|
748
857
|
extensionName
|
|
749
858
|
}, {
|
|
750
|
-
F:
|
|
751
|
-
L:
|
|
859
|
+
F: __dxlog_file4,
|
|
860
|
+
L: 179,
|
|
752
861
|
S: this,
|
|
753
862
|
C: (f, a) => f(...a)
|
|
754
863
|
});
|
|
755
|
-
const extension =
|
|
864
|
+
const extension = this._extensions.get(extensionName) ?? failUndefined2();
|
|
756
865
|
const context = {
|
|
757
866
|
initiator: this.initiator,
|
|
758
867
|
localPeerId: this.localPeerId,
|
|
759
868
|
remotePeerId: this.remotePeerId,
|
|
760
869
|
createPort: async (channelName, opts) => {
|
|
761
|
-
invariant3(!channelName.includes("/"), "Invalid channel name"
|
|
870
|
+
invariant3(!channelName.includes("/"), "Invalid channel name", {
|
|
871
|
+
F: __dxlog_file4,
|
|
872
|
+
L: 187,
|
|
873
|
+
S: this,
|
|
874
|
+
A: [
|
|
875
|
+
"!channelName.includes('/')",
|
|
876
|
+
"'Invalid channel name'"
|
|
877
|
+
]
|
|
878
|
+
});
|
|
762
879
|
return this._muxer.createPort(`${extensionName}/${channelName}`, opts);
|
|
763
880
|
},
|
|
764
881
|
createStream: async (channelName, opts) => {
|
|
765
|
-
invariant3(!channelName.includes("/"), "Invalid channel name"
|
|
882
|
+
invariant3(!channelName.includes("/"), "Invalid channel name", {
|
|
883
|
+
F: __dxlog_file4,
|
|
884
|
+
L: 191,
|
|
885
|
+
S: this,
|
|
886
|
+
A: [
|
|
887
|
+
"!channelName.includes('/')",
|
|
888
|
+
"'Invalid channel name'"
|
|
889
|
+
]
|
|
890
|
+
});
|
|
766
891
|
return this._muxer.createStream(`${extensionName}/${channelName}`, opts);
|
|
767
892
|
},
|
|
768
893
|
close: (err) => {
|
|
@@ -775,8 +900,8 @@ var Teleport = class {
|
|
|
775
900
|
log3("extension opened", {
|
|
776
901
|
extensionName
|
|
777
902
|
}, {
|
|
778
|
-
F:
|
|
779
|
-
L:
|
|
903
|
+
F: __dxlog_file4,
|
|
904
|
+
L: 202,
|
|
780
905
|
S: this,
|
|
781
906
|
C: (f, a) => f(...a)
|
|
782
907
|
});
|
|
@@ -838,7 +963,7 @@ var ControlExtension = class {
|
|
|
838
963
|
};
|
|
839
964
|
|
|
840
965
|
// packages/core/mesh/teleport/src/testing/test-builder.ts
|
|
841
|
-
var
|
|
966
|
+
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/core/mesh/teleport/src/testing/test-builder.ts";
|
|
842
967
|
var TestBuilder = class {
|
|
843
968
|
constructor() {
|
|
844
969
|
this._peers = /* @__PURE__ */ new Set();
|
|
@@ -857,9 +982,33 @@ var TestBuilder = class {
|
|
|
857
982
|
await Promise.all(Array.from(this._peers).map((agent) => agent.destroy()));
|
|
858
983
|
}
|
|
859
984
|
async connect(peer1, peer2) {
|
|
860
|
-
invariant4(peer1 !== peer2
|
|
861
|
-
|
|
862
|
-
|
|
985
|
+
invariant4(peer1 !== peer2, void 0, {
|
|
986
|
+
F: __dxlog_file5,
|
|
987
|
+
L: 37,
|
|
988
|
+
S: this,
|
|
989
|
+
A: [
|
|
990
|
+
"peer1 !== peer2",
|
|
991
|
+
""
|
|
992
|
+
]
|
|
993
|
+
});
|
|
994
|
+
invariant4(this._peers.has(peer1), void 0, {
|
|
995
|
+
F: __dxlog_file5,
|
|
996
|
+
L: 38,
|
|
997
|
+
S: this,
|
|
998
|
+
A: [
|
|
999
|
+
"this._peers.has(peer1)",
|
|
1000
|
+
""
|
|
1001
|
+
]
|
|
1002
|
+
});
|
|
1003
|
+
invariant4(this._peers.has(peer1), void 0, {
|
|
1004
|
+
F: __dxlog_file5,
|
|
1005
|
+
L: 39,
|
|
1006
|
+
S: this,
|
|
1007
|
+
A: [
|
|
1008
|
+
"this._peers.has(peer1)",
|
|
1009
|
+
""
|
|
1010
|
+
]
|
|
1011
|
+
});
|
|
863
1012
|
const connection1 = peer1.createConnection({
|
|
864
1013
|
initiator: true,
|
|
865
1014
|
remotePeerId: peer2.peerId
|
|
@@ -879,13 +1028,53 @@ var TestBuilder = class {
|
|
|
879
1028
|
];
|
|
880
1029
|
}
|
|
881
1030
|
async disconnect(peer1, peer2) {
|
|
882
|
-
invariant4(peer1 !== peer2
|
|
883
|
-
|
|
884
|
-
|
|
1031
|
+
invariant4(peer1 !== peer2, void 0, {
|
|
1032
|
+
F: __dxlog_file5,
|
|
1033
|
+
L: 51,
|
|
1034
|
+
S: this,
|
|
1035
|
+
A: [
|
|
1036
|
+
"peer1 !== peer2",
|
|
1037
|
+
""
|
|
1038
|
+
]
|
|
1039
|
+
});
|
|
1040
|
+
invariant4(this._peers.has(peer1), void 0, {
|
|
1041
|
+
F: __dxlog_file5,
|
|
1042
|
+
L: 52,
|
|
1043
|
+
S: this,
|
|
1044
|
+
A: [
|
|
1045
|
+
"this._peers.has(peer1)",
|
|
1046
|
+
""
|
|
1047
|
+
]
|
|
1048
|
+
});
|
|
1049
|
+
invariant4(this._peers.has(peer1), void 0, {
|
|
1050
|
+
F: __dxlog_file5,
|
|
1051
|
+
L: 53,
|
|
1052
|
+
S: this,
|
|
1053
|
+
A: [
|
|
1054
|
+
"this._peers.has(peer1)",
|
|
1055
|
+
""
|
|
1056
|
+
]
|
|
1057
|
+
});
|
|
885
1058
|
const connection1 = Array.from(peer1.connections).find((connection) => connection.remotePeerId.equals(peer2.peerId));
|
|
886
1059
|
const connection2 = Array.from(peer2.connections).find((connection) => connection.remotePeerId.equals(peer1.peerId));
|
|
887
|
-
invariant4(connection1
|
|
888
|
-
|
|
1060
|
+
invariant4(connection1, void 0, {
|
|
1061
|
+
F: __dxlog_file5,
|
|
1062
|
+
L: 62,
|
|
1063
|
+
S: this,
|
|
1064
|
+
A: [
|
|
1065
|
+
"connection1",
|
|
1066
|
+
""
|
|
1067
|
+
]
|
|
1068
|
+
});
|
|
1069
|
+
invariant4(connection2, void 0, {
|
|
1070
|
+
F: __dxlog_file5,
|
|
1071
|
+
L: 63,
|
|
1072
|
+
S: this,
|
|
1073
|
+
A: [
|
|
1074
|
+
"connection2",
|
|
1075
|
+
""
|
|
1076
|
+
]
|
|
1077
|
+
});
|
|
889
1078
|
await Promise.all([
|
|
890
1079
|
peer1.closeConnection(connection1),
|
|
891
1080
|
peer2.closeConnection(connection2)
|
|
@@ -907,12 +1096,28 @@ var TestPeer = class {
|
|
|
907
1096
|
return connection;
|
|
908
1097
|
}
|
|
909
1098
|
async openConnection(connection) {
|
|
910
|
-
invariant4(this.connections.has(connection)
|
|
1099
|
+
invariant4(this.connections.has(connection), void 0, {
|
|
1100
|
+
F: __dxlog_file5,
|
|
1101
|
+
L: 84,
|
|
1102
|
+
S: this,
|
|
1103
|
+
A: [
|
|
1104
|
+
"this.connections.has(connection)",
|
|
1105
|
+
""
|
|
1106
|
+
]
|
|
1107
|
+
});
|
|
911
1108
|
await connection.teleport.open();
|
|
912
1109
|
await this.onOpen(connection);
|
|
913
1110
|
}
|
|
914
1111
|
async closeConnection(connection) {
|
|
915
|
-
invariant4(this.connections.has(connection)
|
|
1112
|
+
invariant4(this.connections.has(connection), void 0, {
|
|
1113
|
+
F: __dxlog_file5,
|
|
1114
|
+
L: 90,
|
|
1115
|
+
S: this,
|
|
1116
|
+
A: [
|
|
1117
|
+
"this.connections.has(connection)",
|
|
1118
|
+
""
|
|
1119
|
+
]
|
|
1120
|
+
});
|
|
916
1121
|
await this.onClose(connection);
|
|
917
1122
|
await connection.teleport.close();
|
|
918
1123
|
this.connections.delete(connection);
|
|
@@ -927,7 +1132,7 @@ var pipeStreams = (stream1, stream2) => {
|
|
|
927
1132
|
pipeline(stream1, stream2, (err) => {
|
|
928
1133
|
if (err && err.code !== "ERR_STREAM_PREMATURE_CLOSE") {
|
|
929
1134
|
log4.catch(err, void 0, {
|
|
930
|
-
F:
|
|
1135
|
+
F: __dxlog_file5,
|
|
931
1136
|
L: 106,
|
|
932
1137
|
S: void 0,
|
|
933
1138
|
C: (f, a) => f(...a)
|
|
@@ -937,7 +1142,7 @@ var pipeStreams = (stream1, stream2) => {
|
|
|
937
1142
|
pipeline(stream2, stream1, (err) => {
|
|
938
1143
|
if (err && err.code !== "ERR_STREAM_PREMATURE_CLOSE") {
|
|
939
1144
|
log4.catch(err, void 0, {
|
|
940
|
-
F:
|
|
1145
|
+
F: __dxlog_file5,
|
|
941
1146
|
L: 111,
|
|
942
1147
|
S: void 0,
|
|
943
1148
|
C: (f, a) => f(...a)
|
|
@@ -959,12 +1164,12 @@ var TestConnection = class {
|
|
|
959
1164
|
};
|
|
960
1165
|
|
|
961
1166
|
// packages/core/mesh/teleport/src/testing/test-extension.ts
|
|
962
|
-
import invariant5 from "tiny-invariant";
|
|
963
1167
|
import { asyncTimeout as asyncTimeout2, Trigger as Trigger2 } from "@dxos/async";
|
|
1168
|
+
import { invariant as invariant5 } from "@dxos/invariant";
|
|
964
1169
|
import { log as log5 } from "@dxos/log";
|
|
965
1170
|
import { schema as schema3 } from "@dxos/protocols";
|
|
966
1171
|
import { createProtoRpcPeer as createProtoRpcPeer2 } from "@dxos/rpc";
|
|
967
|
-
var
|
|
1172
|
+
var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/core/mesh/teleport/src/testing/test-extension.ts";
|
|
968
1173
|
var TestExtension = class {
|
|
969
1174
|
constructor(callbacks = {}) {
|
|
970
1175
|
this.callbacks = callbacks;
|
|
@@ -972,17 +1177,15 @@ var TestExtension = class {
|
|
|
972
1177
|
this.closed = new Trigger2();
|
|
973
1178
|
}
|
|
974
1179
|
get remotePeerId() {
|
|
975
|
-
|
|
976
|
-
return (_a = this.extensionContext) == null ? void 0 : _a.remotePeerId;
|
|
1180
|
+
return this.extensionContext?.remotePeerId;
|
|
977
1181
|
}
|
|
978
1182
|
async onOpen(context) {
|
|
979
|
-
var _a, _b;
|
|
980
1183
|
log5("onOpen", {
|
|
981
1184
|
localPeerId: context.localPeerId,
|
|
982
1185
|
remotePeerId: context.remotePeerId
|
|
983
1186
|
}, {
|
|
984
|
-
F:
|
|
985
|
-
L:
|
|
1187
|
+
F: __dxlog_file6,
|
|
1188
|
+
L: 32,
|
|
986
1189
|
S: this,
|
|
987
1190
|
C: (f, a) => f(...a)
|
|
988
1191
|
});
|
|
@@ -1011,22 +1214,21 @@ var TestExtension = class {
|
|
|
1011
1214
|
timeout: 2e3
|
|
1012
1215
|
});
|
|
1013
1216
|
await this._rpc.open();
|
|
1014
|
-
await
|
|
1217
|
+
await this.callbacks.onOpen?.();
|
|
1015
1218
|
this.open.wake();
|
|
1016
1219
|
}
|
|
1017
1220
|
async onClose(err) {
|
|
1018
|
-
var _a, _b, _c;
|
|
1019
1221
|
log5("onClose", {
|
|
1020
1222
|
err
|
|
1021
1223
|
}, {
|
|
1022
|
-
F:
|
|
1023
|
-
L:
|
|
1224
|
+
F: __dxlog_file6,
|
|
1225
|
+
L: 66,
|
|
1024
1226
|
S: this,
|
|
1025
1227
|
C: (f, a) => f(...a)
|
|
1026
1228
|
});
|
|
1027
|
-
await
|
|
1229
|
+
await this.callbacks.onClose?.();
|
|
1028
1230
|
this.closed.wake();
|
|
1029
|
-
await
|
|
1231
|
+
await this._rpc?.close();
|
|
1030
1232
|
}
|
|
1031
1233
|
async test(message = "test") {
|
|
1032
1234
|
await this.open.wait({
|
|
@@ -1035,25 +1237,32 @@ var TestExtension = class {
|
|
|
1035
1237
|
const res = await asyncTimeout2(this._rpc.rpc.TestService.testCall({
|
|
1036
1238
|
data: message
|
|
1037
1239
|
}), 1500);
|
|
1038
|
-
invariant5(res.data === message
|
|
1240
|
+
invariant5(res.data === message, void 0, {
|
|
1241
|
+
F: __dxlog_file6,
|
|
1242
|
+
L: 75,
|
|
1243
|
+
S: this,
|
|
1244
|
+
A: [
|
|
1245
|
+
"res.data === message",
|
|
1246
|
+
""
|
|
1247
|
+
]
|
|
1248
|
+
});
|
|
1039
1249
|
}
|
|
1040
1250
|
/**
|
|
1041
1251
|
* Force-close the connection.
|
|
1042
1252
|
*/
|
|
1043
1253
|
async closeConnection(err) {
|
|
1044
|
-
|
|
1045
|
-
(_a = this.extensionContext) == null ? void 0 : _a.close(err);
|
|
1254
|
+
this.extensionContext?.close(err);
|
|
1046
1255
|
}
|
|
1047
1256
|
};
|
|
1048
1257
|
|
|
1049
1258
|
// packages/core/mesh/teleport/src/testing/test-extension-with-streams.ts
|
|
1050
|
-
import assert from "@dxos/node-std/assert";
|
|
1051
1259
|
import { randomBytes } from "@dxos/node-std/crypto";
|
|
1052
1260
|
import { Trigger as Trigger3 } from "@dxos/async";
|
|
1261
|
+
import { invariant as invariant6 } from "@dxos/invariant";
|
|
1053
1262
|
import { log as log6 } from "@dxos/log";
|
|
1054
1263
|
import { schema as schema4 } from "@dxos/protocols";
|
|
1055
1264
|
import { createProtoRpcPeer as createProtoRpcPeer3 } from "@dxos/rpc";
|
|
1056
|
-
var
|
|
1265
|
+
var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/core/mesh/teleport/src/testing/test-extension-with-streams.ts";
|
|
1057
1266
|
var TestExtensionWithStreams = class {
|
|
1058
1267
|
constructor(callbacks = {}) {
|
|
1059
1268
|
this.callbacks = callbacks;
|
|
@@ -1062,11 +1271,18 @@ var TestExtensionWithStreams = class {
|
|
|
1062
1271
|
this._streams = /* @__PURE__ */ new Map();
|
|
1063
1272
|
}
|
|
1064
1273
|
get remotePeerId() {
|
|
1065
|
-
|
|
1066
|
-
return (_a = this.extensionContext) == null ? void 0 : _a.remotePeerId;
|
|
1274
|
+
return this.extensionContext?.remotePeerId;
|
|
1067
1275
|
}
|
|
1068
1276
|
async _openStream(streamTag, interval = 5, chunkSize = 2048) {
|
|
1069
|
-
|
|
1277
|
+
invariant6(!this._streams.has(streamTag), `Stream already exists: ${streamTag}`, {
|
|
1278
|
+
F: __dxlog_file7,
|
|
1279
|
+
L: 37,
|
|
1280
|
+
S: this,
|
|
1281
|
+
A: [
|
|
1282
|
+
"!this._streams.has(streamTag)",
|
|
1283
|
+
"`Stream already exists: ${streamTag}`"
|
|
1284
|
+
]
|
|
1285
|
+
});
|
|
1070
1286
|
const networkStream = await this.extensionContext.createStream(streamTag, {
|
|
1071
1287
|
contentType: "application/x-test-stream"
|
|
1072
1288
|
});
|
|
@@ -1106,7 +1322,6 @@ var TestExtensionWithStreams = class {
|
|
|
1106
1322
|
networkStream.removeAllListeners();
|
|
1107
1323
|
});
|
|
1108
1324
|
streamEntry.reportingTimer = setInterval(() => {
|
|
1109
|
-
var _a, _b;
|
|
1110
1325
|
const { bytesSent, bytesReceived, sendErrors, receiveErrors } = streamEntry;
|
|
1111
1326
|
log6.trace("dxos.test.stream-stats", {
|
|
1112
1327
|
streamTag,
|
|
@@ -1114,10 +1329,10 @@ var TestExtensionWithStreams = class {
|
|
|
1114
1329
|
bytesReceived,
|
|
1115
1330
|
sendErrors,
|
|
1116
1331
|
receiveErrors,
|
|
1117
|
-
from:
|
|
1118
|
-
to:
|
|
1332
|
+
from: this.extensionContext?.localPeerId,
|
|
1333
|
+
to: this.extensionContext?.remotePeerId
|
|
1119
1334
|
}, {
|
|
1120
|
-
F:
|
|
1335
|
+
F: __dxlog_file7,
|
|
1121
1336
|
L: 91,
|
|
1122
1337
|
S: this,
|
|
1123
1338
|
C: (f, a) => f(...a)
|
|
@@ -1125,7 +1340,15 @@ var TestExtensionWithStreams = class {
|
|
|
1125
1340
|
}, 100);
|
|
1126
1341
|
}
|
|
1127
1342
|
_closeStream(streamTag) {
|
|
1128
|
-
|
|
1343
|
+
invariant6(this._streams.has(streamTag), `Stream does not exist: ${streamTag}`, {
|
|
1344
|
+
F: __dxlog_file7,
|
|
1345
|
+
L: 104,
|
|
1346
|
+
S: this,
|
|
1347
|
+
A: [
|
|
1348
|
+
"this._streams.has(streamTag)",
|
|
1349
|
+
"`Stream does not exist: ${streamTag}`"
|
|
1350
|
+
]
|
|
1351
|
+
});
|
|
1129
1352
|
const stream = this._streams.get(streamTag);
|
|
1130
1353
|
clearTimeout(stream.timer);
|
|
1131
1354
|
clearTimeout(stream.reportingTimer);
|
|
@@ -1137,16 +1360,15 @@ var TestExtensionWithStreams = class {
|
|
|
1137
1360
|
bytesReceived,
|
|
1138
1361
|
sendErrors,
|
|
1139
1362
|
receiveErrors,
|
|
1140
|
-
runningTime: Date.now() - (startTimestamp
|
|
1363
|
+
runningTime: Date.now() - (startTimestamp ?? 0)
|
|
1141
1364
|
};
|
|
1142
1365
|
}
|
|
1143
1366
|
async onOpen(context) {
|
|
1144
|
-
var _a, _b;
|
|
1145
1367
|
log6("onOpen", {
|
|
1146
1368
|
localPeerId: context.localPeerId,
|
|
1147
1369
|
remotePeerId: context.remotePeerId
|
|
1148
1370
|
}, {
|
|
1149
|
-
F:
|
|
1371
|
+
F: __dxlog_file7,
|
|
1150
1372
|
L: 126,
|
|
1151
1373
|
S: this,
|
|
1152
1374
|
C: (f, a) => f(...a)
|
|
@@ -1188,26 +1410,25 @@ var TestExtensionWithStreams = class {
|
|
|
1188
1410
|
timeout: 2e3
|
|
1189
1411
|
});
|
|
1190
1412
|
await this._rpc.open();
|
|
1191
|
-
await
|
|
1413
|
+
await this.callbacks.onOpen?.();
|
|
1192
1414
|
this.open.wake();
|
|
1193
1415
|
}
|
|
1194
1416
|
async onClose(err) {
|
|
1195
|
-
var _a, _b, _c;
|
|
1196
1417
|
log6("onClose", {
|
|
1197
1418
|
err
|
|
1198
1419
|
}, {
|
|
1199
|
-
F:
|
|
1420
|
+
F: __dxlog_file7,
|
|
1200
1421
|
L: 177,
|
|
1201
1422
|
S: this,
|
|
1202
1423
|
C: (f, a) => f(...a)
|
|
1203
1424
|
});
|
|
1204
|
-
await
|
|
1425
|
+
await this.callbacks.onClose?.();
|
|
1205
1426
|
this.closed.wake();
|
|
1206
1427
|
for (const [streamTag, stream] of Object.entries(this._streams)) {
|
|
1207
1428
|
log6("closing stream", {
|
|
1208
1429
|
streamTag
|
|
1209
1430
|
}, {
|
|
1210
|
-
F:
|
|
1431
|
+
F: __dxlog_file7,
|
|
1211
1432
|
L: 181,
|
|
1212
1433
|
S: this,
|
|
1213
1434
|
C: (f, a) => f(...a)
|
|
@@ -1215,7 +1436,7 @@ var TestExtensionWithStreams = class {
|
|
|
1215
1436
|
clearTimeout(stream.interval);
|
|
1216
1437
|
stream.networkStream.destroy();
|
|
1217
1438
|
}
|
|
1218
|
-
await
|
|
1439
|
+
await this._rpc?.close();
|
|
1219
1440
|
}
|
|
1220
1441
|
async addNewStream(streamLoadInterval, streamLoadChunkSize, streamTag) {
|
|
1221
1442
|
await this.open.wait({
|
|
@@ -1229,7 +1450,15 @@ var TestExtensionWithStreams = class {
|
|
|
1229
1450
|
streamLoadInterval,
|
|
1230
1451
|
streamLoadChunkSize
|
|
1231
1452
|
});
|
|
1232
|
-
|
|
1453
|
+
invariant6(data === streamTag, void 0, {
|
|
1454
|
+
F: __dxlog_file7,
|
|
1455
|
+
L: 198,
|
|
1456
|
+
S: this,
|
|
1457
|
+
A: [
|
|
1458
|
+
"data === streamTag",
|
|
1459
|
+
""
|
|
1460
|
+
]
|
|
1461
|
+
});
|
|
1233
1462
|
await this._openStream(streamTag, streamLoadInterval, streamLoadChunkSize);
|
|
1234
1463
|
return streamTag;
|
|
1235
1464
|
}
|
|
@@ -1240,7 +1469,15 @@ var TestExtensionWithStreams = class {
|
|
|
1240
1469
|
const { data, bytesSent, bytesReceived, sendErrors, receiveErrors, runningTime } = await this._rpc.rpc.TestServiceWithStreams.closeTestStream({
|
|
1241
1470
|
data: streamTag
|
|
1242
1471
|
});
|
|
1243
|
-
|
|
1472
|
+
invariant6(data === streamTag, void 0, {
|
|
1473
|
+
F: __dxlog_file7,
|
|
1474
|
+
L: 211,
|
|
1475
|
+
S: this,
|
|
1476
|
+
A: [
|
|
1477
|
+
"data === streamTag",
|
|
1478
|
+
""
|
|
1479
|
+
]
|
|
1480
|
+
});
|
|
1244
1481
|
const local = this._closeStream(streamTag);
|
|
1245
1482
|
return {
|
|
1246
1483
|
streamTag,
|
|
@@ -1260,8 +1497,7 @@ var TestExtensionWithStreams = class {
|
|
|
1260
1497
|
* Force-close the connection.
|
|
1261
1498
|
*/
|
|
1262
1499
|
async closeConnection(err) {
|
|
1263
|
-
|
|
1264
|
-
(_a = this.extensionContext) == null ? void 0 : _a.close(err);
|
|
1500
|
+
this.extensionContext?.close(err);
|
|
1265
1501
|
}
|
|
1266
1502
|
};
|
|
1267
1503
|
|
|
@@ -1277,4 +1513,4 @@ export {
|
|
|
1277
1513
|
TestExtension,
|
|
1278
1514
|
TestExtensionWithStreams
|
|
1279
1515
|
};
|
|
1280
|
-
//# sourceMappingURL=chunk-
|
|
1516
|
+
//# sourceMappingURL=chunk-2MN5W64H.mjs.map
|