@automerge/subduction 0.8.1 → 0.9.0

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.
Files changed (32) hide show
  1. package/dist/cjs/wasm-base64.cjs +1 -1
  2. package/dist/cjs/web-bindings.cjs +308 -87
  3. package/dist/cjs/web.cjs +309 -88
  4. package/dist/esm/wasm-base64.js +1 -1
  5. package/dist/iife/index.js +309 -88
  6. package/dist/index.d.ts +87 -24
  7. package/dist/subduction.wasm +0 -0
  8. package/dist/wasm_bindgen/bundler/snippets/subduction_wasm-0ed7fd66cebca59f/inline0.js +9 -0
  9. package/dist/wasm_bindgen/bundler/subduction_wasm.d.ts +87 -24
  10. package/dist/wasm_bindgen/bundler/subduction_wasm_bg.js +294 -96
  11. package/dist/wasm_bindgen/bundler/subduction_wasm_bg.wasm +0 -0
  12. package/dist/wasm_bindgen/bundler/subduction_wasm_bg.wasm.d.ts +28 -20
  13. package/dist/wasm_bindgen/nodejs/snippets/subduction_wasm-0ed7fd66cebca59f/inline0.js +9 -0
  14. package/dist/wasm_bindgen/nodejs/subduction_wasm.cjs +296 -96
  15. package/dist/wasm_bindgen/nodejs/subduction_wasm.d.ts +87 -24
  16. package/dist/wasm_bindgen/nodejs/subduction_wasm_bg.wasm +0 -0
  17. package/dist/wasm_bindgen/nodejs/subduction_wasm_bg.wasm.d.ts +28 -20
  18. package/dist/wasm_bindgen/web/snippets/subduction_wasm-0ed7fd66cebca59f/inline0.js +9 -0
  19. package/dist/wasm_bindgen/web/subduction_wasm.d.ts +115 -44
  20. package/dist/wasm_bindgen/web/subduction_wasm.js +296 -96
  21. package/dist/wasm_bindgen/web/subduction_wasm_bg.wasm +0 -0
  22. package/dist/wasm_bindgen/web/subduction_wasm_bg.wasm.d.ts +28 -20
  23. package/package.json +1 -1
  24. /package/dist/wasm_bindgen/bundler/snippets/{sedimentree_wasm-68c0499598a3382c → sedimentree_wasm-1de4a01519b0f11f}/inline0.js +0 -0
  25. /package/dist/wasm_bindgen/bundler/snippets/{sedimentree_wasm-68c0499598a3382c → sedimentree_wasm-1de4a01519b0f11f}/inline1.js +0 -0
  26. /package/dist/wasm_bindgen/bundler/snippets/{sedimentree_wasm-68c0499598a3382c → sedimentree_wasm-1de4a01519b0f11f}/inline2.js +0 -0
  27. /package/dist/wasm_bindgen/nodejs/snippets/{sedimentree_wasm-68c0499598a3382c → sedimentree_wasm-1de4a01519b0f11f}/inline0.js +0 -0
  28. /package/dist/wasm_bindgen/nodejs/snippets/{sedimentree_wasm-68c0499598a3382c → sedimentree_wasm-1de4a01519b0f11f}/inline1.js +0 -0
  29. /package/dist/wasm_bindgen/nodejs/snippets/{sedimentree_wasm-68c0499598a3382c → sedimentree_wasm-1de4a01519b0f11f}/inline2.js +0 -0
  30. /package/dist/wasm_bindgen/web/snippets/{sedimentree_wasm-68c0499598a3382c → sedimentree_wasm-1de4a01519b0f11f}/inline0.js +0 -0
  31. /package/dist/wasm_bindgen/web/snippets/{sedimentree_wasm-68c0499598a3382c → sedimentree_wasm-1de4a01519b0f11f}/inline1.js +0 -0
  32. /package/dist/wasm_bindgen/web/snippets/{sedimentree_wasm-68c0499598a3382c → sedimentree_wasm-1de4a01519b0f11f}/inline2.js +0 -0
@@ -29,6 +29,7 @@ export interface Transport {
29
29
  sendBytes(bytes: Uint8Array): Promise<void>;
30
30
  recvBytes(): Promise<Uint8Array>;
31
31
  disconnect(): Promise<void>;
32
+ onDisconnect(callback: () => void): void;
32
33
  }
