@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,116 @@
2
2
  const { tryIntoJsSedimentreeIdsArray } = require(String.raw`./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
+ 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
+ exports.AuthenticatedLongPoll = AuthenticatedLongPoll;
66
+
67
+ /**
68
+ * A transport-erased authenticated transport.
69
+ *
70
+ * Wraps an [`Authenticated<MessageTransport<JsTransport>>`] and is the common type
8
71
  * accepted by [`addConnection`](crate::subduction::WasmSubduction::add_connection).
9
72
  *
10
73
  * # Construction
11
74
  *
12
- * There are three ways to obtain an `AuthenticatedConnection`:
75
+ * There are three ways to obtain an `AuthenticatedTransport`:
13
76
  *
14
- * 1. **Custom transport** — implement [`HandshakeConnection`](handshake::JsHandshakeConnection)
15
- * (extends `Connection` with `sendBytes`/`recvBytes`) and call [`setup`](Self::setup):
77
+ * 1. **Custom transport** — implement the `Transport` interface
78
+ * (`sendBytes`/`recvBytes`/`disconnect`) and call [`setup`](Self::setup):
16
79
  *
17
80
  * ```js
18
- * const auth = await AuthenticatedConnection.setup(myConn, signer, peerId);
81
+ * const auth = await AuthenticatedTransport.setup(myTransport, signer, peerId);
19
82
  * ```
20
83
  *
21
84
  * 2. **From WebSocket** — authenticate via [`SubductionWebSocket`] then convert:
22
85
  *
23
86
  * ```js
24
87
  * const wsAuth = await SubductionWebSocket.tryConnect(url, signer, peerId, timeout);
25
- * const auth = wsAuth.toConnection();
88
+ * const auth = wsAuth.toTransport();
26
89
  * ```
27
90
  *
28
91
  * 3. **From HTTP long-poll** — same pattern via [`SubductionLongPoll`]:
29
92
  *
30
93
  * ```js
31
94
  * const lpAuth = await SubductionLongPoll.tryConnect(url, signer, peerId, timeout);
32
- * const auth = lpAuth.toConnection();
95
+ * const auth = lpAuth.toTransport();
33
96
  * ```
34
97
  */
35
- class AuthenticatedConnection {
98
+ class AuthenticatedTransport {
36
99
  static __wrap(ptr) {
37
100
  ptr = ptr >>> 0;
38
- const obj = Object.create(AuthenticatedConnection.prototype);
101
+ const obj = Object.create(AuthenticatedTransport.prototype);
39
102
  obj.__wbg_ptr = ptr;
40
- AuthenticatedConnectionFinalization.register(obj, obj.__wbg_ptr, obj);
103
+ AuthenticatedTransportFinalization.register(obj, obj.__wbg_ptr, obj);
41
104
  return obj;
42
105
  }
43
106
  __destroy_into_raw() {
44
107
  const ptr = this.__wbg_ptr;
45
108
  this.__wbg_ptr = 0;
46
- AuthenticatedConnectionFinalization.unregister(this);
109
+ AuthenticatedTransportFinalization.unregister(this);
47
110
  return ptr;
48
111
  }
49
112
  free() {
50
113
  const ptr = this.__destroy_into_raw();
51
- wasm.__wbg_authenticatedconnection_free(ptr, 0);
114
+ wasm.__wbg_authenticatedtransport_free(ptr, 0);
52
115
  }
53
116
  /**
54
117
  * Accept an incoming handshake over a custom transport (responder side).
@@ -58,20 +121,20 @@ class AuthenticatedConnection {
58
121
  *
59
122
  * # Arguments
60
123
  *
61
- * * `connection` - A `HandshakeConnection` (extends `Connection`)
124
+ * * `transport` - A `Transport` implementing `sendBytes`/`recvBytes`/`disconnect`
62
125
  * * `signer` - The responder's signer for authentication
63
126
  * * `max_drift_seconds` - Maximum acceptable clock drift in seconds (default: 600)
64
127
  *
65
128
  * # Errors
66
129
  *
67
130
  * Returns a [`HandshakeError`](WasmHandshakeError) if the handshake fails.
68
- * @param {HandshakeConnection} connection
131
+ * @param {Transport} transport
69
132
  * @param {any} signer
70
133
  * @param {number | null} [max_drift_seconds]
71
- * @returns {Promise<AuthenticatedConnection>}
134
+ * @returns {Promise<AuthenticatedTransport>}
72
135
  */
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);
136
+ static accept(transport, signer, max_drift_seconds) {
137
+ const ret = wasm.authenticatedtransport_accept(transport, signer, isLikeNone(max_drift_seconds) ? 0x100000001 : (max_drift_seconds) >>> 0);
75
138
  return ret;
76
139
  }
77
140
  /**
@@ -79,105 +142,72 @@ class AuthenticatedConnection {
79
142
  * @returns {PeerId}
80
143
  */
81
144
  get peerId() {
82
- const ret = wasm.authenticatedconnection_peerId(this.__wbg_ptr);
145
+ const ret = wasm.authenticatedtransport_peerId(this.__wbg_ptr);
83
146
  return PeerId.__wrap(ret);
84
147
  }
85
148
  /**
86
149
  * Run the Subduction handshake over a custom transport, producing an
87
- * authenticated connection.
150
+ * authenticated transport.
88
151
  *
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.
152
+ * The `transport` object must implement the `Transport` interface
153
+ * (`sendBytes`/`recvBytes`/`disconnect`).
154
+ * The same object is used for both the handshake phase and post-handshake
155
+ * communication.
92
156
  *
93
157
  * # Arguments
94
158
  *
95
- * * `connection` - A `HandshakeConnection` (extends `Connection`)
159
+ * * `transport` - A `Transport` implementing `sendBytes`/`recvBytes`/`disconnect`
96
160
  * * `signer` - The client's signer for authentication
97
161
  * * `expected_peer_id` - The expected server peer ID (verified during handshake)
98
162
  *
99
163
  * # Errors
100
164
  *
101
165
  * Returns a [`HandshakeError`](WasmHandshakeError) if the handshake fails.
102
- * @param {HandshakeConnection} connection
166
+ * @param {Transport} transport
103
167
  * @param {any} signer
104
168
  * @param {PeerId} expected_peer_id
105
- * @returns {Promise<AuthenticatedConnection>}
169
+ * @returns {Promise<AuthenticatedTransport>}
106
170
  */
107
- static setup(connection, signer, expected_peer_id) {
171
+ static setup(transport, signer, expected_peer_id) {
108
172
  _assertClass(expected_peer_id, PeerId);
109
- const ret = wasm.authenticatedconnection_setup(connection, signer, expected_peer_id.__wbg_ptr);
173
+ const ret = wasm.authenticatedtransport_setup(transport, signer, expected_peer_id.__wbg_ptr);
110
174
  return ret;
111
175
  }
112
- }
113
- if (Symbol.dispose) AuthenticatedConnection.prototype[Symbol.dispose] = AuthenticatedConnection.prototype.free;
114
- exports.AuthenticatedConnection = AuthenticatedConnection;
115
-
116
- /**
117
- * An authenticated HTTP long-poll connection.
118
- *
119
- * This wrapper proves that the connection has completed the Subduction handshake
120
- * and the peer identity has been cryptographically verified.
121
- *
122
- * Obtain via [`SubductionLongPoll::tryConnect`] or [`SubductionLongPoll::tryDiscover`].
123
- */
124
- class AuthenticatedLongPoll {
125
- static __wrap(ptr) {
126
- ptr = ptr >>> 0;
127
- const obj = Object.create(AuthenticatedLongPoll.prototype);
128
- obj.__wbg_ptr = ptr;
129
- AuthenticatedLongPollFinalization.register(obj, obj.__wbg_ptr, obj);
130
- return obj;
131
- }
132
- __destroy_into_raw() {
133
- const ptr = this.__wbg_ptr;
134
- this.__wbg_ptr = 0;
135
- AuthenticatedLongPollFinalization.unregister(this);
136
- return ptr;
137
- }
138
- free() {
139
- const ptr = this.__destroy_into_raw();
140
- wasm.__wbg_authenticatedlongpoll_free(ptr, 0);
141
- }
142
- /**
143
- * The verified peer identity.
144
- * @returns {PeerId}
145
- */
146
- get peerId() {
147
- const ret = wasm.authenticatedlongpoll_peerId(this.__wbg_ptr);
148
- return PeerId.__wrap(ret);
149
- }
150
- /**
151
- * The session ID assigned by the server.
152
- * @returns {string}
153
- */
154
- get sessionId() {
155
- let deferred1_0;
156
- let deferred1_1;
157
- try {
158
- const ret = wasm.authenticatedlongpoll_sessionId(this.__wbg_ptr);
159
- deferred1_0 = ret[0];
160
- deferred1_1 = ret[1];
161
- return getStringFromWasm0(ret[0], ret[1]);
162
- } finally {
163
- wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
164
- }
165
- }
166
176
  /**
167
- * Convert to a transport-erased [`AuthenticatedConnection`](super::WasmAuthenticatedConnection).
168
- * @returns {AuthenticatedConnection}
177
+ * Run the Subduction handshake over a custom transport using discovery
178
+ * mode, producing an authenticated transport.
179
+ *
180
+ * Unlike [`setup`](Self::setup) which requires a known peer ID,
181
+ * this method discovers the peer's identity during the handshake
182
+ * using a shared service name.
183
+ *
184
+ * # Arguments
185
+ *
186
+ * * `transport` - A `Transport` implementing `sendBytes`/`recvBytes`/`disconnect`
187
+ * * `signer` - The client's signer for authentication
188
+ * * `service_name` - Shared service name for discovery.
189
+ * Defaults to [`DEFAULT_LOCAL_SERVICE_NAME`] (`"subduction:local"`) if omitted.
190
+ *
191
+ * # Errors
192
+ *
193
+ * Returns a [`HandshakeError`](WasmHandshakeError) if the handshake fails.
194
+ * @param {Transport} transport
195
+ * @param {any} signer
196
+ * @param {string | null} [service_name]
197
+ * @returns {Promise<AuthenticatedTransport>}
169
198
  */
170
- toConnection() {
171
- const ptr = this.__destroy_into_raw();
172
- const ret = wasm.authenticatedlongpoll_toConnection(ptr);
173
- return AuthenticatedConnection.__wrap(ret);
199
+ static setupDiscover(transport, signer, service_name) {
200
+ var ptr0 = isLikeNone(service_name) ? 0 : passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
201
+ var len0 = WASM_VECTOR_LEN;
202
+ const ret = wasm.authenticatedtransport_setupDiscover(transport, signer, ptr0, len0);
203
+ return ret;
174
204
  }
175
205
  }
176
- if (Symbol.dispose) AuthenticatedLongPoll.prototype[Symbol.dispose] = AuthenticatedLongPoll.prototype.free;
177
- exports.AuthenticatedLongPoll = AuthenticatedLongPoll;
206
+ if (Symbol.dispose) AuthenticatedTransport.prototype[Symbol.dispose] = AuthenticatedTransport.prototype.free;
207
+ exports.AuthenticatedTransport = AuthenticatedTransport;
178
208
 
179
209
  /**
180
- * An authenticated WebSocket connection.
210
+ * An authenticated WebSocket transport.
181
211
  *
182
212
  * This wrapper proves that the connection has completed the Subduction handshake
183
213
  * and the peer identity has been cryptographically verified.
@@ -212,13 +242,13 @@ class AuthenticatedWebSocket {
212
242
  return PeerId.__wrap(ret);
213
243
  }
214
244
  /**
215
- * Convert to a transport-erased [`AuthenticatedConnection`](super::WasmAuthenticatedConnection).
216
- * @returns {AuthenticatedConnection}
245
+ * Convert to a transport-erased [`AuthenticatedTransport`](super::WasmAuthenticatedTransport).
246
+ * @returns {AuthenticatedTransport}
217
247
  */
218
- toConnection() {
248
+ toTransport() {
219
249
  const ptr = this.__destroy_into_raw();
220
- const ret = wasm.authenticatedwebsocket_toConnection(ptr);
221
- return AuthenticatedConnection.__wrap(ret);
250
+ const ret = wasm.authenticatedwebsocket_toTransport(ptr);
251
+ return AuthenticatedTransport.__wrap(ret);
222
252
  }
223
253
  }
224
254
  if (Symbol.dispose) AuthenticatedWebSocket.prototype[Symbol.dispose] = AuthenticatedWebSocket.prototype.free;
@@ -469,65 +499,6 @@ class CommitWithBlob {
469
499
  if (Symbol.dispose) CommitWithBlob.prototype[Symbol.dispose] = CommitWithBlob.prototype.free;
470
500
  exports.CommitWithBlob = CommitWithBlob;
471
501
 
472
- /**
473
- * A pair of a connection and an error that occurred during a call.
474
- */
475
- class ConnErrorPair {
476
- static __wrap(ptr) {
477
- ptr = ptr >>> 0;
478
- const obj = Object.create(ConnErrorPair.prototype);
479
- obj.__wbg_ptr = ptr;
480
- ConnErrorPairFinalization.register(obj, obj.__wbg_ptr, obj);
481
- return obj;
482
- }
483
- __destroy_into_raw() {
484
- const ptr = this.__wbg_ptr;
485
- this.__wbg_ptr = 0;
486
- ConnErrorPairFinalization.unregister(this);
487
- return ptr;
488
- }
489
- free() {
490
- const ptr = this.__destroy_into_raw();
491
- wasm.__wbg_connerrorpair_free(ptr, 0);
492
- }
493
- /**
494
- * The connection that encountered the error.
495
- * @returns {Connection}
496
- */
497
- get conn() {
498
- const ret = wasm.connerrorpair_conn(this.__wbg_ptr);
499
- return ret;
500
- }
501
- /**
502
- * The error that occurred during the call.
503
- * @returns {Error}
504
- */
505
- get err() {
506
- const ret = wasm.connerrorpair_err(this.__wbg_ptr);
507
- return ret;
508
- }
509
- }
510
- if (Symbol.dispose) ConnErrorPair.prototype[Symbol.dispose] = ConnErrorPair.prototype.free;
511
- exports.ConnErrorPair = ConnErrorPair;
512
-
513
- /**
514
- * A Wasm wrapper around the Rust `ConnectionId` type.
515
- */
516
- class ConnectionId {
517
- __destroy_into_raw() {
518
- const ptr = this.__wbg_ptr;
519
- this.__wbg_ptr = 0;
520
- ConnectionIdFinalization.unregister(this);
521
- return ptr;
522
- }
523
- free() {
524
- const ptr = this.__destroy_into_raw();
525
- wasm.__wbg_connectionid_free(ptr, 0);
526
- }
527
- }
528
- if (Symbol.dispose) ConnectionId.prototype[Symbol.dispose] = ConnectionId.prototype.free;
529
- exports.ConnectionId = ConnectionId;
530
-
531
502
  /**
532
503
  * A JavaScript wrapper around `Depth`.
533
504
  */
@@ -1381,360 +1352,121 @@ if (Symbol.dispose) MemoryStorage.prototype[Symbol.dispose] = MemoryStorage.prot
1381
1352
  exports.MemoryStorage = MemoryStorage;
1382
1353
 
1383
1354
  /**
1384
- * Wasm wrapper for [`Message`].
1355
+ * A `Transport` backed by a `MessagePort` (or any object with
1356
+ * `postMessage` / `onmessage` / `close`).
1357
+ *
1358
+ * Implements the byte-oriented `Transport` interface (`sendBytes`,
1359
+ * `recvBytes`, `disconnect`) using the port as the underlying channel.
1360
+ * After the handshake, the [`Authenticated`] wrapper provides the sync API.
1385
1361
  */
1386
- class Message {
1362
+ class MessagePortTransport {
1387
1363
  static __wrap(ptr) {
1388
1364
  ptr = ptr >>> 0;
1389
- const obj = Object.create(Message.prototype);
1365
+ const obj = Object.create(MessagePortTransport.prototype);
1390
1366
  obj.__wbg_ptr = ptr;
1391
- MessageFinalization.register(obj, obj.__wbg_ptr, obj);
1367
+ MessagePortTransportFinalization.register(obj, obj.__wbg_ptr, obj);
1392
1368
  return obj;
1393
1369
  }
1394
1370
  __destroy_into_raw() {
1395
1371
  const ptr = this.__wbg_ptr;
1396
1372
  this.__wbg_ptr = 0;
1397
- MessageFinalization.unregister(this);
1373
+ MessagePortTransportFinalization.unregister(this);
1398
1374
  return ptr;
1399
1375
  }
1400
1376
  free() {
1401
1377
  const ptr = this.__destroy_into_raw();
1402
- wasm.__wbg_message_free(ptr, 0);
1378
+ wasm.__wbg_messageporttransport_free(ptr, 0);
1403
1379
  }
1404
1380
  /**
1405
- * Upcasts; to the JS-import type for [`WasmMessage`].
1406
- * @returns {Message}
1381
+ * Disconnect (close the port).
1382
+ * @returns {Promise<any>}
1407
1383
  */
1408
- __wasm_refgen_toWasmMessage() {
1409
- const ret = wasm.message___wasm_refgen_toWasmMessage(this.__wbg_ptr);
1410
- return Message.__wrap(ret);
1384
+ disconnect() {
1385
+ const ret = wasm.messageporttransport_disconnect(this.__wbg_ptr);
1386
+ return ret;
1411
1387
  }
1412
1388
  /**
1413
- * Create a [`Message::BatchSyncRequest`] message.
1414
- * @param {BatchSyncRequest} request
1415
- * @returns {Message}
1389
+ * Create a new connection wrapping the given `MessagePort`.
1390
+ * @param {any} port
1416
1391
  */
1417
- static batchSyncRequest(request) {
1418
- _assertClass(request, BatchSyncRequest);
1419
- const ret = wasm.message_batchSyncRequest(request.__wbg_ptr);
1420
- return Message.__wrap(ret);
1392
+ constructor(port) {
1393
+ const ret = wasm.messageporttransport_new(port);
1394
+ this.__wbg_ptr = ret >>> 0;
1395
+ MessagePortTransportFinalization.register(this, this.__wbg_ptr, this);
1396
+ return this;
1421
1397
  }
1422
1398
  /**
1423
- * Create a [`Message::BatchSyncResponse`] message.
1424
- * @param {BatchSyncResponse} response
1425
- * @returns {Message}
1399
+ * Receive raw bytes (for the handshake phase).
1400
+ * @returns {Promise<any>}
1426
1401
  */
1427
- static batchSyncResponse(response) {
1428
- _assertClass(response, BatchSyncResponse);
1429
- const ret = wasm.message_batchSyncResponse(response.__wbg_ptr);
1430
- return Message.__wrap(ret);
1402
+ recvBytes() {
1403
+ const ret = wasm.messageporttransport_recvBytes(this.__wbg_ptr);
1404
+ return ret;
1431
1405
  }
1432
1406
  /**
1433
- * The [`Blob`] for commit or fragment messages, if applicable.
1434
- * @returns {Uint8Array | undefined}
1407
+ * Send raw bytes (for the handshake phase).
1408
+ * @param {Uint8Array} bytes
1409
+ * @returns {Promise<any>}
1435
1410
  */
1436
- get blob() {
1437
- const ret = wasm.message_blob(this.__wbg_ptr);
1411
+ sendBytes(bytes) {
1412
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
1413
+ const len0 = WASM_VECTOR_LEN;
1414
+ const ret = wasm.messageporttransport_sendBytes(this.__wbg_ptr, ptr0, len0);
1438
1415
  return ret;
1439
1416
  }
1417
+ }
1418
+ if (Symbol.dispose) MessagePortTransport.prototype[Symbol.dispose] = MessagePortTransport.prototype.free;
1419
+ exports.MessagePortTransport = MessagePortTransport;
1420
+
1421
+ /**
1422
+ * A 64-bit nonce represented as big-endian bytes.
1423
+ */
1424
+ class Nonce {
1425
+ static __wrap(ptr) {
1426
+ ptr = ptr >>> 0;
1427
+ const obj = Object.create(Nonce.prototype);
1428
+ obj.__wbg_ptr = ptr;
1429
+ NonceFinalization.register(obj, obj.__wbg_ptr, obj);
1430
+ return obj;
1431
+ }
1432
+ __destroy_into_raw() {
1433
+ const ptr = this.__wbg_ptr;
1434
+ this.__wbg_ptr = 0;
1435
+ NonceFinalization.unregister(this);
1436
+ return ptr;
1437
+ }
1438
+ free() {
1439
+ const ptr = this.__destroy_into_raw();
1440
+ wasm.__wbg_nonce_free(ptr, 0);
1441
+ }
1440
1442
  /**
1441
- * The [`Blob`]s for a [`Message::BlobsResponse`], if applicable.
1442
- * @returns {Uint8Array[] | undefined}
1443
+ * Get the nonce as big-endian bytes.
1444
+ * @returns {Uint8Array}
1443
1445
  */
1444
- get blobs() {
1445
- const ret = wasm.message_blobs(this.__wbg_ptr);
1446
- let v1;
1447
- if (ret[0] !== 0) {
1448
- v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1449
- wasm.__wbindgen_export5(ret[0], ret[1] * 4, 4);
1450
- }
1446
+ get bytes() {
1447
+ const ret = wasm.nonce_bytes(this.__wbg_ptr);
1448
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1449
+ wasm.__wbindgen_export5(ret[0], ret[1] * 1, 1);
1451
1450
  return v1;
1452
1451
  }
1453
1452
  /**
1454
- * Create a [`Message::BlobsRequest`] message.
1455
- * @param {SedimentreeId} id
1456
- * @param {Digest[]} digests
1457
- * @returns {Message}
1453
+ * Create a new [`WasmNonce`] from exactly 8 big-endian bytes.
1454
+ *
1455
+ * # Errors
1456
+ *
1457
+ * Returns [`WasmNonceError`] if the input is not exactly 8 bytes.
1458
+ * @param {Uint8Array} bytes
1458
1459
  */
1459
- static blobsRequest(id, digests) {
1460
- _assertClass(id, SedimentreeId);
1461
- const ptr0 = passArrayJsValueToWasm0(digests, wasm.__wbindgen_export);
1460
+ constructor(bytes) {
1461
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
1462
1462
  const len0 = WASM_VECTOR_LEN;
1463
- const ret = wasm.message_blobsRequest(id.__wbg_ptr, ptr0, len0);
1464
- return Message.__wrap(ret);
1465
- }
1466
- /**
1467
- * Create a [`Message::BlobsResponse`] message.
1468
- * @param {SedimentreeId} id
1469
- * @param {Uint8Array[]} blobs
1470
- * @returns {Message}
1471
- */
1472
- static blobsResponse(id, blobs) {
1473
- _assertClass(id, SedimentreeId);
1474
- const ptr0 = passArrayJsValueToWasm0(blobs, wasm.__wbindgen_export);
1475
- const len0 = WASM_VECTOR_LEN;
1476
- const ret = wasm.message_blobsResponse(id.__wbg_ptr, ptr0, len0);
1477
- return Message.__wrap(ret);
1478
- }
1479
- /**
1480
- * The [`LooseCommit`] for a [`Message::LooseCommit`], if applicable.
1481
- *
1482
- * Decodes the signed payload to extract the underlying commit.
1483
- * @returns {LooseCommit | undefined}
1484
- */
1485
- get commit() {
1486
- const ret = wasm.message_commit(this.__wbg_ptr);
1487
- return ret === 0 ? undefined : LooseCommit.__wrap(ret);
1488
- }
1489
- /**
1490
- * The requested [`Digest`]s for a [`Message::BlobsRequest`], if applicable.
1491
- * @returns {Digest[] | undefined}
1492
- */
1493
- get digests() {
1494
- const ret = wasm.message_digests(this.__wbg_ptr);
1495
- let v1;
1496
- if (ret[0] !== 0) {
1497
- v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1498
- wasm.__wbindgen_export5(ret[0], ret[1] * 4, 4);
1499
- }
1500
- return v1;
1501
- }
1502
- /**
1503
- * The [`Fragment`] for a [`Message::Fragment`], if applicable.
1504
- *
1505
- * Decodes the signed payload to extract the underlying fragment.
1506
- * @returns {Fragment | undefined}
1507
- */
1508
- get fragment() {
1509
- const ret = wasm.message_fragment(this.__wbg_ptr);
1510
- return ret === 0 ? undefined : Fragment.__wrap(ret);
1511
- }
1512
- /**
1513
- * Deserialize a message from bytes.
1514
- *
1515
- * # Errors
1516
- *
1517
- * Returns a [`JsMessageDeserializationError`] if deserialization fails.
1518
- * @param {Uint8Array} bytes
1519
- * @returns {Message}
1520
- */
1521
- static fromBytes(bytes) {
1522
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
1523
- const len0 = WASM_VECTOR_LEN;
1524
- const ret = wasm.message_fromBytes(ptr0, len0);
1525
- if (ret[2]) {
1526
- throw takeFromExternrefTable0(ret[1]);
1527
- }
1528
- return Message.__wrap(ret[0]);
1529
- }
1530
- /**
1531
- * The [`BatchSyncRequest`] for a [`Message::BatchSyncRequest`], if applicable.
1532
- * @returns {BatchSyncRequest | undefined}
1533
- */
1534
- get request() {
1535
- const ret = wasm.message_request(this.__wbg_ptr);
1536
- return ret === 0 ? undefined : BatchSyncRequest.__wrap(ret);
1537
- }
1538
- /**
1539
- * The [`BatchSyncResponse`] for a [`Message::BatchSyncResponse`], if applicable.
1540
- * @returns {BatchSyncResponse | undefined}
1541
- */
1542
- get response() {
1543
- const ret = wasm.message_response(this.__wbg_ptr);
1544
- return ret === 0 ? undefined : BatchSyncResponse.__wrap(ret);
1545
- }
1546
- /**
1547
- * The [`SedimentreeId`] associated with this message, if any.
1548
- * @returns {SedimentreeId | undefined}
1549
- */
1550
- get sedimentreeId() {
1551
- const ret = wasm.message_sedimentreeId(this.__wbg_ptr);
1552
- return ret === 0 ? undefined : SedimentreeId.__wrap(ret);
1553
- }
1554
- /**
1555
- * Serialize the message to bytes.
1556
- * @returns {Uint8Array}
1557
- */
1558
- toBytes() {
1559
- const ret = wasm.message_toBytes(this.__wbg_ptr);
1560
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1561
- wasm.__wbindgen_export5(ret[0], ret[1] * 1, 1);
1562
- return v1;
1563
- }
1564
- /**
1565
- * The message variant name.
1566
- * @returns {string}
1567
- */
1568
- get type() {
1569
- let deferred1_0;
1570
- let deferred1_1;
1571
- try {
1572
- const ret = wasm.message_type(this.__wbg_ptr);
1573
- deferred1_0 = ret[0];
1574
- deferred1_1 = ret[1];
1575
- return getStringFromWasm0(ret[0], ret[1]);
1576
- } finally {
1577
- wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
1578
- }
1579
- }
1580
- }
1581
- if (Symbol.dispose) Message.prototype[Symbol.dispose] = Message.prototype.free;
1582
- exports.Message = Message;
1583
-
1584
- /**
1585
- * A [`HandshakeConnection`] backed by a `MessagePort` (or any object with
1586
- * `postMessage` / `onmessage` / `close`).
1587
- *
1588
- * Implements the full `HandshakeConnection` interface (`sendBytes`,
1589
- * `recvBytes`, `send`, `recv`, `disconnect`) using the port for transport.
1590
- *
1591
- * `nextRequestId` and `call` return rejected promises — `MessagePort`
1592
- * connections are used for peer-to-peer handshakes, not RPC-style sync.
1593
- * After the handshake, the [`Authenticated`] wrapper provides the sync API.
1594
- */
1595
- class MessagePortConnection {
1596
- static __wrap(ptr) {
1597
- ptr = ptr >>> 0;
1598
- const obj = Object.create(MessagePortConnection.prototype);
1599
- obj.__wbg_ptr = ptr;
1600
- MessagePortConnectionFinalization.register(obj, obj.__wbg_ptr, obj);
1601
- return obj;
1602
- }
1603
- __destroy_into_raw() {
1604
- const ptr = this.__wbg_ptr;
1605
- this.__wbg_ptr = 0;
1606
- MessagePortConnectionFinalization.unregister(this);
1607
- return ptr;
1608
- }
1609
- free() {
1610
- const ptr = this.__destroy_into_raw();
1611
- wasm.__wbg_messageportconnection_free(ptr, 0);
1612
- }
1613
- /**
1614
- * Not supported on `MessagePort` connections.
1615
- * @param {any} _request
1616
- * @param {number | null} [_timeout_ms]
1617
- * @returns {Promise<any>}
1618
- */
1619
- call(_request, _timeout_ms) {
1620
- const ret = wasm.messageportconnection_call(this.__wbg_ptr, _request, !isLikeNone(_timeout_ms), isLikeNone(_timeout_ms) ? 0 : _timeout_ms);
1621
- return ret;
1622
- }
1623
- /**
1624
- * Disconnect (close the port).
1625
- * @returns {Promise<any>}
1626
- */
1627
- disconnect() {
1628
- const ret = wasm.messageportconnection_disconnect(this.__wbg_ptr);
1629
- return ret;
1630
- }
1631
- /**
1632
- * Create a new connection wrapping the given `MessagePort`.
1633
- * @param {any} port
1634
- */
1635
- constructor(port) {
1636
- const ret = wasm.messageportconnection_new(port);
1637
- this.__wbg_ptr = ret >>> 0;
1638
- MessagePortConnectionFinalization.register(this, this.__wbg_ptr, this);
1639
- return this;
1640
- }
1641
- /**
1642
- * Not supported on `MessagePort` connections.
1643
- * @returns {Promise<any>}
1644
- */
1645
- nextRequestId() {
1646
- const ret = wasm.messageportconnection_nextRequestId(this.__wbg_ptr);
1647
- return ret;
1648
- }
1649
- /**
1650
- * Receive the next message.
1651
- * @returns {Promise<any>}
1652
- */
1653
- recv() {
1654
- const ret = wasm.messageportconnection_recv(this.__wbg_ptr);
1655
- return ret;
1656
- }
1657
- /**
1658
- * Receive raw bytes (for the handshake phase).
1659
- * @returns {Promise<any>}
1660
- */
1661
- recvBytes() {
1662
- const ret = wasm.messageportconnection_recvBytes(this.__wbg_ptr);
1663
- return ret;
1664
- }
1665
- /**
1666
- * Send a structured message (post-handshake).
1667
- * @param {any} message
1668
- * @returns {Promise<any>}
1669
- */
1670
- send(message) {
1671
- const ret = wasm.messageportconnection_send(this.__wbg_ptr, message);
1672
- return ret;
1673
- }
1674
- /**
1675
- * Send raw bytes (for the handshake phase).
1676
- * @param {Uint8Array} bytes
1677
- * @returns {Promise<any>}
1678
- */
1679
- sendBytes(bytes) {
1680
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
1681
- const len0 = WASM_VECTOR_LEN;
1682
- const ret = wasm.messageportconnection_sendBytes(this.__wbg_ptr, ptr0, len0);
1683
- return ret;
1684
- }
1685
- }
1686
- if (Symbol.dispose) MessagePortConnection.prototype[Symbol.dispose] = MessagePortConnection.prototype.free;
1687
- exports.MessagePortConnection = MessagePortConnection;
1688
-
1689
- /**
1690
- * A 64-bit nonce represented as big-endian bytes.
1691
- */
1692
- class Nonce {
1693
- static __wrap(ptr) {
1694
- ptr = ptr >>> 0;
1695
- const obj = Object.create(Nonce.prototype);
1696
- obj.__wbg_ptr = ptr;
1697
- NonceFinalization.register(obj, obj.__wbg_ptr, obj);
1698
- return obj;
1699
- }
1700
- __destroy_into_raw() {
1701
- const ptr = this.__wbg_ptr;
1702
- this.__wbg_ptr = 0;
1703
- NonceFinalization.unregister(this);
1704
- return ptr;
1705
- }
1706
- free() {
1707
- const ptr = this.__destroy_into_raw();
1708
- wasm.__wbg_nonce_free(ptr, 0);
1709
- }
1710
- /**
1711
- * Get the nonce as big-endian bytes.
1712
- * @returns {Uint8Array}
1713
- */
1714
- get bytes() {
1715
- const ret = wasm.nonce_bytes(this.__wbg_ptr);
1716
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1717
- wasm.__wbindgen_export5(ret[0], ret[1] * 1, 1);
1718
- return v1;
1719
- }
1720
- /**
1721
- * Create a new [`WasmNonce`] from exactly 8 big-endian bytes.
1722
- *
1723
- * # Errors
1724
- *
1725
- * Returns [`WasmNonceError`] if the input is not exactly 8 bytes.
1726
- * @param {Uint8Array} bytes
1727
- */
1728
- constructor(bytes) {
1729
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
1730
- const len0 = WASM_VECTOR_LEN;
1731
- const ret = wasm.nonce_new(ptr0, len0);
1732
- if (ret[2]) {
1733
- throw takeFromExternrefTable0(ret[1]);
1734
- }
1735
- this.__wbg_ptr = ret[0] >>> 0;
1736
- NonceFinalization.register(this, this.__wbg_ptr, this);
1737
- return this;
1463
+ const ret = wasm.nonce_new(ptr0, len0);
1464
+ if (ret[2]) {
1465
+ throw takeFromExternrefTable0(ret[1]);
1466
+ }
1467
+ this.__wbg_ptr = ret[0] >>> 0;
1468
+ NonceFinalization.register(this, this.__wbg_ptr, this);
1469
+ return this;
1738
1470
  }
1739
1471
  /**
1740
1472
  * Generate a random nonce.
@@ -1773,16 +1505,6 @@ class PeerBatchSyncResult {
1773
1505
  const ptr = this.__destroy_into_raw();
1774
1506
  wasm.__wbg_peerbatchsyncresult_free(ptr, 0);
1775
1507
  }
1776
- /**
1777
- * List of connection errors that occurred during the batch sync.
1778
- * @returns {ConnErrorPair[]}
1779
- */
1780
- get connErrors() {
1781
- const ret = wasm.peerbatchsyncresult_connErrors(this.__wbg_ptr);
1782
- var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1783
- wasm.__wbindgen_export5(ret[0], ret[1] * 4, 4);
1784
- return v1;
1785
- }
1786
1508
  /**
1787
1509
  * Statistics about the sync operation.
1788
1510
  * @returns {SyncStats}
@@ -1799,6 +1521,16 @@ class PeerBatchSyncResult {
1799
1521
  const ret = wasm.peerbatchsyncresult_success(this.__wbg_ptr);
1800
1522
  return ret !== 0;
1801
1523
  }
1524
+ /**
1525
+ * Errors that occurred during the batch sync.
1526
+ * @returns {Error[]}
1527
+ */
1528
+ get transportErrors() {
1529
+ const ret = wasm.peerbatchsyncresult_transportErrors(this.__wbg_ptr);
1530
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1531
+ wasm.__wbindgen_export5(ret[0], ret[1] * 4, 4);
1532
+ return v1;
1533
+ }
1802
1534
  }
1803
1535
  if (Symbol.dispose) PeerBatchSyncResult.prototype[Symbol.dispose] = PeerBatchSyncResult.prototype.free;
1804
1536
  exports.PeerBatchSyncResult = PeerBatchSyncResult;
@@ -2306,6 +2038,30 @@ class Subduction {
2306
2038
  const ptr = this.__destroy_into_raw();
2307
2039
  wasm.__wbg_subduction_free(ptr, 0);
2308
2040
  }
2041
+ /**
2042
+ * Accept a connection from a peer over any [`Transport`](JsTransport).
2043
+ *
2044
+ * Performs the responder side of the handshake, then adds the authenticated
2045
+ * connection. This is the counterpart to [`connectTransport`](Self::connect_transport).
2046
+ *
2047
+ * # Arguments
2048
+ *
2049
+ * * `transport` - Any JS object with `sendBytes`/`recvBytes`/`disconnect`
2050
+ * * `service_name` - Shared service name for discovery
2051
+ *
2052
+ * # Errors
2053
+ *
2054
+ * Returns an error if the handshake or connection fails.
2055
+ * @param {Transport} transport
2056
+ * @param {string} service_name
2057
+ * @returns {Promise<PeerId>}
2058
+ */
2059
+ acceptTransport(transport, service_name) {
2060
+ const ptr0 = passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2061
+ const len0 = WASM_VECTOR_LEN;
2062
+ const ret = wasm.subduction_acceptTransport(this.__wbg_ptr, transport, ptr0, len0);
2063
+ return ret;
2064
+ }
2309
2065
  /**
2310
2066
  * Add a commit with its associated blob to the storage.
2311
2067
  *
@@ -2328,15 +2084,15 @@ class Subduction {
2328
2084
  return ret;
2329
2085
  }
2330
2086
  /**
2331
- * Onboard an authenticated connection: add it and sync all sedimentrees.
2087
+ * Onboard an authenticated transport: add it and sync all sedimentrees.
2332
2088
  *
2333
- * Accepts an [`AuthenticatedConnection`](WasmAuthenticatedConnection),
2334
- * obtained via [`AuthenticatedConnection.setup`](WasmAuthenticatedConnection::setup),
2335
- * [`AuthenticatedWebSocket.toConnection`], or [`AuthenticatedLongPoll.toConnection`].
2089
+ * Accepts an [`AuthenticatedTransport`](WasmAuthenticatedTransport),
2090
+ * obtained via [`AuthenticatedTransport.setup`](WasmAuthenticatedTransport::setup),
2091
+ * [`AuthenticatedWebSocket.toTransport`], or [`AuthenticatedLongPoll.toTransport`].
2336
2092
  *
2337
2093
  * Returns `true` if this is a new peer, `false` if already connected.
2338
2094
  *
2339
- * Add an authenticated connection to tracking.
2095
+ * Add an authenticated transport to tracking.
2340
2096
  *
2341
2097
  * This does not perform any synchronization. To sync after adding,
2342
2098
  * call [`fullSyncWithPeer`](Self::full_sync_with_peer).
@@ -2346,12 +2102,12 @@ class Subduction {
2346
2102
  * # Errors
2347
2103
  *
2348
2104
  * Returns an error if the connection is rejected by the policy.
2349
- * @param {AuthenticatedConnection} conn
2105
+ * @param {AuthenticatedTransport} transport
2350
2106
  * @returns {Promise<boolean>}
2351
2107
  */
2352
- addConnection(conn) {
2353
- _assertClass(conn, AuthenticatedConnection);
2354
- const ret = wasm.subduction_addConnection(this.__wbg_ptr, conn.__wbg_ptr);
2108
+ addConnection(transport) {
2109
+ _assertClass(transport, AuthenticatedTransport);
2110
+ const ret = wasm.subduction_addConnection(this.__wbg_ptr, transport.__wbg_ptr);
2355
2111
  return ret;
2356
2112
  }
2357
2113
  /**
@@ -2411,19 +2167,17 @@ class Subduction {
2411
2167
  *
2412
2168
  * * `address` - The WebSocket URL to connect to
2413
2169
  * * `expected_peer_id` - The expected server peer ID (verified during handshake)
2414
- * * `timeout_milliseconds` - Request timeout in milliseconds
2415
2170
  *
2416
2171
  * # Errors
2417
2172
  *
2418
2173
  * Returns an error if connection, handshake, or adding the connection fails.
2419
2174
  * @param {URL} address
2420
2175
  * @param {PeerId} expected_peer_id
2421
- * @param {number} timeout_milliseconds
2422
2176
  * @returns {Promise<PeerId>}
2423
2177
  */
2424
- connect(address, expected_peer_id, timeout_milliseconds) {
2178
+ connect(address, expected_peer_id) {
2425
2179
  _assertClass(expected_peer_id, PeerId);
2426
- const ret = wasm.subduction_connect(this.__wbg_ptr, address, expected_peer_id.__wbg_ptr, timeout_milliseconds);
2180
+ const ret = wasm.subduction_connect(this.__wbg_ptr, address, expected_peer_id.__wbg_ptr);
2427
2181
  return ret;
2428
2182
  }
2429
2183
  /**
@@ -2441,14 +2195,13 @@ class Subduction {
2441
2195
  *
2442
2196
  * Returns an error if connection, handshake, or adding the connection fails.
2443
2197
  * @param {URL} address
2444
- * @param {number | null} [timeout_milliseconds]
2445
2198
  * @param {string | null} [service_name]
2446
2199
  * @returns {Promise<PeerId>}
2447
2200
  */
2448
- connectDiscover(address, timeout_milliseconds, service_name) {
2201
+ connectDiscover(address, service_name) {
2449
2202
  var ptr0 = isLikeNone(service_name) ? 0 : passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2450
2203
  var len0 = WASM_VECTOR_LEN;
2451
- const ret = wasm.subduction_connectDiscover(this.__wbg_ptr, address, isLikeNone(timeout_milliseconds) ? 0x100000001 : (timeout_milliseconds) >>> 0, ptr0, len0);
2204
+ const ret = wasm.subduction_connectDiscover(this.__wbg_ptr, address, ptr0, len0);
2452
2205
  return ret;
2453
2206
  }
2454
2207
  /**
@@ -2466,16 +2219,15 @@ class Subduction {
2466
2219
  *
2467
2220
  * Returns an error if connection, handshake, or adding the connection fails.
2468
2221
  * @param {string} base_url
2469
- * @param {number | null} [timeout_milliseconds]
2470
2222
  * @param {string | null} [service_name]
2471
2223
  * @returns {Promise<PeerId>}
2472
2224
  */
2473
- connectDiscoverLongPoll(base_url, timeout_milliseconds, service_name) {
2225
+ connectDiscoverLongPoll(base_url, service_name) {
2474
2226
  const ptr0 = passStringToWasm0(base_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2475
2227
  const len0 = WASM_VECTOR_LEN;
2476
2228
  var ptr1 = isLikeNone(service_name) ? 0 : passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2477
2229
  var len1 = WASM_VECTOR_LEN;
2478
- const ret = wasm.subduction_connectDiscoverLongPoll(this.__wbg_ptr, ptr0, len0, isLikeNone(timeout_milliseconds) ? 0x100000001 : (timeout_milliseconds) >>> 0, ptr1, len1);
2230
+ const ret = wasm.subduction_connectDiscoverLongPoll(this.__wbg_ptr, ptr0, len0, ptr1, len1);
2479
2231
  return ret;
2480
2232
  }
2481
2233
  /**
@@ -2494,14 +2246,37 @@ class Subduction {
2494
2246
  * Returns an error if connection, handshake, or adding the connection fails.
2495
2247
  * @param {string} base_url
2496
2248
  * @param {PeerId} expected_peer_id
2497
- * @param {number | null} [timeout_milliseconds]
2498
2249
  * @returns {Promise<PeerId>}
2499
2250
  */
2500
- connectLongPoll(base_url, expected_peer_id, timeout_milliseconds) {
2251
+ connectLongPoll(base_url, expected_peer_id) {
2501
2252
  const ptr0 = passStringToWasm0(base_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2502
2253
  const len0 = WASM_VECTOR_LEN;
2503
2254
  _assertClass(expected_peer_id, PeerId);
2504
- const ret = wasm.subduction_connectLongPoll(this.__wbg_ptr, ptr0, len0, expected_peer_id.__wbg_ptr, isLikeNone(timeout_milliseconds) ? 0x100000001 : (timeout_milliseconds) >>> 0);
2255
+ const ret = wasm.subduction_connectLongPoll(this.__wbg_ptr, ptr0, len0, expected_peer_id.__wbg_ptr);
2256
+ return ret;
2257
+ }
2258
+ /**
2259
+ * Connect to a peer over any [`Transport`](JsTransport) using discovery mode.
2260
+ *
2261
+ * Performs a discovery handshake, then adds the authenticated connection.
2262
+ * The peer's identity is discovered during the handshake.
2263
+ *
2264
+ * # Arguments
2265
+ *
2266
+ * * `transport` - Any JS object with `sendBytes`/`recvBytes`/`disconnect`
2267
+ * * `service_name` - Shared service name for discovery
2268
+ *
2269
+ * # Errors
2270
+ *
2271
+ * Returns an error if the handshake or connection fails.
2272
+ * @param {Transport} transport
2273
+ * @param {string} service_name
2274
+ * @returns {Promise<PeerId>}
2275
+ */
2276
+ connectTransport(transport, service_name) {
2277
+ const ptr0 = passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2278
+ const len0 = WASM_VECTOR_LEN;
2279
+ const ret = wasm.subduction_connectTransport(this.__wbg_ptr, transport, ptr0, len0);
2505
2280
  return ret;
2506
2281
  }
2507
2282
  /**
@@ -2666,6 +2441,27 @@ class Subduction {
2666
2441
  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);
2667
2442
  return ret;
2668
2443
  }
2444
+ /**
2445
+ * Link two local [`Subduction`](WasmSubduction) instances over a
2446
+ * [`MessageChannel`](web_sys::MessageChannel).
2447
+ *
2448
+ * Creates a `MessageChannel`, performs a discovery handshake between
2449
+ * the two instances, and adds the connections to both. This is the
2450
+ * simplest way to sync two local instances.
2451
+ *
2452
+ * # Errors
2453
+ *
2454
+ * Returns an error if the handshake or connection fails.
2455
+ * @param {Subduction} a
2456
+ * @param {Subduction} b
2457
+ * @returns {Promise<void>}
2458
+ */
2459
+ static link(a, b) {
2460
+ _assertClass(a, Subduction);
2461
+ _assertClass(b, Subduction);
2462
+ const ret = wasm.subduction_link(a.__wbg_ptr, b.__wbg_ptr);
2463
+ return ret;
2464
+ }
2669
2465
  /**
2670
2466
  * Create a new [`Subduction`] instance.
2671
2467
  *
@@ -2791,7 +2587,74 @@ if (Symbol.dispose) Subduction.prototype[Symbol.dispose] = Subduction.prototype.
2791
2587
  exports.Subduction = Subduction;
2792
2588
 
2793
2589
  /**
2794
- * HTTP long-poll connection factory for browser/worker environments.
2590
+ * JS-facing wrapper around [`HttpLongPollTransport`] that exposes the
2591
+ * byte-oriented [`Transport`](super::JsTransport) interface
2592
+ * (`sendBytes`/`recvBytes`/`disconnect`) so it can be used as a
2593
+ * duck-typed `JsTransport` from JavaScript.
2594
+ */
2595
+ class SubductionHttpLongPoll {
2596
+ static __wrap(ptr) {
2597
+ ptr = ptr >>> 0;
2598
+ const obj = Object.create(SubductionHttpLongPoll.prototype);
2599
+ obj.__wbg_ptr = ptr;
2600
+ SubductionHttpLongPollFinalization.register(obj, obj.__wbg_ptr, obj);
2601
+ return obj;
2602
+ }
2603
+ __destroy_into_raw() {
2604
+ const ptr = this.__wbg_ptr;
2605
+ this.__wbg_ptr = 0;
2606
+ SubductionHttpLongPollFinalization.unregister(this);
2607
+ return ptr;
2608
+ }
2609
+ free() {
2610
+ const ptr = this.__destroy_into_raw();
2611
+ wasm.__wbg_subductionhttplongpoll_free(ptr, 0);
2612
+ }
2613
+ /**
2614
+ * Disconnect from the peer gracefully.
2615
+ *
2616
+ * # Errors
2617
+ *
2618
+ * Returns an error if the disconnect fails.
2619
+ * @returns {Promise<void>}
2620
+ */
2621
+ disconnect() {
2622
+ const ret = wasm.subductionhttplongpoll_disconnect(this.__wbg_ptr);
2623
+ return ret;
2624
+ }
2625
+ /**
2626
+ * Receive the next message frame as raw bytes.
2627
+ *
2628
+ * # Errors
2629
+ *
2630
+ * Returns an error if the inbound channel is closed.
2631
+ * @returns {Promise<Uint8Array>}
2632
+ */
2633
+ recvBytes() {
2634
+ const ret = wasm.subductionhttplongpoll_recvBytes(this.__wbg_ptr);
2635
+ return ret;
2636
+ }
2637
+ /**
2638
+ * Send raw bytes over the transport.
2639
+ *
2640
+ * # Errors
2641
+ *
2642
+ * Returns an error if the outbound channel is closed.
2643
+ * @param {Uint8Array} bytes
2644
+ * @returns {Promise<void>}
2645
+ */
2646
+ sendBytes(bytes) {
2647
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
2648
+ const len0 = WASM_VECTOR_LEN;
2649
+ const ret = wasm.subductionhttplongpoll_sendBytes(this.__wbg_ptr, ptr0, len0);
2650
+ return ret;
2651
+ }
2652
+ }
2653
+ if (Symbol.dispose) SubductionHttpLongPoll.prototype[Symbol.dispose] = SubductionHttpLongPoll.prototype.free;
2654
+ exports.SubductionHttpLongPoll = SubductionHttpLongPoll;
2655
+
2656
+ /**
2657
+ * HTTP long-poll transport factory for browser/worker environments.
2795
2658
  *
2796
2659
  * Analogous to [`SubductionWebSocket`] but uses HTTP long-poll instead of WebSocket.
2797
2660
  */
@@ -2818,18 +2681,17 @@ class SubductionLongPoll {
2818
2681
  *
2819
2682
  * # Errors
2820
2683
  *
2821
- * Returns [`LongPollConnectionError`] if connection or handshake fails.
2684
+ * Returns [`LongPollTransportError`] if connection or handshake fails.
2822
2685
  * @param {string} base_url
2823
2686
  * @param {any} signer
2824
2687
  * @param {PeerId} expected_peer_id
2825
- * @param {number | null} [timeout_milliseconds]
2826
2688
  * @returns {Promise<AuthenticatedLongPoll>}
2827
2689
  */
2828
- static tryConnect(base_url, signer, expected_peer_id, timeout_milliseconds) {
2690
+ static tryConnect(base_url, signer, expected_peer_id) {
2829
2691
  const ptr0 = passStringToWasm0(base_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2830
2692
  const len0 = WASM_VECTOR_LEN;
2831
2693
  _assertClass(expected_peer_id, PeerId);
2832
- const ret = wasm.subductionlongpoll_tryConnect(ptr0, len0, signer, expected_peer_id.__wbg_ptr, isLikeNone(timeout_milliseconds) ? 0x100000001 : (timeout_milliseconds) >>> 0);
2694
+ const ret = wasm.subductionlongpoll_tryConnect(ptr0, len0, signer, expected_peer_id.__wbg_ptr);
2833
2695
  return ret;
2834
2696
  }
2835
2697
  /**
@@ -2839,122 +2701,35 @@ class SubductionLongPoll {
2839
2701
  *
2840
2702
  * * `base_url` - The server's HTTP base URL (e.g., `http://localhost:8080`)
2841
2703
  * * `signer` - The client's signer for authentication
2842
- * * `timeout_milliseconds` - Request timeout in milliseconds (default: 30000)
2843
2704
  * * `service_name` - The service name for discovery. If omitted, the base URL is used.
2844
2705
  *
2845
2706
  * # Errors
2846
2707
  *
2847
- * Returns [`LongPollConnectionError`] if connection or handshake fails.
2708
+ * Returns [`LongPollTransportError`] if connection or handshake fails.
2848
2709
  * @param {string} base_url
2849
2710
  * @param {any} signer
2850
- * @param {number | null} [timeout_milliseconds]
2851
2711
  * @param {string | null} [service_name]
2852
2712
  * @returns {Promise<AuthenticatedLongPoll>}
2853
2713
  */
2854
- static tryDiscover(base_url, signer, timeout_milliseconds, service_name) {
2714
+ static tryDiscover(base_url, signer, service_name) {
2855
2715
  const ptr0 = passStringToWasm0(base_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2856
2716
  const len0 = WASM_VECTOR_LEN;
2857
2717
  var ptr1 = isLikeNone(service_name) ? 0 : passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2858
2718
  var len1 = WASM_VECTOR_LEN;
2859
- const ret = wasm.subductionlongpoll_tryDiscover(ptr0, len0, signer, isLikeNone(timeout_milliseconds) ? 0x100000001 : (timeout_milliseconds) >>> 0, ptr1, len1);
2860
- return ret;
2861
- }
2862
- }
2863
- if (Symbol.dispose) SubductionLongPoll.prototype[Symbol.dispose] = SubductionLongPoll.prototype.free;
2864
- exports.SubductionLongPoll = SubductionLongPoll;
2865
-
2866
- /**
2867
- * JS-facing wrapper around [`WasmLongPollConnection`] that exposes the
2868
- * [`Connection`](super::JsConnection) interface so it can be used as a
2869
- * duck-typed `JsConnection` from JavaScript.
2870
- */
2871
- class SubductionLongPollConnection {
2872
- static __wrap(ptr) {
2873
- ptr = ptr >>> 0;
2874
- const obj = Object.create(SubductionLongPollConnection.prototype);
2875
- obj.__wbg_ptr = ptr;
2876
- SubductionLongPollConnectionFinalization.register(obj, obj.__wbg_ptr, obj);
2877
- return obj;
2878
- }
2879
- __destroy_into_raw() {
2880
- const ptr = this.__wbg_ptr;
2881
- this.__wbg_ptr = 0;
2882
- SubductionLongPollConnectionFinalization.unregister(this);
2883
- return ptr;
2884
- }
2885
- free() {
2886
- const ptr = this.__destroy_into_raw();
2887
- wasm.__wbg_subductionlongpollconnection_free(ptr, 0);
2888
- }
2889
- /**
2890
- * Make a synchronous call to the peer.
2891
- *
2892
- * # Errors
2893
- *
2894
- * Returns an error if the call fails or times out.
2895
- * @param {BatchSyncRequest} request
2896
- * @param {number | null} [timeout_ms]
2897
- * @returns {Promise<BatchSyncResponse>}
2898
- */
2899
- call(request, timeout_ms) {
2900
- _assertClass(request, BatchSyncRequest);
2901
- var ptr0 = request.__destroy_into_raw();
2902
- const ret = wasm.subductionlongpollconnection_call(this.__wbg_ptr, ptr0, !isLikeNone(timeout_ms), isLikeNone(timeout_ms) ? 0 : timeout_ms);
2903
- return ret;
2904
- }
2905
- /**
2906
- * Disconnect from the peer gracefully.
2907
- *
2908
- * # Errors
2909
- *
2910
- * Returns [`WasmLongPollConnError`] if the disconnect fails.
2911
- * @returns {Promise<void>}
2912
- */
2913
- disconnect() {
2914
- const ret = wasm.subductionlongpollconnection_disconnect(this.__wbg_ptr);
2915
- return ret;
2916
- }
2917
- /**
2918
- * Get the next request ID.
2919
- * @returns {Promise<RequestId>}
2920
- */
2921
- nextRequestId() {
2922
- const ret = wasm.subductionlongpollconnection_nextRequestId(this.__wbg_ptr);
2923
- return ret;
2924
- }
2925
- /**
2926
- * Receive a message.
2927
- *
2928
- * # Errors
2929
- *
2930
- * Returns an error if the inbound channel is closed.
2931
- * @returns {Promise<Message>}
2932
- */
2933
- recv() {
2934
- const ret = wasm.subductionlongpollconnection_recv(this.__wbg_ptr);
2935
- return ret;
2936
- }
2937
- /**
2938
- * Send a message.
2939
- *
2940
- * # Errors
2941
- *
2942
- * Returns an error if the outbound channel is closed.
2943
- * @param {Message} message
2944
- * @returns {Promise<void>}
2945
- */
2946
- send(message) {
2947
- _assertClass(message, Message);
2948
- var ptr0 = message.__destroy_into_raw();
2949
- const ret = wasm.subductionlongpollconnection_send(this.__wbg_ptr, ptr0);
2719
+ const ret = wasm.subductionlongpoll_tryDiscover(ptr0, len0, signer, ptr1, len1);
2950
2720
  return ret;
2951
2721
  }
2952
2722
  }
2953
- if (Symbol.dispose) SubductionLongPollConnection.prototype[Symbol.dispose] = SubductionLongPollConnection.prototype.free;
2954
- exports.SubductionLongPollConnection = SubductionLongPollConnection;
2723
+ if (Symbol.dispose) SubductionLongPoll.prototype[Symbol.dispose] = SubductionLongPoll.prototype.free;
2724
+ exports.SubductionLongPoll = SubductionLongPoll;
2955
2725
 
2956
2726
  /**
2957
- * A WebSocket connection with internal wiring for [`Subduction`] message handling.
2727
+ * A WebSocket transport exposing the byte-oriented `Transport` interface.
2728
+ *
2729
+ * Raw bytes from the WebSocket's `onmessage` handler are buffered in an
2730
+ * `async_channel` and returned via `recvBytes`. No message decoding or
2731
+ * request-response routing happens here — that's handled by
2732
+ * [`MessageTransport`](subduction_core::transport::message::MessageTransport).
2958
2733
  */
2959
2734
  class SubductionWebSocket {
2960
2735
  static __wrap(ptr) {
@@ -2974,22 +2749,6 @@ class SubductionWebSocket {
2974
2749
  const ptr = this.__destroy_into_raw();
2975
2750
  wasm.__wbg_subductionwebsocket_free(ptr, 0);
2976
2751
  }
2977
- /**
2978
- * Make a synchronous call to the peer.
2979
- *
2980
- * # Errors
2981
- *
2982
- * Returns [`WasmCallError`] if the call fails or times out.
2983
- * @param {BatchSyncRequest} request
2984
- * @param {number | null} [timeout_ms]
2985
- * @returns {Promise<BatchSyncResponse>}
2986
- */
2987
- call(request, timeout_ms) {
2988
- _assertClass(request, BatchSyncRequest);
2989
- var ptr0 = request.__destroy_into_raw();
2990
- const ret = wasm.subductionwebsocket_call(this.__wbg_ptr, ptr0, !isLikeNone(timeout_ms), isLikeNone(timeout_ms) ? 0 : timeout_ms);
2991
- return ret;
2992
- }
2993
2752
  /**
2994
2753
  * Disconnect from the peer gracefully.
2995
2754
  * @returns {Promise<void>}
@@ -2999,46 +2758,30 @@ class SubductionWebSocket {
2999
2758
  return ret;
3000
2759
  }
3001
2760
  /**
3002
- * Get the next request ID.
3003
- * @returns {Promise<RequestId>}
3004
- */
3005
- nextRequestId() {
3006
- const ret = wasm.subductionwebsocket_nextRequestId(this.__wbg_ptr);
3007
- return ret;
3008
- }
3009
- /**
3010
- * Get the peer ID of the remote peer.
3011
- * @returns {PeerId}
3012
- */
3013
- peerId() {
3014
- const ret = wasm.subductionwebsocket_peerId(this.__wbg_ptr);
3015
- return PeerId.__wrap(ret);
3016
- }
3017
- /**
3018
- * Receive a message.
2761
+ * Receive the next message frame as raw bytes.
3019
2762
  *
3020
2763
  * # Errors
3021
2764
  *
3022
2765
  * Returns [`ReadFromClosedChannel`] if the channel has been closed.
3023
- * @returns {Promise<Message>}
2766
+ * @returns {Promise<Uint8Array>}
3024
2767
  */
3025
- recv() {
3026
- const ret = wasm.subductionwebsocket_recv(this.__wbg_ptr);
2768
+ recvBytes() {
2769
+ const ret = wasm.subductionwebsocket_recvBytes(this.__wbg_ptr);
3027
2770
  return ret;
3028
2771
  }
3029
2772
  /**
3030
- * Send a message.
2773
+ * Send raw bytes over the WebSocket.
3031
2774
  *
3032
2775
  * # Errors
3033
2776
  *
3034
- * Returns [`WasmSendError`] if the message could not be sent over the WebSocket.
3035
- * @param {Message} wasm_message
2777
+ * Returns [`WasmSendError`] if the bytes could not be sent.
2778
+ * @param {Uint8Array} bytes
3036
2779
  * @returns {Promise<void>}
3037
2780
  */
3038
- send(wasm_message) {
3039
- _assertClass(wasm_message, Message);
3040
- var ptr0 = wasm_message.__destroy_into_raw();
3041
- const ret = wasm.subductionwebsocket_send(this.__wbg_ptr, ptr0);
2781
+ sendBytes(bytes) {
2782
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
2783
+ const len0 = WASM_VECTOR_LEN;
2784
+ const ret = wasm.subductionwebsocket_sendBytes(this.__wbg_ptr, ptr0, len0);
3042
2785
  return ret;
3043
2786
  }
3044
2787
  /**
@@ -3060,12 +2803,11 @@ class SubductionWebSocket {
3060
2803
  * @param {WebSocket} ws
3061
2804
  * @param {any} signer
3062
2805
  * @param {PeerId} expected_peer_id
3063
- * @param {number} timeout_milliseconds
3064
2806
  * @returns {Promise<AuthenticatedWebSocket>}
3065
2807
  */
3066
- static setup(ws, signer, expected_peer_id, timeout_milliseconds) {
2808
+ static setup(ws, signer, expected_peer_id) {
3067
2809
  _assertClass(expected_peer_id, PeerId);
3068
- const ret = wasm.subductionwebsocket_setup(ws, signer, expected_peer_id.__wbg_ptr, timeout_milliseconds);
2810
+ const ret = wasm.subductionwebsocket_setup(ws, signer, expected_peer_id.__wbg_ptr);
3069
2811
  return ret;
3070
2812
  }
3071
2813
  /**
@@ -3076,8 +2818,6 @@ class SubductionWebSocket {
3076
2818
  * * `address` - The WebSocket URL to connect to
3077
2819
  * * `signer` - The client's signer for authentication
3078
2820
  * * `expected_peer_id` - The expected server peer ID (verified during handshake)
3079
- * * `timeout_milliseconds` - Request timeout in milliseconds
3080
- *
3081
2821
  * # Errors
3082
2822
  *
3083
2823
  * Returns an error if:
@@ -3086,12 +2826,11 @@ class SubductionWebSocket {
3086
2826
  * @param {URL} address
3087
2827
  * @param {any} signer
3088
2828
  * @param {PeerId} expected_peer_id
3089
- * @param {number} timeout_milliseconds
3090
2829
  * @returns {Promise<AuthenticatedWebSocket>}
3091
2830
  */
3092
- static tryConnect(address, signer, expected_peer_id, timeout_milliseconds) {
2831
+ static tryConnect(address, signer, expected_peer_id) {
3093
2832
  _assertClass(expected_peer_id, PeerId);
3094
- const ret = wasm.subductionwebsocket_tryConnect(address, signer, expected_peer_id.__wbg_ptr, timeout_milliseconds);
2833
+ const ret = wasm.subductionwebsocket_tryConnect(address, signer, expected_peer_id.__wbg_ptr);
3095
2834
  return ret;
3096
2835
  }
3097
2836
  /**
@@ -3116,20 +2855,220 @@ class SubductionWebSocket {
3116
2855
  * - The handshake fails (signature invalid, clock drift, etc.)
3117
2856
  * @param {URL} address
3118
2857
  * @param {any} signer
3119
- * @param {number | null} [timeout_milliseconds]
3120
2858
  * @param {string | null} [service_name]
3121
2859
  * @returns {Promise<AuthenticatedWebSocket>}
3122
2860
  */
3123
- static tryDiscover(address, signer, timeout_milliseconds, service_name) {
2861
+ static tryDiscover(address, signer, service_name) {
3124
2862
  var ptr0 = isLikeNone(service_name) ? 0 : passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
3125
2863
  var len0 = WASM_VECTOR_LEN;
3126
- const ret = wasm.subductionwebsocket_tryDiscover(address, signer, isLikeNone(timeout_milliseconds) ? 0x100000001 : (timeout_milliseconds) >>> 0, ptr0, len0);
2864
+ const ret = wasm.subductionwebsocket_tryDiscover(address, signer, ptr0, len0);
3127
2865
  return ret;
3128
2866
  }
3129
2867
  }
3130
2868
  if (Symbol.dispose) SubductionWebSocket.prototype[Symbol.dispose] = SubductionWebSocket.prototype.free;
3131
2869
  exports.SubductionWebSocket = SubductionWebSocket;
3132
2870
 
2871
+ /**
2872
+ * Wasm wrapper for [`SyncMessage`].
2873
+ */
2874
+ class SyncMessage {
2875
+ static __wrap(ptr) {
2876
+ ptr = ptr >>> 0;
2877
+ const obj = Object.create(SyncMessage.prototype);
2878
+ obj.__wbg_ptr = ptr;
2879
+ SyncMessageFinalization.register(obj, obj.__wbg_ptr, obj);
2880
+ return obj;
2881
+ }
2882
+ __destroy_into_raw() {
2883
+ const ptr = this.__wbg_ptr;
2884
+ this.__wbg_ptr = 0;
2885
+ SyncMessageFinalization.unregister(this);
2886
+ return ptr;
2887
+ }
2888
+ free() {
2889
+ const ptr = this.__destroy_into_raw();
2890
+ wasm.__wbg_syncmessage_free(ptr, 0);
2891
+ }
2892
+ /**
2893
+ * Upcasts; to the JS-import type for [`WasmMessage`].
2894
+ * @returns {SyncMessage}
2895
+ */
2896
+ __wasm_refgen_toWasmMessage() {
2897
+ const ret = wasm.syncmessage___wasm_refgen_toWasmMessage(this.__wbg_ptr);
2898
+ return SyncMessage.__wrap(ret);
2899
+ }
2900
+ /**
2901
+ * Create a [`SyncMessage::BatchSyncRequest`] message.
2902
+ * @param {BatchSyncRequest} request
2903
+ * @returns {SyncMessage}
2904
+ */
2905
+ static batchSyncRequest(request) {
2906
+ _assertClass(request, BatchSyncRequest);
2907
+ const ret = wasm.syncmessage_batchSyncRequest(request.__wbg_ptr);
2908
+ return SyncMessage.__wrap(ret);
2909
+ }
2910
+ /**
2911
+ * Create a [`SyncMessage::BatchSyncResponse`] message.
2912
+ * @param {BatchSyncResponse} response
2913
+ * @returns {SyncMessage}
2914
+ */
2915
+ static batchSyncResponse(response) {
2916
+ _assertClass(response, BatchSyncResponse);
2917
+ const ret = wasm.syncmessage_batchSyncResponse(response.__wbg_ptr);
2918
+ return SyncMessage.__wrap(ret);
2919
+ }
2920
+ /**
2921
+ * The [`Blob`] for commit or fragment messages, if applicable.
2922
+ * @returns {Uint8Array | undefined}
2923
+ */
2924
+ get blob() {
2925
+ const ret = wasm.syncmessage_blob(this.__wbg_ptr);
2926
+ return ret;
2927
+ }
2928
+ /**
2929
+ * The [`Blob`]s for a [`SyncMessage::BlobsResponse`], if applicable.
2930
+ * @returns {Uint8Array[] | undefined}
2931
+ */
2932
+ get blobs() {
2933
+ const ret = wasm.syncmessage_blobs(this.__wbg_ptr);
2934
+ let v1;
2935
+ if (ret[0] !== 0) {
2936
+ v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
2937
+ wasm.__wbindgen_export5(ret[0], ret[1] * 4, 4);
2938
+ }
2939
+ return v1;
2940
+ }
2941
+ /**
2942
+ * Create a [`SyncMessage::BlobsRequest`] message.
2943
+ * @param {SedimentreeId} id
2944
+ * @param {Digest[]} digests
2945
+ * @returns {SyncMessage}
2946
+ */
2947
+ static blobsRequest(id, digests) {
2948
+ _assertClass(id, SedimentreeId);
2949
+ const ptr0 = passArrayJsValueToWasm0(digests, wasm.__wbindgen_export);
2950
+ const len0 = WASM_VECTOR_LEN;
2951
+ const ret = wasm.syncmessage_blobsRequest(id.__wbg_ptr, ptr0, len0);
2952
+ return SyncMessage.__wrap(ret);
2953
+ }
2954
+ /**
2955
+ * Create a [`SyncMessage::BlobsResponse`] message.
2956
+ * @param {SedimentreeId} id
2957
+ * @param {Uint8Array[]} blobs
2958
+ * @returns {SyncMessage}
2959
+ */
2960
+ static blobsResponse(id, blobs) {
2961
+ _assertClass(id, SedimentreeId);
2962
+ const ptr0 = passArrayJsValueToWasm0(blobs, wasm.__wbindgen_export);
2963
+ const len0 = WASM_VECTOR_LEN;
2964
+ const ret = wasm.syncmessage_blobsResponse(id.__wbg_ptr, ptr0, len0);
2965
+ return SyncMessage.__wrap(ret);
2966
+ }
2967
+ /**
2968
+ * The [`LooseCommit`] for a [`SyncMessage::LooseCommit`], if applicable.
2969
+ *
2970
+ * Decodes the signed payload to extract the underlying commit.
2971
+ * @returns {LooseCommit | undefined}
2972
+ */
2973
+ get commit() {
2974
+ const ret = wasm.syncmessage_commit(this.__wbg_ptr);
2975
+ return ret === 0 ? undefined : LooseCommit.__wrap(ret);
2976
+ }
2977
+ /**
2978
+ * The requested [`Digest`]s for a [`SyncMessage::BlobsRequest`], if applicable.
2979
+ * @returns {Digest[] | undefined}
2980
+ */
2981
+ get digests() {
2982
+ const ret = wasm.syncmessage_digests(this.__wbg_ptr);
2983
+ let v1;
2984
+ if (ret[0] !== 0) {
2985
+ v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
2986
+ wasm.__wbindgen_export5(ret[0], ret[1] * 4, 4);
2987
+ }
2988
+ return v1;
2989
+ }
2990
+ /**
2991
+ * The [`Fragment`] for a [`SyncMessage::Fragment`], if applicable.
2992
+ *
2993
+ * Decodes the signed payload to extract the underlying fragment.
2994
+ * @returns {Fragment | undefined}
2995
+ */
2996
+ get fragment() {
2997
+ const ret = wasm.syncmessage_fragment(this.__wbg_ptr);
2998
+ return ret === 0 ? undefined : Fragment.__wrap(ret);
2999
+ }
3000
+ /**
3001
+ * Deserialize a message from bytes.
3002
+ *
3003
+ * # Errors
3004
+ *
3005
+ * Returns a [`JsMessageDeserializationError`] if deserialization fails.
3006
+ * @param {Uint8Array} bytes
3007
+ * @returns {SyncMessage}
3008
+ */
3009
+ static fromBytes(bytes) {
3010
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
3011
+ const len0 = WASM_VECTOR_LEN;
3012
+ const ret = wasm.syncmessage_fromBytes(ptr0, len0);
3013
+ if (ret[2]) {
3014
+ throw takeFromExternrefTable0(ret[1]);
3015
+ }
3016
+ return SyncMessage.__wrap(ret[0]);
3017
+ }
3018
+ /**
3019
+ * The [`BatchSyncRequest`] for a [`SyncMessage::BatchSyncRequest`], if applicable.
3020
+ * @returns {BatchSyncRequest | undefined}
3021
+ */
3022
+ get request() {
3023
+ const ret = wasm.syncmessage_request(this.__wbg_ptr);
3024
+ return ret === 0 ? undefined : BatchSyncRequest.__wrap(ret);
3025
+ }
3026
+ /**
3027
+ * The [`BatchSyncResponse`] for a [`SyncMessage::BatchSyncResponse`], if applicable.
3028
+ * @returns {BatchSyncResponse | undefined}
3029
+ */
3030
+ get response() {
3031
+ const ret = wasm.syncmessage_response(this.__wbg_ptr);
3032
+ return ret === 0 ? undefined : BatchSyncResponse.__wrap(ret);
3033
+ }
3034
+ /**
3035
+ * The [`SedimentreeId`] associated with this message, if any.
3036
+ * @returns {SedimentreeId | undefined}
3037
+ */
3038
+ get sedimentreeId() {
3039
+ const ret = wasm.syncmessage_sedimentreeId(this.__wbg_ptr);
3040
+ return ret === 0 ? undefined : SedimentreeId.__wrap(ret);
3041
+ }
3042
+ /**
3043
+ * Serialize the message to bytes.
3044
+ * @returns {Uint8Array}
3045
+ */
3046
+ toBytes() {
3047
+ const ret = wasm.syncmessage_toBytes(this.__wbg_ptr);
3048
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
3049
+ wasm.__wbindgen_export5(ret[0], ret[1] * 1, 1);
3050
+ return v1;
3051
+ }
3052
+ /**
3053
+ * The message variant name.
3054
+ * @returns {string}
3055
+ */
3056
+ get type() {
3057
+ let deferred1_0;
3058
+ let deferred1_1;
3059
+ try {
3060
+ const ret = wasm.syncmessage_type(this.__wbg_ptr);
3061
+ deferred1_0 = ret[0];
3062
+ deferred1_1 = ret[1];
3063
+ return getStringFromWasm0(ret[0], ret[1]);
3064
+ } finally {
3065
+ wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
3066
+ }
3067
+ }
3068
+ }
3069
+ if (Symbol.dispose) SyncMessage.prototype[Symbol.dispose] = SyncMessage.prototype.free;
3070
+ exports.SyncMessage = SyncMessage;
3071
+
3133
3072
  /**
3134
3073
  * Statistics from a sync operation.
3135
3074
  *
@@ -3300,15 +3239,15 @@ if (Symbol.dispose) WebCryptoSigner.prototype[Symbol.dispose] = WebCryptoSigner.
3300
3239
  exports.WebCryptoSigner = WebCryptoSigner;
3301
3240
 
3302
3241
  /**
3303
- * Convenience factory — equivalent to `new MessagePortConnection(port)`.
3242
+ * Convenience factory — equivalent to `new MessagePortTransport(port)`.
3304
3243
  * @param {any} port
3305
- * @returns {MessagePortConnection}
3244
+ * @returns {MessagePortTransport}
3306
3245
  */
3307
- function makeMessagePortConnection(port) {
3308
- const ret = wasm.makeMessagePortConnection(port);
3309
- return MessagePortConnection.__wrap(ret);
3246
+ function makeMessagePortTransport(port) {
3247
+ const ret = wasm.makeMessagePortTransport(port);
3248
+ return MessagePortTransport.__wrap(ret);
3310
3249
  }
3311
- exports.makeMessagePortConnection = makeMessagePortConnection;
3250
+ exports.makeMessagePortTransport = makeMessagePortTransport;
3312
3251
 
3313
3252
  /**
3314
3253
  * Entry point called when the Wasm module is instantiated.
@@ -3326,12 +3265,6 @@ exports.start = start;
3326
3265
  function __wbg_get_imports() {
3327
3266
  const import0 = {
3328
3267
  __proto__: null,
3329
- __wbg___wasm_refgen_toWasmBatchSyncResponse_d314d3b3e09c54af: function(arg0) {
3330
- const ret = arg0.__wasm_refgen_toWasmBatchSyncResponse();
3331
- _assertClass(ret, BatchSyncResponse);
3332
- var ptr1 = ret.__destroy_into_raw();
3333
- return ptr1;
3334
- },
3335
3268
  __wbg___wasm_refgen_toWasmCommitWithBlob_dd531ffcf07010df: function(arg0) {
3336
3269
  const ret = arg0.__wasm_refgen_toWasmCommitWithBlob();
3337
3270
  _assertClass(ret, CommitWithBlob);
@@ -3368,18 +3301,6 @@ function __wbg_get_imports() {
3368
3301
  var ptr1 = ret.__destroy_into_raw();
3369
3302
  return ptr1;
3370
3303
  },
3371
- __wbg___wasm_refgen_toWasmMessage_03bf79fea85775dc: function(arg0) {
3372
- const ret = arg0.__wasm_refgen_toWasmMessage();
3373
- _assertClass(ret, Message);
3374
- var ptr1 = ret.__destroy_into_raw();
3375
- return ptr1;
3376
- },
3377
- __wbg___wasm_refgen_toWasmRequestId_659561cf5c639011: function(arg0) {
3378
- const ret = arg0.__wasm_refgen_toWasmRequestId();
3379
- _assertClass(ret, RequestId);
3380
- var ptr1 = ret.__destroy_into_raw();
3381
- return ptr1;
3382
- },
3383
3304
  __wbg___wbindgen_debug_string_5398f5bb970e0daa: function(arg0, arg1) {
3384
3305
  const ret = debugString(arg1);
3385
3306
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
@@ -3428,42 +3349,27 @@ function __wbg_get_imports() {
3428
3349
  const ret = arg0.arrayBuffer();
3429
3350
  return ret;
3430
3351
  }, arguments); },
3431
- __wbg_authenticatedconnection_new: function(arg0) {
3432
- const ret = AuthenticatedConnection.__wrap(arg0);
3433
- return ret;
3434
- },
3435
3352
  __wbg_authenticatedlongpoll_new: function(arg0) {
3436
3353
  const ret = AuthenticatedLongPoll.__wrap(arg0);
3437
3354
  return ret;
3438
3355
  },
3439
- __wbg_authenticatedwebsocket_new: function(arg0) {
3440
- const ret = AuthenticatedWebSocket.__wrap(arg0);
3356
+ __wbg_authenticatedtransport_new: function(arg0) {
3357
+ const ret = AuthenticatedTransport.__wrap(arg0);
3441
3358
  return ret;
3442
3359
  },
3443
- __wbg_batchsyncresponse_new: function(arg0) {
3444
- const ret = BatchSyncResponse.__wrap(arg0);
3360
+ __wbg_authenticatedwebsocket_new: function(arg0) {
3361
+ const ret = AuthenticatedWebSocket.__wrap(arg0);
3445
3362
  return ret;
3446
3363
  },
3447
3364
  __wbg_buffer_60b8043cd926067d: function(arg0) {
3448
3365
  const ret = arg0.buffer;
3449
3366
  return ret;
3450
3367
  },
3451
- __wbg_call_15d4cdb7fcc8c67d: function(arg0, arg1, arg2, arg3) {
3452
- const ret = arg0.call(BatchSyncRequest.__wrap(arg1), arg2 === 0 ? undefined : arg3);
3453
- return ret;
3454
- },
3455
3368
  __wbg_call_2d781c1f4d5c0ef8: function() { return handleError(function (arg0, arg1, arg2) {
3456
3369
  const ret = arg0.call(arg1, arg2);
3457
3370
  return ret;
3458
3371
  }, arguments); },
3459
- __wbg_call_e133b57c9155d22c: function() { return handleError(function (arg0, arg1) {
3460
- const ret = arg0.call(arg1);
3461
- return ret;
3462
- }, arguments); },
3463
- __wbg_clearTimeout_b47e5bf918898b2b: function(arg0) {
3464
- clearTimeout(arg0);
3465
- },
3466
- __wbg_close_83c08a226256ebab: function(arg0) {
3372
+ __wbg_close_9b95bf80abb12681: function(arg0) {
3467
3373
  arg0.close();
3468
3374
  },
3469
3375
  __wbg_close_cbf870bdad0aad99: function(arg0) {
@@ -3473,10 +3379,6 @@ function __wbg_get_imports() {
3473
3379
  const ret = CommitWithBlob.__wrap(arg0);
3474
3380
  return ret;
3475
3381
  },
3476
- __wbg_connerrorpair_new: function(arg0) {
3477
- const ret = ConnErrorPair.__wrap(arg0);
3478
- return ret;
3479
- },
3480
3382
  __wbg_contains_ef4bfb7fa5a241b7: function(arg0, arg1, arg2) {
3481
3383
  const ret = arg0.contains(getStringFromWasm0(arg1, arg2));
3482
3384
  return ret;
@@ -3509,7 +3411,7 @@ function __wbg_get_imports() {
3509
3411
  const ret = Digest.__unwrap(arg0);
3510
3412
  return ret;
3511
3413
  },
3512
- __wbg_disconnect_56f1bb3ba450fd5d: function(arg0) {
3414
+ __wbg_disconnect_285027c2ec32acf6: function(arg0) {
3513
3415
  const ret = arg0.disconnect();
3514
3416
  return ret;
3515
3417
  },
@@ -3732,8 +3634,8 @@ function __wbg_get_imports() {
3732
3634
  const ret = LooseCommit.__wrap(arg0);
3733
3635
  return ret;
3734
3636
  },
3735
- __wbg_message_new: function(arg0) {
3736
- const ret = Message.__wrap(arg0);
3637
+ __wbg_messageporttransport_new: function(arg0) {
3638
+ const ret = MessagePortTransport.__wrap(arg0);
3737
3639
  return ret;
3738
3640
  },
3739
3641
  __wbg_msCrypto_bd5a034af96bcba6: function(arg0) {
@@ -3767,7 +3669,7 @@ function __wbg_get_imports() {
3767
3669
  const a = state0.a;
3768
3670
  state0.a = 0;
3769
3671
  try {
3770
- return __wasm_bindgen_func_elem_1447_191(a, state0.b, arg0, arg1);
3672
+ return __wasm_bindgen_func_elem_1476_183(a, state0.b, arg0, arg1);
3771
3673
  } finally {
3772
3674
  state0.a = a;
3773
3675
  }
@@ -3786,6 +3688,10 @@ function __wbg_get_imports() {
3786
3688
  const ret = new WebSocket(getStringFromWasm0(arg0, arg1));
3787
3689
  return ret;
3788
3690
  }, arguments); },
3691
+ __wbg_new_f7708ba82c4c12f6: function() { return handleError(function () {
3692
+ const ret = new MessageChannel();
3693
+ return ret;
3694
+ }, arguments); },
3789
3695
  __wbg_new_from_slice_22da9388ac046e50: function(arg0, arg1) {
3790
3696
  const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
3791
3697
  return ret;
@@ -3797,7 +3703,7 @@ function __wbg_get_imports() {
3797
3703
  const a = state0.a;
3798
3704
  state0.a = 0;
3799
3705
  try {
3800
- return __wasm_bindgen_func_elem_1447_192(a, state0.b, arg0, arg1);
3706
+ return __wasm_bindgen_func_elem_1476_184(a, state0.b, arg0, arg1);
3801
3707
  } finally {
3802
3708
  state0.a = a;
3803
3709
  }
@@ -3816,10 +3722,6 @@ function __wbg_get_imports() {
3816
3722
  const ret = new Request(getStringFromWasm0(arg0, arg1), arg2);
3817
3723
  return ret;
3818
3724
  }, arguments); },
3819
- __wbg_nextRequestId_dd2f74cf9aba6ad5: function(arg0) {
3820
- const ret = arg0.nextRequestId();
3821
- return ret;
3822
- },
3823
3725
  __wbg_node_84ea875411254db1: function(arg0) {
3824
3726
  const ret = arg0.node;
3825
3727
  return ret;
@@ -3844,10 +3746,6 @@ function __wbg_get_imports() {
3844
3746
  const ret = Array.of(arg0, arg1);
3845
3747
  return ret;
3846
3748
  },
3847
- __wbg_onmessage_8ab5822ce277f116: function(arg0) {
3848
- const ret = arg0.onmessage;
3849
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
3850
- },
3851
3749
  __wbg_open_e7a9d3d6344572f6: function() { return handleError(function (arg0, arg1, arg2, arg3) {
3852
3750
  const ret = arg0.open(getStringFromWasm0(arg1, arg2), arg3 >>> 0);
3853
3751
  return ret;
@@ -3864,7 +3762,15 @@ function __wbg_get_imports() {
3864
3762
  const ret = PeerResultMap.__wrap(arg0);
3865
3763
  return ret;
3866
3764
  },
3867
- __wbg_postMessage_7b7c2f81e97ad513: function(arg0, arg1) {
3765
+ __wbg_port1_869a7ef90538dbdf: function(arg0) {
3766
+ const ret = arg0.port1;
3767
+ return ret;
3768
+ },
3769
+ __wbg_port2_947a51b8ba00adc9: function(arg0) {
3770
+ const ret = arg0.port2;
3771
+ return ret;
3772
+ },
3773
+ __wbg_postMessage_1acd85b7323d11a6: function(arg0, arg1) {
3868
3774
  arg0.postMessage(arg1);
3869
3775
  },
3870
3776
  __wbg_process_44c7a14e11e9f69e: function(arg0) {
@@ -3896,22 +3802,10 @@ function __wbg_get_imports() {
3896
3802
  const ret = arg0.readyState;
3897
3803
  return ret;
3898
3804
  },
3899
- __wbg_recvBytes_74810cb3b96b1b52: function(arg0) {
3805
+ __wbg_recvBytes_35ad4c7c108ff4dd: function(arg0) {
3900
3806
  const ret = arg0.recvBytes();
3901
3807
  return ret;
3902
3808
  },
3903
- __wbg_recv_347c2a4b277359e4: function(arg0) {
3904
- const ret = arg0.recv();
3905
- return ret;
3906
- },
3907
- __wbg_reject_452b6409a2fde3cd: function(arg0) {
3908
- const ret = Promise.reject(arg0);
3909
- return ret;
3910
- },
3911
- __wbg_requestid_new: function(arg0) {
3912
- const ret = RequestId.__wrap(arg0);
3913
- return ret;
3914
- },
3915
3809
  __wbg_require_b4edbdcf3e2a1ef0: function() { return handleError(function () {
3916
3810
  const ret = module.require;
3917
3811
  return ret;
@@ -3944,18 +3838,14 @@ function __wbg_get_imports() {
3944
3838
  const ret = SedimentreeId.__unwrap(arg0);
3945
3839
  return ret;
3946
3840
  },
3947
- __wbg_sendBytes_1443021028c26f11: function(arg0, arg1) {
3841
+ __wbg_sendBytes_c3a40be4ec4bfd25: function(arg0, arg1) {
3948
3842
  const ret = arg0.sendBytes(arg1);
3949
3843
  return ret;
3950
3844
  },
3951
3845
  __wbg_send_d31a693c975dea74: function() { return handleError(function (arg0, arg1, arg2) {
3952
3846
  arg0.send(getArrayU8FromWasm0(arg1, arg2));
3953
3847
  }, arguments); },
3954
- __wbg_send_ef8a4b8f5144f8bf: function(arg0, arg1) {
3955
- const ret = arg0.send(Message.__wrap(arg1));
3956
- return ret;
3957
- },
3958
- __wbg_setTimeout_44f7c6b8fbfaf279: function(arg0, arg1) {
3848
+ __wbg_setTimeout_5e8107dbc66751b5: function(arg0, arg1) {
3959
3849
  const ret = setTimeout(arg0, arg1);
3960
3850
  return ret;
3961
3851
  },
@@ -3993,10 +3883,10 @@ function __wbg_get_imports() {
3993
3883
  __wbg_set_onerror_901ca711f94a5bbb: function(arg0, arg1) {
3994
3884
  arg0.onerror = arg1;
3995
3885
  },
3996
- __wbg_set_onmessage_6f80ab771bf151aa: function(arg0, arg1) {
3886
+ __wbg_set_onmessage_3b92dfded4487295: function(arg0, arg1) {
3997
3887
  arg0.onmessage = arg1;
3998
3888
  },
3999
- __wbg_set_onmessage_8f399489f2e56d62: function(arg0, arg1) {
3889
+ __wbg_set_onmessage_6f80ab771bf151aa: function(arg0, arg1) {
4000
3890
  arg0.onmessage = arg1;
4001
3891
  },
4002
3892
  __wbg_set_onopen_34e3e24cf9337ddd: function(arg0, arg1) {
@@ -4008,14 +3898,14 @@ function __wbg_get_imports() {
4008
3898
  __wbg_set_onupgradeneeded_860ce42184f987e7: function(arg0, arg1) {
4009
3899
  arg0.onupgradeneeded = arg1;
4010
3900
  },
3901
+ __wbg_sign_23c468db7fe0ee83: function(arg0, arg1) {
3902
+ const ret = arg0.sign(arg1);
3903
+ return ret;
3904
+ },
4011
3905
  __wbg_sign_a34d057afd14c54d: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
4012
3906
  const ret = arg0.sign(arg1, arg2, getArrayU8FromWasm0(arg3, arg4));
4013
3907
  return ret;
4014
3908
  }, arguments); },
4015
- __wbg_sign_b6a174bd584137fc: function(arg0, arg1) {
4016
- const ret = arg0.sign(arg1);
4017
- return ret;
4018
- },
4019
3909
  __wbg_signedfragment_new: function(arg0) {
4020
3910
  const ret = SignedFragment.__wrap(arg0);
4021
3911
  return ret;
@@ -4031,6 +3921,9 @@ function __wbg_get_imports() {
4031
3921
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
4032
3922
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
4033
3923
  },
3924
+ __wbg_start_f837ba2bac4733b5: function(arg0) {
3925
+ arg0.start();
3926
+ },
4034
3927
  __wbg_static_accessor_GLOBAL_8adb955bd33fac2f: function() {
4035
3928
  const ret = typeof global === 'undefined' ? null : global;
4036
3929
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
@@ -4059,8 +3952,8 @@ function __wbg_get_imports() {
4059
3952
  const ret = Subduction.__wrap(arg0);
4060
3953
  return ret;
4061
3954
  },
4062
- __wbg_subductionlongpollconnection_new: function(arg0) {
4063
- const ret = SubductionLongPollConnection.__wrap(arg0);
3955
+ __wbg_subductionhttplongpoll_new: function(arg0) {
3956
+ const ret = SubductionHttpLongPoll.__wrap(arg0);
4064
3957
  return ret;
4065
3958
  },
4066
3959
  __wbg_subductionwebsocket_new: function(arg0) {
@@ -4098,7 +3991,7 @@ function __wbg_get_imports() {
4098
3991
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
4099
3992
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
4100
3993
  }, arguments); },
4101
- __wbg_verifyingKey_8bc97ecebbb22709: function(arg0) {
3994
+ __wbg_verifyingKey_e2a30e05511820c4: function(arg0) {
4102
3995
  const ret = arg0.verifyingKey();
4103
3996
  return ret;
4104
3997
  },
@@ -4111,79 +4004,74 @@ function __wbg_get_imports() {
4111
4004
  return ret;
4112
4005
  },
4113
4006
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
4114
- // 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`.
4115
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_239, __wasm_bindgen_func_elem_1447);
4007
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 10, function: Function { arguments: [Externref], shim_idx: 11, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
4008
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_255, __wasm_bindgen_func_elem_552);
4116
4009
  return ret;
4117
4010
  },
4118
4011
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
4119
- // Cast intrinsic for `Closure(Closure { dtor_idx: 7, function: Function { arguments: [Externref], shim_idx: 9, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
4120
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_239, __wasm_bindgen_func_elem_529);
4012
+ // 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`.
4013
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_255, __wasm_bindgen_func_elem_552_1);
4121
4014
  return ret;
4122
4015
  },
4123
4016
  __wbindgen_cast_0000000000000003: function(arg0, arg1) {
4124
- // 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`.
4125
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_239, __wasm_bindgen_func_elem_529_2);
4017
+ // 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`.
4018
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_255, __wasm_bindgen_func_elem_552_2);
4126
4019
  return ret;
4127
4020
  },
4128
4021
  __wbindgen_cast_0000000000000004: function(arg0, arg1) {
4129
- // 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`.
4130
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_239, __wasm_bindgen_func_elem_529_3);
4022
+ // 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`.
4023
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_255, __wasm_bindgen_func_elem_552_3);
4131
4024
  return ret;
4132
4025
  },
4133
4026
  __wbindgen_cast_0000000000000005: function(arg0, arg1) {
4134
- // 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`.
4135
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_239, __wasm_bindgen_func_elem_529_4);
4136
- return ret;
4137
- },
4138
- __wbindgen_cast_0000000000000006: function(arg0, arg1) {
4139
- // Cast intrinsic for `Closure(Closure { dtor_idx: 7, function: Function { arguments: [], shim_idx: 8, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
4140
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_239, __wasm_bindgen_func_elem_528);
4027
+ // 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`.
4028
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_255, __wasm_bindgen_func_elem_1476);
4141
4029
  return ret;
4142
4030
  },
4143
- __wbindgen_cast_0000000000000007: function(arg0) {
4031
+ __wbindgen_cast_0000000000000006: function(arg0) {
4144
4032
  // Cast intrinsic for `F64 -> Externref`.
4145
4033
  const ret = arg0;
4146
4034
  return ret;
4147
4035
  },
4148
- __wbindgen_cast_0000000000000008: function(arg0, arg1) {
4036
+ __wbindgen_cast_0000000000000007: function(arg0, arg1) {
4149
4037
  // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
4150
4038
  const ret = getArrayU8FromWasm0(arg0, arg1);
4151
4039
  return ret;
4152
4040
  },
4153
- __wbindgen_cast_0000000000000009: function(arg0, arg1) {
4041
+ __wbindgen_cast_0000000000000008: function(arg0, arg1) {
4154
4042
  // Cast intrinsic for `Ref(String) -> Externref`.
4155
4043
  const ret = getStringFromWasm0(arg0, arg1);
4156
4044
  return ret;
4157
4045
  },
4158
- __wbindgen_cast_000000000000000a: function(arg0, arg1) {
4046
+ __wbindgen_cast_0000000000000009: function(arg0, arg1) {
4159
4047
  var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
4160
4048
  wasm.__wbindgen_export5(arg0, arg1 * 4, 4);
4161
4049
  // Cast intrinsic for `Vector(NamedExternref("Fragment")) -> Externref`.
4162
4050
  const ret = v0;
4163
4051
  return ret;
4164
4052
  },
4165
- __wbindgen_cast_000000000000000b: function(arg0, arg1) {
4053
+ __wbindgen_cast_000000000000000a: function(arg0, arg1) {
4166
4054
  var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
4167
4055
  wasm.__wbindgen_export5(arg0, arg1 * 4, 4);
4168
4056
  // Cast intrinsic for `Vector(NamedExternref("LooseCommit")) -> Externref`.
4169
4057
  const ret = v0;
4170
4058
  return ret;
4171
4059
  },
4172
- __wbindgen_cast_000000000000000c: function(arg0, arg1) {
4060
+ __wbindgen_cast_000000000000000b: function(arg0, arg1) {
4173
4061
  var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
4174
4062
  wasm.__wbindgen_export5(arg0, arg1 * 4, 4);
4175
4063
  // Cast intrinsic for `Vector(NamedExternref("PeerId")) -> Externref`.
4176
4064
  const ret = v0;
4177
4065
  return ret;
4178
4066
  },
4179
- __wbindgen_cast_000000000000000d: function(arg0, arg1) {
4067
+ __wbindgen_cast_000000000000000c: function(arg0, arg1) {
4180
4068
  var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
4181
4069
  wasm.__wbindgen_export5(arg0, arg1 * 4, 4);
4182
4070
  // Cast intrinsic for `Vector(NamedExternref("SedimentreeId")) -> Externref`.
4183
4071
  const ret = v0;
4184
4072
  return ret;
4185
4073
  },
4186
- __wbindgen_cast_000000000000000e: function(arg0, arg1) {
4074
+ __wbindgen_cast_000000000000000d: function(arg0, arg1) {
4187
4075
  var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
4188
4076
  wasm.__wbindgen_export5(arg0, arg1 * 4, 4);
4189
4077
  // Cast intrinsic for `Vector(NamedExternref("Uint8Array")) -> Externref`.
@@ -4206,39 +4094,35 @@ function __wbg_get_imports() {
4206
4094
  };
4207
4095
  }
4208
4096
 
4209
- function __wasm_bindgen_func_elem_528(arg0, arg1) {
4210
- wasm.__wasm_bindgen_func_elem_528(arg0, arg1);
4097
+ function __wasm_bindgen_func_elem_552(arg0, arg1, arg2) {
4098
+ wasm.__wasm_bindgen_func_elem_552(arg0, arg1, arg2);
4211
4099
  }
4212
4100
 
4213
- function __wasm_bindgen_func_elem_529(arg0, arg1, arg2) {
4214
- wasm.__wasm_bindgen_func_elem_529(arg0, arg1, arg2);
4101
+ function __wasm_bindgen_func_elem_552_1(arg0, arg1, arg2) {
4102
+ wasm.__wasm_bindgen_func_elem_552_1(arg0, arg1, arg2);
4215
4103
  }
4216
4104
 
4217
- function __wasm_bindgen_func_elem_529_2(arg0, arg1, arg2) {
4218
- wasm.__wasm_bindgen_func_elem_529_2(arg0, arg1, arg2);
4105
+ function __wasm_bindgen_func_elem_552_2(arg0, arg1, arg2) {
4106
+ wasm.__wasm_bindgen_func_elem_552_2(arg0, arg1, arg2);
4219
4107
  }
4220
4108
 
4221
- function __wasm_bindgen_func_elem_529_3(arg0, arg1, arg2) {
4222
- wasm.__wasm_bindgen_func_elem_529_3(arg0, arg1, arg2);
4109
+ function __wasm_bindgen_func_elem_552_3(arg0, arg1, arg2) {
4110
+ wasm.__wasm_bindgen_func_elem_552_3(arg0, arg1, arg2);
4223
4111
  }
4224
4112
 
4225
- function __wasm_bindgen_func_elem_529_4(arg0, arg1, arg2) {
4226
- wasm.__wasm_bindgen_func_elem_529_4(arg0, arg1, arg2);
4227
- }
4228
-
4229
- function __wasm_bindgen_func_elem_1447(arg0, arg1, arg2) {
4230
- const ret = wasm.__wasm_bindgen_func_elem_1447(arg0, arg1, arg2);
4113
+ function __wasm_bindgen_func_elem_1476(arg0, arg1, arg2) {
4114
+ const ret = wasm.__wasm_bindgen_func_elem_1476(arg0, arg1, arg2);
4231
4115
  if (ret[1]) {
4232
4116
  throw takeFromExternrefTable0(ret[0]);
4233
4117
  }
4234
4118
  }
4235
4119
 
4236
- function __wasm_bindgen_func_elem_1447_191(arg0, arg1, arg2, arg3) {
4237
- wasm.__wasm_bindgen_func_elem_1447_191(arg0, arg1, arg2, arg3);
4120
+ function __wasm_bindgen_func_elem_1476_183(arg0, arg1, arg2, arg3) {
4121
+ wasm.__wasm_bindgen_func_elem_1476_183(arg0, arg1, arg2, arg3);
4238
4122
  }
4239
4123
 
4240
- function __wasm_bindgen_func_elem_1447_192(arg0, arg1, arg2, arg3) {
4241
- wasm.__wasm_bindgen_func_elem_1447_192(arg0, arg1, arg2, arg3);
4124
+ function __wasm_bindgen_func_elem_1476_184(arg0, arg1, arg2, arg3) {
4125
+ wasm.__wasm_bindgen_func_elem_1476_184(arg0, arg1, arg2, arg3);
4242
4126
  }
4243
4127
 
4244
4128
 
@@ -4249,9 +4133,6 @@ const __wbindgen_enum_IdbTransactionMode = ["readonly", "readwrite", "versioncha
4249
4133
 
4250
4134
 
4251
4135
  const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
4252
- const ConnErrorPairFinalization = (typeof FinalizationRegistry === 'undefined')
4253
- ? { register: () => {}, unregister: () => {} }
4254
- : new FinalizationRegistry(ptr => wasm.__wbg_connerrorpair_free(ptr >>> 0, 1));
4255
4136
  const MemorySignerFinalization = (typeof FinalizationRegistry === 'undefined')
4256
4137
  ? { register: () => {}, unregister: () => {} }
4257
4138
  : new FinalizationRegistry(ptr => wasm.__wbg_memorysigner_free(ptr >>> 0, 1));
@@ -4261,12 +4142,12 @@ const MemoryStorageFinalization = (typeof FinalizationRegistry === 'undefined')
4261
4142
  const PeerBatchSyncResultFinalization = (typeof FinalizationRegistry === 'undefined')
4262
4143
  ? { register: () => {}, unregister: () => {} }
4263
4144
  : new FinalizationRegistry(ptr => wasm.__wbg_peerbatchsyncresult_free(ptr >>> 0, 1));
4264
- const AuthenticatedConnectionFinalization = (typeof FinalizationRegistry === 'undefined')
4265
- ? { register: () => {}, unregister: () => {} }
4266
- : new FinalizationRegistry(ptr => wasm.__wbg_authenticatedconnection_free(ptr >>> 0, 1));
4267
4145
  const AuthenticatedLongPollFinalization = (typeof FinalizationRegistry === 'undefined')
4268
4146
  ? { register: () => {}, unregister: () => {} }
4269
4147
  : new FinalizationRegistry(ptr => wasm.__wbg_authenticatedlongpoll_free(ptr >>> 0, 1));
4148
+ const AuthenticatedTransportFinalization = (typeof FinalizationRegistry === 'undefined')
4149
+ ? { register: () => {}, unregister: () => {} }
4150
+ : new FinalizationRegistry(ptr => wasm.__wbg_authenticatedtransport_free(ptr >>> 0, 1));
4270
4151
  const AuthenticatedWebSocketFinalization = (typeof FinalizationRegistry === 'undefined')
4271
4152
  ? { register: () => {}, unregister: () => {} }
4272
4153
  : new FinalizationRegistry(ptr => wasm.__wbg_authenticatedwebsocket_free(ptr >>> 0, 1));
@@ -4285,9 +4166,6 @@ const CallErrorFinalization = (typeof FinalizationRegistry === 'undefined')
4285
4166
  const CommitWithBlobFinalization = (typeof FinalizationRegistry === 'undefined')
4286
4167
  ? { register: () => {}, unregister: () => {} }
4287
4168
  : new FinalizationRegistry(ptr => wasm.__wbg_commitwithblob_free(ptr >>> 0, 1));
4288
- const ConnectionIdFinalization = (typeof FinalizationRegistry === 'undefined')
4289
- ? { register: () => {}, unregister: () => {} }
4290
- : new FinalizationRegistry(ptr => wasm.__wbg_connectionid_free(ptr >>> 0, 1));
4291
4169
  const DepthFinalization = (typeof FinalizationRegistry === 'undefined')
4292
4170
  ? { register: () => {}, unregister: () => {} }
4293
4171
  : new FinalizationRegistry(ptr => wasm.__wbg_depth_free(ptr >>> 0, 1));
@@ -4309,21 +4187,21 @@ const FragmentsArrayFinalization = (typeof FinalizationRegistry === 'undefined')
4309
4187
  const HashMetricFinalization = (typeof FinalizationRegistry === 'undefined')
4310
4188
  ? { register: () => {}, unregister: () => {} }
4311
4189
  : new FinalizationRegistry(ptr => wasm.__wbg_hashmetric_free(ptr >>> 0, 1));
4190
+ const SubductionHttpLongPollFinalization = (typeof FinalizationRegistry === 'undefined')
4191
+ ? { register: () => {}, unregister: () => {} }
4192
+ : new FinalizationRegistry(ptr => wasm.__wbg_subductionhttplongpoll_free(ptr >>> 0, 1));
4312
4193
  const SubductionLongPollFinalization = (typeof FinalizationRegistry === 'undefined')
4313
4194
  ? { register: () => {}, unregister: () => {} }
4314
4195
  : new FinalizationRegistry(ptr => wasm.__wbg_subductionlongpoll_free(ptr >>> 0, 1));
4315
- const SubductionLongPollConnectionFinalization = (typeof FinalizationRegistry === 'undefined')
4316
- ? { register: () => {}, unregister: () => {} }
4317
- : new FinalizationRegistry(ptr => wasm.__wbg_subductionlongpollconnection_free(ptr >>> 0, 1));
4318
4196
  const LooseCommitFinalization = (typeof FinalizationRegistry === 'undefined')
4319
4197
  ? { register: () => {}, unregister: () => {} }
4320
4198
  : new FinalizationRegistry(ptr => wasm.__wbg_loosecommit_free(ptr >>> 0, 1));
4321
- const MessageFinalization = (typeof FinalizationRegistry === 'undefined')
4199
+ const SyncMessageFinalization = (typeof FinalizationRegistry === 'undefined')
4322
4200
  ? { register: () => {}, unregister: () => {} }
4323
- : new FinalizationRegistry(ptr => wasm.__wbg_message_free(ptr >>> 0, 1));
4324
- const MessagePortConnectionFinalization = (typeof FinalizationRegistry === 'undefined')
4201
+ : new FinalizationRegistry(ptr => wasm.__wbg_syncmessage_free(ptr >>> 0, 1));
4202
+ const MessagePortTransportFinalization = (typeof FinalizationRegistry === 'undefined')
4325
4203
  ? { register: () => {}, unregister: () => {} }
4326
- : new FinalizationRegistry(ptr => wasm.__wbg_messageportconnection_free(ptr >>> 0, 1));
4204
+ : new FinalizationRegistry(ptr => wasm.__wbg_messageporttransport_free(ptr >>> 0, 1));
4327
4205
  const NonceFinalization = (typeof FinalizationRegistry === 'undefined')
4328
4206
  ? { register: () => {}, unregister: () => {} }
4329
4207
  : new FinalizationRegistry(ptr => wasm.__wbg_nonce_free(ptr >>> 0, 1));