@dxos/network-manager 0.1.53-next.e9dc2bc → 0.1.54-main.270ec56

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.
@@ -2284,6 +2284,7 @@ var TestWireProtocol = class {
2284
2284
  constructor(peerId) {
2285
2285
  this.peerId = peerId;
2286
2286
  this.connections = new import_util9.ComplexMap(import_keys12.PublicKey.hash);
2287
+ this.streamConnections = new import_util9.ComplexMap(import_keys12.PublicKey.hash);
2287
2288
  this.connected = new import_async10.Event();
2288
2289
  this.disconnected = new import_async10.Event();
2289
2290
  this.factory = createTeleportProtocolFactory(async (teleport) => {
@@ -2291,7 +2292,7 @@ var TestWireProtocol = class {
2291
2292
  remotePeerId: teleport.remotePeerId
2292
2293
  }, {
2293
2294
  F: __dxlog_file11,
2294
- L: 21,
2295
+ L: 23,
2295
2296
  S: this,
2296
2297
  C: (f, a) => f(...a)
2297
2298
  });
@@ -2304,6 +2305,13 @@ var TestWireProtocol = class {
2304
2305
  this.connections.set(teleport.remotePeerId, extension);
2305
2306
  teleport.addExtension("test", extension);
2306
2307
  this.connected.emit(teleport.remotePeerId);
2308
+ const streamExtension = new import_teleport2.TestExtensionWithStreams({
2309
+ onClose: async () => {
2310
+ this.streamConnections.delete(teleport.remotePeerId);
2311
+ }
2312
+ });
2313
+ this.streamConnections.set(teleport.remotePeerId, streamExtension);
2314
+ teleport.addExtension("test-stream", streamExtension);
2307
2315
  });
2308
2316
  }
2309
2317
  async waitForConnection(peerId) {
@@ -2314,7 +2322,7 @@ var TestWireProtocol = class {
2314
2322
  peerId
2315
2323
  }, {
2316
2324
  F: __dxlog_file11,
2317
- L: 37,
2325
+ L: 47,
2318
2326
  S: this,
2319
2327
  C: (f, a) => f(...a)
2320
2328
  });
@@ -2329,6 +2337,20 @@ var TestWireProtocol = class {
2329
2337
  const connection = await this.waitForConnection(peerId);
2330
2338
  await connection.test(message);
2331
2339
  }
2340
+ async startStream(peerId, streamTag, streamLoadInterval, streamLoadChunkSize) {
2341
+ if (!this.streamConnections.has(peerId)) {
2342
+ throw new Error("Connection does not exist.");
2343
+ }
2344
+ const connection = this.streamConnections.get(peerId);
2345
+ return connection.addNewStream(streamLoadInterval, streamLoadChunkSize, streamTag);
2346
+ }
2347
+ async closeStream(peerId, streamTag) {
2348
+ if (!this.streamConnections.has(peerId)) {
2349
+ throw new Error("Connection does not exist.");
2350
+ }
2351
+ const connection = this.streamConnections.get(peerId);
2352
+ return connection.closeStream(streamTag);
2353
+ }
2332
2354
  };
2333
2355
 
2334
2356
  // packages/core/mesh/network-manager/src/testing/test-builder.ts