@dxos/network-manager 0.8.4-main.72ec0f3 → 0.8.4-main.7ace549

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/network-manager",
3
- "version": "0.8.4-main.72ec0f3",
3
+ "version": "0.8.4-main.7ace549",
4
4
  "description": "Network Manager",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -71,26 +71,26 @@
71
71
  ],
72
72
  "dependencies": {
73
73
  "node-datachannel": "^0.30.0",
74
- "@dxos/async": "0.8.4-main.72ec0f3",
75
- "@dxos/context": "0.8.4-main.72ec0f3",
76
- "@dxos/codec-protobuf": "0.8.4-main.72ec0f3",
77
- "@dxos/debug": "0.8.4-main.72ec0f3",
78
- "@dxos/invariant": "0.8.4-main.72ec0f3",
79
- "@dxos/keys": "0.8.4-main.72ec0f3",
80
- "@dxos/log": "0.8.4-main.72ec0f3",
81
- "@dxos/messaging": "0.8.4-main.72ec0f3",
82
- "@dxos/node-std": "0.8.4-main.72ec0f3",
83
- "@dxos/protocols": "0.8.4-main.72ec0f3",
84
- "@dxos/rpc": "0.8.4-main.72ec0f3",
85
- "@dxos/teleport": "0.8.4-main.72ec0f3",
86
- "@dxos/tracing": "0.8.4-main.72ec0f3",
87
- "@dxos/util": "0.8.4-main.72ec0f3"
74
+ "@dxos/async": "0.8.4-main.7ace549",
75
+ "@dxos/codec-protobuf": "0.8.4-main.7ace549",
76
+ "@dxos/context": "0.8.4-main.7ace549",
77
+ "@dxos/invariant": "0.8.4-main.7ace549",
78
+ "@dxos/debug": "0.8.4-main.7ace549",
79
+ "@dxos/keys": "0.8.4-main.7ace549",
80
+ "@dxos/log": "0.8.4-main.7ace549",
81
+ "@dxos/messaging": "0.8.4-main.7ace549",
82
+ "@dxos/node-std": "0.8.4-main.7ace549",
83
+ "@dxos/protocols": "0.8.4-main.7ace549",
84
+ "@dxos/teleport": "0.8.4-main.7ace549",
85
+ "@dxos/tracing": "0.8.4-main.7ace549",
86
+ "@dxos/rpc": "0.8.4-main.7ace549",
87
+ "@dxos/util": "0.8.4-main.7ace549"
88
88
  },
89
89
  "devDependencies": {
90
90
  "fetch-mock": "^11.0.0",
91
- "@dxos/edge-client": "0.8.4-main.72ec0f3",
92
- "@dxos/signal": "0.8.4-main.72ec0f3",
93
- "@dxos/keyring": "0.8.4-main.72ec0f3"
91
+ "@dxos/edge-client": "0.8.4-main.7ace549",
92
+ "@dxos/keyring": "0.8.4-main.7ace549",
93
+ "@dxos/signal": "0.8.4-main.7ace549"
94
94
  },
