@automerge/subduction 0.8.0-alpha.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.
- package/dist/cjs/wasm-base64.cjs +1 -1
- package/dist/cjs/web-bindings.cjs +308 -87
- package/dist/cjs/web.cjs +309 -88
- package/dist/esm/wasm-base64.js +1 -1
- package/dist/iife/index.js +309 -88
- package/dist/index.d.ts +87 -24
- package/dist/subduction.wasm +0 -0
- package/dist/wasm_bindgen/bundler/snippets/subduction_wasm-0ed7fd66cebca59f/inline0.js +9 -0
- package/dist/wasm_bindgen/bundler/subduction_wasm.d.ts +87 -24
- package/dist/wasm_bindgen/bundler/subduction_wasm_bg.js +294 -96
- package/dist/wasm_bindgen/bundler/subduction_wasm_bg.wasm +0 -0
- package/dist/wasm_bindgen/bundler/subduction_wasm_bg.wasm.d.ts +28 -20
- package/dist/wasm_bindgen/nodejs/snippets/subduction_wasm-0ed7fd66cebca59f/inline0.js +9 -0
- package/dist/wasm_bindgen/nodejs/subduction_wasm.cjs +296 -96
- package/dist/wasm_bindgen/nodejs/subduction_wasm.d.ts +87 -24
- package/dist/wasm_bindgen/nodejs/subduction_wasm_bg.wasm +0 -0
- package/dist/wasm_bindgen/nodejs/subduction_wasm_bg.wasm.d.ts +28 -20
- package/dist/wasm_bindgen/web/snippets/subduction_wasm-0ed7fd66cebca59f/inline0.js +9 -0
- package/dist/wasm_bindgen/web/subduction_wasm.d.ts +115 -44
- package/dist/wasm_bindgen/web/subduction_wasm.js +296 -96
- package/dist/wasm_bindgen/web/subduction_wasm_bg.wasm +0 -0
- package/dist/wasm_bindgen/web/subduction_wasm_bg.wasm.d.ts +28 -20
- package/package.json +1 -1
- /package/dist/wasm_bindgen/bundler/snippets/{sedimentree_wasm-68c0499598a3382c → sedimentree_wasm-1de4a01519b0f11f}/inline0.js +0 -0
- /package/dist/wasm_bindgen/bundler/snippets/{sedimentree_wasm-68c0499598a3382c → sedimentree_wasm-1de4a01519b0f11f}/inline1.js +0 -0
- /package/dist/wasm_bindgen/bundler/snippets/{sedimentree_wasm-68c0499598a3382c → sedimentree_wasm-1de4a01519b0f11f}/inline2.js +0 -0
- /package/dist/wasm_bindgen/nodejs/snippets/{sedimentree_wasm-68c0499598a3382c → sedimentree_wasm-1de4a01519b0f11f}/inline0.js +0 -0
- /package/dist/wasm_bindgen/nodejs/snippets/{sedimentree_wasm-68c0499598a3382c → sedimentree_wasm-1de4a01519b0f11f}/inline1.js +0 -0
- /package/dist/wasm_bindgen/nodejs/snippets/{sedimentree_wasm-68c0499598a3382c → sedimentree_wasm-1de4a01519b0f11f}/inline2.js +0 -0
- /package/dist/wasm_bindgen/web/snippets/{sedimentree_wasm-68c0499598a3382c → sedimentree_wasm-1de4a01519b0f11f}/inline0.js +0 -0
- /package/dist/wasm_bindgen/web/snippets/{sedimentree_wasm-68c0499598a3382c → sedimentree_wasm-1de4a01519b0f11f}/inline1.js +0 -0
- /package/dist/wasm_bindgen/web/snippets/{sedimentree_wasm-68c0499598a3382c → sedimentree_wasm-1de4a01519b0f11f}/inline2.js +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* @ts-self-types="./subduction_wasm.d.ts" */
|
|
2
|
-
const { tryIntoJsSedimentreeIdsArray } = require(String.raw`./snippets/sedimentree_wasm-
|
|
2
|
+
const { tryIntoJsSedimentreeIdsArray } = require(String.raw`./snippets/sedimentree_wasm-1de4a01519b0f11f/inline2.js`);
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* An authenticated HTTP long-poll transport.
|
|
@@ -75,23 +75,30 @@ exports.AuthenticatedLongPoll = AuthenticatedLongPoll;
|
|
|
75
75
|
* There are three ways to obtain an `AuthenticatedTransport`:
|
|
76
76
|
*
|
|
77
77
|
* 1. **Custom transport** — implement the `Transport` interface
|
|
78
|
-
* (`sendBytes`/`recvBytes`/`disconnect`) and call
|
|
78
|
+
* (`sendBytes`/`recvBytes`/`disconnect`/`onDisconnect`) and call
|
|
79
|
+
* [`setup`](Self::setup):
|
|
79
80
|
*
|
|
80
81
|
* ```js
|
|
81
|
-
* const auth = await AuthenticatedTransport.setup(myTransport, signer, peerId)
|
|
82
|
+
* const auth = await AuthenticatedTransport.setup(myTransport, signer, peerId, (peerId) => {
|
|
83
|
+
* console.log(`${peerId} disconnected`);
|
|
84
|
+
* });
|
|
82
85
|
* ```
|
|
83
86
|
*
|
|
84
87
|
* 2. **From WebSocket** — authenticate via [`SubductionWebSocket`] then convert:
|
|
85
88
|
*
|
|
86
89
|
* ```js
|
|
87
|
-
* const wsAuth = await SubductionWebSocket.tryConnect(url, signer, peerId,
|
|
90
|
+
* const wsAuth = await SubductionWebSocket.tryConnect(url, signer, peerId, (peerId) => {
|
|
91
|
+
* console.log(`${peerId} disconnected`);
|
|
92
|
+
* });
|
|
88
93
|
* const auth = wsAuth.toTransport();
|
|
89
94
|
* ```
|
|
90
95
|
*
|
|
91
96
|
* 3. **From HTTP long-poll** — same pattern via [`SubductionLongPoll`]:
|
|
92
97
|
*
|
|
93
98
|
* ```js
|
|
94
|
-
* const lpAuth = await SubductionLongPoll.tryConnect(url, signer, peerId,
|
|
99
|
+
* const lpAuth = await SubductionLongPoll.tryConnect(url, signer, peerId, (peerId) => {
|
|
100
|
+
* console.log(`${peerId} disconnected`);
|
|
101
|
+
* });
|
|
95
102
|
* const auth = lpAuth.toTransport();
|
|
96
103
|
* ```
|
|
97
104
|
*/
|
|
@@ -121,7 +128,7 @@ class AuthenticatedTransport {
|
|
|
121
128
|
*
|
|
122
129
|
* # Arguments
|
|
123
130
|
*
|
|
124
|
-
* * `transport` - A `Transport` implementing `sendBytes`/`recvBytes`/`disconnect`
|
|
131
|
+
* * `transport` - A `Transport` implementing `sendBytes`/`recvBytes`/`disconnect`/`onDisconnect`
|
|
125
132
|
* * `signer` - The responder's signer for authentication
|
|
126
133
|
* * `max_drift_seconds` - Maximum acceptable clock drift in seconds (default: 600)
|
|
127
134
|
*
|
|
@@ -131,10 +138,11 @@ class AuthenticatedTransport {
|
|
|
131
138
|
* @param {Transport} transport
|
|
132
139
|
* @param {any} signer
|
|
133
140
|
* @param {number | null} [max_drift_seconds]
|
|
141
|
+
* @param {Function | null} [on_disconnect]
|
|
134
142
|
* @returns {Promise<AuthenticatedTransport>}
|
|
135
143
|
*/
|
|
136
|
-
static accept(transport, signer, max_drift_seconds) {
|
|
137
|
-
const ret = wasm.authenticatedtransport_accept(transport, signer, isLikeNone(max_drift_seconds) ? 0x100000001 : (max_drift_seconds) >>> 0);
|
|
144
|
+
static accept(transport, signer, max_drift_seconds, on_disconnect) {
|
|
145
|
+
const ret = wasm.authenticatedtransport_accept(transport, signer, isLikeNone(max_drift_seconds) ? 0x100000001 : (max_drift_seconds) >>> 0, isLikeNone(on_disconnect) ? 0 : addToExternrefTable0(on_disconnect));
|
|
138
146
|
return ret;
|
|
139
147
|
}
|
|
140
148
|
/**
|
|
@@ -150,13 +158,13 @@ class AuthenticatedTransport {
|
|
|
150
158
|
* authenticated transport.
|
|
151
159
|
*
|
|
152
160
|
* The `transport` object must implement the `Transport` interface
|
|
153
|
-
* (`sendBytes`/`recvBytes`/`disconnect`).
|
|
161
|
+
* (`sendBytes`/`recvBytes`/`disconnect`/`onDisconnect`).
|
|
154
162
|
* The same object is used for both the handshake phase and post-handshake
|
|
155
163
|
* communication.
|
|
156
164
|
*
|
|
157
165
|
* # Arguments
|
|
158
166
|
*
|
|
159
|
-
* * `transport` - A `Transport` implementing `sendBytes`/`recvBytes`/`disconnect`
|
|
167
|
+
* * `transport` - A `Transport` implementing `sendBytes`/`recvBytes`/`disconnect`/`onDisconnect`
|
|
160
168
|
* * `signer` - The client's signer for authentication
|
|
161
169
|
* * `expected_peer_id` - The expected server peer ID (verified during handshake)
|
|
162
170
|
*
|
|
@@ -166,11 +174,12 @@ class AuthenticatedTransport {
|
|
|
166
174
|
* @param {Transport} transport
|
|
167
175
|
* @param {any} signer
|
|
168
176
|
* @param {PeerId} expected_peer_id
|
|
177
|
+
* @param {Function | null} [on_disconnect]
|
|
169
178
|
* @returns {Promise<AuthenticatedTransport>}
|
|
170
179
|
*/
|
|
171
|
-
static setup(transport, signer, expected_peer_id) {
|
|
180
|
+
static setup(transport, signer, expected_peer_id, on_disconnect) {
|
|
172
181
|
_assertClass(expected_peer_id, PeerId);
|
|
173
|
-
const ret = wasm.authenticatedtransport_setup(transport, signer, expected_peer_id.__wbg_ptr);
|
|
182
|
+
const ret = wasm.authenticatedtransport_setup(transport, signer, expected_peer_id.__wbg_ptr, isLikeNone(on_disconnect) ? 0 : addToExternrefTable0(on_disconnect));
|
|
174
183
|
return ret;
|
|
175
184
|
}
|
|
176
185
|
/**
|
|
@@ -183,7 +192,7 @@ class AuthenticatedTransport {
|
|
|
183
192
|
*
|
|
184
193
|
* # Arguments
|
|
185
194
|
*
|
|
186
|
-
* * `transport` - A `Transport` implementing `sendBytes`/`recvBytes`/`disconnect`
|
|
195
|
+
* * `transport` - A `Transport` implementing `sendBytes`/`recvBytes`/`disconnect`/`onDisconnect`
|
|
187
196
|
* * `signer` - The client's signer for authentication
|
|
188
197
|
* * `service_name` - Shared service name for discovery.
|
|
189
198
|
* Defaults to [`DEFAULT_LOCAL_SERVICE_NAME`] (`"subduction:local"`) if omitted.
|
|
@@ -194,12 +203,13 @@ class AuthenticatedTransport {
|
|
|
194
203
|
* @param {Transport} transport
|
|
195
204
|
* @param {any} signer
|
|
196
205
|
* @param {string | null} [service_name]
|
|
206
|
+
* @param {Function | null} [on_disconnect]
|
|
197
207
|
* @returns {Promise<AuthenticatedTransport>}
|
|
198
208
|
*/
|
|
199
|
-
static setupDiscover(transport, signer, service_name) {
|
|
209
|
+
static setupDiscover(transport, signer, service_name, on_disconnect) {
|
|
200
210
|
var ptr0 = isLikeNone(service_name) ? 0 : passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
201
211
|
var len0 = WASM_VECTOR_LEN;
|
|
202
|
-
const ret = wasm.authenticatedtransport_setupDiscover(transport, signer, ptr0, len0);
|
|
212
|
+
const ret = wasm.authenticatedtransport_setupDiscover(transport, signer, ptr0, len0, isLikeNone(on_disconnect) ? 0 : addToExternrefTable0(on_disconnect));
|
|
203
213
|
return ret;
|
|
204
214
|
}
|
|
205
215
|
}
|
|
@@ -1378,7 +1388,7 @@ class MessagePortTransport {
|
|
|
1378
1388
|
wasm.__wbg_messageporttransport_free(ptr, 0);
|
|
1379
1389
|
}
|
|
1380
1390
|
/**
|
|
1381
|
-
* Disconnect (close the port).
|
|
1391
|
+
* Disconnect (close the port) and fire the `onDisconnect` callback if registered.
|
|
1382
1392
|
* @returns {Promise<any>}
|
|
1383
1393
|
*/
|
|
1384
1394
|
disconnect() {
|
|
@@ -1395,6 +1405,16 @@ class MessagePortTransport {
|
|
|
1395
1405
|
MessagePortTransportFinalization.register(this, this.__wbg_ptr, this);
|
|
1396
1406
|
return this;
|
|
1397
1407
|
}
|
|
1408
|
+
/**
|
|
1409
|
+
* Register a callback to be invoked when the transport disconnects.
|
|
1410
|
+
*
|
|
1411
|
+
* Part of the [`Transport`](super::JsTransport) interface contract.
|
|
1412
|
+
* Typically called by internal wiring rather than directly by user code.
|
|
1413
|
+
* @param {Function} callback
|
|
1414
|
+
*/
|
|
1415
|
+
onDisconnect(callback) {
|
|
1416
|
+
wasm.messageporttransport_onDisconnect(this.__wbg_ptr, callback);
|
|
1417
|
+
}
|
|
1398
1418
|
/**
|
|
1399
1419
|
* Receive raw bytes (for the handshake phase).
|
|
1400
1420
|
* @returns {Promise<any>}
|
|
@@ -2433,12 +2453,15 @@ class Subduction {
|
|
|
2433
2453
|
* @param {string | null} [service_name]
|
|
2434
2454
|
* @param {(digest: Digest) => Depth | null} [hash_metric_override]
|
|
2435
2455
|
* @param {number | null} [max_pending_blob_requests]
|
|
2456
|
+
* @param {any | null} [policy]
|
|
2457
|
+
* @param {Function | null} [on_remote_heads]
|
|
2458
|
+
* @param {Function | null} [on_ephemeral]
|
|
2436
2459
|
* @returns {Promise<Subduction>}
|
|
2437
2460
|
*/
|
|
2438
|
-
static hydrate(signer, storage, service_name, hash_metric_override, max_pending_blob_requests) {
|
|
2461
|
+
static hydrate(signer, storage, service_name, hash_metric_override, max_pending_blob_requests, policy, on_remote_heads, on_ephemeral) {
|
|
2439
2462
|
var ptr0 = isLikeNone(service_name) ? 0 : passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2440
2463
|
var len0 = WASM_VECTOR_LEN;
|
|
2441
|
-
const ret = wasm.subduction_hydrate(signer, storage, ptr0, len0, isLikeNone(hash_metric_override) ? 0 : addToExternrefTable0(hash_metric_override), isLikeNone(max_pending_blob_requests) ? 0x100000001 : (max_pending_blob_requests) >>> 0);
|
|
2464
|
+
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, isLikeNone(policy) ? 0 : addToExternrefTable0(policy), isLikeNone(on_remote_heads) ? 0 : addToExternrefTable0(on_remote_heads), isLikeNone(on_ephemeral) ? 0 : addToExternrefTable0(on_ephemeral));
|
|
2442
2465
|
return ret;
|
|
2443
2466
|
}
|
|
2444
2467
|
/**
|
|
@@ -2473,6 +2496,9 @@ class Subduction {
|
|
|
2473
2496
|
* When set, clients can connect without knowing the server's peer ID.
|
|
2474
2497
|
* * `hash_metric_override` - Optional custom depth metric function
|
|
2475
2498
|
* * `max_pending_blob_requests` - Optional maximum number of pending blob requests (default: 10,000)
|
|
2499
|
+
* * `policy` - Optional JS object implementing authorization.
|
|
2500
|
+
* Must have `authorizeConnect(...)`, `authorizeFetch(...)`, `authorizePut(...)`,
|
|
2501
|
+
* `filterAuthorizedFetch(...)`. Defaults to allow-all.
|
|
2476
2502
|
*
|
|
2477
2503
|
* # Panics
|
|
2478
2504
|
*
|
|
@@ -2483,15 +2509,34 @@ class Subduction {
|
|
|
2483
2509
|
* @param {string | null} [service_name]
|
|
2484
2510
|
* @param {(digest: Digest) => Depth | null} [hash_metric_override]
|
|
2485
2511
|
* @param {number | null} [max_pending_blob_requests]
|
|
2512
|
+
* @param {any | null} [policy]
|
|
2513
|
+
* @param {Function | null} [on_remote_heads]
|
|
2514
|
+
* @param {Function | null} [on_ephemeral]
|
|
2486
2515
|
*/
|
|
2487
|
-
constructor(signer, storage, service_name, hash_metric_override, max_pending_blob_requests) {
|
|
2516
|
+
constructor(signer, storage, service_name, hash_metric_override, max_pending_blob_requests, policy, on_remote_heads, on_ephemeral) {
|
|
2488
2517
|
var ptr0 = isLikeNone(service_name) ? 0 : passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2489
2518
|
var len0 = WASM_VECTOR_LEN;
|
|
2490
|
-
const ret = wasm.subduction_new(signer, storage, ptr0, len0, isLikeNone(hash_metric_override) ? 0 : addToExternrefTable0(hash_metric_override), isLikeNone(max_pending_blob_requests) ? 0x100000001 : (max_pending_blob_requests) >>> 0);
|
|
2519
|
+
const ret = wasm.subduction_new(signer, storage, ptr0, len0, isLikeNone(hash_metric_override) ? 0 : addToExternrefTable0(hash_metric_override), isLikeNone(max_pending_blob_requests) ? 0x100000001 : (max_pending_blob_requests) >>> 0, isLikeNone(policy) ? 0 : addToExternrefTable0(policy), isLikeNone(on_remote_heads) ? 0 : addToExternrefTable0(on_remote_heads), isLikeNone(on_ephemeral) ? 0 : addToExternrefTable0(on_ephemeral));
|
|
2491
2520
|
this.__wbg_ptr = ret >>> 0;
|
|
2492
2521
|
SubductionFinalization.register(this, this.__wbg_ptr, this);
|
|
2493
2522
|
return this;
|
|
2494
2523
|
}
|
|
2524
|
+
/**
|
|
2525
|
+
* Publish an ephemeral message to all subscribers of a sedimentree.
|
|
2526
|
+
*
|
|
2527
|
+
* The payload is opaque bytes — encoding is the caller's responsibility.
|
|
2528
|
+
* Messages are fire-and-forget; delivery is best-effort.
|
|
2529
|
+
* @param {SedimentreeId} id
|
|
2530
|
+
* @param {Uint8Array} payload
|
|
2531
|
+
* @returns {Promise<void>}
|
|
2532
|
+
*/
|
|
2533
|
+
publishEphemeral(id, payload) {
|
|
2534
|
+
_assertClass(id, SedimentreeId);
|
|
2535
|
+
const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_export);
|
|
2536
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2537
|
+
const ret = wasm.subduction_publishEphemeral(this.__wbg_ptr, id.__wbg_ptr, ptr0, len0);
|
|
2538
|
+
return ret;
|
|
2539
|
+
}
|
|
2495
2540
|
/**
|
|
2496
2541
|
* Remove a Sedimentree and all associated data.
|
|
2497
2542
|
*
|
|
@@ -2535,6 +2580,18 @@ class Subduction {
|
|
|
2535
2580
|
const ret = wasm.subduction_storage(this.__wbg_ptr);
|
|
2536
2581
|
return ret;
|
|
2537
2582
|
}
|
|
2583
|
+
/**
|
|
2584
|
+
* Subscribe to ephemeral messages for the given sedimentree IDs
|
|
2585
|
+
* from all connected peers.
|
|
2586
|
+
* @param {SedimentreeId[]} ids
|
|
2587
|
+
* @returns {Promise<void>}
|
|
2588
|
+
*/
|
|
2589
|
+
subscribeEphemeral(ids) {
|
|
2590
|
+
const ptr0 = passArrayJsValueToWasm0(ids, wasm.__wbindgen_export);
|
|
2591
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2592
|
+
const ret = wasm.subduction_subscribeEphemeral(this.__wbg_ptr, ptr0, len0);
|
|
2593
|
+
return ret;
|
|
2594
|
+
}
|
|
2538
2595
|
/**
|
|
2539
2596
|
* Request batch sync for a given Sedimentree ID from all connected peers.
|
|
2540
2597
|
*
|
|
@@ -2582,6 +2639,18 @@ class Subduction {
|
|
|
2582
2639
|
const ret = wasm.subduction_syncWithPeer(this.__wbg_ptr, to_ask.__wbg_ptr, id.__wbg_ptr, subscribe, !isLikeNone(timeout_milliseconds), isLikeNone(timeout_milliseconds) ? BigInt(0) : timeout_milliseconds);
|
|
2583
2640
|
return ret;
|
|
2584
2641
|
}
|
|
2642
|
+
/**
|
|
2643
|
+
* Unsubscribe from ephemeral messages for the given sedimentree IDs
|
|
2644
|
+
* from all connected peers.
|
|
2645
|
+
* @param {SedimentreeId[]} ids
|
|
2646
|
+
* @returns {Promise<void>}
|
|
2647
|
+
*/
|
|
2648
|
+
unsubscribeEphemeral(ids) {
|
|
2649
|
+
const ptr0 = passArrayJsValueToWasm0(ids, wasm.__wbindgen_export);
|
|
2650
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2651
|
+
const ret = wasm.subduction_unsubscribeEphemeral(this.__wbg_ptr, ptr0, len0);
|
|
2652
|
+
return ret;
|
|
2653
|
+
}
|
|
2585
2654
|
}
|
|
2586
2655
|
if (Symbol.dispose) Subduction.prototype[Symbol.dispose] = Subduction.prototype.free;
|
|
2587
2656
|
exports.Subduction = Subduction;
|
|
@@ -2589,7 +2658,7 @@ exports.Subduction = Subduction;
|
|
|
2589
2658
|
/**
|
|
2590
2659
|
* JS-facing wrapper around [`HttpLongPollTransport`] that exposes the
|
|
2591
2660
|
* byte-oriented [`Transport`](super::JsTransport) interface
|
|
2592
|
-
* (`sendBytes`/`recvBytes`/`disconnect`) so it can be used as a
|
|
2661
|
+
* (`sendBytes`/`recvBytes`/`disconnect`/`onDisconnect`) so it can be used as a
|
|
2593
2662
|
* duck-typed `JsTransport` from JavaScript.
|
|
2594
2663
|
*/
|
|
2595
2664
|
class SubductionHttpLongPoll {
|
|
@@ -2613,6 +2682,8 @@ class SubductionHttpLongPoll {
|
|
|
2613
2682
|
/**
|
|
2614
2683
|
* Disconnect from the peer gracefully.
|
|
2615
2684
|
*
|
|
2685
|
+
* Fires the `onDisconnect` callback if one is registered.
|
|
2686
|
+
*
|
|
2616
2687
|
* # Errors
|
|
2617
2688
|
*
|
|
2618
2689
|
* Returns an error if the disconnect fails.
|
|
@@ -2622,6 +2693,16 @@ class SubductionHttpLongPoll {
|
|
|
2622
2693
|
const ret = wasm.subductionhttplongpoll_disconnect(this.__wbg_ptr);
|
|
2623
2694
|
return ret;
|
|
2624
2695
|
}
|
|
2696
|
+
/**
|
|
2697
|
+
* Register a callback to be invoked when the transport disconnects.
|
|
2698
|
+
*
|
|
2699
|
+
* Part of the [`Transport`](super::JsTransport) interface contract.
|
|
2700
|
+
* Typically called by internal wiring rather than directly by user code.
|
|
2701
|
+
* @param {Function} callback
|
|
2702
|
+
*/
|
|
2703
|
+
onDisconnect(callback) {
|
|
2704
|
+
wasm.subductionhttplongpoll_onDisconnect(this.__wbg_ptr, callback);
|
|
2705
|
+
}
|
|
2625
2706
|
/**
|
|
2626
2707
|
* Receive the next message frame as raw bytes.
|
|
2627
2708
|
*
|
|
@@ -2677,7 +2758,7 @@ class SubductionLongPoll {
|
|
|
2677
2758
|
* * `base_url` - The server's HTTP base URL (e.g., `http://localhost:8080`)
|
|
2678
2759
|
* * `signer` - The client's signer for authentication
|
|
2679
2760
|
* * `expected_peer_id` - The expected server peer ID (verified during handshake)
|
|
2680
|
-
* * `
|
|
2761
|
+
* * `on_disconnect` - Optional callback invoked with the peer's [`PeerId`] when the connection closes
|
|
2681
2762
|
*
|
|
2682
2763
|
* # Errors
|
|
2683
2764
|
*
|
|
@@ -2685,13 +2766,14 @@ class SubductionLongPoll {
|
|
|
2685
2766
|
* @param {string} base_url
|
|
2686
2767
|
* @param {any} signer
|
|
2687
2768
|
* @param {PeerId} expected_peer_id
|
|
2769
|
+
* @param {Function | null} [on_disconnect]
|
|
2688
2770
|
* @returns {Promise<AuthenticatedLongPoll>}
|
|
2689
2771
|
*/
|
|
2690
|
-
static tryConnect(base_url, signer, expected_peer_id) {
|
|
2772
|
+
static tryConnect(base_url, signer, expected_peer_id, on_disconnect) {
|
|
2691
2773
|
const ptr0 = passStringToWasm0(base_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2692
2774
|
const len0 = WASM_VECTOR_LEN;
|
|
2693
2775
|
_assertClass(expected_peer_id, PeerId);
|
|
2694
|
-
const ret = wasm.subductionlongpoll_tryConnect(ptr0, len0, signer, expected_peer_id.__wbg_ptr);
|
|
2776
|
+
const ret = wasm.subductionlongpoll_tryConnect(ptr0, len0, signer, expected_peer_id.__wbg_ptr, isLikeNone(on_disconnect) ? 0 : addToExternrefTable0(on_disconnect));
|
|
2695
2777
|
return ret;
|
|
2696
2778
|
}
|
|
2697
2779
|
/**
|
|
@@ -2709,14 +2791,15 @@ class SubductionLongPoll {
|
|
|
2709
2791
|
* @param {string} base_url
|
|
2710
2792
|
* @param {any} signer
|
|
2711
2793
|
* @param {string | null} [service_name]
|
|
2794
|
+
* @param {Function | null} [on_disconnect]
|
|
2712
2795
|
* @returns {Promise<AuthenticatedLongPoll>}
|
|
2713
2796
|
*/
|
|
2714
|
-
static tryDiscover(base_url, signer, service_name) {
|
|
2797
|
+
static tryDiscover(base_url, signer, service_name, on_disconnect) {
|
|
2715
2798
|
const ptr0 = passStringToWasm0(base_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2716
2799
|
const len0 = WASM_VECTOR_LEN;
|
|
2717
2800
|
var ptr1 = isLikeNone(service_name) ? 0 : passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2718
2801
|
var len1 = WASM_VECTOR_LEN;
|
|
2719
|
-
const ret = wasm.subductionlongpoll_tryDiscover(ptr0, len0, signer, ptr1, len1);
|
|
2802
|
+
const ret = wasm.subductionlongpoll_tryDiscover(ptr0, len0, signer, ptr1, len1, isLikeNone(on_disconnect) ? 0 : addToExternrefTable0(on_disconnect));
|
|
2720
2803
|
return ret;
|
|
2721
2804
|
}
|
|
2722
2805
|
}
|
|
@@ -2757,6 +2840,19 @@ class SubductionWebSocket {
|
|
|
2757
2840
|
const ret = wasm.subductionwebsocket_disconnect(this.__wbg_ptr);
|
|
2758
2841
|
return ret;
|
|
2759
2842
|
}
|
|
2843
|
+
/**
|
|
2844
|
+
* Register a callback to be invoked when the WebSocket closes.
|
|
2845
|
+
*
|
|
2846
|
+
* Part of the [`Transport`](super::JsTransport) interface contract.
|
|
2847
|
+
* Typically called by internal wiring (factory methods like `tryConnect`
|
|
2848
|
+
* and `tryDiscover`) rather than directly by user code.
|
|
2849
|
+
*
|
|
2850
|
+
* The callback is fired from the browser WebSocket's `onclose` handler.
|
|
2851
|
+
* @param {Function} callback
|
|
2852
|
+
*/
|
|
2853
|
+
onDisconnect(callback) {
|
|
2854
|
+
wasm.subductionwebsocket_onDisconnect(this.__wbg_ptr, callback);
|
|
2855
|
+
}
|
|
2760
2856
|
/**
|
|
2761
2857
|
* Receive the next message frame as raw bytes.
|
|
2762
2858
|
*
|
|
@@ -2795,7 +2891,7 @@ class SubductionWebSocket {
|
|
|
2795
2891
|
* * `ws` - An existing WebSocket (CONNECTING or OPEN)
|
|
2796
2892
|
* * `signer` - The client's signer for authentication
|
|
2797
2893
|
* * `expected_peer_id` - The expected server peer ID (verified during handshake)
|
|
2798
|
-
* * `
|
|
2894
|
+
* * `on_disconnect` - Optional callback invoked with the peer's [`PeerId`] when the connection closes
|
|
2799
2895
|
*
|
|
2800
2896
|
* # Errors
|
|
2801
2897
|
*
|
|
@@ -2803,11 +2899,12 @@ class SubductionWebSocket {
|
|
|
2803
2899
|
* @param {WebSocket} ws
|
|
2804
2900
|
* @param {any} signer
|
|
2805
2901
|
* @param {PeerId} expected_peer_id
|
|
2902
|
+
* @param {Function | null} [on_disconnect]
|
|
2806
2903
|
* @returns {Promise<AuthenticatedWebSocket>}
|
|
2807
2904
|
*/
|
|
2808
|
-
static setup(ws, signer, expected_peer_id) {
|
|
2905
|
+
static setup(ws, signer, expected_peer_id, on_disconnect) {
|
|
2809
2906
|
_assertClass(expected_peer_id, PeerId);
|
|
2810
|
-
const ret = wasm.subductionwebsocket_setup(ws, signer, expected_peer_id.__wbg_ptr);
|
|
2907
|
+
const ret = wasm.subductionwebsocket_setup(ws, signer, expected_peer_id.__wbg_ptr, isLikeNone(on_disconnect) ? 0 : addToExternrefTable0(on_disconnect));
|
|
2811
2908
|
return ret;
|
|
2812
2909
|
}
|
|
2813
2910
|
/**
|
|
@@ -2818,6 +2915,8 @@ class SubductionWebSocket {
|
|
|
2818
2915
|
* * `address` - The WebSocket URL to connect to
|
|
2819
2916
|
* * `signer` - The client's signer for authentication
|
|
2820
2917
|
* * `expected_peer_id` - The expected server peer ID (verified during handshake)
|
|
2918
|
+
* * `on_disconnect` - Optional callback invoked with the peer's [`PeerId`] when the connection closes
|
|
2919
|
+
*
|
|
2821
2920
|
* # Errors
|
|
2822
2921
|
*
|
|
2823
2922
|
* Returns an error if:
|
|
@@ -2826,11 +2925,12 @@ class SubductionWebSocket {
|
|
|
2826
2925
|
* @param {URL} address
|
|
2827
2926
|
* @param {any} signer
|
|
2828
2927
|
* @param {PeerId} expected_peer_id
|
|
2928
|
+
* @param {Function | null} [on_disconnect]
|
|
2829
2929
|
* @returns {Promise<AuthenticatedWebSocket>}
|
|
2830
2930
|
*/
|
|
2831
|
-
static tryConnect(address, signer, expected_peer_id) {
|
|
2931
|
+
static tryConnect(address, signer, expected_peer_id, on_disconnect) {
|
|
2832
2932
|
_assertClass(expected_peer_id, PeerId);
|
|
2833
|
-
const ret = wasm.subductionwebsocket_tryConnect(address, signer, expected_peer_id.__wbg_ptr);
|
|
2933
|
+
const ret = wasm.subductionwebsocket_tryConnect(address, signer, expected_peer_id.__wbg_ptr, isLikeNone(on_disconnect) ? 0 : addToExternrefTable0(on_disconnect));
|
|
2834
2934
|
return ret;
|
|
2835
2935
|
}
|
|
2836
2936
|
/**
|
|
@@ -2844,9 +2944,9 @@ class SubductionWebSocket {
|
|
|
2844
2944
|
*
|
|
2845
2945
|
* * `address` - The WebSocket URL to connect to
|
|
2846
2946
|
* * `signer` - The client's signer for authentication
|
|
2847
|
-
* * `timeout_milliseconds` - Request timeout in milliseconds. Defaults to 30000 (30s).
|
|
2848
2947
|
* * `service_name` - The service name for discovery (e.g., `localhost:8080`).
|
|
2849
2948
|
* If omitted, the host is extracted from the URL.
|
|
2949
|
+
* * `on_disconnect` - Optional callback invoked with the peer's [`PeerId`] when the connection closes
|
|
2850
2950
|
*
|
|
2851
2951
|
* # Errors
|
|
2852
2952
|
*
|
|
@@ -2856,12 +2956,13 @@ class SubductionWebSocket {
|
|
|
2856
2956
|
* @param {URL} address
|
|
2857
2957
|
* @param {any} signer
|
|
2858
2958
|
* @param {string | null} [service_name]
|
|
2959
|
+
* @param {Function | null} [on_disconnect]
|
|
2859
2960
|
* @returns {Promise<AuthenticatedWebSocket>}
|
|
2860
2961
|
*/
|
|
2861
|
-
static tryDiscover(address, signer, service_name) {
|
|
2962
|
+
static tryDiscover(address, signer, service_name, on_disconnect) {
|
|
2862
2963
|
var ptr0 = isLikeNone(service_name) ? 0 : passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2863
2964
|
var len0 = WASM_VECTOR_LEN;
|
|
2864
|
-
const ret = wasm.subductionwebsocket_tryDiscover(address, signer, ptr0, len0);
|
|
2965
|
+
const ret = wasm.subductionwebsocket_tryDiscover(address, signer, ptr0, len0, isLikeNone(on_disconnect) ? 0 : addToExternrefTable0(on_disconnect));
|
|
2865
2966
|
return ret;
|
|
2866
2967
|
}
|
|
2867
2968
|
}
|
|
@@ -3126,13 +3227,26 @@ class SyncStats {
|
|
|
3126
3227
|
return ret >>> 0;
|
|
3127
3228
|
}
|
|
3128
3229
|
/**
|
|
3129
|
-
* Returns true if no
|
|
3230
|
+
* Returns true if no commits or fragments were transferred.
|
|
3231
|
+
*
|
|
3232
|
+
* Note: `remoteHeads` may still be non-empty (heads metadata is not
|
|
3233
|
+
* considered "data" for this check).
|
|
3130
3234
|
* @returns {boolean}
|
|
3131
3235
|
*/
|
|
3132
3236
|
get isEmpty() {
|
|
3133
3237
|
const ret = wasm.syncstats_isEmpty(this.__wbg_ptr);
|
|
3134
3238
|
return ret !== 0;
|
|
3135
3239
|
}
|
|
3240
|
+
/**
|
|
3241
|
+
* The remote peer's heads for this sedimentree.
|
|
3242
|
+
* @returns {Digest[]}
|
|
3243
|
+
*/
|
|
3244
|
+
get remoteHeads() {
|
|
3245
|
+
const ret = wasm.syncstats_remoteHeads(this.__wbg_ptr);
|
|
3246
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
3247
|
+
wasm.__wbindgen_export5(ret[0], ret[1] * 4, 4);
|
|
3248
|
+
return v1;
|
|
3249
|
+
}
|
|
3136
3250
|
/**
|
|
3137
3251
|
* Total items received (commits + fragments).
|
|
3138
3252
|
* @returns {number}
|
|
@@ -3261,41 +3375,42 @@ function start() {
|
|
|
3261
3375
|
wasm.start();
|
|
3262
3376
|
}
|
|
3263
3377
|
exports.start = start;
|
|
3378
|
+
const import1 = require("./snippets/subduction_wasm-0ed7fd66cebca59f/inline0.js");
|
|
3264
3379
|
|
|
3265
3380
|
function __wbg_get_imports() {
|
|
3266
3381
|
const import0 = {
|
|
3267
3382
|
__proto__: null,
|
|
3268
|
-
|
|
3383
|
+
__wbg___wasm_refgen_toWasmCommitWithBlob_4c1dc5cc453af7eb: function(arg0) {
|
|
3269
3384
|
const ret = arg0.__wasm_refgen_toWasmCommitWithBlob();
|
|
3270
3385
|
_assertClass(ret, CommitWithBlob);
|
|
3271
3386
|
var ptr1 = ret.__destroy_into_raw();
|
|
3272
3387
|
return ptr1;
|
|
3273
3388
|
},
|
|
3274
|
-
|
|
3389
|
+
__wbg___wasm_refgen_toWasmDepth_e11bce6176c8257e: function(arg0) {
|
|
3275
3390
|
const ret = arg0.__wasm_refgen_toWasmDepth();
|
|
3276
3391
|
_assertClass(ret, Depth);
|
|
3277
3392
|
var ptr1 = ret.__destroy_into_raw();
|
|
3278
3393
|
return ptr1;
|
|
3279
3394
|
},
|
|
3280
|
-
|
|
3395
|
+
__wbg___wasm_refgen_toWasmDigest_86d449f5dc99fc6a: function(arg0) {
|
|
3281
3396
|
const ret = arg0.__wasm_refgen_toWasmDigest();
|
|
3282
3397
|
_assertClass(ret, Digest);
|
|
3283
3398
|
var ptr1 = ret.__destroy_into_raw();
|
|
3284
3399
|
return ptr1;
|
|
3285
3400
|
},
|
|
3286
|
-
|
|
3401
|
+
__wbg___wasm_refgen_toWasmFragmentWithBlob_d7450dc251166eea: function(arg0) {
|
|
3287
3402
|
const ret = arg0.__wasm_refgen_toWasmFragmentWithBlob();
|
|
3288
3403
|
_assertClass(ret, FragmentWithBlob);
|
|
3289
3404
|
var ptr1 = ret.__destroy_into_raw();
|
|
3290
3405
|
return ptr1;
|
|
3291
3406
|
},
|
|
3292
|
-
|
|
3407
|
+
__wbg___wasm_refgen_toWasmFragment_03b5e19d20693b4f: function(arg0) {
|
|
3293
3408
|
const ret = arg0.__wasm_refgen_toWasmFragment();
|
|
3294
3409
|
_assertClass(ret, Fragment);
|
|
3295
3410
|
var ptr1 = ret.__destroy_into_raw();
|
|
3296
3411
|
return ptr1;
|
|
3297
3412
|
},
|
|
3298
|
-
|
|
3413
|
+
__wbg___wasm_refgen_toWasmLooseCommit_bc6f015053af2dd7: function(arg0) {
|
|
3299
3414
|
const ret = arg0.__wasm_refgen_toWasmLooseCommit();
|
|
3300
3415
|
_assertClass(ret, LooseCommit);
|
|
3301
3416
|
var ptr1 = ret.__destroy_into_raw();
|
|
@@ -3339,6 +3454,14 @@ function __wbg_get_imports() {
|
|
|
3339
3454
|
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
3340
3455
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
3341
3456
|
},
|
|
3457
|
+
__wbg___wbindgen_string_get_395e606bd0ee4427: function(arg0, arg1) {
|
|
3458
|
+
const obj = arg1;
|
|
3459
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
3460
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
3461
|
+
var len1 = WASM_VECTOR_LEN;
|
|
3462
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
3463
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
3464
|
+
},
|
|
3342
3465
|
__wbg___wbindgen_throw_6ddd609b62940d55: function(arg0, arg1) {
|
|
3343
3466
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
3344
3467
|
},
|
|
@@ -3361,6 +3484,18 @@ function __wbg_get_imports() {
|
|
|
3361
3484
|
const ret = AuthenticatedWebSocket.__wrap(arg0);
|
|
3362
3485
|
return ret;
|
|
3363
3486
|
},
|
|
3487
|
+
__wbg_authorizeConnect_0e61e98d289a37c9: function() { return handleError(function (arg0, arg1) {
|
|
3488
|
+
const ret = arg0.authorizeConnect(arg1);
|
|
3489
|
+
return ret;
|
|
3490
|
+
}, arguments); },
|
|
3491
|
+
__wbg_authorizeFetch_88703389e9c295d0: function() { return handleError(function (arg0, arg1, arg2) {
|
|
3492
|
+
const ret = arg0.authorizeFetch(arg1, arg2);
|
|
3493
|
+
return ret;
|
|
3494
|
+
}, arguments); },
|
|
3495
|
+
__wbg_authorizePut_dab9270462803778: function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
3496
|
+
const ret = arg0.authorizePut(arg1, arg2, arg3);
|
|
3497
|
+
return ret;
|
|
3498
|
+
}, arguments); },
|
|
3364
3499
|
__wbg_buffer_60b8043cd926067d: function(arg0) {
|
|
3365
3500
|
const ret = arg0.buffer;
|
|
3366
3501
|
return ret;
|
|
@@ -3369,9 +3504,20 @@ function __wbg_get_imports() {
|
|
|
3369
3504
|
const ret = arg0.call(arg1, arg2);
|
|
3370
3505
|
return ret;
|
|
3371
3506
|
}, arguments); },
|
|
3372
|
-
|
|
3507
|
+
__wbg_call_e133b57c9155d22c: function() { return handleError(function (arg0, arg1) {
|
|
3508
|
+
const ret = arg0.call(arg1);
|
|
3509
|
+
return ret;
|
|
3510
|
+
}, arguments); },
|
|
3511
|
+
__wbg_call_f858478a02f9600f: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
|
3512
|
+
const ret = arg0.call(arg1, arg2, arg3, arg4);
|
|
3513
|
+
return ret;
|
|
3514
|
+
}, arguments); },
|
|
3515
|
+
__wbg_close_574e2788efd7bb53: function(arg0) {
|
|
3373
3516
|
arg0.close();
|
|
3374
3517
|
},
|
|
3518
|
+
__wbg_close_af26905c832a88cb: function() { return handleError(function (arg0) {
|
|
3519
|
+
arg0.close();
|
|
3520
|
+
}, arguments); },
|
|
3375
3521
|
__wbg_close_cbf870bdad0aad99: function(arg0) {
|
|
3376
3522
|
arg0.close();
|
|
3377
3523
|
},
|
|
@@ -3395,11 +3541,11 @@ function __wbg_get_imports() {
|
|
|
3395
3541
|
const ret = arg0.data;
|
|
3396
3542
|
return ret;
|
|
3397
3543
|
},
|
|
3398
|
-
|
|
3544
|
+
__wbg_deleteAllCommits_b0197e590f7fce60: function(arg0, arg1) {
|
|
3399
3545
|
const ret = arg0.deleteAllCommits(arg1);
|
|
3400
3546
|
return ret;
|
|
3401
3547
|
},
|
|
3402
|
-
|
|
3548
|
+
__wbg_deleteAllFragments_f884845698f5afb7: function(arg0, arg1) {
|
|
3403
3549
|
const ret = arg0.deleteAllFragments(arg1);
|
|
3404
3550
|
return ret;
|
|
3405
3551
|
},
|
|
@@ -3411,7 +3557,7 @@ function __wbg_get_imports() {
|
|
|
3411
3557
|
const ret = Digest.__unwrap(arg0);
|
|
3412
3558
|
return ret;
|
|
3413
3559
|
},
|
|
3414
|
-
|
|
3560
|
+
__wbg_disconnect_849aae59f5879e45: function(arg0) {
|
|
3415
3561
|
const ret = arg0.disconnect();
|
|
3416
3562
|
return ret;
|
|
3417
3563
|
},
|
|
@@ -3438,6 +3584,10 @@ function __wbg_get_imports() {
|
|
|
3438
3584
|
const ret = arg0.fetch(arg1);
|
|
3439
3585
|
return ret;
|
|
3440
3586
|
},
|
|
3587
|
+
__wbg_filterAuthorizedFetch_0d6450fa919b271d: function() { return handleError(function (arg0, arg1, arg2) {
|
|
3588
|
+
const ret = arg0.filterAuthorizedFetch(arg1, arg2);
|
|
3589
|
+
return ret;
|
|
3590
|
+
}, arguments); },
|
|
3441
3591
|
__wbg_fragment_new: function(arg0) {
|
|
3442
3592
|
const ret = Fragment.__wrap(arg0);
|
|
3443
3593
|
return ret;
|
|
@@ -3480,6 +3630,10 @@ function __wbg_get_imports() {
|
|
|
3480
3630
|
const ret = arg0[arg1 >>> 0];
|
|
3481
3631
|
return ret;
|
|
3482
3632
|
},
|
|
3633
|
+
__wbg_get_unchecked_329cfe50afab7352: function(arg0, arg1) {
|
|
3634
|
+
const ret = arg0[arg1 >>> 0];
|
|
3635
|
+
return ret;
|
|
3636
|
+
},
|
|
3483
3637
|
__wbg_has_926ef2ff40b308cf: function() { return handleError(function (arg0, arg1) {
|
|
3484
3638
|
const ret = Reflect.has(arg0, arg1);
|
|
3485
3639
|
return ret;
|
|
@@ -3606,6 +3760,10 @@ function __wbg_get_imports() {
|
|
|
3606
3760
|
const ret = result;
|
|
3607
3761
|
return ret;
|
|
3608
3762
|
},
|
|
3763
|
+
__wbg_isArray_33b91feb269ff46e: function(arg0) {
|
|
3764
|
+
const ret = Array.isArray(arg0);
|
|
3765
|
+
return ret;
|
|
3766
|
+
},
|
|
3609
3767
|
__wbg_isSafeInteger_ecd6a7f9c3e053cd: function(arg0) {
|
|
3610
3768
|
const ret = Number.isSafeInteger(arg0);
|
|
3611
3769
|
return ret;
|
|
@@ -3618,15 +3776,15 @@ function __wbg_get_imports() {
|
|
|
3618
3776
|
const ret = arg0.length;
|
|
3619
3777
|
return ret;
|
|
3620
3778
|
},
|
|
3621
|
-
|
|
3779
|
+
__wbg_loadAllCommits_0e97df07ed213aa0: function(arg0, arg1) {
|
|
3622
3780
|
const ret = arg0.loadAllCommits(arg1);
|
|
3623
3781
|
return ret;
|
|
3624
3782
|
},
|
|
3625
|
-
|
|
3783
|
+
__wbg_loadAllFragments_12ecf8f9bd0e0b58: function(arg0, arg1) {
|
|
3626
3784
|
const ret = arg0.loadAllFragments(arg1);
|
|
3627
3785
|
return ret;
|
|
3628
3786
|
},
|
|
3629
|
-
|
|
3787
|
+
__wbg_loadAllSedimentreeIds_1a18451ef1f8e795: function(arg0) {
|
|
3630
3788
|
const ret = arg0.loadAllSedimentreeIds();
|
|
3631
3789
|
return ret;
|
|
3632
3790
|
},
|
|
@@ -3669,7 +3827,7 @@ function __wbg_get_imports() {
|
|
|
3669
3827
|
const a = state0.a;
|
|
3670
3828
|
state0.a = 0;
|
|
3671
3829
|
try {
|
|
3672
|
-
return
|
|
3830
|
+
return __wasm_bindgen_func_elem_1605_191(a, state0.b, arg0, arg1);
|
|
3673
3831
|
} finally {
|
|
3674
3832
|
state0.a = a;
|
|
3675
3833
|
}
|
|
@@ -3703,7 +3861,7 @@ function __wbg_get_imports() {
|
|
|
3703
3861
|
const a = state0.a;
|
|
3704
3862
|
state0.a = 0;
|
|
3705
3863
|
try {
|
|
3706
|
-
return
|
|
3864
|
+
return __wasm_bindgen_func_elem_1605_192(a, state0.b, arg0, arg1);
|
|
3707
3865
|
} finally {
|
|
3708
3866
|
state0.a = a;
|
|
3709
3867
|
}
|
|
@@ -3714,6 +3872,10 @@ function __wbg_get_imports() {
|
|
|
3714
3872
|
state0.a = state0.b = 0;
|
|
3715
3873
|
}
|
|
3716
3874
|
},
|
|
3875
|
+
__wbg_new_typed_bccac67128ed885a: function() {
|
|
3876
|
+
const ret = new Array();
|
|
3877
|
+
return ret;
|
|
3878
|
+
},
|
|
3717
3879
|
__wbg_new_with_length_825018a1616e9e55: function(arg0) {
|
|
3718
3880
|
const ret = new Uint8Array(arg0 >>> 0);
|
|
3719
3881
|
return ret;
|
|
@@ -3746,6 +3908,9 @@ function __wbg_get_imports() {
|
|
|
3746
3908
|
const ret = Array.of(arg0, arg1);
|
|
3747
3909
|
return ret;
|
|
3748
3910
|
},
|
|
3911
|
+
__wbg_onDisconnect_12d6884490508121: function(arg0, arg1) {
|
|
3912
|
+
arg0.onDisconnect(arg1);
|
|
3913
|
+
},
|
|
3749
3914
|
__wbg_open_e7a9d3d6344572f6: function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
3750
3915
|
const ret = arg0.open(getStringFromWasm0(arg1, arg2), arg3 >>> 0);
|
|
3751
3916
|
return ret;
|
|
@@ -3770,7 +3935,7 @@ function __wbg_get_imports() {
|
|
|
3770
3935
|
const ret = arg0.port2;
|
|
3771
3936
|
return ret;
|
|
3772
3937
|
},
|
|
3773
|
-
|
|
3938
|
+
__wbg_postMessage_0541d6c31330afe3: function(arg0, arg1) {
|
|
3774
3939
|
arg0.postMessage(arg1);
|
|
3775
3940
|
},
|
|
3776
3941
|
__wbg_process_44c7a14e11e9f69e: function(arg0) {
|
|
@@ -3802,7 +3967,7 @@ function __wbg_get_imports() {
|
|
|
3802
3967
|
const ret = arg0.readyState;
|
|
3803
3968
|
return ret;
|
|
3804
3969
|
},
|
|
3805
|
-
|
|
3970
|
+
__wbg_recvBytes_c85b12fb48cd7a35: function(arg0) {
|
|
3806
3971
|
const ret = arg0.recvBytes();
|
|
3807
3972
|
return ret;
|
|
3808
3973
|
},
|
|
@@ -3818,15 +3983,15 @@ function __wbg_get_imports() {
|
|
|
3818
3983
|
const ret = arg0.result;
|
|
3819
3984
|
return ret;
|
|
3820
3985
|
}, arguments); },
|
|
3821
|
-
|
|
3986
|
+
__wbg_saveCommit_02f095436fc502e0: function(arg0, arg1, arg2, arg3, arg4) {
|
|
3822
3987
|
const ret = arg0.saveCommit(arg1, arg2, arg3, arg4);
|
|
3823
3988
|
return ret;
|
|
3824
3989
|
},
|
|
3825
|
-
|
|
3990
|
+
__wbg_saveFragment_7681b2171b8cfb35: function(arg0, arg1, arg2, arg3, arg4) {
|
|
3826
3991
|
const ret = arg0.saveFragment(arg1, arg2, arg3, arg4);
|
|
3827
3992
|
return ret;
|
|
3828
3993
|
},
|
|
3829
|
-
|
|
3994
|
+
__wbg_saveSedimentreeId_c265aaeef5af34b6: function(arg0, arg1) {
|
|
3830
3995
|
const ret = arg0.saveSedimentreeId(arg1);
|
|
3831
3996
|
return ret;
|
|
3832
3997
|
},
|
|
@@ -3838,14 +4003,14 @@ function __wbg_get_imports() {
|
|
|
3838
4003
|
const ret = SedimentreeId.__unwrap(arg0);
|
|
3839
4004
|
return ret;
|
|
3840
4005
|
},
|
|
3841
|
-
|
|
4006
|
+
__wbg_sendBytes_e6262dd74f1c260a: function(arg0, arg1) {
|
|
3842
4007
|
const ret = arg0.sendBytes(arg1);
|
|
3843
4008
|
return ret;
|
|
3844
4009
|
},
|
|
3845
4010
|
__wbg_send_d31a693c975dea74: function() { return handleError(function (arg0, arg1, arg2) {
|
|
3846
4011
|
arg0.send(getArrayU8FromWasm0(arg1, arg2));
|
|
3847
4012
|
}, arguments); },
|
|
3848
|
-
|
|
4013
|
+
__wbg_setTimeout_7829585928963a1f: function(arg0, arg1) {
|
|
3849
4014
|
const ret = setTimeout(arg0, arg1);
|
|
3850
4015
|
return ret;
|
|
3851
4016
|
},
|
|
@@ -3883,7 +4048,7 @@ function __wbg_get_imports() {
|
|
|
3883
4048
|
__wbg_set_onerror_901ca711f94a5bbb: function(arg0, arg1) {
|
|
3884
4049
|
arg0.onerror = arg1;
|
|
3885
4050
|
},
|
|
3886
|
-
|
|
4051
|
+
__wbg_set_onmessage_29558b29aee9a78a: function(arg0, arg1) {
|
|
3887
4052
|
arg0.onmessage = arg1;
|
|
3888
4053
|
},
|
|
3889
4054
|
__wbg_set_onmessage_6f80ab771bf151aa: function(arg0, arg1) {
|
|
@@ -3898,14 +4063,14 @@ function __wbg_get_imports() {
|
|
|
3898
4063
|
__wbg_set_onupgradeneeded_860ce42184f987e7: function(arg0, arg1) {
|
|
3899
4064
|
arg0.onupgradeneeded = arg1;
|
|
3900
4065
|
},
|
|
3901
|
-
__wbg_sign_23c468db7fe0ee83: function(arg0, arg1) {
|
|
3902
|
-
const ret = arg0.sign(arg1);
|
|
3903
|
-
return ret;
|
|
3904
|
-
},
|
|
3905
4066
|
__wbg_sign_a34d057afd14c54d: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
|
3906
4067
|
const ret = arg0.sign(arg1, arg2, getArrayU8FromWasm0(arg3, arg4));
|
|
3907
4068
|
return ret;
|
|
3908
4069
|
}, arguments); },
|
|
4070
|
+
__wbg_sign_d03455abc6736428: function(arg0, arg1) {
|
|
4071
|
+
const ret = arg0.sign(arg1);
|
|
4072
|
+
return ret;
|
|
4073
|
+
},
|
|
3909
4074
|
__wbg_signedfragment_new: function(arg0) {
|
|
3910
4075
|
const ret = SignedFragment.__wrap(arg0);
|
|
3911
4076
|
return ret;
|
|
@@ -3984,14 +4149,14 @@ function __wbg_get_imports() {
|
|
|
3984
4149
|
const ret = arg0.transaction(getStringFromWasm0(arg1, arg2));
|
|
3985
4150
|
return ret;
|
|
3986
4151
|
}, arguments); },
|
|
3987
|
-
|
|
4152
|
+
__wbg_tryIntoJsSedimentreeIdsArray_d6337c0aa0f28604: function() { return handleError(function (arg0, arg1) {
|
|
3988
4153
|
const ret = tryIntoJsSedimentreeIdsArray(arg1);
|
|
3989
4154
|
const ptr1 = passArrayJsValueToWasm0(ret, wasm.__wbindgen_export);
|
|
3990
4155
|
const len1 = WASM_VECTOR_LEN;
|
|
3991
4156
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
3992
4157
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
3993
4158
|
}, arguments); },
|
|
3994
|
-
|
|
4159
|
+
__wbg_verifyingKey_29533740d75f8cdb: function(arg0) {
|
|
3995
4160
|
const ret = arg0.verifyingKey();
|
|
3996
4161
|
return ret;
|
|
3997
4162
|
},
|
|
@@ -4004,74 +4169,79 @@ function __wbg_get_imports() {
|
|
|
4004
4169
|
return ret;
|
|
4005
4170
|
},
|
|
4006
4171
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
4007
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
4008
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
4172
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 11, function: Function { arguments: [Externref], shim_idx: 12, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
4173
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_274, __wasm_bindgen_func_elem_590);
|
|
4009
4174
|
return ret;
|
|
4010
4175
|
},
|
|
4011
4176
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
4012
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
4013
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
4177
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 11, function: Function { arguments: [NamedExternref("Event")], shim_idx: 12, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
4178
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_274, __wasm_bindgen_func_elem_590_1);
|
|
4014
4179
|
return ret;
|
|
4015
4180
|
},
|
|
4016
4181
|
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
4017
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
4018
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
4182
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 11, function: Function { arguments: [NamedExternref("IDBVersionChangeEvent")], shim_idx: 12, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
4183
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_274, __wasm_bindgen_func_elem_590_2);
|
|
4019
4184
|
return ret;
|
|
4020
4185
|
},
|
|
4021
4186
|
__wbindgen_cast_0000000000000004: function(arg0, arg1) {
|
|
4022
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
4023
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
4187
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 11, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 12, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
4188
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_274, __wasm_bindgen_func_elem_590_3);
|
|
4024
4189
|
return ret;
|
|
4025
4190
|
},
|
|
4026
4191
|
__wbindgen_cast_0000000000000005: function(arg0, arg1) {
|
|
4027
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
4028
|
-
const ret =
|
|
4192
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 11, function: Function { arguments: [], shim_idx: 13, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`.
|
|
4193
|
+
const ret = makeClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_274, __wasm_bindgen_func_elem_589);
|
|
4194
|
+
return ret;
|
|
4195
|
+
},
|
|
4196
|
+
__wbindgen_cast_0000000000000006: function(arg0, arg1) {
|
|
4197
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 655, function: Function { arguments: [Externref], shim_idx: 738, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
4198
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_274, __wasm_bindgen_func_elem_1605);
|
|
4029
4199
|
return ret;
|
|
4030
4200
|
},
|
|
4031
|
-
|
|
4201
|
+
__wbindgen_cast_0000000000000007: function(arg0) {
|
|
4032
4202
|
// Cast intrinsic for `F64 -> Externref`.
|
|
4033
4203
|
const ret = arg0;
|
|
4034
4204
|
return ret;
|
|
4035
4205
|
},
|
|
4036
|
-
|
|
4206
|
+
__wbindgen_cast_0000000000000008: function(arg0, arg1) {
|
|
4037
4207
|
// Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
|
|
4038
4208
|
const ret = getArrayU8FromWasm0(arg0, arg1);
|
|
4039
4209
|
return ret;
|
|
4040
4210
|
},
|
|
4041
|
-
|
|
4211
|
+
__wbindgen_cast_0000000000000009: function(arg0, arg1) {
|
|
4042
4212
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
4043
4213
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
4044
4214
|
return ret;
|
|
4045
4215
|
},
|
|
4046
|
-
|
|
4216
|
+
__wbindgen_cast_000000000000000a: function(arg0, arg1) {
|
|
4047
4217
|
var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
|
|
4048
4218
|
wasm.__wbindgen_export5(arg0, arg1 * 4, 4);
|
|
4049
4219
|
// Cast intrinsic for `Vector(NamedExternref("Fragment")) -> Externref`.
|
|
4050
4220
|
const ret = v0;
|
|
4051
4221
|
return ret;
|
|
4052
4222
|
},
|
|
4053
|
-
|
|
4223
|
+
__wbindgen_cast_000000000000000b: function(arg0, arg1) {
|
|
4054
4224
|
var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
|
|
4055
4225
|
wasm.__wbindgen_export5(arg0, arg1 * 4, 4);
|
|
4056
4226
|
// Cast intrinsic for `Vector(NamedExternref("LooseCommit")) -> Externref`.
|
|
4057
4227
|
const ret = v0;
|
|
4058
4228
|
return ret;
|
|
4059
4229
|
},
|
|
4060
|
-
|
|
4230
|
+
__wbindgen_cast_000000000000000c: function(arg0, arg1) {
|
|
4061
4231
|
var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
|
|
4062
4232
|
wasm.__wbindgen_export5(arg0, arg1 * 4, 4);
|
|
4063
4233
|
// Cast intrinsic for `Vector(NamedExternref("PeerId")) -> Externref`.
|
|
4064
4234
|
const ret = v0;
|
|
4065
4235
|
return ret;
|
|
4066
4236
|
},
|
|
4067
|
-
|
|
4237
|
+
__wbindgen_cast_000000000000000d: function(arg0, arg1) {
|
|
4068
4238
|
var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
|
|
4069
4239
|
wasm.__wbindgen_export5(arg0, arg1 * 4, 4);
|
|
4070
4240
|
// Cast intrinsic for `Vector(NamedExternref("SedimentreeId")) -> Externref`.
|
|
4071
4241
|
const ret = v0;
|
|
4072
4242
|
return ret;
|
|
4073
4243
|
},
|
|
4074
|
-
|
|
4244
|
+
__wbindgen_cast_000000000000000e: function(arg0, arg1) {
|
|
4075
4245
|
var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
|
|
4076
4246
|
wasm.__wbindgen_export5(arg0, arg1 * 4, 4);
|
|
4077
4247
|
// Cast intrinsic for `Vector(NamedExternref("Uint8Array")) -> Externref`.
|
|
@@ -4091,38 +4261,43 @@ function __wbg_get_imports() {
|
|
|
4091
4261
|
return {
|
|
4092
4262
|
__proto__: null,
|
|
4093
4263
|
"./subduction_wasm_bg.js": import0,
|
|
4264
|
+
"./snippets/subduction_wasm-0ed7fd66cebca59f/inline0.js": import1,
|
|
4094
4265
|
};
|
|
4095
4266
|
}
|
|
4096
4267
|
|
|
4097
|
-
function
|
|
4098
|
-
wasm.
|
|
4268
|
+
function __wasm_bindgen_func_elem_589(arg0, arg1) {
|
|
4269
|
+
wasm.__wasm_bindgen_func_elem_589(arg0, arg1);
|
|
4099
4270
|
}
|
|
4100
4271
|
|
|
4101
|
-
function
|
|
4102
|
-
wasm.
|
|
4272
|
+
function __wasm_bindgen_func_elem_590(arg0, arg1, arg2) {
|
|
4273
|
+
wasm.__wasm_bindgen_func_elem_590(arg0, arg1, arg2);
|
|
4103
4274
|
}
|
|
4104
4275
|
|
|
4105
|
-
function
|
|
4106
|
-
wasm.
|
|
4276
|
+
function __wasm_bindgen_func_elem_590_1(arg0, arg1, arg2) {
|
|
4277
|
+
wasm.__wasm_bindgen_func_elem_590_1(arg0, arg1, arg2);
|
|
4107
4278
|
}
|
|
4108
4279
|
|
|
4109
|
-
function
|
|
4110
|
-
wasm.
|
|
4280
|
+
function __wasm_bindgen_func_elem_590_2(arg0, arg1, arg2) {
|
|
4281
|
+
wasm.__wasm_bindgen_func_elem_590_2(arg0, arg1, arg2);
|
|
4111
4282
|
}
|
|
4112
4283
|
|
|
4113
|
-
function
|
|
4114
|
-
|
|
4284
|
+
function __wasm_bindgen_func_elem_590_3(arg0, arg1, arg2) {
|
|
4285
|
+
wasm.__wasm_bindgen_func_elem_590_3(arg0, arg1, arg2);
|
|
4286
|
+
}
|
|
4287
|
+
|
|
4288
|
+
function __wasm_bindgen_func_elem_1605(arg0, arg1, arg2) {
|
|
4289
|
+
const ret = wasm.__wasm_bindgen_func_elem_1605(arg0, arg1, arg2);
|
|
4115
4290
|
if (ret[1]) {
|
|
4116
4291
|
throw takeFromExternrefTable0(ret[0]);
|
|
4117
4292
|
}
|
|
4118
4293
|
}
|
|
4119
4294
|
|
|
4120
|
-
function
|
|
4121
|
-
wasm.
|
|
4295
|
+
function __wasm_bindgen_func_elem_1605_191(arg0, arg1, arg2, arg3) {
|
|
4296
|
+
wasm.__wasm_bindgen_func_elem_1605_191(arg0, arg1, arg2, arg3);
|
|
4122
4297
|
}
|
|
4123
4298
|
|
|
4124
|
-
function
|
|
4125
|
-
wasm.
|
|
4299
|
+
function __wasm_bindgen_func_elem_1605_192(arg0, arg1, arg2, arg3) {
|
|
4300
|
+
wasm.__wasm_bindgen_func_elem_1605_192(arg0, arg1, arg2, arg3);
|
|
4126
4301
|
}
|
|
4127
4302
|
|
|
4128
4303
|
|
|
@@ -4373,6 +4548,31 @@ function isLikeNone(x) {
|
|
|
4373
4548
|
return x === undefined || x === null;
|
|
4374
4549
|
}
|
|
4375
4550
|
|
|
4551
|
+
function makeClosure(arg0, arg1, dtor, f) {
|
|
4552
|
+
const state = { a: arg0, b: arg1, cnt: 1, dtor };
|
|
4553
|
+
const real = (...args) => {
|
|
4554
|
+
|
|
4555
|
+
// First up with a closure we increment the internal reference
|
|
4556
|
+
// count. This ensures that the Rust closure environment won't
|
|
4557
|
+
// be deallocated while we're invoking it.
|
|
4558
|
+
state.cnt++;
|
|
4559
|
+
try {
|
|
4560
|
+
return f(state.a, state.b, ...args);
|
|
4561
|
+
} finally {
|
|
4562
|
+
real._wbg_cb_unref();
|
|
4563
|
+
}
|
|
4564
|
+
};
|
|
4565
|
+
real._wbg_cb_unref = () => {
|
|
4566
|
+
if (--state.cnt === 0) {
|
|
4567
|
+
state.dtor(state.a, state.b);
|
|
4568
|
+
state.a = 0;
|
|
4569
|
+
CLOSURE_DTORS.unregister(state);
|
|
4570
|
+
}
|
|
4571
|
+
};
|
|
4572
|
+
CLOSURE_DTORS.register(real, state, state);
|
|
4573
|
+
return real;
|
|
4574
|
+
}
|
|
4575
|
+
|
|
4376
4576
|
function makeMutClosure(arg0, arg1, dtor, f) {
|
|
4377
4577
|
const state = { a: arg0, b: arg1, cnt: 1, dtor };
|
|
4378
4578
|
const real = (...args) => {
|