@automerge/subduction 0.7.0-alpha.1 → 0.8.1

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.
@@ -2,53 +2,115 @@
2
2
  import { tryIntoJsSedimentreeIdsArray } from './snippets/sedimentree_wasm-68c0499598a3382c/inline2.js';
3
3
 
4
4
  /**
5
- * A transport-erased authenticated connection.
5
+ * An authenticated HTTP long-poll transport.
6
6
  *
7
- * Wraps an [`Authenticated<JsConnection>`] and is the common type
7
+ * This wrapper proves that the transport has completed the Subduction handshake
8
+ * and the peer identity has been cryptographically verified.
9
+ *
10
+ * Obtain via [`SubductionLongPoll::tryConnect`] or [`SubductionLongPoll::tryDiscover`].
11
+ */
12
+ export class AuthenticatedLongPoll {
13
+ static __wrap(ptr) {
14
+ ptr = ptr >>> 0;
15
+ const obj = Object.create(AuthenticatedLongPoll.prototype);
16
+ obj.__wbg_ptr = ptr;
17
+ AuthenticatedLongPollFinalization.register(obj, obj.__wbg_ptr, obj);
18
+ return obj;
19
+ }
20
+ __destroy_into_raw() {
21
+ const ptr = this.__wbg_ptr;
22
+ this.__wbg_ptr = 0;
23
+ AuthenticatedLongPollFinalization.unregister(this);
24
+ return ptr;
25
+ }
26
+ free() {
27
+ const ptr = this.__destroy_into_raw();
28
+ wasm.__wbg_authenticatedlongpoll_free(ptr, 0);
29
+ }
30
+ /**
31
+ * The verified peer identity.
32
+ * @returns {PeerId}
33
+ */
34
+ get peerId() {
35
+ const ret = wasm.authenticatedlongpoll_peerId(this.__wbg_ptr);
36
+ return PeerId.__wrap(ret);
37
+ }
38
+ /**
39
+ * The session ID assigned by the server.
40
+ * @returns {string}
41
+ */
42
+ get sessionId() {
43
+ let deferred1_0;
44
+ let deferred1_1;
45
+ try {
46
+ const ret = wasm.authenticatedlongpoll_sessionId(this.__wbg_ptr);
47
+ deferred1_0 = ret[0];
48
+ deferred1_1 = ret[1];
49
+ return getStringFromWasm0(ret[0], ret[1]);
50
+ } finally {
51
+ wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
52
+ }
53
+ }
54
+ /**
55
+ * Convert to a transport-erased [`AuthenticatedTransport`](super::WasmAuthenticatedTransport).
56
+ * @returns {AuthenticatedTransport}
57
+ */
58
+ toTransport() {
59
+ const ptr = this.__destroy_into_raw();
60
+ const ret = wasm.authenticatedlongpoll_toTransport(ptr);
61
+ return AuthenticatedTransport.__wrap(ret);
62
+ }
63
+ }
64
+ if (Symbol.dispose) AuthenticatedLongPoll.prototype[Symbol.dispose] = AuthenticatedLongPoll.prototype.free;
65
+
66
+ /**
67
+ * A transport-erased authenticated transport.
68
+ *
69
+ * Wraps an [`Authenticated<MessageTransport<JsTransport>>`] and is the common type
8
70
  * accepted by [`addConnection`](crate::subduction::WasmSubduction::add_connection).
9
71
  *
10
72
  * # Construction
11
73
  *
12
- * There are three ways to obtain an `AuthenticatedConnection`:
74
+ * There are three ways to obtain an `AuthenticatedTransport`:
13
75
  *
14
- * 1. **Custom transport** — implement [`HandshakeConnection`](handshake::JsHandshakeConnection)
15
- * (extends `Connection` with `sendBytes`/`recvBytes`) and call [`setup`](Self::setup):
76
+ * 1. **Custom transport** — implement the `Transport` interface
77
+ * (`sendBytes`/`recvBytes`/`disconnect`) and call [`setup`](Self::setup):
16
78
  *
17
79
  * ```js
18
- * const auth = await AuthenticatedConnection.setup(myConn, signer, peerId);
80
+ * const auth = await AuthenticatedTransport.setup(myTransport, signer, peerId);
19
81
  * ```
20
82
  *
21
83
  * 2. **From WebSocket** — authenticate via [`SubductionWebSocket`] then convert:
22
84
  *
23
85
  * ```js
24
86
  * const wsAuth = await SubductionWebSocket.tryConnect(url, signer, peerId, timeout);
25
- * const auth = wsAuth.toConnection();
87
+ * const auth = wsAuth.toTransport();
26
88
  * ```
27
89
  *
28
90
  * 3. **From HTTP long-poll** — same pattern via [`SubductionLongPoll`]:
29
91
  *
30
92
  * ```js
31
93
  * const lpAuth = await SubductionLongPoll.tryConnect(url, signer, peerId, timeout);
32
- * const auth = lpAuth.toConnection();
94
+ * const auth = lpAuth.toTransport();
33
95
  * ```
34
96
  */