95
95
  "publishConfig": {
96
96
  "access": "public"
@@ -185,16 +185,18 @@ export class Connection {
185
185
  this._protocol.stream.on('close', () => {
186
186
  log('protocol stream closed');
187
187
  this._protocolClosed.wake();
188
- this.close({ error: new ProtocolError('protocol stream closed') }).catch((err) => this.errors.raise(err));
188
+ this.close({ error: new ProtocolError({ message: 'protocol stream closed' }) }).catch((err) =>
189
+ this.errors.raise(err),
190
+ );
189
191
  });
190
192
 
191
193
  scheduleTask(
192
194
  this.connectedTimeoutContext,
193
195
  async () => {
194
196
  log.info(`timeout waiting ${TRANSPORT_CONNECTION_TIMEOUT / 1000}s for transport to connect, aborting`);
195
- await this.abort(new TimeoutError(`${TRANSPORT_CONNECTION_TIMEOUT / 1000}s for transport to connect`)).catch(
196
- (err) => this.errors.raise(err),
197
- );
197
+ await this.abort(
198
+ new TimeoutError({ message: `${TRANSPORT_CONNECTION_TIMEOUT / 1000}s for transport to connect` }),
199
+ ).catch((err) => this.errors.raise(err));
198
200
  },
199
201
  TRANSPORT_CONNECTION_TIMEOUT,
200
202
  );
@@ -397,7 +399,7 @@ export class Connection {
397
399
 
398
400
  // If signal fails treat connection as failed
399
401
  log.info('signal message failed to deliver', { err });
400
- await this.close({ error: new ConnectivityError('signal message failed to deliver', err) });
402
+ await this.close({ error: new ConnectivityError({ message: 'signal message failed to deliver', cause: err }) });
401
403
  }
402
404
  }
403
405
 
package/src/swarm/peer.ts CHANGED
@@ -20,7 +20,7 @@ import { type ConnectionLimiter } from './connection-limiter';
20
20
 
21
21
  export class ConnectionDisplacedError extends SystemError {
22
22
  constructor() {
23
- super('Connection displaced by remote initiator.');
23
+ super({ message: 'Connection displaced by remote initiator.' });
24
24
  }
25
25
  }
26
26
 
@@ -469,7 +469,7 @@ type IceCandidateErrorDetails = { url: string; errorCode: number; errorText: str
469
469
 
470
470
  const createIceFailureError = (details: IceCandidateErrorDetails[]) => {
471
471
  const candidateErrors = details.map(({ url, errorCode, errorText }) => `${errorCode} ${url}: ${errorText}`);
472
- return new ConnectivityError(`ICE failed:\n${candidateErrors.join('\n')}`);
472
+ return new ConnectivityError({ message: `ICE failed:\n${candidateErrors.join('\n')}` });
473
473
  };
474
474
 
475
475
  type ChannelCreatedCallback = {
@@ -71,7 +71,7 @@ export class RtcTransportChannel extends Resource implements Transport {
71
71
  const error =
72
72
  err instanceof Error
73
73
  ? err
74
- : new ConnectivityError(`Failed to create a channel: ${JSON.stringify(err?.message)}`);
74
+ : new ConnectivityError({ message: `Failed to create a channel: ${JSON.stringify(err?.message)}` });
75
75
  this.errors.raise(error);
76
76
  } else {
77
77
  log.verbose('connection establishment failed after transport was closed', { err });
@@ -176,7 +176,9 @@ export class RtcTransportProxy extends Resource implements Transport {
176
176
  } catch (error) {
177
177
  const type = signalEvent.payload.payload.data?.type;
178
178
  if (type === 'offer' || type === 'answer') {
179
- this._raiseIfOpen(new ConnectivityError(`Session establishment failed: ${type} couldn't be sent.`));
179
+ this._raiseIfOpen(
180
+ new ConnectivityError({ message: `Session establishment failed: ${type} couldn't be sent.` }),
181
+ );
180
182
  }
181
183
  }
182
184
  }
@@ -255,11 +257,11 @@ export class RtcTransportProxyFactory implements TransportFactory {
255
257
  const decodeError = (err: Error | string) => {
256
258
  const message = typeof err === 'string' ? err : err.message;
257
259
  if (message.includes('CONNECTION_RESET')) {
258
- return new ConnectionResetError(message);
260
+ return new ConnectionResetError({ message });
259
261
  } else if (message.includes('TIMEOUT')) {
260
- return new TimeoutError(message);
262
+ return new TimeoutError({ message });
261
263
  } else if (message.includes('CONNECTIVITY_ERROR')) {
262
- return new ConnectivityError(message);
264
+ return new ConnectivityError({ message });
263
265
  } else {
264
266
  return typeof err === 'string' ? new Error(err) : err;
265
267
  }