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