35
- export class AuthenticatedConnection {
97
+ export class AuthenticatedTransport {
36
98
  static __wrap(ptr) {
37
99
  ptr = ptr >>> 0;
38
- const obj = Object.create(AuthenticatedConnection.prototype);
100
+ const obj = Object.create(AuthenticatedTransport.prototype);
39
101
  obj.__wbg_ptr = ptr;
40
- AuthenticatedConnectionFinalization.register(obj, obj.__wbg_ptr, obj);
102
+ AuthenticatedTransportFinalization.register(obj, obj.__wbg_ptr, obj);
41
103
  return obj;
42
104
  }
43
105
  __destroy_into_raw() {
44
106
  const ptr = this.__wbg_ptr;
45
107
  this.__wbg_ptr = 0;
46
- AuthenticatedConnectionFinalization.unregister(this);
108
+ AuthenticatedTransportFinalization.unregister(this);
47
109
  return ptr;
48
110
  }
49
111
  free() {
50
112
  const ptr = this.__destroy_into_raw();
51
- wasm.__wbg_authenticatedconnection_free(ptr, 0);
113
+ wasm.__wbg_authenticatedtransport_free(ptr, 0);
52
114
  }
53
115
  /**
54
116
  * Accept an incoming handshake over a custom transport (responder side).
@@ -58,20 +120,20 @@ export class AuthenticatedConnection {
58
120
  *
59
121
  * # Arguments
60
122
  *
61
- * * `connection` - A `HandshakeConnection` (extends `Connection`)
123
+ * * `transport` - A `Transport` implementing `sendBytes`/`recvBytes`/`disconnect`
62
124
  * * `signer` - The responder's signer for authentication
63
125
  * * `max_drift_seconds` - Maximum acceptable clock drift in seconds (default: 600)
64
126
  *
65
127
  * # Errors
66
128
  *
67
129
  * Returns a [`HandshakeError`](WasmHandshakeError) if the handshake fails.
68
- * @param {HandshakeConnection} connection
130
+ * @param {Transport} transport
69
131
  * @param {any} signer
70
132
  * @param {number | null} [max_drift_seconds]
71
- * @returns {Promise<AuthenticatedConnection>}
133
+ * @returns {Promise<AuthenticatedTransport>}
72
134
  */
73
- static accept(connection, signer, max_drift_seconds) {
74
- const ret = wasm.authenticatedconnection_accept(connection, signer, isLikeNone(max_drift_seconds) ? 0x100000001 : (max_drift_seconds) >>> 0);
135
+ static accept(transport, signer, max_drift_seconds) {
136
+ const ret = wasm.authenticatedtransport_accept(transport, signer, isLikeNone(max_drift_seconds) ? 0x100000001 : (max_drift_seconds) >>> 0);
75
137
  return ret;
76
138
  }
77
139
  /**
@@ -79,103 +141,71 @@ export class AuthenticatedConnection {
79
141
  * @returns {PeerId}
80
142
  */
81
143
  get peerId() {
82
- const ret = wasm.authenticatedconnection_peerId(this.__wbg_ptr);
144
+ const ret = wasm.authenticatedtransport_peerId(this.__wbg_ptr);
83
145
  return PeerId.__wrap(ret);
84
146
  }
85
147
  /**
86
148
  * Run the Subduction handshake over a custom transport, producing an
87
- * authenticated connection.
149
+ * authenticated transport.
88
150
  *
89
- * The `connection` object must implement both `HandshakeConnection`
90
- * (for the handshake phase) and `Connection` (for post-handshake
91
- * communication). The same object is used for both phases.
151
+ * The `transport` object must implement the `Transport` interface
152
+ * (`sendBytes`/`recvBytes`/`disconnect`).
153
+ * The same object is used for both the handshake phase and post-handshake
154
+ * communication.
92
155
  *
93
156
  * # Arguments
94
157
  *
95
- * * `connection` - A `HandshakeConnection` (extends `Connection`)
158
+ * * `transport` - A `Transport` implementing `sendBytes`/`recvBytes`/`disconnect`
96
159
  * * `signer` - The client's signer for authentication
97
160
  * * `expected_peer_id` - The expected server peer ID (verified during handshake)
98
161
  *
99
162
  * # Errors
100
163
  *
101
164
  * Returns a [`HandshakeError`](WasmHandshakeError) if the handshake fails.
102
- * @param {HandshakeConnection} connection
165
+ * @param {Transport} transport
103
166
  * @param {any} signer
104
167
  * @param {PeerId} expected_peer_id
105
- * @returns {Promise<AuthenticatedConnection>}
168
+ * @returns {Promise<AuthenticatedTransport>}
106
169
  */
107
- static setup(connection, signer, expected_peer_id) {
170
+ static setup(transport, signer, expected_peer_id) {
108
171
  _assertClass(expected_peer_id, PeerId);
109
- const ret = wasm.authenticatedconnection_setup(connection, signer, expected_peer_id.__wbg_ptr);
172
+ const ret = wasm.authenticatedtransport_setup(transport, signer, expected_peer_id.__wbg_ptr);
110
173
  return ret;
111
174
  }
112
- }
113
- if (Symbol.dispose) AuthenticatedConnection.prototype[Symbol.dispose] = AuthenticatedConnection.prototype.free;
114
-
115
- /**
116
- * An authenticated HTTP long-poll connection.
117
- *
118
- * This wrapper proves that the connection has completed the Subduction handshake
119
- * and the peer identity has been cryptographically verified.
120
- *
121
- * Obtain via [`SubductionLongPoll::tryConnect`] or [`SubductionLongPoll::tryDiscover`].
122
- */
123
- export class AuthenticatedLongPoll {
124
- static __wrap(ptr) {
125
- ptr = ptr >>> 0;
126
- const obj = Object.create(AuthenticatedLongPoll.prototype);
127
- obj.__wbg_ptr = ptr;
128
- AuthenticatedLongPollFinalization.register(obj, obj.__wbg_ptr, obj);
129
- return obj;
130
- }
131
- __destroy_into_raw() {
132
- const ptr = this.__wbg_ptr;
133
- this.__wbg_ptr = 0;
134
- AuthenticatedLongPollFinalization.unregister(this);
135
- return ptr;
136
- }
137
- free() {
138
- const ptr = this.__destroy_into_raw();
139
- wasm.__wbg_authenticatedlongpoll_free(ptr, 0);
140
- }
141
- /**
142
- * The verified peer identity.
143
- * @returns {PeerId}
144
- */
145
- get peerId() {
146
- const ret = wasm.authenticatedlongpoll_peerId(this.__wbg_ptr);
147
- return PeerId.__wrap(ret);
148
- }
149
- /**
150
- * The session ID assigned by the server.
151
- * @returns {string}
152
- */
153
- get sessionId() {
154
- let deferred1_0;
155
- let deferred1_1;
156
- try {
157
- const ret = wasm.authenticatedlongpoll_sessionId(this.__wbg_ptr);
158
- deferred1_0 = ret[0];
159
- deferred1_1 = ret[1];
160
- return getStringFromWasm0(ret[0], ret[1]);
161
- } finally {
162
- wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
163
- }
164
- }
165
175
  /**
166
- * Convert to a transport-erased [`AuthenticatedConnection`](super::WasmAuthenticatedConnection).
167
- * @returns {AuthenticatedConnection}
176
+ * Run the Subduction handshake over a custom transport using discovery
177
+ * mode, producing an authenticated transport.
178
+ *
179
+ * Unlike [`setup`](Self::setup) which requires a known peer ID,
180
+ * this method discovers the peer's identity during the handshake
181
+ * using a shared service name.
182
+ *
183
+ * # Arguments
184
+ *
185
+ * * `transport` - A `Transport` implementing `sendBytes`/`recvBytes`/`disconnect`
186
+ * * `signer` - The client's signer for authentication
187
+ * * `service_name` - Shared service name for discovery.
188
+ * Defaults to [`DEFAULT_LOCAL_SERVICE_NAME`] (`"subduction:local"`) if omitted.
189
+ *
190
+ * # Errors
191
+ *
192
+ * Returns a [`HandshakeError`](WasmHandshakeError) if the handshake fails.
193
+ * @param {Transport} transport
194
+ * @param {any} signer
195
+ * @param {string | null} [service_name]
196
+ * @returns {Promise<AuthenticatedTransport>}
168
197
  */
169
- toConnection() {
170
- const ptr = this.__destroy_into_raw();
171
- const ret = wasm.authenticatedlongpoll_toConnection(ptr);
172
- return AuthenticatedConnection.__wrap(ret);
198
+ static setupDiscover(transport, signer, service_name) {
199
+ var ptr0 = isLikeNone(service_name) ? 0 : passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
200
+ var len0 = WASM_VECTOR_LEN;
201
+ const ret = wasm.authenticatedtransport_setupDiscover(transport, signer, ptr0, len0);
202
+ return ret;
173
203
  }
174
204
  }
175
- if (Symbol.dispose) AuthenticatedLongPoll.prototype[Symbol.dispose] = AuthenticatedLongPoll.prototype.free;
205
+ if (Symbol.dispose) AuthenticatedTransport.prototype[Symbol.dispose] = AuthenticatedTransport.prototype.free;
176
206
 
177
207
  /**
178
- * An authenticated WebSocket connection.
208
+ * An authenticated WebSocket transport.
179
209
  *
180
210
  * This wrapper proves that the connection has completed the Subduction handshake
181
211
  * and the peer identity has been cryptographically verified.
@@ -210,13 +240,13 @@ export class AuthenticatedWebSocket {
210
240
  return PeerId.__wrap(ret);
211
241
  }
212
242
  /**
213
- * Convert to a transport-erased [`AuthenticatedConnection`](super::WasmAuthenticatedConnection).
214
- * @returns {AuthenticatedConnection}
243
+ * Convert to a transport-erased [`AuthenticatedTransport`](super::WasmAuthenticatedTransport).
244
+ * @returns {AuthenticatedTransport}
215
245
  */
216
- toConnection() {
246
+ toTransport() {
217
247
  const ptr = this.__destroy_into_raw();
218
- const ret = wasm.authenticatedwebsocket_toConnection(ptr);
219
- return AuthenticatedConnection.__wrap(ret);
248
+ const ret = wasm.authenticatedwebsocket_toTransport(ptr);
249
+ return AuthenticatedTransport.__wrap(ret);
220
250
  }
221
251
  }
222
252
  if (Symbol.dispose) AuthenticatedWebSocket.prototype[Symbol.dispose] = AuthenticatedWebSocket.prototype.free;
@@ -461,63 +491,6 @@ export class CommitWithBlob {
461
491
  }
462
492
  if (Symbol.dispose) CommitWithBlob.prototype[Symbol.dispose] = CommitWithBlob.prototype.free;
463
493
 
464
- /**
465
- * A pair of a connection and an error that occurred during a call.
466
- */
467
- export class ConnErrorPair {
468
- static __wrap(ptr) {
469
- ptr = ptr >>> 0;
470
- const obj = Object.create(ConnErrorPair.prototype);
471
- obj.__wbg_ptr = ptr;
472
- ConnErrorPairFinalization.register(obj, obj.__wbg_ptr, obj);
473
- return obj;
474
- }
475
- __destroy_into_raw() {
476
- const ptr = this.__wbg_ptr;
477
- this.__wbg_ptr = 0;
478
- ConnErrorPairFinalization.unregister(this);
479
- return ptr;
480
- }
481
- free() {
482
- const ptr = this.__destroy_into_raw();
483
- wasm.__wbg_connerrorpair_free(ptr, 0);
484
- }
485
- /**
486
- * The connection that encountered the error.
487
- * @returns {Connection}
488
- */
489
- get conn() {
490
- const ret = wasm.connerrorpair_conn(this.__wbg_ptr);
491
- return ret;
492
- }
493
- /**
494
- * The error that occurred during the call.
495
- * @returns {Error}
496
- */
497
- get err() {
498
- const ret = wasm.connerrorpair_err(this.__wbg_ptr);
499
- return ret;
500
- }
501
- }
502
- if (Symbol.dispose) ConnErrorPair.prototype[Symbol.dispose] = ConnErrorPair.prototype.free;
503
-
504
- /**
505
- * A Wasm wrapper around the Rust `ConnectionId` type.
506
- */
507
- export class ConnectionId {
508
- __destroy_into_raw() {
509
- const ptr = this.__wbg_ptr;
510
- this.__wbg_ptr = 0;
511
- ConnectionIdFinalization.unregister(this);
512
- return ptr;
513
- }
514
- free() {
515
- const ptr = this.__destroy_into_raw();
516
- wasm.__wbg_connectionid_free(ptr, 0);
517
- }
518
- }
519
- if (Symbol.dispose) ConnectionId.prototype[Symbol.dispose] = ConnectionId.prototype.free;
520
-
521
494
  /**
522
495
  * A JavaScript wrapper around `Depth`.
523
496
  */
@@ -1361,366 +1334,128 @@ export class MemoryStorage {
1361
1334
  if (Symbol.dispose) MemoryStorage.prototype[Symbol.dispose] = MemoryStorage.prototype.free;
1362
1335
 
1363
1336
  /**
1364
- * Wasm wrapper for [`Message`].
1337
+ * A `Transport` backed by a `MessagePort` (or any object with
1338
+ * `postMessage` / `onmessage` / `close`).
1339
+ *
1340
+ * Implements the byte-oriented `Transport` interface (`sendBytes`,
1341
+ * `recvBytes`, `disconnect`) using the port as the underlying channel.
1342
+ * After the handshake, the [`Authenticated`] wrapper provides the sync API.
1365
1343
  */
1366
- export class Message {
1344
+ export class MessagePortTransport {
1367
1345
  static __wrap(ptr) {
1368
1346
  ptr = ptr >>> 0;
1369
- const obj = Object.create(Message.prototype);
1347
+ const obj = Object.create(MessagePortTransport.prototype);
1370
1348
  obj.__wbg_ptr = ptr;
1371
- MessageFinalization.register(obj, obj.__wbg_ptr, obj);
1349
+ MessagePortTransportFinalization.register(obj, obj.__wbg_ptr, obj);
1372
1350
  return obj;
1373
1351
  }
1374
1352
  __destroy_into_raw() {
1375
1353
  const ptr = this.__wbg_ptr;
1376
1354
  this.__wbg_ptr = 0;
1377
- MessageFinalization.unregister(this);
1355
+ MessagePortTransportFinalization.unregister(this);
1378
1356
  return ptr;
1379
1357
  }
1380
1358
  free() {
1381
1359
  const ptr = this.__destroy_into_raw();
1382
- wasm.__wbg_message_free(ptr, 0);
1360
+ wasm.__wbg_messageporttransport_free(ptr, 0);
1383
1361
  }
1384
1362
  /**
1385
- * Upcasts; to the JS-import type for [`WasmMessage`].
1386
- * @returns {Message}
1363
+ * Disconnect (close the port).
1364
+ * @returns {Promise<any>}
1387
1365
  */
1388
- __wasm_refgen_toWasmMessage() {
1389
- const ret = wasm.message___wasm_refgen_toWasmMessage(this.__wbg_ptr);
1390
- return Message.__wrap(ret);
1366
+ disconnect() {
1367
+ const ret = wasm.messageporttransport_disconnect(this.__wbg_ptr);
1368
+ return ret;
1391
1369
  }
1392
1370
  /**
1393
- * Create a [`Message::BatchSyncRequest`] message.
1394
- * @param {BatchSyncRequest} request
1395
- * @returns {Message}
1371
+ * Create a new connection wrapping the given `MessagePort`.
1372
+ * @param {any} port
1396
1373
  */
1397
- static batchSyncRequest(request) {
1398
- _assertClass(request, BatchSyncRequest);
1399
- const ret = wasm.message_batchSyncRequest(request.__wbg_ptr);
1400
- return Message.__wrap(ret);
1374
+ constructor(port) {
1375
+ const ret = wasm.messageporttransport_new(port);
1376
+ this.__wbg_ptr = ret >>> 0;
1377
+ MessagePortTransportFinalization.register(this, this.__wbg_ptr, this);
1378
+ return this;
1401
1379
  }
1402
1380
  /**
1403
- * Create a [`Message::BatchSyncResponse`] message.
1404
- * @param {BatchSyncResponse} response
1405
- * @returns {Message}
1381
+ * Receive raw bytes (for the handshake phase).
1382
+ * @returns {Promise<any>}
1406
1383
  */
1407
- static batchSyncResponse(response) {
1408
- _assertClass(response, BatchSyncResponse);
1409
- const ret = wasm.message_batchSyncResponse(response.__wbg_ptr);
1410
- return Message.__wrap(ret);
1384
+ recvBytes() {
1385
+ const ret = wasm.messageporttransport_recvBytes(this.__wbg_ptr);
1386
+ return ret;
1411
1387
  }
1412
1388
  /**
1413
- * The [`Blob`] for commit or fragment messages, if applicable.
1414
- * @returns {Uint8Array | undefined}
1389
+ * Send raw bytes (for the handshake phase).
1390
+ * @param {Uint8Array} bytes
1391
+ * @returns {Promise<any>}
1415
1392
  */
1416
- get blob() {
1417
- const ret = wasm.message_blob(this.__wbg_ptr);
1393
+ sendBytes(bytes) {
1394
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
1395
+ const len0 = WASM_VECTOR_LEN;
1396
+ const ret = wasm.messageporttransport_sendBytes(this.__wbg_ptr, ptr0, len0);
1418
1397
  return ret;
1419
1398
  }
1399
+ }
1400
+ if (Symbol.dispose) MessagePortTransport.prototype[Symbol.dispose] = MessagePortTransport.prototype.free;
1401
+
1402
+ /**
1403
+ * A 64-bit nonce represented as big-endian bytes.
1404
+ */
1405
+ export class Nonce {
1406
+ static __wrap(ptr) {
1407
+ ptr = ptr >>> 0;
1408
+ const obj = Object.create(Nonce.prototype);
1409
+ obj.__wbg_ptr = ptr;
1410
+ NonceFinalization.register(obj, obj.__wbg_ptr, obj);
1411
+ return obj;
1412
+ }
1413
+ __destroy_into_raw() {
1414
+ const ptr = this.__wbg_ptr;
1415
+ this.__wbg_ptr = 0;
1416
+ NonceFinalization.unregister(this);
1417
+ return ptr;
1418
+ }
1419
+ free() {
1420
+ const ptr = this.__destroy_into_raw();
1421
+ wasm.__wbg_nonce_free(ptr, 0);
1422
+ }
1420
1423
  /**
1421
- * The [`Blob`]s for a [`Message::BlobsResponse`], if applicable.
1422
- * @returns {Uint8Array[] | undefined}
1424
+ * Get the nonce as big-endian bytes.
1425
+ * @returns {Uint8Array}
1423
1426
  */
1424
- get blobs() {
1425
- const ret = wasm.message_blobs(this.__wbg_ptr);
1426
- let v1;
1427
- if (ret[0] !== 0) {
1428
- v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1429
- wasm.__wbindgen_export5(ret[0], ret[1] * 4, 4);
1430
- }
1427
+ get bytes() {
1428
+ const ret = wasm.nonce_bytes(this.__wbg_ptr);
1429
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1430
+ wasm.__wbindgen_export5(ret[0], ret[1] * 1, 1);
1431
1431
  return v1;
1432
1432
  }
1433
1433
  /**
1434
- * Create a [`Message::BlobsRequest`] message.
1435
- * @param {SedimentreeId} id
1436
- * @param {Digest[]} digests
1437
- * @returns {Message}
1434
+ * Create a new [`WasmNonce`] from exactly 8 big-endian bytes.
1435
+ *
1436
+ * # Errors
1437
+ *
1438
+ * Returns [`WasmNonceError`] if the input is not exactly 8 bytes.
1439
+ * @param {Uint8Array} bytes
1438
1440
  */
1439
- static blobsRequest(id, digests) {
1440
- _assertClass(id, SedimentreeId);
1441
- const ptr0 = passArrayJsValueToWasm0(digests, wasm.__wbindgen_export);
1441
+ constructor(bytes) {
1442
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
1442
1443
  const len0 = WASM_VECTOR_LEN;
1443
- const ret = wasm.message_blobsRequest(id.__wbg_ptr, ptr0, len0);
1444
- return Message.__wrap(ret);
1444
+ const ret = wasm.nonce_new(ptr0, len0);
1445
+ if (ret[2]) {
1446
+ throw takeFromExternrefTable0(ret[1]);
1447
+ }
1448
+ this.__wbg_ptr = ret[0] >>> 0;
1449
+ NonceFinalization.register(this, this.__wbg_ptr, this);
1450
+ return this;
1445
1451
  }
1446
1452
  /**
1447
- * Create a [`Message::BlobsResponse`] message.
1448
- * @param {SedimentreeId} id
1449
- * @param {Uint8Array[]} blobs
1450
- * @returns {Message}
1451
- */
1452
- static blobsResponse(id, blobs) {
1453
- _assertClass(id, SedimentreeId);
1454
- const ptr0 = passArrayJsValueToWasm0(blobs, wasm.__wbindgen_export);
1455
- const len0 = WASM_VECTOR_LEN;
1456
- const ret = wasm.message_blobsResponse(id.__wbg_ptr, ptr0, len0);
1457
- return Message.__wrap(ret);
1458
- }
1459
- /**
1460
- * The [`LooseCommit`] for a [`Message::LooseCommit`], if applicable.
1461
- *
1462
- * Decodes the signed payload to extract the underlying commit.
1463
- * @returns {LooseCommit | undefined}
1464
- */
1465
- get commit() {
1466
- const ret = wasm.message_commit(this.__wbg_ptr);
1467
- return ret === 0 ? undefined : LooseCommit.__wrap(ret);
1468
- }
1469
- /**
1470
- * The requested [`Digest`]s for a [`Message::BlobsRequest`], if applicable.
1471
- * @returns {Digest[] | undefined}
1472
- */
1473
- get digests() {
1474
- const ret = wasm.message_digests(this.__wbg_ptr);
1475
- let v1;
1476
- if (ret[0] !== 0) {
1477
- v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1478
- wasm.__wbindgen_export5(ret[0], ret[1] * 4, 4);
1479
- }
1480
- return v1;
1481
- }
1482
- /**
1483
- * The [`Fragment`] for a [`Message::Fragment`], if applicable.
1484
- *
1485
- * Decodes the signed payload to extract the underlying fragment.
1486
- * @returns {Fragment | undefined}
1487
- */
1488
- get fragment() {
1489
- const ret = wasm.message_fragment(this.__wbg_ptr);
1490
- return ret === 0 ? undefined : Fragment.__wrap(ret);
1491
- }
1492
- /**
1493
- * Deserialize a message from bytes.
1494
- *
1495
- * # Errors
1496
- *
1497
- * Returns a [`JsMessageDeserializationError`] if deserialization fails.
1498
- * @param {Uint8Array} bytes
1499
- * @returns {Message}
1500
- */
1501
- static fromBytes(bytes) {
1502
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
1503
- const len0 = WASM_VECTOR_LEN;
1504
- const ret = wasm.message_fromBytes(ptr0, len0);
1505
- if (ret[2]) {
1506
- throw takeFromExternrefTable0(ret[1]);
1507
- }
1508
- return Message.__wrap(ret[0]);
1509
- }
1510
- /**
1511
- * The [`BatchSyncRequest`] for a [`Message::BatchSyncRequest`], if applicable.
1512
- * @returns {BatchSyncRequest | undefined}
1513
- */
1514
- get request() {
1515
- const ret = wasm.message_request(this.__wbg_ptr);
1516
- return ret === 0 ? undefined : BatchSyncRequest.__wrap(ret);
1517
- }
1518
- /**
1519
- * The [`BatchSyncResponse`] for a [`Message::BatchSyncResponse`], if applicable.
1520
- * @returns {BatchSyncResponse | undefined}
1521
- */
1522
- get response() {
1523
- const ret = wasm.message_response(this.__wbg_ptr);
1524
- return ret === 0 ? undefined : BatchSyncResponse.__wrap(ret);
1525
- }
1526
- /**
1527
- * The [`SedimentreeId`] associated with this message, if any.
1528
- * @returns {SedimentreeId | undefined}
1529
- */
1530
- get sedimentreeId() {
1531
- const ret = wasm.message_sedimentreeId(this.__wbg_ptr);
1532
- return ret === 0 ? undefined : SedimentreeId.__wrap(ret);
1533
- }
1534
- /**
1535
- * Serialize the message to bytes.
1536
- * @returns {Uint8Array}
1537
- */
1538
- toBytes() {
1539
- const ret = wasm.message_toBytes(this.__wbg_ptr);
1540
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1541
- wasm.__wbindgen_export5(ret[0], ret[1] * 1, 1);
1542
- return v1;
1543
- }
1544
- /**
1545
- * The message variant name.
1546
- * @returns {string}
1547
- */
1548
- get type() {
1549
- let deferred1_0;
1550
- let deferred1_1;
1551
- try {
1552
- const ret = wasm.message_type(this.__wbg_ptr);
1553
- deferred1_0 = ret[0];
1554
- deferred1_1 = ret[1];
1555
- return getStringFromWasm0(ret[0], ret[1]);
1556
- } finally {
1557
- wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
1558
- }
1559
- }
1560
- }
1561
- if (Symbol.dispose) Message.prototype[Symbol.dispose] = Message.prototype.free;
1562
-
1563
- /**
1564
- * A [`HandshakeConnection`] backed by a `MessagePort` (or any object with
1565
- * `postMessage` / `onmessage` / `close`).
1566
- *
1567
- * Implements the full `HandshakeConnection` interface (`sendBytes`,
1568
- * `recvBytes`, `send`, `recv`, `disconnect`) using the port for transport.
1569
- *
1570
- * `nextRequestId` and `call` return rejected promises — `MessagePort`
1571
- * connections are used for peer-to-peer handshakes, not RPC-style sync.
1572
- * After the handshake, the [`Authenticated`] wrapper provides the sync API.
1573
- */
1574
- export class MessagePortConnection {
1575
- static __wrap(ptr) {
1576
- ptr = ptr >>> 0;
1577
- const obj = Object.create(MessagePortConnection.prototype);
1578
- obj.__wbg_ptr = ptr;
1579
- MessagePortConnectionFinalization.register(obj, obj.__wbg_ptr, obj);
1580
- return obj;
1581
- }
1582
- __destroy_into_raw() {
1583
- const ptr = this.__wbg_ptr;
1584
- this.__wbg_ptr = 0;
1585
- MessagePortConnectionFinalization.unregister(this);
1586
- return ptr;
1587
- }
1588
- free() {
1589
- const ptr = this.__destroy_into_raw();
1590
- wasm.__wbg_messageportconnection_free(ptr, 0);
1591
- }
1592
- /**
1593
- * Not supported on `MessagePort` connections.
1594
- * @param {any} _request
1595
- * @param {number | null} [_timeout_ms]
1596
- * @returns {Promise<any>}
1597
- */
1598
- call(_request, _timeout_ms) {
1599
- const ret = wasm.messageportconnection_call(this.__wbg_ptr, _request, !isLikeNone(_timeout_ms), isLikeNone(_timeout_ms) ? 0 : _timeout_ms);
1600
- return ret;
1601
- }
1602
- /**
1603
- * Disconnect (close the port).
1604
- * @returns {Promise<any>}
1605
- */
1606
- disconnect() {
1607
- const ret = wasm.messageportconnection_disconnect(this.__wbg_ptr);
1608
- return ret;
1609
- }
1610
- /**
1611
- * Create a new connection wrapping the given `MessagePort`.
1612
- * @param {any} port
1613
- */
1614
- constructor(port) {
1615
- const ret = wasm.messageportconnection_new(port);
1616
- this.__wbg_ptr = ret >>> 0;
1617
- MessagePortConnectionFinalization.register(this, this.__wbg_ptr, this);
1618
- return this;
1619
- }
1620
- /**
1621
- * Not supported on `MessagePort` connections.
1622
- * @returns {Promise<any>}
1623
- */
1624
- nextRequestId() {
1625
- const ret = wasm.messageportconnection_nextRequestId(this.__wbg_ptr);
1626
- return ret;
1627
- }
1628
- /**
1629
- * Receive the next message.
1630
- * @returns {Promise<any>}
1631
- */
1632
- recv() {
1633
- const ret = wasm.messageportconnection_recv(this.__wbg_ptr);
1634
- return ret;
1635
- }
1636
- /**
1637
- * Receive raw bytes (for the handshake phase).
1638
- * @returns {Promise<any>}
1639
- */
1640
- recvBytes() {
1641
- const ret = wasm.messageportconnection_recvBytes(this.__wbg_ptr);
1642
- return ret;
1643
- }
1644
- /**
1645
- * Send a structured message (post-handshake).
1646
- * @param {any} message
1647
- * @returns {Promise<any>}
1648
- */
1649
- send(message) {
1650
- const ret = wasm.messageportconnection_send(this.__wbg_ptr, message);
1651
- return ret;
1652
- }
1653
- /**
1654
- * Send raw bytes (for the handshake phase).
1655
- * @param {Uint8Array} bytes
1656
- * @returns {Promise<any>}
1657
- */
1658
- sendBytes(bytes) {
1659
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
1660
- const len0 = WASM_VECTOR_LEN;
1661
- const ret = wasm.messageportconnection_sendBytes(this.__wbg_ptr, ptr0, len0);
1662
- return ret;
1663
- }
1664
- }
1665
- if (Symbol.dispose) MessagePortConnection.prototype[Symbol.dispose] = MessagePortConnection.prototype.free;
1666
-
1667
- /**
1668
- * A 64-bit nonce represented as big-endian bytes.
1669
- */
1670
- export class Nonce {
1671
- static __wrap(ptr) {
1672
- ptr = ptr >>> 0;
1673
- const obj = Object.create(Nonce.prototype);
1674
- obj.__wbg_ptr = ptr;
1675
- NonceFinalization.register(obj, obj.__wbg_ptr, obj);
1676
- return obj;
1677
- }
1678
- __destroy_into_raw() {
1679
- const ptr = this.__wbg_ptr;
1680
- this.__wbg_ptr = 0;
1681
- NonceFinalization.unregister(this);
1682
- return ptr;
1683
- }
1684
- free() {
1685
- const ptr = this.__destroy_into_raw();
1686
- wasm.__wbg_nonce_free(ptr, 0);
1687
- }
1688
- /**
1689
- * Get the nonce as big-endian bytes.
1690
- * @returns {Uint8Array}
1691
- */
1692
- get bytes() {
1693
- const ret = wasm.nonce_bytes(this.__wbg_ptr);
1694
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1695
- wasm.__wbindgen_export5(ret[0], ret[1] * 1, 1);
1696
- return v1;
1697
- }
1698
- /**
1699
- * Create a new [`WasmNonce`] from exactly 8 big-endian bytes.
1700
- *
1701
- * # Errors
1702
- *
1703
- * Returns [`WasmNonceError`] if the input is not exactly 8 bytes.
1704
- * @param {Uint8Array} bytes
1705
- */
1706
- constructor(bytes) {
1707
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
1708
- const len0 = WASM_VECTOR_LEN;
1709
- const ret = wasm.nonce_new(ptr0, len0);
1710
- if (ret[2]) {
1711
- throw takeFromExternrefTable0(ret[1]);
1712
- }
1713
- this.__wbg_ptr = ret[0] >>> 0;
1714
- NonceFinalization.register(this, this.__wbg_ptr, this);
1715
- return this;
1716
- }
1717
- /**
1718
- * Generate a random nonce.
1719
- *
1720
- * # Panics
1721
- *
1722
- * Panics if the system random number generator fails.
1723
- * @returns {Nonce}
1453
+ * Generate a random nonce.
1454
+ *
1455
+ * # Panics
1456
+ *
1457
+ * Panics if the system random number generator fails.
1458
+ * @returns {Nonce}
1724
1459
  */
1725
1460
  static random() {
1726
1461
  const ret = wasm.nonce_random();
@@ -1750,16 +1485,6 @@ export class PeerBatchSyncResult {
1750
1485
  const ptr = this.__destroy_into_raw();
1751
1486
  wasm.__wbg_peerbatchsyncresult_free(ptr, 0);
1752
1487
  }
1753
- /**
1754
- * List of connection errors that occurred during the batch sync.
1755
- * @returns {ConnErrorPair[]}
1756
- */
1757
- get connErrors() {
1758
- const ret = wasm.peerbatchsyncresult_connErrors(this.__wbg_ptr);
1759
- var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1760
- wasm.__wbindgen_export5(ret[0], ret[1] * 4, 4);
1761
- return v1;
1762
- }
1763
1488
  /**
1764
1489
  * Statistics about the sync operation.
1765
1490
  * @returns {SyncStats}
@@ -1776,6 +1501,16 @@ export class PeerBatchSyncResult {
1776
1501
  const ret = wasm.peerbatchsyncresult_success(this.__wbg_ptr);
1777
1502
  return ret !== 0;
1778
1503
  }
1504
+ /**
1505
+ * Errors that occurred during the batch sync.
1506
+ * @returns {Error[]}
1507
+ */
1508
+ get transportErrors() {
1509
+ const ret = wasm.peerbatchsyncresult_transportErrors(this.__wbg_ptr);
1510
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1511
+ wasm.__wbindgen_export5(ret[0], ret[1] * 4, 4);
1512
+ return v1;
1513
+ }
1779
1514
  }
1780
1515
  if (Symbol.dispose) PeerBatchSyncResult.prototype[Symbol.dispose] = PeerBatchSyncResult.prototype.free;
1781
1516
 
@@ -2274,6 +2009,30 @@ export class Subduction {
2274
2009
  const ptr = this.__destroy_into_raw();
2275
2010
  wasm.__wbg_subduction_free(ptr, 0);
2276
2011
  }
2012
+ /**
2013
+ * Accept a connection from a peer over any [`Transport`](JsTransport).
2014
+ *
2015
+ * Performs the responder side of the handshake, then adds the authenticated
2016
+ * connection. This is the counterpart to [`connectTransport`](Self::connect_transport).
2017
+ *
2018
+ * # Arguments
2019
+ *
2020
+ * * `transport` - Any JS object with `sendBytes`/`recvBytes`/`disconnect`
2021
+ * * `service_name` - Shared service name for discovery
2022
+ *
2023
+ * # Errors
2024
+ *
2025
+ * Returns an error if the handshake or connection fails.
2026
+ * @param {Transport} transport
2027
+ * @param {string} service_name
2028
+ * @returns {Promise<PeerId>}
2029
+ */
2030
+ acceptTransport(transport, service_name) {
2031
+ const ptr0 = passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2032
+ const len0 = WASM_VECTOR_LEN;
2033
+ const ret = wasm.subduction_acceptTransport(this.__wbg_ptr, transport, ptr0, len0);
2034
+ return ret;
2035
+ }
2277
2036
  /**
2278
2037
  * Add a commit with its associated blob to the storage.
2279
2038
  *
@@ -2296,15 +2055,15 @@ export class Subduction {
2296
2055
  return ret;
2297
2056
  }
2298
2057
  /**
2299
- * Onboard an authenticated connection: add it and sync all sedimentrees.
2058
+ * Onboard an authenticated transport: add it and sync all sedimentrees.
2300
2059
  *
2301
- * Accepts an [`AuthenticatedConnection`](WasmAuthenticatedConnection),
2302
- * obtained via [`AuthenticatedConnection.setup`](WasmAuthenticatedConnection::setup),
2303
- * [`AuthenticatedWebSocket.toConnection`], or [`AuthenticatedLongPoll.toConnection`].
2060
+ * Accepts an [`AuthenticatedTransport`](WasmAuthenticatedTransport),
2061
+ * obtained via [`AuthenticatedTransport.setup`](WasmAuthenticatedTransport::setup),
2062
+ * [`AuthenticatedWebSocket.toTransport`], or [`AuthenticatedLongPoll.toTransport`].
2304
2063
  *
2305
2064
  * Returns `true` if this is a new peer, `false` if already connected.
2306
2065
  *
2307
- * Add an authenticated connection to tracking.
2066
+ * Add an authenticated transport to tracking.
2308
2067
  *
2309
2068
  * This does not perform any synchronization. To sync after adding,
2310
2069
  * call [`fullSyncWithPeer`](Self::full_sync_with_peer).
@@ -2314,12 +2073,12 @@ export class Subduction {
2314
2073
  * # Errors
2315
2074
  *
2316
2075
  * Returns an error if the connection is rejected by the policy.
2317
- * @param {AuthenticatedConnection} conn
2076
+ * @param {AuthenticatedTransport} transport
2318
2077
  * @returns {Promise<boolean>}
2319
2078
  */
2320
- addConnection(conn) {
2321
- _assertClass(conn, AuthenticatedConnection);
2322
- const ret = wasm.subduction_addConnection(this.__wbg_ptr, conn.__wbg_ptr);
2079
+ addConnection(transport) {
2080
+ _assertClass(transport, AuthenticatedTransport);
2081
+ const ret = wasm.subduction_addConnection(this.__wbg_ptr, transport.__wbg_ptr);
2323
2082
  return ret;
2324
2083
  }
2325
2084
  /**
@@ -2379,19 +2138,17 @@ export class Subduction {
2379
2138
  *
2380
2139
  * * `address` - The WebSocket URL to connect to
2381
2140
  * * `expected_peer_id` - The expected server peer ID (verified during handshake)
2382
- * * `timeout_milliseconds` - Request timeout in milliseconds
2383
2141
  *
2384
2142
  * # Errors
2385
2143
  *
2386
2144
  * Returns an error if connection, handshake, or adding the connection fails.
2387
2145
  * @param {URL} address
2388
2146
  * @param {PeerId} expected_peer_id
2389
- * @param {number} timeout_milliseconds
2390
2147
  * @returns {Promise<PeerId>}
2391
2148
  */
2392
- connect(address, expected_peer_id, timeout_milliseconds) {
2149
+ connect(address, expected_peer_id) {
2393
2150
  _assertClass(expected_peer_id, PeerId);
2394
- const ret = wasm.subduction_connect(this.__wbg_ptr, address, expected_peer_id.__wbg_ptr, timeout_milliseconds);
2151
+ const ret = wasm.subduction_connect(this.__wbg_ptr, address, expected_peer_id.__wbg_ptr);
2395
2152
  return ret;
2396
2153
  }
2397
2154
  /**
@@ -2409,14 +2166,13 @@ export class Subduction {
2409
2166
  *
2410
2167
  * Returns an error if connection, handshake, or adding the connection fails.
2411
2168
  * @param {URL} address
2412
- * @param {number | null} [timeout_milliseconds]
2413
2169
  * @param {string | null} [service_name]
2414
2170
  * @returns {Promise<PeerId>}
2415
2171
  */
2416
- connectDiscover(address, timeout_milliseconds, service_name) {
2172
+ connectDiscover(address, service_name) {
2417
2173
  var ptr0 = isLikeNone(service_name) ? 0 : passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2418
2174
  var len0 = WASM_VECTOR_LEN;
2419
- const ret = wasm.subduction_connectDiscover(this.__wbg_ptr, address, isLikeNone(timeout_milliseconds) ? 0x100000001 : (timeout_milliseconds) >>> 0, ptr0, len0);
2175
+ const ret = wasm.subduction_connectDiscover(this.__wbg_ptr, address, ptr0, len0);
2420
2176
  return ret;
2421
2177
  }
2422
2178
  /**
@@ -2434,16 +2190,15 @@ export class Subduction {
2434
2190
  *
2435
2191
  * Returns an error if connection, handshake, or adding the connection fails.
2436
2192
  * @param {string} base_url
2437
- * @param {number | null} [timeout_milliseconds]
2438
2193
  * @param {string | null} [service_name]
2439
2194
  * @returns {Promise<PeerId>}
2440
2195
  */
2441
- connectDiscoverLongPoll(base_url, timeout_milliseconds, service_name) {
2196
+ connectDiscoverLongPoll(base_url, service_name) {
2442
2197
  const ptr0 = passStringToWasm0(base_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2443
2198
  const len0 = WASM_VECTOR_LEN;
2444
2199
  var ptr1 = isLikeNone(service_name) ? 0 : passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2445
2200
  var len1 = WASM_VECTOR_LEN;
2446
- const ret = wasm.subduction_connectDiscoverLongPoll(this.__wbg_ptr, ptr0, len0, isLikeNone(timeout_milliseconds) ? 0x100000001 : (timeout_milliseconds) >>> 0, ptr1, len1);
2201
+ const ret = wasm.subduction_connectDiscoverLongPoll(this.__wbg_ptr, ptr0, len0, ptr1, len1);
2447
2202
  return ret;
2448
2203
  }
2449
2204
  /**
@@ -2462,14 +2217,37 @@ export class Subduction {
2462
2217
  * Returns an error if connection, handshake, or adding the connection fails.
2463
2218
  * @param {string} base_url
2464
2219
  * @param {PeerId} expected_peer_id
2465
- * @param {number | null} [timeout_milliseconds]
2466
2220
  * @returns {Promise<PeerId>}
2467
2221
  */
2468
- connectLongPoll(base_url, expected_peer_id, timeout_milliseconds) {
2222
+ connectLongPoll(base_url, expected_peer_id) {
2469
2223
  const ptr0 = passStringToWasm0(base_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2470
2224
  const len0 = WASM_VECTOR_LEN;
2471
2225
  _assertClass(expected_peer_id, PeerId);
2472
- const ret = wasm.subduction_connectLongPoll(this.__wbg_ptr, ptr0, len0, expected_peer_id.__wbg_ptr, isLikeNone(timeout_milliseconds) ? 0x100000001 : (timeout_milliseconds) >>> 0);
2226
+ const ret = wasm.subduction_connectLongPoll(this.__wbg_ptr, ptr0, len0, expected_peer_id.__wbg_ptr);
2227
+ return ret;
2228
+ }
2229
+ /**
2230
+ * Connect to a peer over any [`Transport`](JsTransport) using discovery mode.
2231
+ *
2232
+ * Performs a discovery handshake, then adds the authenticated connection.
2233
+ * The peer's identity is discovered during the handshake.
2234
+ *
2235
+ * # Arguments
2236
+ *
2237
+ * * `transport` - Any JS object with `sendBytes`/`recvBytes`/`disconnect`
2238
+ * * `service_name` - Shared service name for discovery
2239
+ *
2240
+ * # Errors
2241
+ *
2242
+ * Returns an error if the handshake or connection fails.
2243
+ * @param {Transport} transport
2244
+ * @param {string} service_name
2245
+ * @returns {Promise<PeerId>}
2246
+ */
2247
+ connectTransport(transport, service_name) {
2248
+ const ptr0 = passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2249
+ const len0 = WASM_VECTOR_LEN;
2250
+ const ret = wasm.subduction_connectTransport(this.__wbg_ptr, transport, ptr0, len0);
2473
2251
  return ret;
2474
2252
  }
2475
2253
  /**
@@ -2634,6 +2412,27 @@ export class Subduction {
2634
2412
  const ret = wasm.subduction_hydrate(signer, storage, ptr0, len0, isLikeNone(hash_metric_override) ? 0 : addToExternrefTable0(hash_metric_override), isLikeNone(max_pending_blob_requests) ? 0x100000001 : (max_pending_blob_requests) >>> 0);
2635
2413
  return ret;
2636
2414
  }
2415
+ /**
2416
+ * Link two local [`Subduction`](WasmSubduction) instances over a
2417
+ * [`MessageChannel`](web_sys::MessageChannel).
2418
+ *
2419
+ * Creates a `MessageChannel`, performs a discovery handshake between
2420
+ * the two instances, and adds the connections to both. This is the
2421
+ * simplest way to sync two local instances.
2422
+ *
2423
+ * # Errors
2424
+ *
2425
+ * Returns an error if the handshake or connection fails.
2426
+ * @param {Subduction} a
2427
+ * @param {Subduction} b
2428
+ * @returns {Promise<void>}
2429
+ */
2430
+ static link(a, b) {
2431
+ _assertClass(a, Subduction);
2432
+ _assertClass(b, Subduction);
2433
+ const ret = wasm.subduction_link(a.__wbg_ptr, b.__wbg_ptr);
2434
+ return ret;
2435
+ }
2637
2436
  /**
2638
2437
  * Create a new [`Subduction`] instance.
2639
2438
  *
@@ -2758,7 +2557,73 @@ export class Subduction {
2758
2557
  if (Symbol.dispose) Subduction.prototype[Symbol.dispose] = Subduction.prototype.free;
2759
2558
 
2760
2559
  /**
2761
- * HTTP long-poll connection factory for browser/worker environments.
2560
+ * JS-facing wrapper around [`HttpLongPollTransport`] that exposes the
2561
+ * byte-oriented [`Transport`](super::JsTransport) interface
2562
+ * (`sendBytes`/`recvBytes`/`disconnect`) so it can be used as a
2563
+ * duck-typed `JsTransport` from JavaScript.
2564
+ */
2565
+ export class SubductionHttpLongPoll {
2566
+ static __wrap(ptr) {
2567
+ ptr = ptr >>> 0;
2568
+ const obj = Object.create(SubductionHttpLongPoll.prototype);
2569
+ obj.__wbg_ptr = ptr;
2570
+ SubductionHttpLongPollFinalization.register(obj, obj.__wbg_ptr, obj);
2571
+ return obj;
2572
+ }
2573
+ __destroy_into_raw() {
2574
+ const ptr = this.__wbg_ptr;
2575
+ this.__wbg_ptr = 0;
2576
+ SubductionHttpLongPollFinalization.unregister(this);
2577
+ return ptr;
2578
+ }
2579
+ free() {
2580
+ const ptr = this.__destroy_into_raw();
2581
+ wasm.__wbg_subductionhttplongpoll_free(ptr, 0);
2582
+ }
2583
+ /**
2584
+ * Disconnect from the peer gracefully.
2585
+ *
2586
+ * # Errors
2587
+ *
2588
+ * Returns an error if the disconnect fails.
2589
+ * @returns {Promise<void>}
2590
+ */
2591
+ disconnect() {
2592
+ const ret = wasm.subductionhttplongpoll_disconnect(this.__wbg_ptr);
2593
+ return ret;
2594
+ }
2595
+ /**
2596
+ * Receive the next message frame as raw bytes.
2597
+ *
2598
+ * # Errors
2599
+ *
2600
+ * Returns an error if the inbound channel is closed.
2601
+ * @returns {Promise<Uint8Array>}
2602
+ */
2603
+ recvBytes() {
2604
+ const ret = wasm.subductionhttplongpoll_recvBytes(this.__wbg_ptr);
2605
+ return ret;
2606
+ }
2607
+ /**
2608
+ * Send raw bytes over the transport.
2609
+ *
2610
+ * # Errors
2611
+ *
2612
+ * Returns an error if the outbound channel is closed.
2613
+ * @param {Uint8Array} bytes
2614
+ * @returns {Promise<void>}
2615
+ */
2616
+ sendBytes(bytes) {
2617
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
2618
+ const len0 = WASM_VECTOR_LEN;
2619
+ const ret = wasm.subductionhttplongpoll_sendBytes(this.__wbg_ptr, ptr0, len0);
2620
+ return ret;
2621
+ }
2622
+ }
2623
+ if (Symbol.dispose) SubductionHttpLongPoll.prototype[Symbol.dispose] = SubductionHttpLongPoll.prototype.free;
2624
+
2625
+ /**
2626
+ * HTTP long-poll transport factory for browser/worker environments.
2762
2627
  *
2763
2628
  * Analogous to [`SubductionWebSocket`] but uses HTTP long-poll instead of WebSocket.
2764
2629
  */
@@ -2785,18 +2650,17 @@ export class SubductionLongPoll {
2785
2650
  *
2786
2651
  * # Errors
2787
2652
  *
2788
- * Returns [`LongPollConnectionError`] if connection or handshake fails.
2653
+ * Returns [`LongPollTransportError`] if connection or handshake fails.
2789
2654
  * @param {string} base_url
2790
2655
  * @param {any} signer
2791
2656
  * @param {PeerId} expected_peer_id
2792
- * @param {number | null} [timeout_milliseconds]
2793
2657
  * @returns {Promise<AuthenticatedLongPoll>}
2794
2658
  */
2795
- static tryConnect(base_url, signer, expected_peer_id, timeout_milliseconds) {
2659
+ static tryConnect(base_url, signer, expected_peer_id) {
2796
2660
  const ptr0 = passStringToWasm0(base_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2797
2661
  const len0 = WASM_VECTOR_LEN;
2798
2662
  _assertClass(expected_peer_id, PeerId);
2799
- const ret = wasm.subductionlongpoll_tryConnect(ptr0, len0, signer, expected_peer_id.__wbg_ptr, isLikeNone(timeout_milliseconds) ? 0x100000001 : (timeout_milliseconds) >>> 0);
2663
+ const ret = wasm.subductionlongpoll_tryConnect(ptr0, len0, signer, expected_peer_id.__wbg_ptr);
2800
2664
  return ret;
2801
2665
  }
2802
2666
  /**
@@ -2806,120 +2670,34 @@ export class SubductionLongPoll {
2806
2670
  *
2807
2671
  * * `base_url` - The server's HTTP base URL (e.g., `http://localhost:8080`)
2808
2672
  * * `signer` - The client's signer for authentication
2809
- * * `timeout_milliseconds` - Request timeout in milliseconds (default: 30000)
2810
2673
  * * `service_name` - The service name for discovery. If omitted, the base URL is used.
2811
2674
  *
2812
2675
  * # Errors
2813
2676
  *
2814
- * Returns [`LongPollConnectionError`] if connection or handshake fails.
2677
+ * Returns [`LongPollTransportError`] if connection or handshake fails.
2815
2678
  * @param {string} base_url
2816
2679
  * @param {any} signer
2817
- * @param {number | null} [timeout_milliseconds]
2818
2680
  * @param {string | null} [service_name]
2819
2681
  * @returns {Promise<AuthenticatedLongPoll>}
2820
2682
  */
2821
- static tryDiscover(base_url, signer, timeout_milliseconds, service_name) {
2683
+ static tryDiscover(base_url, signer, service_name) {
2822
2684
  const ptr0 = passStringToWasm0(base_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2823
2685
  const len0 = WASM_VECTOR_LEN;
2824
2686
  var ptr1 = isLikeNone(service_name) ? 0 : passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2825
- var len1 = WASM_VECTOR_LEN;
2826
- const ret = wasm.subductionlongpoll_tryDiscover(ptr0, len0, signer, isLikeNone(timeout_milliseconds) ? 0x100000001 : (timeout_milliseconds) >>> 0, ptr1, len1);
2827
- return ret;
2828
- }
2829
- }
2830
- if (Symbol.dispose) SubductionLongPoll.prototype[Symbol.dispose] = SubductionLongPoll.prototype.free;
2831
-
2832
- /**
2833
- * JS-facing wrapper around [`WasmLongPollConnection`] that exposes the
2834
- * [`Connection`](super::JsConnection) interface so it can be used as a
2835
- * duck-typed `JsConnection` from JavaScript.
2836
- */
2837
- export class SubductionLongPollConnection {
2838
- static __wrap(ptr) {
2839
- ptr = ptr >>> 0;
2840
- const obj = Object.create(SubductionLongPollConnection.prototype);
2841
- obj.__wbg_ptr = ptr;
2842
- SubductionLongPollConnectionFinalization.register(obj, obj.__wbg_ptr, obj);
2843
- return obj;
2844
- }
2845
- __destroy_into_raw() {
2846
- const ptr = this.__wbg_ptr;
2847
- this.__wbg_ptr = 0;
2848
- SubductionLongPollConnectionFinalization.unregister(this);
2849
- return ptr;
2850
- }
2851
- free() {
2852
- const ptr = this.__destroy_into_raw();
2853
- wasm.__wbg_subductionlongpollconnection_free(ptr, 0);
2854
- }
2855
- /**
2856
- * Make a synchronous call to the peer.
2857
- *
2858
- * # Errors
2859
- *
2860
- * Returns an error if the call fails or times out.
2861
- * @param {BatchSyncRequest} request
2862
- * @param {number | null} [timeout_ms]
2863
- * @returns {Promise<BatchSyncResponse>}
2864
- */
2865
- call(request, timeout_ms) {
2866
- _assertClass(request, BatchSyncRequest);
2867
- var ptr0 = request.__destroy_into_raw();
2868
- const ret = wasm.subductionlongpollconnection_call(this.__wbg_ptr, ptr0, !isLikeNone(timeout_ms), isLikeNone(timeout_ms) ? 0 : timeout_ms);
2869
- return ret;
2870
- }
2871
- /**
2872
- * Disconnect from the peer gracefully.
2873
- *
2874
- * # Errors
2875
- *
2876
- * Returns [`WasmLongPollConnError`] if the disconnect fails.
2877
- * @returns {Promise<void>}
2878
- */
2879
- disconnect() {
2880
- const ret = wasm.subductionlongpollconnection_disconnect(this.__wbg_ptr);
2881
- return ret;
2882
- }
2883
- /**
2884
- * Get the next request ID.
2885
- * @returns {Promise<RequestId>}
2886
- */
2887
- nextRequestId() {
2888
- const ret = wasm.subductionlongpollconnection_nextRequestId(this.__wbg_ptr);
2889
- return ret;
2890
- }
2891
- /**
2892
- * Receive a message.
2893
- *
2894
- * # Errors
2895
- *
2896
- * Returns an error if the inbound channel is closed.
2897
- * @returns {Promise<Message>}
2898
- */
2899
- recv() {
2900
- const ret = wasm.subductionlongpollconnection_recv(this.__wbg_ptr);
2901
- return ret;
2902
- }
2903
- /**
2904
- * Send a message.
2905
- *
2906
- * # Errors
2907
- *
2908
- * Returns an error if the outbound channel is closed.
2909
- * @param {Message} message
2910
- * @returns {Promise<void>}
2911
- */
2912
- send(message) {
2913
- _assertClass(message, Message);
2914
- var ptr0 = message.__destroy_into_raw();
2915
- const ret = wasm.subductionlongpollconnection_send(this.__wbg_ptr, ptr0);
2687
+ var len1 = WASM_VECTOR_LEN;
2688
+ const ret = wasm.subductionlongpoll_tryDiscover(ptr0, len0, signer, ptr1, len1);
2916
2689
  return ret;
2917
2690
  }
2918
2691
  }
2919
- if (Symbol.dispose) SubductionLongPollConnection.prototype[Symbol.dispose] = SubductionLongPollConnection.prototype.free;
2692
+ if (Symbol.dispose) SubductionLongPoll.prototype[Symbol.dispose] = SubductionLongPoll.prototype.free;
2920
2693
 
2921
2694
  /**
2922
- * A WebSocket connection with internal wiring for [`Subduction`] message handling.
2695
+ * A WebSocket transport exposing the byte-oriented `Transport` interface.
2696
+ *
2697
+ * Raw bytes from the WebSocket's `onmessage` handler are buffered in an
2698
+ * `async_channel` and returned via `recvBytes`. No message decoding or
2699
+ * request-response routing happens here — that's handled by
2700
+ * [`MessageTransport`](subduction_core::transport::message::MessageTransport).
2923
2701
  */
2924
2702
  export class SubductionWebSocket {
2925
2703
  static __wrap(ptr) {
@@ -2939,22 +2717,6 @@ export class SubductionWebSocket {
2939
2717
  const ptr = this.__destroy_into_raw();
2940
2718
  wasm.__wbg_subductionwebsocket_free(ptr, 0);
2941
2719
  }
2942
- /**
2943
- * Make a synchronous call to the peer.
2944
- *
2945
- * # Errors
2946
- *
2947
- * Returns [`WasmCallError`] if the call fails or times out.
2948
- * @param {BatchSyncRequest} request
2949
- * @param {number | null} [timeout_ms]
2950
- * @returns {Promise<BatchSyncResponse>}
2951
- */
2952
- call(request, timeout_ms) {
2953
- _assertClass(request, BatchSyncRequest);
2954
- var ptr0 = request.__destroy_into_raw();
2955
- const ret = wasm.subductionwebsocket_call(this.__wbg_ptr, ptr0, !isLikeNone(timeout_ms), isLikeNone(timeout_ms) ? 0 : timeout_ms);
2956
- return ret;
2957
- }
2958
2720
  /**
2959
2721
  * Disconnect from the peer gracefully.
2960
2722
  * @returns {Promise<void>}
@@ -2964,46 +2726,30 @@ export class SubductionWebSocket {
2964
2726
  return ret;
2965
2727
  }
2966
2728
  /**
2967
- * Get the next request ID.
2968
- * @returns {Promise<RequestId>}
2969
- */
2970
- nextRequestId() {
2971
- const ret = wasm.subductionwebsocket_nextRequestId(this.__wbg_ptr);
2972
- return ret;
2973
- }
2974
- /**
2975
- * Get the peer ID of the remote peer.
2976
- * @returns {PeerId}
2977
- */
2978
- peerId() {
2979
- const ret = wasm.subductionwebsocket_peerId(this.__wbg_ptr);
2980
- return PeerId.__wrap(ret);
2981
- }
2982
- /**
2983
- * Receive a message.
2729
+ * Receive the next message frame as raw bytes.
2984
2730
  *
2985
2731
  * # Errors
2986
2732
  *
2987
2733
  * Returns [`ReadFromClosedChannel`] if the channel has been closed.
2988
- * @returns {Promise<Message>}
2734
+ * @returns {Promise<Uint8Array>}
2989
2735
  */
2990
- recv() {
2991
- const ret = wasm.subductionwebsocket_recv(this.__wbg_ptr);
2736
+ recvBytes() {
2737
+ const ret = wasm.subductionwebsocket_recvBytes(this.__wbg_ptr);
2992
2738
  return ret;
2993
2739
  }
2994
2740
  /**
2995
- * Send a message.
2741
+ * Send raw bytes over the WebSocket.
2996
2742
  *
2997
2743
  * # Errors
2998
2744
  *
2999
- * Returns [`WasmSendError`] if the message could not be sent over the WebSocket.
3000
- * @param {Message} wasm_message
2745
+ * Returns [`WasmSendError`] if the bytes could not be sent.
2746
+ * @param {Uint8Array} bytes
3001
2747
  * @returns {Promise<void>}
3002
2748
  */
3003
- send(wasm_message) {
3004
- _assertClass(wasm_message, Message);
3005
- var ptr0 = wasm_message.__destroy_into_raw();
3006
- const ret = wasm.subductionwebsocket_send(this.__wbg_ptr, ptr0);
2749
+ sendBytes(bytes) {
2750
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
2751
+ const len0 = WASM_VECTOR_LEN;
2752
+ const ret = wasm.subductionwebsocket_sendBytes(this.__wbg_ptr, ptr0, len0);
3007
2753
  return ret;
3008
2754
  }
3009
2755
  /**
@@ -3025,12 +2771,11 @@ export class SubductionWebSocket {
3025
2771
  * @param {WebSocket} ws
3026
2772
  * @param {any} signer
3027
2773
  * @param {PeerId} expected_peer_id
3028
- * @param {number} timeout_milliseconds
3029
2774
  * @returns {Promise<AuthenticatedWebSocket>}
3030
2775
  */
3031
- static setup(ws, signer, expected_peer_id, timeout_milliseconds) {
2776
+ static setup(ws, signer, expected_peer_id) {
3032
2777
  _assertClass(expected_peer_id, PeerId);
3033
- const ret = wasm.subductionwebsocket_setup(ws, signer, expected_peer_id.__wbg_ptr, timeout_milliseconds);
2778
+ const ret = wasm.subductionwebsocket_setup(ws, signer, expected_peer_id.__wbg_ptr);
3034
2779
  return ret;
3035
2780
  }
3036
2781
  /**
@@ -3041,8 +2786,6 @@ export class SubductionWebSocket {
3041
2786
  * * `address` - The WebSocket URL to connect to
3042
2787
  * * `signer` - The client's signer for authentication
3043
2788
  * * `expected_peer_id` - The expected server peer ID (verified during handshake)
3044
- * * `timeout_milliseconds` - Request timeout in milliseconds
3045
- *
3046
2789
  * # Errors
3047
2790
  *
3048
2791
  * Returns an error if:
@@ -3051,12 +2794,11 @@ export class SubductionWebSocket {
3051
2794
  * @param {URL} address
3052
2795
  * @param {any} signer
3053
2796
  * @param {PeerId} expected_peer_id
3054
- * @param {number} timeout_milliseconds
3055
2797
  * @returns {Promise<AuthenticatedWebSocket>}
3056
2798
  */
3057
- static tryConnect(address, signer, expected_peer_id, timeout_milliseconds) {
2799
+ static tryConnect(address, signer, expected_peer_id) {
3058
2800
  _assertClass(expected_peer_id, PeerId);
3059
- const ret = wasm.subductionwebsocket_tryConnect(address, signer, expected_peer_id.__wbg_ptr, timeout_milliseconds);
2801
+ const ret = wasm.subductionwebsocket_tryConnect(address, signer, expected_peer_id.__wbg_ptr);
3060
2802
  return ret;
3061
2803
  }
3062
2804
  /**
@@ -3081,19 +2823,218 @@ export class SubductionWebSocket {
3081
2823
  * - The handshake fails (signature invalid, clock drift, etc.)
3082
2824
  * @param {URL} address
3083
2825
  * @param {any} signer
3084
- * @param {number | null} [timeout_milliseconds]
3085
2826
  * @param {string | null} [service_name]
3086
2827
  * @returns {Promise<AuthenticatedWebSocket>}
3087
2828
  */
3088
- static tryDiscover(address, signer, timeout_milliseconds, service_name) {
2829
+ static tryDiscover(address, signer, service_name) {
3089
2830
  var ptr0 = isLikeNone(service_name) ? 0 : passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
3090
2831
  var len0 = WASM_VECTOR_LEN;
3091
- const ret = wasm.subductionwebsocket_tryDiscover(address, signer, isLikeNone(timeout_milliseconds) ? 0x100000001 : (timeout_milliseconds) >>> 0, ptr0, len0);
2832
+ const ret = wasm.subductionwebsocket_tryDiscover(address, signer, ptr0, len0);
3092
2833
  return ret;
3093
2834
  }
3094
2835
  }
3095
2836
  if (Symbol.dispose) SubductionWebSocket.prototype[Symbol.dispose] = SubductionWebSocket.prototype.free;
3096
2837
 
2838
+ /**
2839
+ * Wasm wrapper for [`SyncMessage`].
2840
+ */
2841
+ export class SyncMessage {
2842
+ static __wrap(ptr) {
2843
+ ptr = ptr >>> 0;
2844
+ const obj = Object.create(SyncMessage.prototype);
2845
+ obj.__wbg_ptr = ptr;
2846
+ SyncMessageFinalization.register(obj, obj.__wbg_ptr, obj);
2847
+ return obj;
2848
+ }
2849
+ __destroy_into_raw() {
2850
+ const ptr = this.__wbg_ptr;
2851
+ this.__wbg_ptr = 0;
2852
+ SyncMessageFinalization.unregister(this);
2853
+ return ptr;
2854
+ }
2855
+ free() {
2856
+ const ptr = this.__destroy_into_raw();
2857
+ wasm.__wbg_syncmessage_free(ptr, 0);
2858
+ }
2859
+ /**
2860
+ * Upcasts; to the JS-import type for [`WasmMessage`].
2861
+ * @returns {SyncMessage}
2862
+ */
2863
+ __wasm_refgen_toWasmMessage() {
2864
+ const ret = wasm.syncmessage___wasm_refgen_toWasmMessage(this.__wbg_ptr);
2865
+ return SyncMessage.__wrap(ret);
2866
+ }
2867
+ /**
2868
+ * Create a [`SyncMessage::BatchSyncRequest`] message.
2869
+ * @param {BatchSyncRequest} request
2870
+ * @returns {SyncMessage}
2871
+ */
2872
+ static batchSyncRequest(request) {
2873
+ _assertClass(request, BatchSyncRequest);
2874
+ const ret = wasm.syncmessage_batchSyncRequest(request.__wbg_ptr);
2875
+ return SyncMessage.__wrap(ret);
2876
+ }
2877
+ /**
2878
+ * Create a [`SyncMessage::BatchSyncResponse`] message.
2879
+ * @param {BatchSyncResponse} response
2880
+ * @returns {SyncMessage}
2881
+ */
2882
+ static batchSyncResponse(response) {
2883
+ _assertClass(response, BatchSyncResponse);
2884
+ const ret = wasm.syncmessage_batchSyncResponse(response.__wbg_ptr);
2885
+ return SyncMessage.__wrap(ret);
2886
+ }
2887
+ /**
2888
+ * The [`Blob`] for commit or fragment messages, if applicable.
2889
+ * @returns {Uint8Array | undefined}
2890
+ */
2891
+ get blob() {
2892
+ const ret = wasm.syncmessage_blob(this.__wbg_ptr);
2893
+ return ret;
2894
+ }
2895
+ /**
2896
+ * The [`Blob`]s for a [`SyncMessage::BlobsResponse`], if applicable.
2897
+ * @returns {Uint8Array[] | undefined}
2898
+ */
2899
+ get blobs() {
2900
+ const ret = wasm.syncmessage_blobs(this.__wbg_ptr);
2901
+ let v1;
2902
+ if (ret[0] !== 0) {
2903
+ v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
2904
+ wasm.__wbindgen_export5(ret[0], ret[1] * 4, 4);
2905
+ }
2906
+ return v1;
2907
+ }
2908
+ /**
2909
+ * Create a [`SyncMessage::BlobsRequest`] message.
2910
+ * @param {SedimentreeId} id
2911
+ * @param {Digest[]} digests
2912
+ * @returns {SyncMessage}
2913
+ */
2914
+ static blobsRequest(id, digests) {
2915
+ _assertClass(id, SedimentreeId);
2916
+ const ptr0 = passArrayJsValueToWasm0(digests, wasm.__wbindgen_export);
2917
+ const len0 = WASM_VECTOR_LEN;
2918
+ const ret = wasm.syncmessage_blobsRequest(id.__wbg_ptr, ptr0, len0);
2919
+ return SyncMessage.__wrap(ret);
2920
+ }
2921
+ /**
2922
+ * Create a [`SyncMessage::BlobsResponse`] message.
2923
+ * @param {SedimentreeId} id
2924
+ * @param {Uint8Array[]} blobs
2925
+ * @returns {SyncMessage}
2926
+ */
2927
+ static blobsResponse(id, blobs) {
2928
+ _assertClass(id, SedimentreeId);
2929
+ const ptr0 = passArrayJsValueToWasm0(blobs, wasm.__wbindgen_export);
2930
+ const len0 = WASM_VECTOR_LEN;
2931
+ const ret = wasm.syncmessage_blobsResponse(id.__wbg_ptr, ptr0, len0);
2932
+ return SyncMessage.__wrap(ret);
2933
+ }
2934
+ /**
2935
+ * The [`LooseCommit`] for a [`SyncMessage::LooseCommit`], if applicable.
2936
+ *
2937
+ * Decodes the signed payload to extract the underlying commit.
2938
+ * @returns {LooseCommit | undefined}
2939
+ */
2940
+ get commit() {
2941
+ const ret = wasm.syncmessage_commit(this.__wbg_ptr);
2942
+ return ret === 0 ? undefined : LooseCommit.__wrap(ret);
2943
+ }
2944
+ /**
2945
+ * The requested [`Digest`]s for a [`SyncMessage::BlobsRequest`], if applicable.
2946
+ * @returns {Digest[] | undefined}
2947
+ */
2948
+ get digests() {
2949
+ const ret = wasm.syncmessage_digests(this.__wbg_ptr);
2950
+ let v1;
2951
+ if (ret[0] !== 0) {
2952
+ v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
2953
+ wasm.__wbindgen_export5(ret[0], ret[1] * 4, 4);
2954
+ }
2955
+ return v1;
2956
+ }
2957
+ /**
2958
+ * The [`Fragment`] for a [`SyncMessage::Fragment`], if applicable.
2959
+ *
2960
+ * Decodes the signed payload to extract the underlying fragment.
2961
+ * @returns {Fragment | undefined}
2962
+ */
2963
+ get fragment() {
2964
+ const ret = wasm.syncmessage_fragment(this.__wbg_ptr);
2965
+ return ret === 0 ? undefined : Fragment.__wrap(ret);
2966
+ }
2967
+ /**
2968
+ * Deserialize a message from bytes.
2969
+ *
2970
+ * # Errors
2971
+ *
2972
+ * Returns a [`JsMessageDeserializationError`] if deserialization fails.
2973
+ * @param {Uint8Array} bytes
2974
+ * @returns {SyncMessage}
2975
+ */
2976
+ static fromBytes(bytes) {
2977
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
2978
+ const len0 = WASM_VECTOR_LEN;
2979
+ const ret = wasm.syncmessage_fromBytes(ptr0, len0);
2980
+ if (ret[2]) {
2981
+ throw takeFromExternrefTable0(ret[1]);
2982
+ }
2983
+ return SyncMessage.__wrap(ret[0]);
2984
+ }
2985
+ /**
2986
+ * The [`BatchSyncRequest`] for a [`SyncMessage::BatchSyncRequest`], if applicable.
2987
+ * @returns {BatchSyncRequest | undefined}
2988
+ */
2989
+ get request() {
2990
+ const ret = wasm.syncmessage_request(this.__wbg_ptr);
2991
+ return ret === 0 ? undefined : BatchSyncRequest.__wrap(ret);
2992
+ }
2993
+ /**
2994
+ * The [`BatchSyncResponse`] for a [`SyncMessage::BatchSyncResponse`], if applicable.
2995
+ * @returns {BatchSyncResponse | undefined}
2996
+ */
2997
+ get response() {
2998
+ const ret = wasm.syncmessage_response(this.__wbg_ptr);
2999
+ return ret === 0 ? undefined : BatchSyncResponse.__wrap(ret);
3000
+ }
3001
+ /**
3002
+ * The [`SedimentreeId`] associated with this message, if any.
3003
+ * @returns {SedimentreeId | undefined}
3004
+ */
3005
+ get sedimentreeId() {
3006
+ const ret = wasm.syncmessage_sedimentreeId(this.__wbg_ptr);
3007
+ return ret === 0 ? undefined : SedimentreeId.__wrap(ret);
3008
+ }
3009
+ /**
3010
+ * Serialize the message to bytes.
3011
+ * @returns {Uint8Array}
3012
+ */
3013
+ toBytes() {
3014
+ const ret = wasm.syncmessage_toBytes(this.__wbg_ptr);
3015
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
3016
+ wasm.__wbindgen_export5(ret[0], ret[1] * 1, 1);
3017
+ return v1;
3018
+ }
3019
+ /**
3020
+ * The message variant name.
3021
+ * @returns {string}
3022
+ */
3023
+ get type() {
3024
+ let deferred1_0;
3025
+ let deferred1_1;
3026
+ try {
3027
+ const ret = wasm.syncmessage_type(this.__wbg_ptr);
3028
+ deferred1_0 = ret[0];
3029
+ deferred1_1 = ret[1];
3030
+ return getStringFromWasm0(ret[0], ret[1]);
3031
+ } finally {
3032
+ wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
3033
+ }
3034
+ }
3035
+ }
3036
+ if (Symbol.dispose) SyncMessage.prototype[Symbol.dispose] = SyncMessage.prototype.free;
3037
+
3097
3038
  /**
3098
3039
  * Statistics from a sync operation.
3099
3040
  *
@@ -3262,13 +3203,13 @@ export class WebCryptoSigner {
3262
3203
  if (Symbol.dispose) WebCryptoSigner.prototype[Symbol.dispose] = WebCryptoSigner.prototype.free;
3263
3204
 
3264
3205
  /**
3265
- * Convenience factory — equivalent to `new MessagePortConnection(port)`.
3206
+ * Convenience factory — equivalent to `new MessagePortTransport(port)`.
3266
3207
  * @param {any} port
3267
- * @returns {MessagePortConnection}
3208
+ * @returns {MessagePortTransport}
3268
3209
  */
3269
- export function makeMessagePortConnection(port) {
3270
- const ret = wasm.makeMessagePortConnection(port);
3271
- return MessagePortConnection.__wrap(ret);
3210
+ export function makeMessagePortTransport(port) {
3211
+ const ret = wasm.makeMessagePortTransport(port);
3212
+ return MessagePortTransport.__wrap(ret);
3272
3213
  }
3273
3214
 
3274
3215
  /**
@@ -3286,12 +3227,6 @@ export function start() {
3286
3227
  function __wbg_get_imports() {
3287
3228
  const import0 = {
3288
3229
  __proto__: null,
3289
- __wbg___wasm_refgen_toWasmBatchSyncResponse_d314d3b3e09c54af: function(arg0) {
3290
- const ret = arg0.__wasm_refgen_toWasmBatchSyncResponse();
3291
- _assertClass(ret, BatchSyncResponse);
3292
- var ptr1 = ret.__destroy_into_raw();
3293
- return ptr1;
3294
- },
3295
3230
  __wbg___wasm_refgen_toWasmCommitWithBlob_dd531ffcf07010df: function(arg0) {
3296
3231
  const ret = arg0.__wasm_refgen_toWasmCommitWithBlob();
3297
3232
  _assertClass(ret, CommitWithBlob);
@@ -3328,18 +3263,6 @@ function __wbg_get_imports() {
3328
3263
  var ptr1 = ret.__destroy_into_raw();
3329
3264
  return ptr1;
3330
3265
  },
3331
- __wbg___wasm_refgen_toWasmMessage_03bf79fea85775dc: function(arg0) {
3332
- const ret = arg0.__wasm_refgen_toWasmMessage();
3333
- _assertClass(ret, Message);
3334
- var ptr1 = ret.__destroy_into_raw();
3335
- return ptr1;
3336
- },
3337
- __wbg___wasm_refgen_toWasmRequestId_659561cf5c639011: function(arg0) {
3338
- const ret = arg0.__wasm_refgen_toWasmRequestId();
3339
- _assertClass(ret, RequestId);
3340
- var ptr1 = ret.__destroy_into_raw();
3341
- return ptr1;
3342
- },
3343
3266
  __wbg___wbindgen_debug_string_5398f5bb970e0daa: function(arg0, arg1) {
3344
3267
  const ret = debugString(arg1);
3345
3268
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
@@ -3388,42 +3311,27 @@ function __wbg_get_imports() {
3388
3311
  const ret = arg0.arrayBuffer();
3389
3312
  return ret;
3390
3313
  }, arguments); },
3391
- __wbg_authenticatedconnection_new: function(arg0) {
3392
- const ret = AuthenticatedConnection.__wrap(arg0);
3393
- return ret;
3394
- },
3395
3314
  __wbg_authenticatedlongpoll_new: function(arg0) {
3396
3315
  const ret = AuthenticatedLongPoll.__wrap(arg0);
3397
3316
  return ret;
3398
3317
  },
3399
- __wbg_authenticatedwebsocket_new: function(arg0) {
3400
- const ret = AuthenticatedWebSocket.__wrap(arg0);
3318
+ __wbg_authenticatedtransport_new: function(arg0) {
3319
+ const ret = AuthenticatedTransport.__wrap(arg0);
3401
3320
  return ret;
3402
3321
  },
3403
- __wbg_batchsyncresponse_new: function(arg0) {
3404
- const ret = BatchSyncResponse.__wrap(arg0);
3322
+ __wbg_authenticatedwebsocket_new: function(arg0) {
3323
+ const ret = AuthenticatedWebSocket.__wrap(arg0);
3405
3324
  return ret;
3406
3325
  },
3407
3326
  __wbg_buffer_60b8043cd926067d: function(arg0) {
3408
3327
  const ret = arg0.buffer;
3409
3328
  return ret;
3410
3329
  },
3411
- __wbg_call_15d4cdb7fcc8c67d: function(arg0, arg1, arg2, arg3) {
3412
- const ret = arg0.call(BatchSyncRequest.__wrap(arg1), arg2 === 0 ? undefined : arg3);
3413
- return ret;
3414
- },
3415
3330
  __wbg_call_2d781c1f4d5c0ef8: function() { return handleError(function (arg0, arg1, arg2) {
3416
3331
  const ret = arg0.call(arg1, arg2);
3417
3332
  return ret;
3418
3333
  }, arguments); },
3419
- __wbg_call_e133b57c9155d22c: function() { return handleError(function (arg0, arg1) {
3420
- const ret = arg0.call(arg1);
3421
- return ret;
3422
- }, arguments); },
3423
- __wbg_clearTimeout_b47e5bf918898b2b: function(arg0) {
3424
- clearTimeout(arg0);
3425
- },
3426
- __wbg_close_83c08a226256ebab: function(arg0) {
3334
+ __wbg_close_9b95bf80abb12681: function(arg0) {
3427
3335
  arg0.close();
3428
3336
  },
3429
3337
  __wbg_close_cbf870bdad0aad99: function(arg0) {
@@ -3433,10 +3341,6 @@ function __wbg_get_imports() {
3433
3341
  const ret = CommitWithBlob.__wrap(arg0);
3434
3342
  return ret;
3435
3343
  },
3436
- __wbg_connerrorpair_new: function(arg0) {
3437
- const ret = ConnErrorPair.__wrap(arg0);
3438
- return ret;
3439
- },
3440
3344
  __wbg_contains_ef4bfb7fa5a241b7: function(arg0, arg1, arg2) {
3441
3345
  const ret = arg0.contains(getStringFromWasm0(arg1, arg2));
3442
3346
  return ret;
@@ -3469,7 +3373,7 @@ function __wbg_get_imports() {
3469
3373
  const ret = Digest.__unwrap(arg0);
3470
3374
  return ret;
3471
3375
  },
3472
- __wbg_disconnect_56f1bb3ba450fd5d: function(arg0) {
3376
+ __wbg_disconnect_285027c2ec32acf6: function(arg0) {
3473
3377
  const ret = arg0.disconnect();
3474
3378
  return ret;
3475
3379
  },
@@ -3692,8 +3596,8 @@ function __wbg_get_imports() {
3692
3596
  const ret = LooseCommit.__wrap(arg0);
3693
3597
  return ret;
3694
3598
  },
3695
- __wbg_message_new: function(arg0) {
3696
- const ret = Message.__wrap(arg0);
3599
+ __wbg_messageporttransport_new: function(arg0) {
3600
+ const ret = MessagePortTransport.__wrap(arg0);
3697
3601
  return ret;
3698
3602
  },
3699
3603
  __wbg_msCrypto_bd5a034af96bcba6: function(arg0) {
@@ -3727,7 +3631,7 @@ function __wbg_get_imports() {
3727
3631
  const a = state0.a;
3728
3632
  state0.a = 0;
3729
3633
  try {
3730
- return __wasm_bindgen_func_elem_1447_191(a, state0.b, arg0, arg1);
3634
+ return __wasm_bindgen_func_elem_1476_183(a, state0.b, arg0, arg1);
3731
3635
  } finally {
3732
3636
  state0.a = a;
3733
3637
  }
@@ -3746,6 +3650,10 @@ function __wbg_get_imports() {
3746
3650
  const ret = new WebSocket(getStringFromWasm0(arg0, arg1));
3747
3651
  return ret;
3748
3652
  }, arguments); },
3653
+ __wbg_new_f7708ba82c4c12f6: function() { return handleError(function () {
3654
+ const ret = new MessageChannel();
3655
+ return ret;
3656
+ }, arguments); },
3749
3657
  __wbg_new_from_slice_22da9388ac046e50: function(arg0, arg1) {
3750
3658
  const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
3751
3659
  return ret;
@@ -3757,7 +3665,7 @@ function __wbg_get_imports() {
3757
3665
  const a = state0.a;
3758
3666
  state0.a = 0;
3759
3667
  try {
3760
- return __wasm_bindgen_func_elem_1447_192(a, state0.b, arg0, arg1);
3668
+ return __wasm_bindgen_func_elem_1476_184(a, state0.b, arg0, arg1);
3761
3669
  } finally {
3762
3670
  state0.a = a;
3763
3671
  }
@@ -3776,10 +3684,6 @@ function __wbg_get_imports() {
3776
3684
  const ret = new Request(getStringFromWasm0(arg0, arg1), arg2);
3777
3685
  return ret;
3778
3686
  }, arguments); },
3779
- __wbg_nextRequestId_dd2f74cf9aba6ad5: function(arg0) {
3780
- const ret = arg0.nextRequestId();
3781
- return ret;
3782
- },
3783
3687
  __wbg_node_84ea875411254db1: function(arg0) {
3784
3688
  const ret = arg0.node;
3785
3689
  return ret;
@@ -3804,10 +3708,6 @@ function __wbg_get_imports() {
3804
3708
  const ret = Array.of(arg0, arg1);
3805
3709
  return ret;
3806
3710
  },
3807
- __wbg_onmessage_8ab5822ce277f116: function(arg0) {
3808
- const ret = arg0.onmessage;
3809
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
3810
- },
3811
3711
  __wbg_open_e7a9d3d6344572f6: function() { return handleError(function (arg0, arg1, arg2, arg3) {
3812
3712
  const ret = arg0.open(getStringFromWasm0(arg1, arg2), arg3 >>> 0);
3813
3713
  return ret;
@@ -3824,7 +3724,15 @@ function __wbg_get_imports() {
3824
3724
  const ret = PeerResultMap.__wrap(arg0);
3825
3725
  return ret;
3826
3726
  },
3827
- __wbg_postMessage_7b7c2f81e97ad513: function(arg0, arg1) {
3727
+ __wbg_port1_869a7ef90538dbdf: function(arg0) {
3728
+ const ret = arg0.port1;
3729
+ return ret;
3730
+ },
3731
+ __wbg_port2_947a51b8ba00adc9: function(arg0) {
3732
+ const ret = arg0.port2;
3733
+ return ret;
3734
+ },
3735
+ __wbg_postMessage_1acd85b7323d11a6: function(arg0, arg1) {
3828
3736
  arg0.postMessage(arg1);
3829
3737
  },
3830
3738
  __wbg_process_44c7a14e11e9f69e: function(arg0) {
@@ -3856,22 +3764,10 @@ function __wbg_get_imports() {
3856
3764
  const ret = arg0.readyState;
3857
3765
  return ret;
3858
3766
  },
3859
- __wbg_recvBytes_74810cb3b96b1b52: function(arg0) {
3767
+ __wbg_recvBytes_35ad4c7c108ff4dd: function(arg0) {
3860
3768
  const ret = arg0.recvBytes();
3861
3769
  return ret;
3862
3770
  },
3863
- __wbg_recv_347c2a4b277359e4: function(arg0) {
3864
- const ret = arg0.recv();
3865
- return ret;
3866
- },
3867
- __wbg_reject_452b6409a2fde3cd: function(arg0) {
3868
- const ret = Promise.reject(arg0);
3869
- return ret;
3870
- },
3871
- __wbg_requestid_new: function(arg0) {
3872
- const ret = RequestId.__wrap(arg0);
3873
- return ret;
3874
- },
3875
3771
  __wbg_require_b4edbdcf3e2a1ef0: function() { return handleError(function () {
3876
3772
  const ret = module.require;
3877
3773
  return ret;
@@ -3904,18 +3800,14 @@ function __wbg_get_imports() {
3904
3800
  const ret = SedimentreeId.__unwrap(arg0);
3905
3801
  return ret;
3906
3802
  },
3907
- __wbg_sendBytes_1443021028c26f11: function(arg0, arg1) {
3803
+ __wbg_sendBytes_c3a40be4ec4bfd25: function(arg0, arg1) {
3908
3804
  const ret = arg0.sendBytes(arg1);
3909
3805
  return ret;
3910
3806
  },
3911
3807
  __wbg_send_d31a693c975dea74: function() { return handleError(function (arg0, arg1, arg2) {
3912
3808
  arg0.send(getArrayU8FromWasm0(arg1, arg2));
3913
3809
  }, arguments); },
3914
- __wbg_send_ef8a4b8f5144f8bf: function(arg0, arg1) {
3915
- const ret = arg0.send(Message.__wrap(arg1));
3916
- return ret;
3917
- },
3918
- __wbg_setTimeout_44f7c6b8fbfaf279: function(arg0, arg1) {
3810
+ __wbg_setTimeout_5e8107dbc66751b5: function(arg0, arg1) {
3919
3811
  const ret = setTimeout(arg0, arg1);
3920
3812
  return ret;
3921
3813
  },
@@ -3953,10 +3845,10 @@ function __wbg_get_imports() {
3953
3845
  __wbg_set_onerror_901ca711f94a5bbb: function(arg0, arg1) {
3954
3846
  arg0.onerror = arg1;
3955
3847
  },
3956
- __wbg_set_onmessage_6f80ab771bf151aa: function(arg0, arg1) {
3848
+ __wbg_set_onmessage_3b92dfded4487295: function(arg0, arg1) {
3957
3849
  arg0.onmessage = arg1;
3958
3850
  },
3959
- __wbg_set_onmessage_8f399489f2e56d62: function(arg0, arg1) {
3851
+ __wbg_set_onmessage_6f80ab771bf151aa: function(arg0, arg1) {
3960
3852
  arg0.onmessage = arg1;
3961
3853
  },
3962
3854
  __wbg_set_onopen_34e3e24cf9337ddd: function(arg0, arg1) {
@@ -3968,14 +3860,14 @@ function __wbg_get_imports() {
3968
3860
  __wbg_set_onupgradeneeded_860ce42184f987e7: function(arg0, arg1) {
3969
3861
  arg0.onupgradeneeded = arg1;
3970
3862
  },
3863
+ __wbg_sign_23c468db7fe0ee83: function(arg0, arg1) {
3864
+ const ret = arg0.sign(arg1);
3865
+ return ret;
3866
+ },
3971
3867
  __wbg_sign_a34d057afd14c54d: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
3972
3868
  const ret = arg0.sign(arg1, arg2, getArrayU8FromWasm0(arg3, arg4));
3973
3869
  return ret;
3974
3870
  }, arguments); },
3975
- __wbg_sign_b6a174bd584137fc: function(arg0, arg1) {
3976
- const ret = arg0.sign(arg1);
3977
- return ret;
3978
- },
3979
3871
  __wbg_signedfragment_new: function(arg0) {
3980
3872
  const ret = SignedFragment.__wrap(arg0);
3981
3873
  return ret;
@@ -3991,6 +3883,9 @@ function __wbg_get_imports() {
3991
3883
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
3992
3884
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
3993
3885
  },
3886
+ __wbg_start_f837ba2bac4733b5: function(arg0) {
3887
+ arg0.start();
3888
+ },
3994
3889
  __wbg_static_accessor_GLOBAL_8adb955bd33fac2f: function() {
3995
3890
  const ret = typeof global === 'undefined' ? null : global;
3996
3891
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
@@ -4019,8 +3914,8 @@ function __wbg_get_imports() {
4019
3914
  const ret = Subduction.__wrap(arg0);
4020
3915
  return ret;
4021
3916
  },
4022
- __wbg_subductionlongpollconnection_new: function(arg0) {
4023
- const ret = SubductionLongPollConnection.__wrap(arg0);
3917
+ __wbg_subductionhttplongpoll_new: function(arg0) {
3918
+ const ret = SubductionHttpLongPoll.__wrap(arg0);
4024
3919
  return ret;
4025
3920
  },
4026
3921
  __wbg_subductionwebsocket_new: function(arg0) {
@@ -4058,7 +3953,7 @@ function __wbg_get_imports() {
4058
3953
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
4059
3954
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
4060
3955
  }, arguments); },
4061
- __wbg_verifyingKey_8bc97ecebbb22709: function(arg0) {
3956
+ __wbg_verifyingKey_e2a30e05511820c4: function(arg0) {
4062
3957
  const ret = arg0.verifyingKey();
4063
3958
  return ret;
4064
3959
  },
@@ -4071,79 +3966,74 @@ function __wbg_get_imports() {
4071
3966
  return ret;
4072
3967
  },
4073
3968
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
4074
- // Cast intrinsic for `Closure(Closure { dtor_idx: 589, function: Function { arguments: [Externref], shim_idx: 700, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
4075
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_239, __wasm_bindgen_func_elem_1447);
3969
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 10, function: Function { arguments: [Externref], shim_idx: 11, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3970
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_255, __wasm_bindgen_func_elem_552);
4076
3971
  return ret;
4077
3972
  },
4078
3973
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
4079
- // Cast intrinsic for `Closure(Closure { dtor_idx: 7, function: Function { arguments: [Externref], shim_idx: 9, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
4080
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_239, __wasm_bindgen_func_elem_529);
3974
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 10, function: Function { arguments: [NamedExternref("Event")], shim_idx: 11, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3975
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_255, __wasm_bindgen_func_elem_552_1);
4081
3976
  return ret;
4082
3977
  },
4083
3978
  __wbindgen_cast_0000000000000003: function(arg0, arg1) {
4084
- // Cast intrinsic for `Closure(Closure { dtor_idx: 7, function: Function { arguments: [NamedExternref("Event")], shim_idx: 9, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
4085
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_239, __wasm_bindgen_func_elem_529_2);
3979
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 10, function: Function { arguments: [NamedExternref("IDBVersionChangeEvent")], shim_idx: 11, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3980
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_255, __wasm_bindgen_func_elem_552_2);
4086
3981
  return ret;
4087
3982
  },
4088
3983
  __wbindgen_cast_0000000000000004: function(arg0, arg1) {
4089
- // Cast intrinsic for `Closure(Closure { dtor_idx: 7, function: Function { arguments: [NamedExternref("IDBVersionChangeEvent")], shim_idx: 9, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
4090
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_239, __wasm_bindgen_func_elem_529_3);
3984
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 10, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 11, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3985
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_255, __wasm_bindgen_func_elem_552_3);
4091
3986
  return ret;
4092
3987
  },
4093
3988
  __wbindgen_cast_0000000000000005: function(arg0, arg1) {
4094
- // Cast intrinsic for `Closure(Closure { dtor_idx: 7, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 9, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
4095
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_239, __wasm_bindgen_func_elem_529_4);
4096
- return ret;
4097
- },
4098
- __wbindgen_cast_0000000000000006: function(arg0, arg1) {
4099
- // Cast intrinsic for `Closure(Closure { dtor_idx: 7, function: Function { arguments: [], shim_idx: 8, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
4100
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_239, __wasm_bindgen_func_elem_528);
3989
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 609, function: Function { arguments: [Externref], shim_idx: 698, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
3990
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_255, __wasm_bindgen_func_elem_1476);
4101
3991
  return ret;
4102
3992
  },
4103
- __wbindgen_cast_0000000000000007: function(arg0) {
3993
+ __wbindgen_cast_0000000000000006: function(arg0) {
4104
3994
  // Cast intrinsic for `F64 -> Externref`.
4105
3995
  const ret = arg0;
4106
3996
  return ret;
4107
3997
  },
4108
- __wbindgen_cast_0000000000000008: function(arg0, arg1) {
3998
+ __wbindgen_cast_0000000000000007: function(arg0, arg1) {
4109
3999
  // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
4110
4000
  const ret = getArrayU8FromWasm0(arg0, arg1);
4111
4001
  return ret;
4112
4002
  },
4113
- __wbindgen_cast_0000000000000009: function(arg0, arg1) {
4003
+ __wbindgen_cast_0000000000000008: function(arg0, arg1) {
4114
4004
  // Cast intrinsic for `Ref(String) -> Externref`.
4115
4005
  const ret = getStringFromWasm0(arg0, arg1);
4116
4006
  return ret;
4117
4007
  },
4118
- __wbindgen_cast_000000000000000a: function(arg0, arg1) {
4008
+ __wbindgen_cast_0000000000000009: function(arg0, arg1) {
4119
4009
  var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
4120
4010
  wasm.__wbindgen_export5(arg0, arg1 * 4, 4);
4121
4011
  // Cast intrinsic for `Vector(NamedExternref("Fragment")) -> Externref`.
4122
4012
  const ret = v0;
4123
4013
  return ret;
4124
4014
  },
4125
- __wbindgen_cast_000000000000000b: function(arg0, arg1) {
4015
+ __wbindgen_cast_000000000000000a: function(arg0, arg1) {
4126
4016
  var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
4127
4017
  wasm.__wbindgen_export5(arg0, arg1 * 4, 4);
4128
4018
  // Cast intrinsic for `Vector(NamedExternref("LooseCommit")) -> Externref`.
4129
4019
  const ret = v0;
4130
4020
  return ret;
4131
4021
  },
4132
- __wbindgen_cast_000000000000000c: function(arg0, arg1) {
4022
+ __wbindgen_cast_000000000000000b: function(arg0, arg1) {
4133
4023
  var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
4134
4024
  wasm.__wbindgen_export5(arg0, arg1 * 4, 4);
4135
4025
  // Cast intrinsic for `Vector(NamedExternref("PeerId")) -> Externref`.
4136
4026
  const ret = v0;
4137
4027
  return ret;
4138
4028
  },
4139
- __wbindgen_cast_000000000000000d: function(arg0, arg1) {
4029
+ __wbindgen_cast_000000000000000c: function(arg0, arg1) {
4140
4030
  var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
4141
4031
  wasm.__wbindgen_export5(arg0, arg1 * 4, 4);
4142
4032
  // Cast intrinsic for `Vector(NamedExternref("SedimentreeId")) -> Externref`.
4143
4033
  const ret = v0;
4144
4034
  return ret;
4145
4035
  },
4146
- __wbindgen_cast_000000000000000e: function(arg0, arg1) {
4036
+ __wbindgen_cast_000000000000000d: function(arg0, arg1) {
4147
4037
  var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
4148
4038
  wasm.__wbindgen_export5(arg0, arg1 * 4, 4);
4149
4039
  // Cast intrinsic for `Vector(NamedExternref("Uint8Array")) -> Externref`.
@@ -4166,39 +4056,35 @@ function __wbg_get_imports() {
4166
4056
  };
4167
4057
  }
4168
4058
 
4169
- function __wasm_bindgen_func_elem_528(arg0, arg1) {
4170
- wasm.__wasm_bindgen_func_elem_528(arg0, arg1);
4059
+ function __wasm_bindgen_func_elem_552(arg0, arg1, arg2) {
4060
+ wasm.__wasm_bindgen_func_elem_552(arg0, arg1, arg2);
4171
4061
  }
4172
4062
 
4173
- function __wasm_bindgen_func_elem_529(arg0, arg1, arg2) {
4174
- wasm.__wasm_bindgen_func_elem_529(arg0, arg1, arg2);
4063
+ function __wasm_bindgen_func_elem_552_1(arg0, arg1, arg2) {
4064
+ wasm.__wasm_bindgen_func_elem_552_1(arg0, arg1, arg2);
4175
4065
  }
4176
4066
 
4177
- function __wasm_bindgen_func_elem_529_2(arg0, arg1, arg2) {
4178
- wasm.__wasm_bindgen_func_elem_529_2(arg0, arg1, arg2);
4067
+ function __wasm_bindgen_func_elem_552_2(arg0, arg1, arg2) {
4068
+ wasm.__wasm_bindgen_func_elem_552_2(arg0, arg1, arg2);
4179
4069
  }
4180
4070
 
4181
- function __wasm_bindgen_func_elem_529_3(arg0, arg1, arg2) {
4182
- wasm.__wasm_bindgen_func_elem_529_3(arg0, arg1, arg2);
4071
+ function __wasm_bindgen_func_elem_552_3(arg0, arg1, arg2) {
4072
+ wasm.__wasm_bindgen_func_elem_552_3(arg0, arg1, arg2);
4183
4073
  }
4184
4074
 
4185
- function __wasm_bindgen_func_elem_529_4(arg0, arg1, arg2) {
4186
- wasm.__wasm_bindgen_func_elem_529_4(arg0, arg1, arg2);
4187
- }
4188
-
4189
- function __wasm_bindgen_func_elem_1447(arg0, arg1, arg2) {
4190
- const ret = wasm.__wasm_bindgen_func_elem_1447(arg0, arg1, arg2);
4075
+ function __wasm_bindgen_func_elem_1476(arg0, arg1, arg2) {
4076
+ const ret = wasm.__wasm_bindgen_func_elem_1476(arg0, arg1, arg2);
4191
4077
  if (ret[1]) {
4192
4078
  throw takeFromExternrefTable0(ret[0]);
4193
4079
  }
4194
4080
  }
4195
4081
 
4196
- function __wasm_bindgen_func_elem_1447_191(arg0, arg1, arg2, arg3) {
4197
- wasm.__wasm_bindgen_func_elem_1447_191(arg0, arg1, arg2, arg3);
4082
+ function __wasm_bindgen_func_elem_1476_183(arg0, arg1, arg2, arg3) {
4083
+ wasm.__wasm_bindgen_func_elem_1476_183(arg0, arg1, arg2, arg3);
4198
4084
  }
4199
4085
 
4200
- function __wasm_bindgen_func_elem_1447_192(arg0, arg1, arg2, arg3) {
4201
- wasm.__wasm_bindgen_func_elem_1447_192(arg0, arg1, arg2, arg3);
4086
+ function __wasm_bindgen_func_elem_1476_184(arg0, arg1, arg2, arg3) {
4087
+ wasm.__wasm_bindgen_func_elem_1476_184(arg0, arg1, arg2, arg3);
4202
4088
  }
4203
4089
 
4204
4090
 
@@ -4209,9 +4095,6 @@ const __wbindgen_enum_IdbTransactionMode = ["readonly", "readwrite", "versioncha
4209
4095
 
4210
4096
 
4211
4097
  const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
4212
- const ConnErrorPairFinalization = (typeof FinalizationRegistry === 'undefined')
4213
- ? { register: () => {}, unregister: () => {} }
4214
- : new FinalizationRegistry(ptr => wasm.__wbg_connerrorpair_free(ptr >>> 0, 1));
4215
4098
  const MemorySignerFinalization = (typeof FinalizationRegistry === 'undefined')
4216
4099
  ? { register: () => {}, unregister: () => {} }
4217
4100
  : new FinalizationRegistry(ptr => wasm.__wbg_memorysigner_free(ptr >>> 0, 1));
@@ -4221,12 +4104,12 @@ const MemoryStorageFinalization = (typeof FinalizationRegistry === 'undefined')
4221
4104
  const PeerBatchSyncResultFinalization = (typeof FinalizationRegistry === 'undefined')
4222
4105
  ? { register: () => {}, unregister: () => {} }
4223
4106
  : new FinalizationRegistry(ptr => wasm.__wbg_peerbatchsyncresult_free(ptr >>> 0, 1));
4224
- const AuthenticatedConnectionFinalization = (typeof FinalizationRegistry === 'undefined')
4225
- ? { register: () => {}, unregister: () => {} }
4226
- : new FinalizationRegistry(ptr => wasm.__wbg_authenticatedconnection_free(ptr >>> 0, 1));
4227
4107
  const AuthenticatedLongPollFinalization = (typeof FinalizationRegistry === 'undefined')
4228
4108
  ? { register: () => {}, unregister: () => {} }
4229
4109
  : new FinalizationRegistry(ptr => wasm.__wbg_authenticatedlongpoll_free(ptr >>> 0, 1));
4110
+ const AuthenticatedTransportFinalization = (typeof FinalizationRegistry === 'undefined')
4111
+ ? { register: () => {}, unregister: () => {} }
4112
+ : new FinalizationRegistry(ptr => wasm.__wbg_authenticatedtransport_free(ptr >>> 0, 1));
4230
4113
  const AuthenticatedWebSocketFinalization = (typeof FinalizationRegistry === 'undefined')
4231
4114
  ? { register: () => {}, unregister: () => {} }
4232
4115
  : new FinalizationRegistry(ptr => wasm.__wbg_authenticatedwebsocket_free(ptr >>> 0, 1));
@@ -4245,9 +4128,6 @@ const CallErrorFinalization = (typeof FinalizationRegistry === 'undefined')
4245
4128
  const CommitWithBlobFinalization = (typeof FinalizationRegistry === 'undefined')
4246
4129
  ? { register: () => {}, unregister: () => {} }
4247
4130
  : new FinalizationRegistry(ptr => wasm.__wbg_commitwithblob_free(ptr >>> 0, 1));
4248
- const ConnectionIdFinalization = (typeof FinalizationRegistry === 'undefined')
4249
- ? { register: () => {}, unregister: () => {} }
4250
- : new FinalizationRegistry(ptr => wasm.__wbg_connectionid_free(ptr >>> 0, 1));
4251
4131
  const DepthFinalization = (typeof FinalizationRegistry === 'undefined')
4252
4132
  ? { register: () => {}, unregister: () => {} }
4253
4133
  : new FinalizationRegistry(ptr => wasm.__wbg_depth_free(ptr >>> 0, 1));
@@ -4269,21 +4149,21 @@ const FragmentsArrayFinalization = (typeof FinalizationRegistry === 'undefined')
4269
4149
  const HashMetricFinalization = (typeof FinalizationRegistry === 'undefined')
4270
4150
  ? { register: () => {}, unregister: () => {} }
4271
4151
  : new FinalizationRegistry(ptr => wasm.__wbg_hashmetric_free(ptr >>> 0, 1));
4152
+ const SubductionHttpLongPollFinalization = (typeof FinalizationRegistry === 'undefined')
4153
+ ? { register: () => {}, unregister: () => {} }
4154
+ : new FinalizationRegistry(ptr => wasm.__wbg_subductionhttplongpoll_free(ptr >>> 0, 1));
4272
4155
  const SubductionLongPollFinalization = (typeof FinalizationRegistry === 'undefined')
4273
4156
  ? { register: () => {}, unregister: () => {} }
4274
4157
  : new FinalizationRegistry(ptr => wasm.__wbg_subductionlongpoll_free(ptr >>> 0, 1));
4275
- const SubductionLongPollConnectionFinalization = (typeof FinalizationRegistry === 'undefined')
4276
- ? { register: () => {}, unregister: () => {} }
4277
- : new FinalizationRegistry(ptr => wasm.__wbg_subductionlongpollconnection_free(ptr >>> 0, 1));
4278
4158
  const LooseCommitFinalization = (typeof FinalizationRegistry === 'undefined')
4279
4159
  ? { register: () => {}, unregister: () => {} }
4280
4160
  : new FinalizationRegistry(ptr => wasm.__wbg_loosecommit_free(ptr >>> 0, 1));
4281
- const MessageFinalization = (typeof FinalizationRegistry === 'undefined')
4161
+ const SyncMessageFinalization = (typeof FinalizationRegistry === 'undefined')
4282
4162
  ? { register: () => {}, unregister: () => {} }
4283
- : new FinalizationRegistry(ptr => wasm.__wbg_message_free(ptr >>> 0, 1));
4284
- const MessagePortConnectionFinalization = (typeof FinalizationRegistry === 'undefined')
4163
+ : new FinalizationRegistry(ptr => wasm.__wbg_syncmessage_free(ptr >>> 0, 1));
4164
+ const MessagePortTransportFinalization = (typeof FinalizationRegistry === 'undefined')
4285
4165
  ? { register: () => {}, unregister: () => {} }
4286
- : new FinalizationRegistry(ptr => wasm.__wbg_messageportconnection_free(ptr >>> 0, 1));
4166
+ : new FinalizationRegistry(ptr => wasm.__wbg_messageporttransport_free(ptr >>> 0, 1));
4287
4167
  const NonceFinalization = (typeof FinalizationRegistry === 'undefined')
4288
4168
  ? { register: () => {}, unregister: () => {} }
4289
4169
  : new FinalizationRegistry(ptr => wasm.__wbg_nonce_free(ptr >>> 0, 1));