33
34
 
34
35
 
@@ -70,23 +71,30 @@ export class AuthenticatedLongPoll {
70
71
  * There are three ways to obtain an `AuthenticatedTransport`:
71
72
  *
72
73
  * 1. **Custom transport** — implement the `Transport` interface
73
- * (`sendBytes`/`recvBytes`/`disconnect`) and call [`setup`](Self::setup):
74
+ * (`sendBytes`/`recvBytes`/`disconnect`/`onDisconnect`) and call
75
+ * [`setup`](Self::setup):
74
76
  *
75
77
  * ```js
76
- * const auth = await AuthenticatedTransport.setup(myTransport, signer, peerId);
78
+ * const auth = await AuthenticatedTransport.setup(myTransport, signer, peerId, (peerId) => {
79
+ * console.log(`${peerId} disconnected`);
80
+ * });
77
81
  * ```
78
82
  *
79
83
  * 2. **From WebSocket** — authenticate via [`SubductionWebSocket`] then convert:
80
84
  *
81
85
  * ```js
82
- * const wsAuth = await SubductionWebSocket.tryConnect(url, signer, peerId, timeout);
86
+ * const wsAuth = await SubductionWebSocket.tryConnect(url, signer, peerId, (peerId) => {
87
+ * console.log(`${peerId} disconnected`);
88
+ * });
83
89
  * const auth = wsAuth.toTransport();
84
90
  * ```
85
91
  *
86
92
  * 3. **From HTTP long-poll** — same pattern via [`SubductionLongPoll`]:
87
93
  *
88
94
  * ```js
89
- * const lpAuth = await SubductionLongPoll.tryConnect(url, signer, peerId, timeout);
95
+ * const lpAuth = await SubductionLongPoll.tryConnect(url, signer, peerId, (peerId) => {
96
+ * console.log(`${peerId} disconnected`);
97
+ * });
90
98
  * const auth = lpAuth.toTransport();
91
99
  * ```
92
100
  */
@@ -102,7 +110,7 @@ export class AuthenticatedTransport {
102
110
  *
103
111
  * # Arguments
104
112
  *
105
- * * `transport` - A `Transport` implementing `sendBytes`/`recvBytes`/`disconnect`
113
+ * * `transport` - A `Transport` implementing `sendBytes`/`recvBytes`/`disconnect`/`onDisconnect`
106
114
  * * `signer` - The responder's signer for authentication
107
115
  * * `max_drift_seconds` - Maximum acceptable clock drift in seconds (default: 600)
108
116
  *
@@ -110,19 +118,19 @@ export class AuthenticatedTransport {
110
118
  *
111
119
  * Returns a [`HandshakeError`](WasmHandshakeError) if the handshake fails.
112
120
  */
113
- static accept(transport: Transport, signer: any, max_drift_seconds?: number | null): Promise<AuthenticatedTransport>;
121
+ static accept(transport: Transport, signer: any, max_drift_seconds?: number | null, on_disconnect?: Function | null): Promise<AuthenticatedTransport>;
114
122
  /**
115
123
  * Run the Subduction handshake over a custom transport, producing an
116
124
  * authenticated transport.
117
125
  *
118
126
  * The `transport` object must implement the `Transport` interface
119
- * (`sendBytes`/`recvBytes`/`disconnect`).
127
+ * (`sendBytes`/`recvBytes`/`disconnect`/`onDisconnect`).
120
128
  * The same object is used for both the handshake phase and post-handshake
121
129
  * communication.
122
130
  *
123
131
  * # Arguments
124
132
  *
125
- * * `transport` - A `Transport` implementing `sendBytes`/`recvBytes`/`disconnect`
133
+ * * `transport` - A `Transport` implementing `sendBytes`/`recvBytes`/`disconnect`/`onDisconnect`
126
134
  * * `signer` - The client's signer for authentication
127
135
  * * `expected_peer_id` - The expected server peer ID (verified during handshake)
128
136
  *
@@ -130,7 +138,7 @@ export class AuthenticatedTransport {
130
138
  *
131
139
  * Returns a [`HandshakeError`](WasmHandshakeError) if the handshake fails.
132
140
  */
133
- static setup(transport: Transport, signer: any, expected_peer_id: PeerId): Promise<AuthenticatedTransport>;
141
+ static setup(transport: Transport, signer: any, expected_peer_id: PeerId, on_disconnect?: Function | null): Promise<AuthenticatedTransport>;
134
142
  /**
135
143
  * Run the Subduction handshake over a custom transport using discovery
136
144
  * mode, producing an authenticated transport.
@@ -141,7 +149,7 @@ export class AuthenticatedTransport {
141
149
  *
142
150
  * # Arguments
143
151
  *
144
- * * `transport` - A `Transport` implementing `sendBytes`/`recvBytes`/`disconnect`
152
+ * * `transport` - A `Transport` implementing `sendBytes`/`recvBytes`/`disconnect`/`onDisconnect`
145
153
  * * `signer` - The client's signer for authentication
146
154
  * * `service_name` - Shared service name for discovery.
147
155
  * Defaults to [`DEFAULT_LOCAL_SERVICE_NAME`] (`"subduction:local"`) if omitted.
@@ -150,7 +158,7 @@ export class AuthenticatedTransport {
150
158
  *
151
159
  * Returns a [`HandshakeError`](WasmHandshakeError) if the handshake fails.
152
160
  */
153
- static setupDiscover(transport: Transport, signer: any, service_name?: string | null): Promise<AuthenticatedTransport>;
161
+ static setupDiscover(transport: Transport, signer: any, service_name?: string | null, on_disconnect?: Function | null): Promise<AuthenticatedTransport>;
154
162
  /**
155
163
  * The verified peer identity.
156
164
  */
@@ -639,13 +647,20 @@ export class MessagePortTransport {
639
647
  free(): void;
640
648
  [Symbol.dispose](): void;
641
649
  /**
642
- * Disconnect (close the port).
650
+ * Disconnect (close the port) and fire the `onDisconnect` callback if registered.
643
651
  */
644
652
  disconnect(): Promise<any>;
645
653
  /**
646
654
  * Create a new connection wrapping the given `MessagePort`.
647
655
  */
648
656
  constructor(port: any);
657
+ /**
658
+ * Register a callback to be invoked when the transport disconnects.
659
+ *
660
+ * Part of the [`Transport`](super::JsTransport) interface contract.
661
+ * Typically called by internal wiring rather than directly by user code.
662
+ */
663
+ onDisconnect(callback: Function): void;
649
664
  /**
650
665
  * Receive raw bytes (for the handshake phase).
651
666
  */
@@ -1136,7 +1151,7 @@ export class Subduction {
1136
1151
  *
1137
1152
  * Returns [`WasmHydrationError`] if hydration fails.
1138
1153
  */
1139
- static hydrate(signer: any, storage: SedimentreeStorage, service_name?: string | null, hash_metric_override?: (digest: Digest) => Depth | null, max_pending_blob_requests?: number | null): Promise<Subduction>;
1154
+ static hydrate(signer: any, storage: SedimentreeStorage, service_name?: string | null, hash_metric_override?: (digest: Digest) => Depth | null, max_pending_blob_requests?: number | null, policy?: any | null, on_remote_heads?: Function | null, on_ephemeral?: Function | null): Promise<Subduction>;
1140
1155
  /**
1141
1156
  * Link two local [`Subduction`](WasmSubduction) instances over a
1142
1157
  * [`MessageChannel`](web_sys::MessageChannel).
@@ -1161,13 +1176,23 @@ export class Subduction {
1161
1176
  * When set, clients can connect without knowing the server's peer ID.
1162
1177
  * * `hash_metric_override` - Optional custom depth metric function
1163
1178
  * * `max_pending_blob_requests` - Optional maximum number of pending blob requests (default: 10,000)
1179
+ * * `policy` - Optional JS object implementing authorization.
1180
+ * Must have `authorizeConnect(...)`, `authorizeFetch(...)`, `authorizePut(...)`,
1181
+ * `filterAuthorizedFetch(...)`. Defaults to allow-all.
1164
1182
  *
1165
1183
  * # Panics
1166
1184
  *
1167
1185
  * Panics if `hash_metric_override` is `Some` but the underlying JS value
1168
1186
  * cannot be cast to a `Function`.
1169
1187
  */
1170
- constructor(signer: any, storage: SedimentreeStorage, service_name?: string | null, hash_metric_override?: (digest: Digest) => Depth | null, max_pending_blob_requests?: number | null);
1188
+ constructor(signer: any, storage: SedimentreeStorage, service_name?: string | null, hash_metric_override?: (digest: Digest) => Depth | null, max_pending_blob_requests?: number | null, policy?: any | null, on_remote_heads?: Function | null, on_ephemeral?: Function | null);
1189
+ /**
1190
+ * Publish an ephemeral message to all subscribers of a sedimentree.
1191
+ *
1192
+ * The payload is opaque bytes — encoding is the caller's responsibility.
1193
+ * Messages are fire-and-forget; delivery is best-effort.
1194
+ */
1195
+ publishEphemeral(id: SedimentreeId, payload: Uint8Array): Promise<void>;
1171
1196
  /**
1172
1197
  * Remove a Sedimentree and all associated data.
1173
1198
  *
@@ -1184,6 +1209,11 @@ export class Subduction {
1184
1209
  * Get all known Sedimentree IDs
1185
1210
  */
1186
1211
  sedimentreeIds(): Promise<SedimentreeId[]>;
1212
+ /**
1213
+ * Subscribe to ephemeral messages for the given sedimentree IDs
1214
+ * from all connected peers.
1215
+ */
1216
+ subscribeEphemeral(ids: SedimentreeId[]): Promise<void>;
1187
1217
  /**
1188
1218
  * Request batch sync for a given Sedimentree ID from all connected peers.
1189
1219
  *
@@ -1213,6 +1243,11 @@ export class Subduction {
1213
1243
  * Returns a [`WasmIoError`] if storage or networking fail.
1214
1244
  */
1215
1245
  syncWithPeer(to_ask: PeerId, id: SedimentreeId, subscribe: boolean, timeout_milliseconds?: bigint | null): Promise<PeerBatchSyncResult>;
1246
+ /**
1247
+ * Unsubscribe from ephemeral messages for the given sedimentree IDs
1248
+ * from all connected peers.
1249
+ */
1250
+ unsubscribeEphemeral(ids: SedimentreeId[]): Promise<void>;
1216
1251
  /**
1217
1252
  * Get the backing storage.
1218
1253
  */
@@ -1222,7 +1257,7 @@ export class Subduction {
1222
1257
  /**
1223
1258
  * JS-facing wrapper around [`HttpLongPollTransport`] that exposes the
1224
1259
  * byte-oriented [`Transport`](super::JsTransport) interface
1225
- * (`sendBytes`/`recvBytes`/`disconnect`) so it can be used as a
1260
+ * (`sendBytes`/`recvBytes`/`disconnect`/`onDisconnect`) so it can be used as a
1226
1261
  * duck-typed `JsTransport` from JavaScript.
1227
1262
  */
1228
1263
  export class SubductionHttpLongPoll {
@@ -1232,11 +1267,20 @@ export class SubductionHttpLongPoll {
1232
1267
  /**
1233
1268
  * Disconnect from the peer gracefully.
1234
1269
  *
1270
+ * Fires the `onDisconnect` callback if one is registered.
1271
+ *
1235
1272
  * # Errors
1236
1273
  *
1237
1274
  * Returns an error if the disconnect fails.
1238
1275
  */
1239
1276
  disconnect(): Promise<void>;
1277
+ /**
1278
+ * Register a callback to be invoked when the transport disconnects.
1279
+ *
1280
+ * Part of the [`Transport`](super::JsTransport) interface contract.
1281
+ * Typically called by internal wiring rather than directly by user code.
1282
+ */
1283
+ onDisconnect(callback: Function): void;
1240
1284
  /**
1241
1285
  * Receive the next message frame as raw bytes.
1242
1286
  *
@@ -1272,13 +1316,13 @@ export class SubductionLongPoll {
1272
1316
  * * `base_url` - The server's HTTP base URL (e.g., `http://localhost:8080`)
1273
1317
  * * `signer` - The client's signer for authentication
1274
1318
  * * `expected_peer_id` - The expected server peer ID (verified during handshake)
1275
- * * `timeout_milliseconds` - Request timeout in milliseconds (default: 30000)
1319
+ * * `on_disconnect` - Optional callback invoked with the peer's [`PeerId`] when the connection closes
1276
1320
  *
1277
1321
  * # Errors
1278
1322
  *
1279
1323
  * Returns [`LongPollTransportError`] if connection or handshake fails.
1280
1324
  */
1281
- static tryConnect(base_url: string, signer: any, expected_peer_id: PeerId): Promise<AuthenticatedLongPoll>;
1325
+ static tryConnect(base_url: string, signer: any, expected_peer_id: PeerId, on_disconnect?: Function | null): Promise<AuthenticatedLongPoll>;
1282
1326
  /**
1283
1327
  * Connect to a server using discovery mode.
1284
1328
  *
@@ -1292,7 +1336,7 @@ export class SubductionLongPoll {
1292
1336
  *
1293
1337
  * Returns [`LongPollTransportError`] if connection or handshake fails.
1294
1338
  */
1295
- static tryDiscover(base_url: string, signer: any, service_name?: string | null): Promise<AuthenticatedLongPoll>;
1339
+ static tryDiscover(base_url: string, signer: any, service_name?: string | null, on_disconnect?: Function | null): Promise<AuthenticatedLongPoll>;
1296
1340
  }
1297
1341
 
1298
1342
  /**
@@ -1311,6 +1355,16 @@ export class SubductionWebSocket {
1311
1355
  * Disconnect from the peer gracefully.
1312
1356
  */
1313
1357
  disconnect(): Promise<void>;
1358
+ /**
1359
+ * Register a callback to be invoked when the WebSocket closes.
1360
+ *
1361
+ * Part of the [`Transport`](super::JsTransport) interface contract.
1362
+ * Typically called by internal wiring (factory methods like `tryConnect`
1363
+ * and `tryDiscover`) rather than directly by user code.
1364
+ *
1365
+ * The callback is fired from the browser WebSocket's `onclose` handler.
1366
+ */
1367
+ onDisconnect(callback: Function): void;
1314
1368
  /**
1315
1369
  * Receive the next message frame as raw bytes.
1316
1370
  *
@@ -1338,13 +1392,13 @@ export class SubductionWebSocket {
1338
1392
  * * `ws` - An existing WebSocket (CONNECTING or OPEN)
1339
1393
  * * `signer` - The client's signer for authentication
1340
1394
  * * `expected_peer_id` - The expected server peer ID (verified during handshake)
1341
- * * `timeout_milliseconds` - Request timeout in milliseconds
1395
+ * * `on_disconnect` - Optional callback invoked with the peer's [`PeerId`] when the connection closes
1342
1396
  *
1343
1397
  * # Errors
1344
1398
  *
1345
1399
  * Returns an error if the handshake fails (signature invalid, wrong peer, etc.)
1346
1400
  */
1347
- static setup(ws: WebSocket, signer: any, expected_peer_id: PeerId): Promise<AuthenticatedWebSocket>;
1401
+ static setup(ws: WebSocket, signer: any, expected_peer_id: PeerId, on_disconnect?: Function | null): Promise<AuthenticatedWebSocket>;
1348
1402
  /**
1349
1403
  * Connect to a WebSocket server with mutual authentication via handshake.
1350
1404
  *
@@ -1353,13 +1407,15 @@ export class SubductionWebSocket {
1353
1407
  * * `address` - The WebSocket URL to connect to
1354
1408
  * * `signer` - The client's signer for authentication
1355
1409
  * * `expected_peer_id` - The expected server peer ID (verified during handshake)
1410
+ * * `on_disconnect` - Optional callback invoked with the peer's [`PeerId`] when the connection closes
1411
+ *
1356
1412
  * # Errors
1357
1413
  *
1358
1414
  * Returns an error if:
1359
1415
  * - The WebSocket connection could not be established
1360
1416
  * - The handshake fails (signature invalid, wrong server, clock drift, etc.)
1361
1417
  */
1362
- static tryConnect(address: URL, signer: any, expected_peer_id: PeerId): Promise<AuthenticatedWebSocket>;
1418
+ static tryConnect(address: URL, signer: any, expected_peer_id: PeerId, on_disconnect?: Function | null): Promise<AuthenticatedWebSocket>;
1363
1419
  /**
1364
1420
  * Connect to a WebSocket server using discovery mode.
1365
1421
  *
@@ -1371,9 +1427,9 @@ export class SubductionWebSocket {
1371
1427
  *
1372
1428
  * * `address` - The WebSocket URL to connect to
1373
1429
  * * `signer` - The client's signer for authentication
1374
- * * `timeout_milliseconds` - Request timeout in milliseconds. Defaults to 30000 (30s).
1375
1430
  * * `service_name` - The service name for discovery (e.g., `localhost:8080`).
1376
1431
  * If omitted, the host is extracted from the URL.
1432
+ * * `on_disconnect` - Optional callback invoked with the peer's [`PeerId`] when the connection closes
1377
1433
  *
1378
1434
  * # Errors
1379
1435
  *
@@ -1381,7 +1437,7 @@ export class SubductionWebSocket {
1381
1437
  * - The WebSocket connection could not be established
1382
1438
  * - The handshake fails (signature invalid, clock drift, etc.)
1383
1439
  */
1384
- static tryDiscover(address: URL, signer: any, service_name?: string | null): Promise<AuthenticatedWebSocket>;
1440
+ static tryDiscover(address: URL, signer: any, service_name?: string | null, on_disconnect?: Function | null): Promise<AuthenticatedWebSocket>;
1385
1441
  }
1386
1442
 
1387
1443
  /**
@@ -1492,9 +1548,16 @@ export class SyncStats {
1492
1548
  */
1493
1549
  readonly fragmentsSent: number;
1494
1550
  /**
1495
- * Returns true if no data was exchanged.
1551
+ * Returns true if no commits or fragments were transferred.
1552
+ *
1553
+ * Note: `remoteHeads` may still be non-empty (heads metadata is not
1554
+ * considered "data" for this check).
1496
1555
  */
1497
1556
  readonly isEmpty: boolean;
1557
+ /**
1558
+ * The remote peer's heads for this sedimentree.
1559
+ */
1560
+ readonly remoteHeads: Digest[];
1498
1561
  /**
1499
1562
  * Total items received (commits + fragments).
1500
1563
  */
@@ -21,8 +21,8 @@ export const webcryptosigner_sign: (a: number, b: number, c: number) => any;
21
21
  export const webcryptosigner_verifyingKey: (a: number) => any;
22
22
  export const webcryptosigner_peerId: (a: number) => number;
23
23
  export const __wbg_subduction_free: (a: number, b: number) => void;
24
- export const subduction_new: (a: any, b: any, c: number, d: number, e: number, f: number) => number;
25
- export const subduction_hydrate: (a: any, b: any, c: number, d: number, e: number, f: number) => any;
24
+ export const subduction_new: (a: any, b: any, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
25
+ export const subduction_hydrate: (a: any, b: any, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => any;
26
26
  export const subduction_addSedimentree: (a: number, b: number, c: number, d: number, e: number) => any;
27
27
  export const subduction_removeSedimentree: (a: number, b: number) => any;
28
28
  export const subduction_connect: (a: number, b: any, c: number) => any;
@@ -45,6 +45,9 @@ export const subduction_syncWithPeer: (a: number, b: number, c: number, d: numbe
45
45
  export const subduction_syncWithAllPeers: (a: number, b: number, c: number, d: number, e: bigint) => any;
46
46
  export const subduction_fullSyncWithPeer: (a: number, b: number, c: number, d: number, e: bigint) => any;
47
47
  export const subduction_fullSyncWithAllPeers: (a: number, b: number, c: bigint) => any;
48
+ export const subduction_publishEphemeral: (a: number, b: number, c: number, d: number) => any;
49
+ export const subduction_subscribeEphemeral: (a: number, b: number, c: number) => any;
50
+ export const subduction_unsubscribeEphemeral: (a: number, b: number, c: number) => any;
48
51
  export const subduction_sedimentreeIds: (a: number) => any;
49
52
  export const subduction_getCommits: (a: number, b: number) => any;
50
53
  export const subduction_getFragments: (a: number, b: number) => any;
@@ -68,17 +71,24 @@ export const syncstats_fragmentsSent: (a: number) => number;
68
71
  export const syncstats_totalReceived: (a: number) => number;
69
72
  export const syncstats_totalSent: (a: number) => number;
70
73
  export const syncstats_isEmpty: (a: number) => number;
74
+ export const syncstats_remoteHeads: (a: number) => [number, number];
75
+ export const __wbg_authenticatedtransport_free: (a: number, b: number) => void;
76
+ export const authenticatedtransport_setup: (a: any, b: any, c: number, d: number) => any;
77
+ export const authenticatedtransport_setupDiscover: (a: any, b: any, c: number, d: number, e: number) => any;
78
+ export const authenticatedtransport_accept: (a: any, b: any, c: number, d: number) => any;
79
+ export const authenticatedtransport_peerId: (a: number) => number;
71
80
  export const __wbg_subductionhttplongpoll_free: (a: number, b: number) => void;
72
81
  export const subductionhttplongpoll_sendBytes: (a: number, b: number, c: number) => any;
73
82
  export const subductionhttplongpoll_recvBytes: (a: number) => any;
74
83
  export const subductionhttplongpoll_disconnect: (a: number) => any;
84
+ export const subductionhttplongpoll_onDisconnect: (a: number, b: any) => void;
75
85
  export const __wbg_authenticatedlongpoll_free: (a: number, b: number) => void;
76
86
  export const authenticatedlongpoll_peerId: (a: number) => number;
77
87
  export const authenticatedlongpoll_sessionId: (a: number) => [number, number];
78
88
  export const authenticatedlongpoll_toTransport: (a: number) => number;
79
89
  export const __wbg_subductionlongpoll_free: (a: number, b: number) => void;
80
- export const subductionlongpoll_tryConnect: (a: number, b: number, c: any, d: number) => any;
81
- export const subductionlongpoll_tryDiscover: (a: number, b: number, c: any, d: number, e: number) => any;
90
+ export const subductionlongpoll_tryConnect: (a: number, b: number, c: any, d: number, e: number) => any;
91
+ export const subductionlongpoll_tryDiscover: (a: number, b: number, c: any, d: number, e: number, f: number) => any;
82
92
  export const __wbg_syncmessage_free: (a: number, b: number) => void;
83
93
  export const syncmessage_toBytes: (a: number) => [number, number];
84
94
  export const syncmessage_fromBytes: (a: number, b: number) => [number, number, number];
@@ -100,18 +110,20 @@ export const __wbg_messageporttransport_free: (a: number, b: number) => void;
100
110
  export const messageporttransport_sendBytes: (a: number, b: number, c: number) => any;
101
111
  export const messageporttransport_recvBytes: (a: number) => any;
102
112
  export const messageporttransport_disconnect: (a: number) => any;
113
+ export const messageporttransport_onDisconnect: (a: number, b: any) => void;
103
114
  export const makeMessagePortTransport: (a: any) => number;
104
115
  export const __wbg_nonce_free: (a: number, b: number) => void;
105
116
  export const nonce_new: (a: number, b: number) => [number, number, number];
106
117
  export const nonce_random: () => number;
107
118
  export const nonce_bytes: (a: number) => [number, number];
108
119
  export const __wbg_subductionwebsocket_free: (a: number, b: number) => void;
109
- export const subductionwebsocket_setup: (a: any, b: any, c: number) => any;
110
- export const subductionwebsocket_tryConnect: (a: any, b: any, c: number) => any;
111
- export const subductionwebsocket_tryDiscover: (a: any, b: any, c: number, d: number) => any;
120
+ export const subductionwebsocket_setup: (a: any, b: any, c: number, d: number) => any;
121
+ export const subductionwebsocket_tryConnect: (a: any, b: any, c: number, d: number) => any;
122
+ export const subductionwebsocket_tryDiscover: (a: any, b: any, c: number, d: number, e: number) => any;
112
123
  export const subductionwebsocket_sendBytes: (a: number, b: number, c: number) => any;
113
124
  export const subductionwebsocket_recvBytes: (a: number) => any;
114
125
  export const subductionwebsocket_disconnect: (a: number) => any;
126
+ export const subductionwebsocket_onDisconnect: (a: number, b: any) => void;
115
127
  export const __wbg_authenticatedwebsocket_free: (a: number, b: number) => void;
116
128
  export const authenticatedwebsocket_peerId: (a: number) => number;
117
129
  export const authenticatedwebsocket_toTransport: (a: number) => number;
@@ -128,11 +140,6 @@ export const __wbg_batchsyncresponse_free: (a: number, b: number) => void;
128
140
  export const batchsyncresponse_id: (a: number) => number;
129
141
  export const batchsyncresponse_request_id: (a: number) => number;
130
142
  export const batchsyncresponse___wasm_refgen_toWasmBatchSyncResponse: (a: number) => number;
131
- export const __wbg_authenticatedtransport_free: (a: number, b: number) => void;
132
- export const authenticatedtransport_setup: (a: any, b: any, c: number) => any;
133
- export const authenticatedtransport_setupDiscover: (a: any, b: any, c: number, d: number) => any;
134
- export const authenticatedtransport_accept: (a: any, b: any, c: number) => any;
135
- export const authenticatedtransport_peerId: (a: number) => number;
136
143
  export const memorysigner_new: () => number;
137
144
  export const messageporttransport_new: (a: any) => number;
138
145
  export const __wbg_webcryptosigner_free: (a: number, b: number) => void;
@@ -215,14 +222,15 @@ export const __wbg_signedloosecommit_free: (a: number, b: number) => void;
215
222
  export const sedimentreeid___wasm_refgen_toWasmSedimentreeId: (a: number) => number;
216
223
  export const sedimentreeid_toBytes: (a: number) => [number, number];
217
224
  export const fragmentwithblob_blob: (a: number) => any;
218
- export const __wasm_bindgen_func_elem_255: (a: number, b: number) => void;
219
- export const __wasm_bindgen_func_elem_1476: (a: number, b: number, c: any) => [number, number];
220
- export const __wasm_bindgen_func_elem_1476_183: (a: number, b: number, c: any, d: any) => void;
221
- export const __wasm_bindgen_func_elem_1476_184: (a: number, b: number, c: any, d: any) => void;
222
- export const __wasm_bindgen_func_elem_552: (a: number, b: number, c: any) => void;
223
- export const __wasm_bindgen_func_elem_552_1: (a: number, b: number, c: any) => void;
224
- export const __wasm_bindgen_func_elem_552_2: (a: number, b: number, c: any) => void;
225
- export const __wasm_bindgen_func_elem_552_3: (a: number, b: number, c: any) => void;
225
+ export const __wasm_bindgen_func_elem_274: (a: number, b: number) => void;
226
+ export const __wasm_bindgen_func_elem_1605: (a: number, b: number, c: any) => [number, number];
227
+ export const __wasm_bindgen_func_elem_1605_191: (a: number, b: number, c: any, d: any) => void;
228
+ export const __wasm_bindgen_func_elem_1605_192: (a: number, b: number, c: any, d: any) => void;
229
+ export const __wasm_bindgen_func_elem_590: (a: number, b: number, c: any) => void;
230
+ export const __wasm_bindgen_func_elem_590_1: (a: number, b: number, c: any) => void;
231
+ export const __wasm_bindgen_func_elem_590_2: (a: number, b: number, c: any) => void;
232
+ export const __wasm_bindgen_func_elem_590_3: (a: number, b: number, c: any) => void;
233
+ export const __wasm_bindgen_func_elem_589: (a: number, b: number) => void;
226
234
  export const __wbindgen_export: (a: number, b: number) => number;
227
235
  export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
228
236
  export const __wbindgen_export3: (a: number) => void;
@@ -0,0 +1,9 @@
1
+
2
+ export function makeOpenPolicy() {
3
+ return {
4
+ authorizeConnect() { return Promise.resolve(); },
5
+ authorizeFetch() { return Promise.resolve(); },
6
+ authorizePut() { return Promise.resolve(); },
7
+ filterAuthorizedFetch(_peer, ids) { return Promise.resolve(ids); },
8
+ };
9
+ }