@automerge/subduction 0.9.0 → 0.10.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/package.json +3 -2
- package/dist/cjs/node.cjs +0 -5
- package/dist/cjs/slim.cjs +0 -1
- package/dist/cjs/wasm-base64.cjs +0 -1
- package/dist/cjs/web-bindings.cjs +0 -4621
- package/dist/cjs/web.cjs +0 -4572
- package/dist/esm/bundler.js +0 -7
- package/dist/esm/node.js +0 -7
- package/dist/esm/slim.js +0 -2
- package/dist/esm/wasm-base64.js +0 -1
- package/dist/esm/web.js +0 -5
- package/dist/esm/workerd.js +0 -5
- package/dist/iife/index.js +0 -4531
- package/dist/index.d.ts +0 -1634
- package/dist/subduction.wasm +0 -0
- package/dist/wasm_bindgen/bundler/snippets/sedimentree_wasm-1de4a01519b0f11f/inline0.js +0 -2
- package/dist/wasm_bindgen/bundler/snippets/sedimentree_wasm-1de4a01519b0f11f/inline1.js +0 -2
- package/dist/wasm_bindgen/bundler/snippets/sedimentree_wasm-1de4a01519b0f11f/inline2.js +0 -2
- package/dist/wasm_bindgen/bundler/snippets/subduction_wasm-0ed7fd66cebca59f/inline0.js +0 -9
- package/dist/wasm_bindgen/bundler/subduction_wasm.d.ts +0 -1634
- package/dist/wasm_bindgen/bundler/subduction_wasm.js +0 -9
- package/dist/wasm_bindgen/bundler/subduction_wasm_bg.js +0 -4645
- package/dist/wasm_bindgen/bundler/subduction_wasm_bg.wasm +0 -0
- package/dist/wasm_bindgen/bundler/subduction_wasm_bg.wasm.d.ts +0 -242
- package/dist/wasm_bindgen/nodejs/snippets/sedimentree_wasm-1de4a01519b0f11f/inline0.js +0 -2
- package/dist/wasm_bindgen/nodejs/snippets/sedimentree_wasm-1de4a01519b0f11f/inline1.js +0 -2
- package/dist/wasm_bindgen/nodejs/snippets/sedimentree_wasm-1de4a01519b0f11f/inline2.js +0 -2
- package/dist/wasm_bindgen/nodejs/snippets/subduction_wasm-0ed7fd66cebca59f/inline0.js +0 -9
- package/dist/wasm_bindgen/nodejs/subduction_wasm.cjs +0 -4689
- package/dist/wasm_bindgen/nodejs/subduction_wasm.d.ts +0 -1634
- package/dist/wasm_bindgen/nodejs/subduction_wasm_bg.wasm +0 -0
- package/dist/wasm_bindgen/nodejs/subduction_wasm_bg.wasm.d.ts +0 -242
- package/dist/wasm_bindgen/web/snippets/sedimentree_wasm-1de4a01519b0f11f/inline0.js +0 -2
- package/dist/wasm_bindgen/web/snippets/sedimentree_wasm-1de4a01519b0f11f/inline1.js +0 -2
- package/dist/wasm_bindgen/web/snippets/sedimentree_wasm-1de4a01519b0f11f/inline2.js +0 -2
- package/dist/wasm_bindgen/web/snippets/subduction_wasm-0ed7fd66cebca59f/inline0.js +0 -9
- package/dist/wasm_bindgen/web/subduction_wasm.d.ts +0 -1901
- package/dist/wasm_bindgen/web/subduction_wasm.js +0 -4748
- package/dist/wasm_bindgen/web/subduction_wasm_bg.wasm +0 -0
- package/dist/wasm_bindgen/web/subduction_wasm_bg.wasm.d.ts +0 -242
|
@@ -1,4645 +0,0 @@
|
|
|
1
|
-
import { tryIntoJsSedimentreeIdsArray } from './snippets/sedimentree_wasm-1de4a01519b0f11f/inline2.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* An authenticated HTTP long-poll transport.
|
|
5
|
-
*
|
|
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
|
|
69
|
-
* accepted by [`addConnection`](crate::subduction::WasmSubduction::add_connection).
|
|
70
|
-
*
|
|
71
|
-
* # Construction
|
|
72
|
-
*
|
|
73
|
-
* There are three ways to obtain an `AuthenticatedTransport`:
|
|
74
|
-
*
|
|
75
|
-
* 1. **Custom transport** — implement the `Transport` interface
|
|
76
|
-
* (`sendBytes`/`recvBytes`/`disconnect`/`onDisconnect`) and call
|
|
77
|
-
* [`setup`](Self::setup):
|
|
78
|
-
*
|
|
79
|
-
* ```js
|
|
80
|
-
* const auth = await AuthenticatedTransport.setup(myTransport, signer, peerId, (peerId) => {
|
|
81
|
-
* console.log(`${peerId} disconnected`);
|
|
82
|
-
* });
|
|
83
|
-
* ```
|
|
84
|
-
*
|
|
85
|
-
* 2. **From WebSocket** — authenticate via [`SubductionWebSocket`] then convert:
|
|
86
|
-
*
|
|
87
|
-
* ```js
|
|
88
|
-
* const wsAuth = await SubductionWebSocket.tryConnect(url, signer, peerId, (peerId) => {
|
|
89
|
-
* console.log(`${peerId} disconnected`);
|
|
90
|
-
* });
|
|
91
|
-
* const auth = wsAuth.toTransport();
|
|
92
|
-
* ```
|
|
93
|
-
*
|
|
94
|
-
* 3. **From HTTP long-poll** — same pattern via [`SubductionLongPoll`]:
|
|
95
|
-
*
|
|
96
|
-
* ```js
|
|
97
|
-
* const lpAuth = await SubductionLongPoll.tryConnect(url, signer, peerId, (peerId) => {
|
|
98
|
-
* console.log(`${peerId} disconnected`);
|
|
99
|
-
* });
|
|
100
|
-
* const auth = lpAuth.toTransport();
|
|
101
|
-
* ```
|
|
102
|
-
*/
|
|
103
|
-
export class AuthenticatedTransport {
|
|
104
|
-
static __wrap(ptr) {
|
|
105
|
-
ptr = ptr >>> 0;
|
|
106
|
-
const obj = Object.create(AuthenticatedTransport.prototype);
|
|
107
|
-
obj.__wbg_ptr = ptr;
|
|
108
|
-
AuthenticatedTransportFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
109
|
-
return obj;
|
|
110
|
-
}
|
|
111
|
-
__destroy_into_raw() {
|
|
112
|
-
const ptr = this.__wbg_ptr;
|
|
113
|
-
this.__wbg_ptr = 0;
|
|
114
|
-
AuthenticatedTransportFinalization.unregister(this);
|
|
115
|
-
return ptr;
|
|
116
|
-
}
|
|
117
|
-
free() {
|
|
118
|
-
const ptr = this.__destroy_into_raw();
|
|
119
|
-
wasm.__wbg_authenticatedtransport_free(ptr, 0);
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Accept an incoming handshake over a custom transport (responder side).
|
|
123
|
-
*
|
|
124
|
-
* This is the counterpart to [`setup`](Self::setup). The initiator calls
|
|
125
|
-
* `setup`, and the responder calls `accept` over the same underlying channel.
|
|
126
|
-
*
|
|
127
|
-
* # Arguments
|
|
128
|
-
*
|
|
129
|
-
* * `transport` - A `Transport` implementing `sendBytes`/`recvBytes`/`disconnect`/`onDisconnect`
|
|
130
|
-
* * `signer` - The responder's signer for authentication
|
|
131
|
-
* * `max_drift_seconds` - Maximum acceptable clock drift in seconds (default: 600)
|
|
132
|
-
*
|
|
133
|
-
* # Errors
|
|
134
|
-
*
|
|
135
|
-
* Returns a [`HandshakeError`](WasmHandshakeError) if the handshake fails.
|
|
136
|
-
* @param {Transport} transport
|
|
137
|
-
* @param {any} signer
|
|
138
|
-
* @param {number | null} [max_drift_seconds]
|
|
139
|
-
* @param {Function | null} [on_disconnect]
|
|
140
|
-
* @returns {Promise<AuthenticatedTransport>}
|
|
141
|
-
*/
|
|
142
|
-
static accept(transport, signer, max_drift_seconds, on_disconnect) {
|
|
143
|
-
const ret = wasm.authenticatedtransport_accept(transport, signer, isLikeNone(max_drift_seconds) ? 0x100000001 : (max_drift_seconds) >>> 0, isLikeNone(on_disconnect) ? 0 : addToExternrefTable0(on_disconnect));
|
|
144
|
-
return ret;
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* The verified peer identity.
|
|
148
|
-
* @returns {PeerId}
|
|
149
|
-
*/
|
|
150
|
-
get peerId() {
|
|
151
|
-
const ret = wasm.authenticatedtransport_peerId(this.__wbg_ptr);
|
|
152
|
-
return PeerId.__wrap(ret);
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Run the Subduction handshake over a custom transport, producing an
|
|
156
|
-
* authenticated transport.
|
|
157
|
-
*
|
|
158
|
-
* The `transport` object must implement the `Transport` interface
|
|
159
|
-
* (`sendBytes`/`recvBytes`/`disconnect`/`onDisconnect`).
|
|
160
|
-
* The same object is used for both the handshake phase and post-handshake
|
|
161
|
-
* communication.
|
|
162
|
-
*
|
|
163
|
-
* # Arguments
|
|
164
|
-
*
|
|
165
|
-
* * `transport` - A `Transport` implementing `sendBytes`/`recvBytes`/`disconnect`/`onDisconnect`
|
|
166
|
-
* * `signer` - The client's signer for authentication
|
|
167
|
-
* * `expected_peer_id` - The expected server peer ID (verified during handshake)
|
|
168
|
-
*
|
|
169
|
-
* # Errors
|
|
170
|
-
*
|
|
171
|
-
* Returns a [`HandshakeError`](WasmHandshakeError) if the handshake fails.
|
|
172
|
-
* @param {Transport} transport
|
|
173
|
-
* @param {any} signer
|
|
174
|
-
* @param {PeerId} expected_peer_id
|
|
175
|
-
* @param {Function | null} [on_disconnect]
|
|
176
|
-
* @returns {Promise<AuthenticatedTransport>}
|
|
177
|
-
*/
|
|
178
|
-
static setup(transport, signer, expected_peer_id, on_disconnect) {
|
|
179
|
-
_assertClass(expected_peer_id, PeerId);
|
|
180
|
-
const ret = wasm.authenticatedtransport_setup(transport, signer, expected_peer_id.__wbg_ptr, isLikeNone(on_disconnect) ? 0 : addToExternrefTable0(on_disconnect));
|
|
181
|
-
return ret;
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Run the Subduction handshake over a custom transport using discovery
|
|
185
|
-
* mode, producing an authenticated transport.
|
|
186
|
-
*
|
|
187
|
-
* Unlike [`setup`](Self::setup) which requires a known peer ID,
|
|
188
|
-
* this method discovers the peer's identity during the handshake
|
|
189
|
-
* using a shared service name.
|
|
190
|
-
*
|
|
191
|
-
* # Arguments
|
|
192
|
-
*
|
|
193
|
-
* * `transport` - A `Transport` implementing `sendBytes`/`recvBytes`/`disconnect`/`onDisconnect`
|
|
194
|
-
* * `signer` - The client's signer for authentication
|
|
195
|
-
* * `service_name` - Shared service name for discovery.
|
|
196
|
-
* Defaults to [`DEFAULT_LOCAL_SERVICE_NAME`] (`"subduction:local"`) if omitted.
|
|
197
|
-
*
|
|
198
|
-
* # Errors
|
|
199
|
-
*
|
|
200
|
-
* Returns a [`HandshakeError`](WasmHandshakeError) if the handshake fails.
|
|
201
|
-
* @param {Transport} transport
|
|
202
|
-
* @param {any} signer
|
|
203
|
-
* @param {string | null} [service_name]
|
|
204
|
-
* @param {Function | null} [on_disconnect]
|
|
205
|
-
* @returns {Promise<AuthenticatedTransport>}
|
|
206
|
-
*/
|
|
207
|
-
static setupDiscover(transport, signer, service_name, on_disconnect) {
|
|
208
|
-
var ptr0 = isLikeNone(service_name) ? 0 : passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
209
|
-
var len0 = WASM_VECTOR_LEN;
|
|
210
|
-
const ret = wasm.authenticatedtransport_setupDiscover(transport, signer, ptr0, len0, isLikeNone(on_disconnect) ? 0 : addToExternrefTable0(on_disconnect));
|
|
211
|
-
return ret;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
if (Symbol.dispose) AuthenticatedTransport.prototype[Symbol.dispose] = AuthenticatedTransport.prototype.free;
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* An authenticated WebSocket transport.
|
|
218
|
-
*
|
|
219
|
-
* This wrapper proves that the connection has completed the Subduction handshake
|
|
220
|
-
* and the peer identity has been cryptographically verified.
|
|
221
|
-
*
|
|
222
|
-
* Obtain via [`SubductionWebSocket::setup`], [`SubductionWebSocket::tryConnect`],
|
|
223
|
-
* or [`SubductionWebSocket::tryDiscover`].
|
|
224
|
-
*/
|
|
225
|
-
export class AuthenticatedWebSocket {
|
|
226
|
-
static __wrap(ptr) {
|
|
227
|
-
ptr = ptr >>> 0;
|
|
228
|
-
const obj = Object.create(AuthenticatedWebSocket.prototype);
|
|
229
|
-
obj.__wbg_ptr = ptr;
|
|
230
|
-
AuthenticatedWebSocketFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
231
|
-
return obj;
|
|
232
|
-
}
|
|
233
|
-
__destroy_into_raw() {
|
|
234
|
-
const ptr = this.__wbg_ptr;
|
|
235
|
-
this.__wbg_ptr = 0;
|
|
236
|
-
AuthenticatedWebSocketFinalization.unregister(this);
|
|
237
|
-
return ptr;
|
|
238
|
-
}
|
|
239
|
-
free() {
|
|
240
|
-
const ptr = this.__destroy_into_raw();
|
|
241
|
-
wasm.__wbg_authenticatedwebsocket_free(ptr, 0);
|
|
242
|
-
}
|
|
243
|
-
/**
|
|
244
|
-
* The verified peer identity.
|
|
245
|
-
* @returns {PeerId}
|
|
246
|
-
*/
|
|
247
|
-
get peerId() {
|
|
248
|
-
const ret = wasm.authenticatedwebsocket_peerId(this.__wbg_ptr);
|
|
249
|
-
return PeerId.__wrap(ret);
|
|
250
|
-
}
|
|
251
|
-
/**
|
|
252
|
-
* Convert to a transport-erased [`AuthenticatedTransport`](super::WasmAuthenticatedTransport).
|
|
253
|
-
* @returns {AuthenticatedTransport}
|
|
254
|
-
*/
|
|
255
|
-
toTransport() {
|
|
256
|
-
const ptr = this.__destroy_into_raw();
|
|
257
|
-
const ret = wasm.authenticatedwebsocket_toTransport(ptr);
|
|
258
|
-
return AuthenticatedTransport.__wrap(ret);
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
if (Symbol.dispose) AuthenticatedWebSocket.prototype[Symbol.dispose] = AuthenticatedWebSocket.prototype.free;
|
|
262
|
-
|
|
263
|
-
/**
|
|
264
|
-
* Wasm wrapper for [`BatchSyncRequest`].
|
|
265
|
-
*/
|
|
266
|
-
export class BatchSyncRequest {
|
|
267
|
-
static __wrap(ptr) {
|
|
268
|
-
ptr = ptr >>> 0;
|
|
269
|
-
const obj = Object.create(BatchSyncRequest.prototype);
|
|
270
|
-
obj.__wbg_ptr = ptr;
|
|
271
|
-
BatchSyncRequestFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
272
|
-
return obj;
|
|
273
|
-
}
|
|
274
|
-
__destroy_into_raw() {
|
|
275
|
-
const ptr = this.__wbg_ptr;
|
|
276
|
-
this.__wbg_ptr = 0;
|
|
277
|
-
BatchSyncRequestFinalization.unregister(this);
|
|
278
|
-
return ptr;
|
|
279
|
-
}
|
|
280
|
-
free() {
|
|
281
|
-
const ptr = this.__destroy_into_raw();
|
|
282
|
-
wasm.__wbg_batchsyncrequest_free(ptr, 0);
|
|
283
|
-
}
|
|
284
|
-
/**
|
|
285
|
-
* The sedimentree ID this request corresponds to.
|
|
286
|
-
* @returns {SedimentreeId}
|
|
287
|
-
*/
|
|
288
|
-
id() {
|
|
289
|
-
const ret = wasm.batchsyncrequest_id(this.__wbg_ptr);
|
|
290
|
-
return SedimentreeId.__wrap(ret);
|
|
291
|
-
}
|
|
292
|
-
/**
|
|
293
|
-
* The request ID for this request.
|
|
294
|
-
* @returns {RequestId}
|
|
295
|
-
*/
|
|
296
|
-
request_id() {
|
|
297
|
-
const ret = wasm.batchsyncrequest_request_id(this.__wbg_ptr);
|
|
298
|
-
return RequestId.__wrap(ret);
|
|
299
|
-
}
|
|
300
|
-
/**
|
|
301
|
-
* Whether this request subscribes to future updates.
|
|
302
|
-
* @returns {boolean}
|
|
303
|
-
*/
|
|
304
|
-
subscribe() {
|
|
305
|
-
const ret = wasm.batchsyncrequest_subscribe(this.__wbg_ptr);
|
|
306
|
-
return ret !== 0;
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
if (Symbol.dispose) BatchSyncRequest.prototype[Symbol.dispose] = BatchSyncRequest.prototype.free;
|
|
310
|
-
|
|
311
|
-
/**
|
|
312
|
-
* Wasm wrapper for [`BatchSyncResponse`].
|
|
313
|
-
*/
|
|
314
|
-
export class BatchSyncResponse {
|
|
315
|
-
static __wrap(ptr) {
|
|
316
|
-
ptr = ptr >>> 0;
|
|
317
|
-
const obj = Object.create(BatchSyncResponse.prototype);
|
|
318
|
-
obj.__wbg_ptr = ptr;
|
|
319
|
-
BatchSyncResponseFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
320
|
-
return obj;
|
|
321
|
-
}
|
|
322
|
-
__destroy_into_raw() {
|
|
323
|
-
const ptr = this.__wbg_ptr;
|
|
324
|
-
this.__wbg_ptr = 0;
|
|
325
|
-
BatchSyncResponseFinalization.unregister(this);
|
|
326
|
-
return ptr;
|
|
327
|
-
}
|
|
328
|
-
free() {
|
|
329
|
-
const ptr = this.__destroy_into_raw();
|
|
330
|
-
wasm.__wbg_batchsyncresponse_free(ptr, 0);
|
|
331
|
-
}
|
|
332
|
-
/**
|
|
333
|
-
* Upcasts; to the JS-import type for [`WasmBatchSyncResponse`].
|
|
334
|
-
* @returns {BatchSyncResponse}
|
|
335
|
-
*/
|
|
336
|
-
__wasm_refgen_toWasmBatchSyncResponse() {
|
|
337
|
-
const ret = wasm.batchsyncresponse___wasm_refgen_toWasmBatchSyncResponse(this.__wbg_ptr);
|
|
338
|
-
return BatchSyncResponse.__wrap(ret);
|
|
339
|
-
}
|
|
340
|
-
/**
|
|
341
|
-
* The sedimentree ID this response corresponds to.
|
|
342
|
-
* @returns {SedimentreeId}
|
|
343
|
-
*/
|
|
344
|
-
id() {
|
|
345
|
-
const ret = wasm.batchsyncresponse_id(this.__wbg_ptr);
|
|
346
|
-
return SedimentreeId.__wrap(ret);
|
|
347
|
-
}
|
|
348
|
-
/**
|
|
349
|
-
* The request ID this response corresponds to.
|
|
350
|
-
* @returns {RequestId}
|
|
351
|
-
*/
|
|
352
|
-
request_id() {
|
|
353
|
-
const ret = wasm.batchsyncresponse_request_id(this.__wbg_ptr);
|
|
354
|
-
return RequestId.__wrap(ret);
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
if (Symbol.dispose) BatchSyncResponse.prototype[Symbol.dispose] = BatchSyncResponse.prototype.free;
|
|
358
|
-
|
|
359
|
-
/**
|
|
360
|
-
* A Wasm wrapper around the [`BlobMeta`] type.
|
|
361
|
-
*/
|
|
362
|
-
export class BlobMeta {
|
|
363
|
-
static __wrap(ptr) {
|
|
364
|
-
ptr = ptr >>> 0;
|
|
365
|
-
const obj = Object.create(BlobMeta.prototype);
|
|
366
|
-
obj.__wbg_ptr = ptr;
|
|
367
|
-
BlobMetaFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
368
|
-
return obj;
|
|
369
|
-
}
|
|
370
|
-
__destroy_into_raw() {
|
|
371
|
-
const ptr = this.__wbg_ptr;
|
|
372
|
-
this.__wbg_ptr = 0;
|
|
373
|
-
BlobMetaFinalization.unregister(this);
|
|
374
|
-
return ptr;
|
|
375
|
-
}
|
|
376
|
-
free() {
|
|
377
|
-
const ptr = this.__destroy_into_raw();
|
|
378
|
-
wasm.__wbg_blobmeta_free(ptr, 0);
|
|
379
|
-
}
|
|
380
|
-
/**
|
|
381
|
-
* Get the digest of the blob.
|
|
382
|
-
* @returns {Digest}
|
|
383
|
-
*/
|
|
384
|
-
digest() {
|
|
385
|
-
const ret = wasm.blobmeta_digest(this.__wbg_ptr);
|
|
386
|
-
return Digest.__wrap(ret);
|
|
387
|
-
}
|
|
388
|
-
/**
|
|
389
|
-
* Create a `BlobMeta` from a digest and size.
|
|
390
|
-
*
|
|
391
|
-
* This is useful for deserialization when the original blob is not available.
|
|
392
|
-
* Since this is manual, the caller must ensure the digest and size are correct.
|
|
393
|
-
* @param {Digest} digest
|
|
394
|
-
* @param {bigint} size_bytes
|
|
395
|
-
* @returns {BlobMeta}
|
|
396
|
-
*/
|
|
397
|
-
static fromDigestSize(digest, size_bytes) {
|
|
398
|
-
_assertClass(digest, Digest);
|
|
399
|
-
const ret = wasm.blobmeta_fromDigestSize(digest.__wbg_ptr, size_bytes);
|
|
400
|
-
return BlobMeta.__wrap(ret);
|
|
401
|
-
}
|
|
402
|
-
/**
|
|
403
|
-
* Create a new `BlobMeta` from the given blob contents.
|
|
404
|
-
* @param {Uint8Array} blob
|
|
405
|
-
*/
|
|
406
|
-
constructor(blob) {
|
|
407
|
-
const ptr0 = passArray8ToWasm0(blob, wasm.__wbindgen_export);
|
|
408
|
-
const len0 = WASM_VECTOR_LEN;
|
|
409
|
-
const ret = wasm.blobmeta_new(ptr0, len0);
|
|
410
|
-
this.__wbg_ptr = ret >>> 0;
|
|
411
|
-
BlobMetaFinalization.register(this, this.__wbg_ptr, this);
|
|
412
|
-
return this;
|
|
413
|
-
}
|
|
414
|
-
/**
|
|
415
|
-
* Get the size of the blob in bytes.
|
|
416
|
-
* @returns {bigint}
|
|
417
|
-
*/
|
|
418
|
-
get sizeBytes() {
|
|
419
|
-
const ret = wasm.blobmeta_sizeBytes(this.__wbg_ptr);
|
|
420
|
-
return BigInt.asUintN(64, ret);
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
if (Symbol.dispose) BlobMeta.prototype[Symbol.dispose] = BlobMeta.prototype.free;
|
|
424
|
-
|
|
425
|
-
/**
|
|
426
|
-
* Wasm wrapper for call errors.
|
|
427
|
-
*/
|
|
428
|
-
export class CallError {
|
|
429
|
-
__destroy_into_raw() {
|
|
430
|
-
const ptr = this.__wbg_ptr;
|
|
431
|
-
this.__wbg_ptr = 0;
|
|
432
|
-
CallErrorFinalization.unregister(this);
|
|
433
|
-
return ptr;
|
|
434
|
-
}
|
|
435
|
-
free() {
|
|
436
|
-
const ptr = this.__destroy_into_raw();
|
|
437
|
-
wasm.__wbg_callerror_free(ptr, 0);
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
if (Symbol.dispose) CallError.prototype[Symbol.dispose] = CallError.prototype.free;
|
|
441
|
-
|
|
442
|
-
/**
|
|
443
|
-
* A commit stored with its associated blob.
|
|
444
|
-
*/
|
|
445
|
-
export class CommitWithBlob {
|
|
446
|
-
static __wrap(ptr) {
|
|
447
|
-
ptr = ptr >>> 0;
|
|
448
|
-
const obj = Object.create(CommitWithBlob.prototype);
|
|
449
|
-
obj.__wbg_ptr = ptr;
|
|
450
|
-
CommitWithBlobFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
451
|
-
return obj;
|
|
452
|
-
}
|
|
453
|
-
__destroy_into_raw() {
|
|
454
|
-
const ptr = this.__wbg_ptr;
|
|
455
|
-
this.__wbg_ptr = 0;
|
|
456
|
-
CommitWithBlobFinalization.unregister(this);
|
|
457
|
-
return ptr;
|
|
458
|
-
}
|
|
459
|
-
free() {
|
|
460
|
-
const ptr = this.__destroy_into_raw();
|
|
461
|
-
wasm.__wbg_commitwithblob_free(ptr, 0);
|
|
462
|
-
}
|
|
463
|
-
/**
|
|
464
|
-
* Upcasts; to the JS-import type for [`WasmCommitWithBlob`].
|
|
465
|
-
* @returns {CommitWithBlob}
|
|
466
|
-
*/
|
|
467
|
-
__wasm_refgen_toWasmCommitWithBlob() {
|
|
468
|
-
const ret = wasm.commitwithblob___wasm_refgen_toWasmCommitWithBlob(this.__wbg_ptr);
|
|
469
|
-
return CommitWithBlob.__wrap(ret);
|
|
470
|
-
}
|
|
471
|
-
/**
|
|
472
|
-
* Get the blob.
|
|
473
|
-
* @returns {Uint8Array}
|
|
474
|
-
*/
|
|
475
|
-
get blob() {
|
|
476
|
-
const ret = wasm.commitwithblob_blob(this.__wbg_ptr);
|
|
477
|
-
return ret;
|
|
478
|
-
}
|
|
479
|
-
/**
|
|
480
|
-
* Create a new commit with blob.
|
|
481
|
-
* @param {SignedLooseCommit} signed
|
|
482
|
-
* @param {Uint8Array} blob
|
|
483
|
-
*/
|
|
484
|
-
constructor(signed, blob) {
|
|
485
|
-
_assertClass(signed, SignedLooseCommit);
|
|
486
|
-
var ptr0 = signed.__destroy_into_raw();
|
|
487
|
-
const ret = wasm.commitwithblob_new(ptr0, blob);
|
|
488
|
-
this.__wbg_ptr = ret >>> 0;
|
|
489
|
-
CommitWithBlobFinalization.register(this, this.__wbg_ptr, this);
|
|
490
|
-
return this;
|
|
491
|
-
}
|
|
492
|
-
/**
|
|
493
|
-
* Get the signed commit.
|
|
494
|
-
* @returns {SignedLooseCommit}
|
|
495
|
-
*/
|
|
496
|
-
get signed() {
|
|
497
|
-
const ret = wasm.commitwithblob_signed(this.__wbg_ptr);
|
|
498
|
-
return SignedLooseCommit.__wrap(ret);
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
if (Symbol.dispose) CommitWithBlob.prototype[Symbol.dispose] = CommitWithBlob.prototype.free;
|
|
502
|
-
|
|
503
|
-
/**
|
|
504
|
-
* A JavaScript wrapper around `Depth`.
|
|
505
|
-
*/
|
|
506
|
-
export class Depth {
|
|
507
|
-
static __wrap(ptr) {
|
|
508
|
-
ptr = ptr >>> 0;
|
|
509
|
-
const obj = Object.create(Depth.prototype);
|
|
510
|
-
obj.__wbg_ptr = ptr;
|
|
511
|
-
DepthFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
512
|
-
return obj;
|
|
513
|
-
}
|
|
514
|
-
__destroy_into_raw() {
|
|
515
|
-
const ptr = this.__wbg_ptr;
|
|
516
|
-
this.__wbg_ptr = 0;
|
|
517
|
-
DepthFinalization.unregister(this);
|
|
518
|
-
return ptr;
|
|
519
|
-
}
|
|
520
|
-
free() {
|
|
521
|
-
const ptr = this.__destroy_into_raw();
|
|
522
|
-
wasm.__wbg_depth_free(ptr, 0);
|
|
523
|
-
}
|
|
524
|
-
/**
|
|
525
|
-
* Internal method for a hack crossing the JS boundary.
|
|
526
|
-
* @returns {Depth}
|
|
527
|
-
*/
|
|
528
|
-
__subduction_castToDepth() {
|
|
529
|
-
const ret = wasm.depth___subduction_castToDepth(this.__wbg_ptr);
|
|
530
|
-
return Depth.__wrap(ret);
|
|
531
|
-
}
|
|
532
|
-
/**
|
|
533
|
-
* Upcasts; to the JS-import type for [`WasmDepth`].
|
|
534
|
-
* @returns {Depth}
|
|
535
|
-
*/
|
|
536
|
-
__wasm_refgen_toWasmDepth() {
|
|
537
|
-
const ret = wasm.depth___wasm_refgen_toWasmDepth(this.__wbg_ptr);
|
|
538
|
-
return Depth.__wrap(ret);
|
|
539
|
-
}
|
|
540
|
-
/**
|
|
541
|
-
* Creates a new `WasmDepth` from a JavaScript value.
|
|
542
|
-
*
|
|
543
|
-
* # Errors
|
|
544
|
-
*
|
|
545
|
-
* Returns a `NotU32Error` if the JS value is not safely coercible to `u32`.
|
|
546
|
-
* @param {any} js_value
|
|
547
|
-
*/
|
|
548
|
-
constructor(js_value) {
|
|
549
|
-
const ret = wasm.depth_new(js_value);
|
|
550
|
-
if (ret[2]) {
|
|
551
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
552
|
-
}
|
|
553
|
-
this.__wbg_ptr = ret[0] >>> 0;
|
|
554
|
-
DepthFinalization.register(this, this.__wbg_ptr, this);
|
|
555
|
-
return this;
|
|
556
|
-
}
|
|
557
|
-
/**
|
|
558
|
-
* The depth value as an integer.
|
|
559
|
-
* @returns {number}
|
|
560
|
-
*/
|
|
561
|
-
get value() {
|
|
562
|
-
const ret = wasm.depth_value(this.__wbg_ptr);
|
|
563
|
-
return ret >>> 0;
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
if (Symbol.dispose) Depth.prototype[Symbol.dispose] = Depth.prototype.free;
|
|
567
|
-
|
|
568
|
-
/**
|
|
569
|
-
* A wrapper around digest bytes for use in JavaScript via wasm-bindgen.
|
|
570
|
-
*
|
|
571
|
-
* Since JavaScript doesn't have Rust's type system, this stores raw bytes
|
|
572
|
-
* and converts to/from typed `Digest<T>` at the Rust boundary.
|
|
573
|
-
*/
|
|
574
|
-
export class Digest {
|
|
575
|
-
static __wrap(ptr) {
|
|
576
|
-
ptr = ptr >>> 0;
|
|
577
|
-
const obj = Object.create(Digest.prototype);
|
|
578
|
-
obj.__wbg_ptr = ptr;
|
|
579
|
-
DigestFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
580
|
-
return obj;
|
|
581
|
-
}
|
|
582
|
-
static __unwrap(jsValue) {
|
|
583
|
-
if (!(jsValue instanceof Digest)) {
|
|
584
|
-
return 0;
|
|
585
|
-
}
|
|
586
|
-
return jsValue.__destroy_into_raw();
|
|
587
|
-
}
|
|
588
|
-
__destroy_into_raw() {
|
|
589
|
-
const ptr = this.__wbg_ptr;
|
|
590
|
-
this.__wbg_ptr = 0;
|
|
591
|
-
DigestFinalization.unregister(this);
|
|
592
|
-
return ptr;
|
|
593
|
-
}
|
|
594
|
-
free() {
|
|
595
|
-
const ptr = this.__destroy_into_raw();
|
|
596
|
-
wasm.__wbg_digest_free(ptr, 0);
|
|
597
|
-
}
|
|
598
|
-
/**
|
|
599
|
-
* Upcasts; to the JS-import type for [`WasmDigest`].
|
|
600
|
-
* @returns {Digest}
|
|
601
|
-
*/
|
|
602
|
-
__wasm_refgen_toWasmDigest() {
|
|
603
|
-
const ret = wasm.digest___wasm_refgen_toWasmDigest(this.__wbg_ptr);
|
|
604
|
-
return Digest.__wrap(ret);
|
|
605
|
-
}
|
|
606
|
-
/**
|
|
607
|
-
* Creates a new digest from its Base58 string representation.
|
|
608
|
-
*
|
|
609
|
-
* # Errors
|
|
610
|
-
*
|
|
611
|
-
* Returns a `WasmInvalidDigest` error if the string cannot be decoded or is not a valid digest.
|
|
612
|
-
* @param {string} s
|
|
613
|
-
* @returns {Digest}
|
|
614
|
-
*/
|
|
615
|
-
static fromBase58(s) {
|
|
616
|
-
const ptr0 = passStringToWasm0(s, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
617
|
-
const len0 = WASM_VECTOR_LEN;
|
|
618
|
-
const ret = wasm.digest_fromBase58(ptr0, len0);
|
|
619
|
-
if (ret[2]) {
|
|
620
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
621
|
-
}
|
|
622
|
-
return Digest.__wrap(ret[0]);
|
|
623
|
-
}
|
|
624
|
-
/**
|
|
625
|
-
* Creates a new digest from its byte representation.
|
|
626
|
-
*
|
|
627
|
-
* # Errors
|
|
628
|
-
*
|
|
629
|
-
* Returns a `WasmValue` error if the byte slice is not a valid digest.
|
|
630
|
-
* @param {Uint8Array} bytes
|
|
631
|
-
* @returns {Digest}
|
|
632
|
-
*/
|
|
633
|
-
static fromBytes(bytes) {
|
|
634
|
-
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
|
|
635
|
-
const len0 = WASM_VECTOR_LEN;
|
|
636
|
-
const ret = wasm.digest_fromBytes(ptr0, len0);
|
|
637
|
-
if (ret[2]) {
|
|
638
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
639
|
-
}
|
|
640
|
-
return Digest.__wrap(ret[0]);
|
|
641
|
-
}
|
|
642
|
-
/**
|
|
643
|
-
* Creates a new digest from its hexadecimal string representation.
|
|
644
|
-
*
|
|
645
|
-
* # Errors
|
|
646
|
-
*
|
|
647
|
-
* Returns a [`WasmInvalidDigest`] if the string is not a valid digest.
|
|
648
|
-
* @param {string} s
|
|
649
|
-
* @returns {Digest}
|
|
650
|
-
*/
|
|
651
|
-
static fromHexString(s) {
|
|
652
|
-
const ptr0 = passStringToWasm0(s, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
653
|
-
const len0 = WASM_VECTOR_LEN;
|
|
654
|
-
const ret = wasm.digest_fromHexString(ptr0, len0);
|
|
655
|
-
if (ret[2]) {
|
|
656
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
657
|
-
}
|
|
658
|
-
return Digest.__wrap(ret[0]);
|
|
659
|
-
}
|
|
660
|
-
/**
|
|
661
|
-
* Creates a new digest from its byte representation.
|
|
662
|
-
*
|
|
663
|
-
* # Errors
|
|
664
|
-
*
|
|
665
|
-
* Returns a `WasmValue` error if the byte slice is not a valid digest.
|
|
666
|
-
* @param {Uint8Array} bytes
|
|
667
|
-
*/
|
|
668
|
-
constructor(bytes) {
|
|
669
|
-
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
|
|
670
|
-
const len0 = WASM_VECTOR_LEN;
|
|
671
|
-
const ret = wasm.digest_new(ptr0, len0);
|
|
672
|
-
if (ret[2]) {
|
|
673
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
674
|
-
}
|
|
675
|
-
this.__wbg_ptr = ret[0] >>> 0;
|
|
676
|
-
DigestFinalization.register(this, this.__wbg_ptr, this);
|
|
677
|
-
return this;
|
|
678
|
-
}
|
|
679
|
-
/**
|
|
680
|
-
* Returns the byte representation of the digest.
|
|
681
|
-
* @returns {Uint8Array}
|
|
682
|
-
*/
|
|
683
|
-
toBytes() {
|
|
684
|
-
const ret = wasm.digest_toBytes(this.__wbg_ptr);
|
|
685
|
-
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
686
|
-
wasm.__wbindgen_export5(ret[0], ret[1] * 1, 1);
|
|
687
|
-
return v1;
|
|
688
|
-
}
|
|
689
|
-
/**
|
|
690
|
-
* Returns the hexadecimal string representation of the digest.
|
|
691
|
-
* @returns {string}
|
|
692
|
-
*/
|
|
693
|
-
toHexString() {
|
|
694
|
-
let deferred1_0;
|
|
695
|
-
let deferred1_1;
|
|
696
|
-
try {
|
|
697
|
-
const ret = wasm.digest_toHexString(this.__wbg_ptr);
|
|
698
|
-
deferred1_0 = ret[0];
|
|
699
|
-
deferred1_1 = ret[1];
|
|
700
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
701
|
-
} finally {
|
|
702
|
-
wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
|
|
703
|
-
}
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
if (Symbol.dispose) Digest.prototype[Symbol.dispose] = Digest.prototype.free;
|
|
707
|
-
|
|
708
|
-
/**
|
|
709
|
-
* A data fragment used in the Sedimentree system.
|
|
710
|
-
*/
|
|
711
|
-
export class Fragment {
|
|
712
|
-
static __wrap(ptr) {
|
|
713
|
-
ptr = ptr >>> 0;
|
|
714
|
-
const obj = Object.create(Fragment.prototype);
|
|
715
|
-
obj.__wbg_ptr = ptr;
|
|
716
|
-
FragmentFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
717
|
-
return obj;
|
|
718
|
-
}
|
|
719
|
-
__destroy_into_raw() {
|
|
720
|
-
const ptr = this.__wbg_ptr;
|
|
721
|
-
this.__wbg_ptr = 0;
|
|
722
|
-
FragmentFinalization.unregister(this);
|
|
723
|
-
return ptr;
|
|
724
|
-
}
|
|
725
|
-
free() {
|
|
726
|
-
const ptr = this.__destroy_into_raw();
|
|
727
|
-
wasm.__wbg_fragment_free(ptr, 0);
|
|
728
|
-
}
|
|
729
|
-
/**
|
|
730
|
-
* Upcasts; to the JS-import type for [`WasmFragment`].
|
|
731
|
-
* @returns {Fragment}
|
|
732
|
-
*/
|
|
733
|
-
__wasm_refgen_toWasmFragment() {
|
|
734
|
-
const ret = wasm.fragment___wasm_refgen_toWasmFragment(this.__wbg_ptr);
|
|
735
|
-
return Fragment.__wrap(ret);
|
|
736
|
-
}
|
|
737
|
-
/**
|
|
738
|
-
* Get the blob metadata of the fragment.
|
|
739
|
-
* @returns {BlobMeta}
|
|
740
|
-
*/
|
|
741
|
-
get blobMeta() {
|
|
742
|
-
const ret = wasm.fragment_blobMeta(this.__wbg_ptr);
|
|
743
|
-
return BlobMeta.__wrap(ret);
|
|
744
|
-
}
|
|
745
|
-
/**
|
|
746
|
-
* Get the boundary digests of the fragment.
|
|
747
|
-
* @returns {Digest[]}
|
|
748
|
-
*/
|
|
749
|
-
get boundary() {
|
|
750
|
-
const ret = wasm.fragment_boundary(this.__wbg_ptr);
|
|
751
|
-
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
752
|
-
wasm.__wbindgen_export5(ret[0], ret[1] * 4, 4);
|
|
753
|
-
return v1;
|
|
754
|
-
}
|
|
755
|
-
/**
|
|
756
|
-
* Get the head digest of the fragment.
|
|
757
|
-
* @returns {Digest}
|
|
758
|
-
*/
|
|
759
|
-
get head() {
|
|
760
|
-
const ret = wasm.fragment_head(this.__wbg_ptr);
|
|
761
|
-
return Digest.__wrap(ret);
|
|
762
|
-
}
|
|
763
|
-
/**
|
|
764
|
-
* Create a new fragment from the given sedimentree ID, head, boundary, checkpoints, and blob metadata.
|
|
765
|
-
* @param {SedimentreeId} sedimentree_id
|
|
766
|
-
* @param {Digest} head
|
|
767
|
-
* @param {Digest[]} boundary
|
|
768
|
-
* @param {Digest[]} checkpoints
|
|
769
|
-
* @param {BlobMeta} blob_meta
|
|
770
|
-
*/
|
|
771
|
-
constructor(sedimentree_id, head, boundary, checkpoints, blob_meta) {
|
|
772
|
-
_assertClass(sedimentree_id, SedimentreeId);
|
|
773
|
-
var ptr0 = sedimentree_id.__destroy_into_raw();
|
|
774
|
-
_assertClass(head, Digest);
|
|
775
|
-
var ptr1 = head.__destroy_into_raw();
|
|
776
|
-
const ptr2 = passArrayJsValueToWasm0(boundary, wasm.__wbindgen_export);
|
|
777
|
-
const len2 = WASM_VECTOR_LEN;
|
|
778
|
-
const ptr3 = passArrayJsValueToWasm0(checkpoints, wasm.__wbindgen_export);
|
|
779
|
-
const len3 = WASM_VECTOR_LEN;
|
|
780
|
-
_assertClass(blob_meta, BlobMeta);
|
|
781
|
-
var ptr4 = blob_meta.__destroy_into_raw();
|
|
782
|
-
const ret = wasm.fragment_new(ptr0, ptr1, ptr2, len2, ptr3, len3, ptr4);
|
|
783
|
-
this.__wbg_ptr = ret >>> 0;
|
|
784
|
-
FragmentFinalization.register(this, this.__wbg_ptr, this);
|
|
785
|
-
return this;
|
|
786
|
-
}
|
|
787
|
-
}
|
|
788
|
-
if (Symbol.dispose) Fragment.prototype[Symbol.dispose] = Fragment.prototype.free;
|
|
789
|
-
|
|
790
|
-
/**
|
|
791
|
-
* A request for a specific fragment in the Sedimentree system.
|
|
792
|
-
*/
|
|
793
|
-
export class FragmentRequested {
|
|
794
|
-
static __wrap(ptr) {
|
|
795
|
-
ptr = ptr >>> 0;
|
|
796
|
-
const obj = Object.create(FragmentRequested.prototype);
|
|
797
|
-
obj.__wbg_ptr = ptr;
|
|
798
|
-
FragmentRequestedFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
799
|
-
return obj;
|
|
800
|
-
}
|
|
801
|
-
__destroy_into_raw() {
|
|
802
|
-
const ptr = this.__wbg_ptr;
|
|
803
|
-
this.__wbg_ptr = 0;
|
|
804
|
-
FragmentRequestedFinalization.unregister(this);
|
|
805
|
-
return ptr;
|
|
806
|
-
}
|
|
807
|
-
free() {
|
|
808
|
-
const ptr = this.__destroy_into_raw();
|
|
809
|
-
wasm.__wbg_fragmentrequested_free(ptr, 0);
|
|
810
|
-
}
|
|
811
|
-
/**
|
|
812
|
-
* Get the depth of the requested fragment.
|
|
813
|
-
* @returns {Depth}
|
|
814
|
-
*/
|
|
815
|
-
get depth() {
|
|
816
|
-
const ret = wasm.fragmentrequested_depth(this.__wbg_ptr);
|
|
817
|
-
return Depth.__wrap(ret);
|
|
818
|
-
}
|
|
819
|
-
/**
|
|
820
|
-
* Get the digest of the requested fragment.
|
|
821
|
-
* @returns {Digest}
|
|
822
|
-
*/
|
|
823
|
-
get head() {
|
|
824
|
-
const ret = wasm.fragmentrequested_head(this.__wbg_ptr);
|
|
825
|
-
return Digest.__wrap(ret);
|
|
826
|
-
}
|
|
827
|
-
/**
|
|
828
|
-
* Create a new fragment request from the given digest.
|
|
829
|
-
* @param {Digest} digest
|
|
830
|
-
* @param {Depth} depth
|
|
831
|
-
*/
|
|
832
|
-
constructor(digest, depth) {
|
|
833
|
-
_assertClass(digest, Digest);
|
|
834
|
-
_assertClass(depth, Depth);
|
|
835
|
-
const ret = wasm.fragmentrequested_new(digest.__wbg_ptr, depth.__wbg_ptr);
|
|
836
|
-
this.__wbg_ptr = ret >>> 0;
|
|
837
|
-
FragmentRequestedFinalization.register(this, this.__wbg_ptr, this);
|
|
838
|
-
return this;
|
|
839
|
-
}
|
|
840
|
-
}
|
|
841
|
-
if (Symbol.dispose) FragmentRequested.prototype[Symbol.dispose] = FragmentRequested.prototype.free;
|
|
842
|
-
|
|
843
|
-
/**
|
|
844
|
-
* A fragment stored with its associated blob.
|
|
845
|
-
*/
|
|
846
|
-
export class FragmentWithBlob {
|
|
847
|
-
static __wrap(ptr) {
|
|
848
|
-
ptr = ptr >>> 0;
|
|
849
|
-
const obj = Object.create(FragmentWithBlob.prototype);
|
|
850
|
-
obj.__wbg_ptr = ptr;
|
|
851
|
-
FragmentWithBlobFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
852
|
-
return obj;
|
|
853
|
-
}
|
|
854
|
-
__destroy_into_raw() {
|
|
855
|
-
const ptr = this.__wbg_ptr;
|
|
856
|
-
this.__wbg_ptr = 0;
|
|
857
|
-
FragmentWithBlobFinalization.unregister(this);
|
|
858
|
-
return ptr;
|
|
859
|
-
}
|
|
860
|
-
free() {
|
|
861
|
-
const ptr = this.__destroy_into_raw();
|
|
862
|
-
wasm.__wbg_fragmentwithblob_free(ptr, 0);
|
|
863
|
-
}
|
|
864
|
-
/**
|
|
865
|
-
* Upcasts; to the JS-import type for [`WasmFragmentWithBlob`].
|
|
866
|
-
* @returns {FragmentWithBlob}
|
|
867
|
-
*/
|
|
868
|
-
__wasm_refgen_toWasmFragmentWithBlob() {
|
|
869
|
-
const ret = wasm.fragmentwithblob___wasm_refgen_toWasmFragmentWithBlob(this.__wbg_ptr);
|
|
870
|
-
return FragmentWithBlob.__wrap(ret);
|
|
871
|
-
}
|
|
872
|
-
/**
|
|
873
|
-
* Get the blob.
|
|
874
|
-
* @returns {Uint8Array}
|
|
875
|
-
*/
|
|
876
|
-
get blob() {
|
|
877
|
-
const ret = wasm.fragmentwithblob_blob(this.__wbg_ptr);
|
|
878
|
-
return ret;
|
|
879
|
-
}
|
|
880
|
-
/**
|
|
881
|
-
* Create a new fragment with blob.
|
|
882
|
-
* @param {SignedFragment} signed
|
|
883
|
-
* @param {Uint8Array} blob
|
|
884
|
-
*/
|
|
885
|
-
constructor(signed, blob) {
|
|
886
|
-
_assertClass(signed, SignedFragment);
|
|
887
|
-
var ptr0 = signed.__destroy_into_raw();
|
|
888
|
-
const ret = wasm.fragmentwithblob_new(ptr0, blob);
|
|
889
|
-
this.__wbg_ptr = ret >>> 0;
|
|
890
|
-
FragmentWithBlobFinalization.register(this, this.__wbg_ptr, this);
|
|
891
|
-
return this;
|
|
892
|
-
}
|
|
893
|
-
/**
|
|
894
|
-
* Get the signed fragment.
|
|
895
|
-
* @returns {SignedFragment}
|
|
896
|
-
*/
|
|
897
|
-
get signed() {
|
|
898
|
-
const ret = wasm.fragmentwithblob_signed(this.__wbg_ptr);
|
|
899
|
-
return SignedFragment.__wrap(ret);
|
|
900
|
-
}
|
|
901
|
-
}
|
|
902
|
-
if (Symbol.dispose) FragmentWithBlob.prototype[Symbol.dispose] = FragmentWithBlob.prototype.free;
|
|
903
|
-
|
|
904
|
-
export class FragmentsArray {
|
|
905
|
-
static __wrap(ptr) {
|
|
906
|
-
ptr = ptr >>> 0;
|
|
907
|
-
const obj = Object.create(FragmentsArray.prototype);
|
|
908
|
-
obj.__wbg_ptr = ptr;
|
|
909
|
-
FragmentsArrayFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
910
|
-
return obj;
|
|
911
|
-
}
|
|
912
|
-
__destroy_into_raw() {
|
|
913
|
-
const ptr = this.__wbg_ptr;
|
|
914
|
-
this.__wbg_ptr = 0;
|
|
915
|
-
FragmentsArrayFinalization.unregister(this);
|
|
916
|
-
return ptr;
|
|
917
|
-
}
|
|
918
|
-
free() {
|
|
919
|
-
const ptr = this.__destroy_into_raw();
|
|
920
|
-
wasm.__wbg_fragmentsarray_free(ptr, 0);
|
|
921
|
-
}
|
|
922
|
-
/**
|
|
923
|
-
* Upcasts; to the JS-import type for [`WasmFragmentsArray`].
|
|
924
|
-
* @returns {FragmentsArray}
|
|
925
|
-
*/
|
|
926
|
-
__wasm_refgen_toWasmFragmentsArray() {
|
|
927
|
-
const ret = wasm.fragmentsarray___wasm_refgen_toWasmFragmentsArray(this.__wbg_ptr);
|
|
928
|
-
return FragmentsArray.__wrap(ret);
|
|
929
|
-
}
|
|
930
|
-
}
|
|
931
|
-
if (Symbol.dispose) FragmentsArray.prototype[Symbol.dispose] = FragmentsArray.prototype.free;
|
|
932
|
-
|
|
933
|
-
/**
|
|
934
|
-
* An overridable hash metric.
|
|
935
|
-
*/
|
|
936
|
-
export class HashMetric {
|
|
937
|
-
__destroy_into_raw() {
|
|
938
|
-
const ptr = this.__wbg_ptr;
|
|
939
|
-
this.__wbg_ptr = 0;
|
|
940
|
-
HashMetricFinalization.unregister(this);
|
|
941
|
-
return ptr;
|
|
942
|
-
}
|
|
943
|
-
free() {
|
|
944
|
-
const ptr = this.__destroy_into_raw();
|
|
945
|
-
wasm.__wbg_hashmetric_free(ptr, 0);
|
|
946
|
-
}
|
|
947
|
-
/**
|
|
948
|
-
* Create a new `WasmHashMetric` with an optional JavaScript function.
|
|
949
|
-
*
|
|
950
|
-
* Defaults to counting leading zero bytes if no function is provided.
|
|
951
|
-
* @param {Function | null} [func]
|
|
952
|
-
*/
|
|
953
|
-
constructor(func) {
|
|
954
|
-
const ret = wasm.hashmetric_new(isLikeNone(func) ? 0 : addToExternrefTable0(func));
|
|
955
|
-
this.__wbg_ptr = ret >>> 0;
|
|
956
|
-
HashMetricFinalization.register(this, this.__wbg_ptr, this);
|
|
957
|
-
return this;
|
|
958
|
-
}
|
|
959
|
-
}
|
|
960
|
-
if (Symbol.dispose) HashMetric.prototype[Symbol.dispose] = HashMetric.prototype.free;
|
|
961
|
-
|
|
962
|
-
/**
|
|
963
|
-
* A Wasm wrapper around the [`LooseCommit`] type.
|
|
964
|
-
*/
|
|
965
|
-
export class LooseCommit {
|
|
966
|
-
static __wrap(ptr) {
|
|
967
|
-
ptr = ptr >>> 0;
|
|
968
|
-
const obj = Object.create(LooseCommit.prototype);
|
|
969
|
-
obj.__wbg_ptr = ptr;
|
|
970
|
-
LooseCommitFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
971
|
-
return obj;
|
|
972
|
-
}
|
|
973
|
-
__destroy_into_raw() {
|
|
974
|
-
const ptr = this.__wbg_ptr;
|
|
975
|
-
this.__wbg_ptr = 0;
|
|
976
|
-
LooseCommitFinalization.unregister(this);
|
|
977
|
-
return ptr;
|
|
978
|
-
}
|
|
979
|
-
free() {
|
|
980
|
-
const ptr = this.__destroy_into_raw();
|
|
981
|
-
wasm.__wbg_loosecommit_free(ptr, 0);
|
|
982
|
-
}
|
|
983
|
-
/**
|
|
984
|
-
* Upcasts; to the JS-import type for [`WasmLooseCommit`].
|
|
985
|
-
* @returns {LooseCommit}
|
|
986
|
-
*/
|
|
987
|
-
__wasm_refgen_toWasmLooseCommit() {
|
|
988
|
-
const ret = wasm.loosecommit___wasm_refgen_toWasmLooseCommit(this.__wbg_ptr);
|
|
989
|
-
return LooseCommit.__wrap(ret);
|
|
990
|
-
}
|
|
991
|
-
/**
|
|
992
|
-
* Get the blob metadata of the commit.
|
|
993
|
-
* @returns {BlobMeta}
|
|
994
|
-
*/
|
|
995
|
-
get blobMeta() {
|
|
996
|
-
const ret = wasm.loosecommit_blobMeta(this.__wbg_ptr);
|
|
997
|
-
return BlobMeta.__wrap(ret);
|
|
998
|
-
}
|
|
999
|
-
/**
|
|
1000
|
-
* Get the digest of the commit.
|
|
1001
|
-
* @returns {Digest}
|
|
1002
|
-
*/
|
|
1003
|
-
get digest() {
|
|
1004
|
-
const ret = wasm.loosecommit_digest(this.__wbg_ptr);
|
|
1005
|
-
return Digest.__wrap(ret);
|
|
1006
|
-
}
|
|
1007
|
-
/**
|
|
1008
|
-
* Create a new `LooseCommit` from the given sedimentree ID, parents, and blob metadata.
|
|
1009
|
-
* @param {SedimentreeId} sedimentree_id
|
|
1010
|
-
* @param {Digest[]} parents
|
|
1011
|
-
* @param {BlobMeta} blob_meta
|
|
1012
|
-
*/
|
|
1013
|
-
constructor(sedimentree_id, parents, blob_meta) {
|
|
1014
|
-
_assertClass(sedimentree_id, SedimentreeId);
|
|
1015
|
-
var ptr0 = sedimentree_id.__destroy_into_raw();
|
|
1016
|
-
const ptr1 = passArrayJsValueToWasm0(parents, wasm.__wbindgen_export);
|
|
1017
|
-
const len1 = WASM_VECTOR_LEN;
|
|
1018
|
-
_assertClass(blob_meta, BlobMeta);
|
|
1019
|
-
const ret = wasm.loosecommit_new(ptr0, ptr1, len1, blob_meta.__wbg_ptr);
|
|
1020
|
-
this.__wbg_ptr = ret >>> 0;
|
|
1021
|
-
LooseCommitFinalization.register(this, this.__wbg_ptr, this);
|
|
1022
|
-
return this;
|
|
1023
|
-
}
|
|
1024
|
-
/**
|
|
1025
|
-
* Get the parent digests of the commit.
|
|
1026
|
-
* @returns {Digest[]}
|
|
1027
|
-
*/
|
|
1028
|
-
get parents() {
|
|
1029
|
-
const ret = wasm.loosecommit_parents(this.__wbg_ptr);
|
|
1030
|
-
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
1031
|
-
wasm.__wbindgen_export5(ret[0], ret[1] * 4, 4);
|
|
1032
|
-
return v1;
|
|
1033
|
-
}
|
|
1034
|
-
}
|
|
1035
|
-
if (Symbol.dispose) LooseCommit.prototype[Symbol.dispose] = LooseCommit.prototype.free;
|
|
1036
|
-
|
|
1037
|
-
/**
|
|
1038
|
-
* An in-memory Ed25519 signer exposed to JavaScript.
|
|
1039
|
-
*
|
|
1040
|
-
* Implements the `Signer` interface (`sign` / `verifyingKey`) so it can be
|
|
1041
|
-
* passed anywhere a [`JsSigner`](crate::signer::JsSigner) is expected.
|
|
1042
|
-
*
|
|
1043
|
-
* # Example
|
|
1044
|
-
*
|
|
1045
|
-
* ```javascript
|
|
1046
|
-
* import { MemorySigner } from "@automerge/subduction";
|
|
1047
|
-
*
|
|
1048
|
-
* const signer = MemorySigner.generate();
|
|
1049
|
-
* console.log("Peer ID:", signer.peerId().toString());
|
|
1050
|
-
* ```
|
|
1051
|
-
*/
|
|
1052
|
-
export class MemorySigner {
|
|
1053
|
-
static __wrap(ptr) {
|
|
1054
|
-
ptr = ptr >>> 0;
|
|
1055
|
-
const obj = Object.create(MemorySigner.prototype);
|
|
1056
|
-
obj.__wbg_ptr = ptr;
|
|
1057
|
-
MemorySignerFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1058
|
-
return obj;
|
|
1059
|
-
}
|
|
1060
|
-
__destroy_into_raw() {
|
|
1061
|
-
const ptr = this.__wbg_ptr;
|
|
1062
|
-
this.__wbg_ptr = 0;
|
|
1063
|
-
MemorySignerFinalization.unregister(this);
|
|
1064
|
-
return ptr;
|
|
1065
|
-
}
|
|
1066
|
-
free() {
|
|
1067
|
-
const ptr = this.__destroy_into_raw();
|
|
1068
|
-
wasm.__wbg_memorysigner_free(ptr, 0);
|
|
1069
|
-
}
|
|
1070
|
-
/**
|
|
1071
|
-
* Create a signer from raw 32-byte Ed25519 secret key bytes.
|
|
1072
|
-
*
|
|
1073
|
-
* # Errors
|
|
1074
|
-
*
|
|
1075
|
-
* Returns an error if `bytes` is not exactly 32 bytes.
|
|
1076
|
-
* @param {Uint8Array} bytes
|
|
1077
|
-
* @returns {MemorySigner}
|
|
1078
|
-
*/
|
|
1079
|
-
static fromBytes(bytes) {
|
|
1080
|
-
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
|
|
1081
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1082
|
-
const ret = wasm.memorysigner_fromBytes(ptr0, len0);
|
|
1083
|
-
if (ret[2]) {
|
|
1084
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
1085
|
-
}
|
|
1086
|
-
return MemorySigner.__wrap(ret[0]);
|
|
1087
|
-
}
|
|
1088
|
-
/**
|
|
1089
|
-
* Create a new signer with a randomly generated Ed25519 key.
|
|
1090
|
-
*
|
|
1091
|
-
* # Panics
|
|
1092
|
-
*
|
|
1093
|
-
* Panics if the system random number generator fails.
|
|
1094
|
-
* @returns {MemorySigner}
|
|
1095
|
-
*/
|
|
1096
|
-
static generate() {
|
|
1097
|
-
const ret = wasm.memorysigner_generate();
|
|
1098
|
-
return MemorySigner.__wrap(ret);
|
|
1099
|
-
}
|
|
1100
|
-
/**
|
|
1101
|
-
* Create a new signer with a randomly generated Ed25519 key.
|
|
1102
|
-
*
|
|
1103
|
-
* This is the JS constructor (`new MemorySigner()`), equivalent to
|
|
1104
|
-
* [`generate`](Self::generate).
|
|
1105
|
-
*
|
|
1106
|
-
* # Panics
|
|
1107
|
-
*
|
|
1108
|
-
* Panics if the system random number generator fails.
|
|
1109
|
-
*/
|
|
1110
|
-
constructor() {
|
|
1111
|
-
const ret = wasm.memorysigner_new();
|
|
1112
|
-
this.__wbg_ptr = ret >>> 0;
|
|
1113
|
-
MemorySignerFinalization.register(this, this.__wbg_ptr, this);
|
|
1114
|
-
return this;
|
|
1115
|
-
}
|
|
1116
|
-
/**
|
|
1117
|
-
* Get the peer ID derived from this signer's verifying key.
|
|
1118
|
-
* @returns {PeerId}
|
|
1119
|
-
*/
|
|
1120
|
-
peerId() {
|
|
1121
|
-
const ret = wasm.memorysigner_peerId(this.__wbg_ptr);
|
|
1122
|
-
return PeerId.__wrap(ret);
|
|
1123
|
-
}
|
|
1124
|
-
/**
|
|
1125
|
-
* Sign a message and return the 64-byte Ed25519 signature as a `Uint8Array`.
|
|
1126
|
-
*
|
|
1127
|
-
* This fulfils the `Signer.sign(message)` interface contract.
|
|
1128
|
-
* Returns a `Promise<Uint8Array>` for consistency with the async signer interface.
|
|
1129
|
-
* @param {Uint8Array} message
|
|
1130
|
-
* @returns {Promise<Uint8Array>}
|
|
1131
|
-
*/
|
|
1132
|
-
sign(message) {
|
|
1133
|
-
const ptr0 = passArray8ToWasm0(message, wasm.__wbindgen_export);
|
|
1134
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1135
|
-
const ret = wasm.memorysigner_sign(this.__wbg_ptr, ptr0, len0);
|
|
1136
|
-
return ret;
|
|
1137
|
-
}
|
|
1138
|
-
/**
|
|
1139
|
-
* Get the 32-byte Ed25519 verifying (public) key as a `Uint8Array`.
|
|
1140
|
-
*
|
|
1141
|
-
* This fulfils the `Signer.verifyingKey()` interface contract.
|
|
1142
|
-
* @returns {Uint8Array}
|
|
1143
|
-
*/
|
|
1144
|
-
verifyingKey() {
|
|
1145
|
-
const ret = wasm.memorysigner_verifyingKey(this.__wbg_ptr);
|
|
1146
|
-
return ret;
|
|
1147
|
-
}
|
|
1148
|
-
}
|
|
1149
|
-
if (Symbol.dispose) MemorySigner.prototype[Symbol.dispose] = MemorySigner.prototype.free;
|
|
1150
|
-
|
|
1151
|
-
/**
|
|
1152
|
-
* An in-memory storage implementation for use in tests and development.
|
|
1153
|
-
*
|
|
1154
|
-
* This wraps the core `MemoryStorage` and exposes it via the `SedimentreeStorage` interface.
|
|
1155
|
-
*/
|
|
1156
|
-
export class MemoryStorage {
|
|
1157
|
-
__destroy_into_raw() {
|
|
1158
|
-
const ptr = this.__wbg_ptr;
|
|
1159
|
-
this.__wbg_ptr = 0;
|
|
1160
|
-
MemoryStorageFinalization.unregister(this);
|
|
1161
|
-
return ptr;
|
|
1162
|
-
}
|
|
1163
|
-
free() {
|
|
1164
|
-
const ptr = this.__destroy_into_raw();
|
|
1165
|
-
wasm.__wbg_memorystorage_free(ptr, 0);
|
|
1166
|
-
}
|
|
1167
|
-
/**
|
|
1168
|
-
* Delete all commits for a sedimentree.
|
|
1169
|
-
* @param {SedimentreeId} sedimentree_id
|
|
1170
|
-
* @returns {Promise<any>}
|
|
1171
|
-
*/
|
|
1172
|
-
deleteAllCommits(sedimentree_id) {
|
|
1173
|
-
_assertClass(sedimentree_id, SedimentreeId);
|
|
1174
|
-
const ret = wasm.memorystorage_deleteAllCommits(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
|
|
1175
|
-
return ret;
|
|
1176
|
-
}
|
|
1177
|
-
/**
|
|
1178
|
-
* Delete all fragments for a sedimentree.
|
|
1179
|
-
* @param {SedimentreeId} sedimentree_id
|
|
1180
|
-
* @returns {Promise<any>}
|
|
1181
|
-
*/
|
|
1182
|
-
deleteAllFragments(sedimentree_id) {
|
|
1183
|
-
_assertClass(sedimentree_id, SedimentreeId);
|
|
1184
|
-
const ret = wasm.memorystorage_deleteAllFragments(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
|
|
1185
|
-
return ret;
|
|
1186
|
-
}
|
|
1187
|
-
/**
|
|
1188
|
-
* Delete a commit by digest.
|
|
1189
|
-
* @param {SedimentreeId} sedimentree_id
|
|
1190
|
-
* @param {Digest} digest
|
|
1191
|
-
* @returns {Promise<any>}
|
|
1192
|
-
*/
|
|
1193
|
-
deleteCommit(sedimentree_id, digest) {
|
|
1194
|
-
_assertClass(sedimentree_id, SedimentreeId);
|
|
1195
|
-
_assertClass(digest, Digest);
|
|
1196
|
-
const ret = wasm.memorystorage_deleteCommit(this.__wbg_ptr, sedimentree_id.__wbg_ptr, digest.__wbg_ptr);
|
|
1197
|
-
return ret;
|
|
1198
|
-
}
|
|
1199
|
-
/**
|
|
1200
|
-
* Delete a fragment by digest.
|
|
1201
|
-
* @param {SedimentreeId} sedimentree_id
|
|
1202
|
-
* @param {Digest} digest
|
|
1203
|
-
* @returns {Promise<any>}
|
|
1204
|
-
*/
|
|
1205
|
-
deleteFragment(sedimentree_id, digest) {
|
|
1206
|
-
_assertClass(sedimentree_id, SedimentreeId);
|
|
1207
|
-
_assertClass(digest, Digest);
|
|
1208
|
-
const ret = wasm.memorystorage_deleteFragment(this.__wbg_ptr, sedimentree_id.__wbg_ptr, digest.__wbg_ptr);
|
|
1209
|
-
return ret;
|
|
1210
|
-
}
|
|
1211
|
-
/**
|
|
1212
|
-
* Delete a sedimentree ID.
|
|
1213
|
-
* @param {SedimentreeId} sedimentree_id
|
|
1214
|
-
* @returns {Promise<any>}
|
|
1215
|
-
*/
|
|
1216
|
-
deleteSedimentreeId(sedimentree_id) {
|
|
1217
|
-
_assertClass(sedimentree_id, SedimentreeId);
|
|
1218
|
-
const ret = wasm.memorystorage_deleteSedimentreeId(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
|
|
1219
|
-
return ret;
|
|
1220
|
-
}
|
|
1221
|
-
/**
|
|
1222
|
-
* List all commit digests for a sedimentree.
|
|
1223
|
-
* @param {SedimentreeId} sedimentree_id
|
|
1224
|
-
* @returns {Promise<any>}
|
|
1225
|
-
*/
|
|
1226
|
-
listCommitDigests(sedimentree_id) {
|
|
1227
|
-
_assertClass(sedimentree_id, SedimentreeId);
|
|
1228
|
-
const ret = wasm.memorystorage_listCommitDigests(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
|
|
1229
|
-
return ret;
|
|
1230
|
-
}
|
|
1231
|
-
/**
|
|
1232
|
-
* List all fragment digests for a sedimentree.
|
|
1233
|
-
* @param {SedimentreeId} sedimentree_id
|
|
1234
|
-
* @returns {Promise<any>}
|
|
1235
|
-
*/
|
|
1236
|
-
listFragmentDigests(sedimentree_id) {
|
|
1237
|
-
_assertClass(sedimentree_id, SedimentreeId);
|
|
1238
|
-
const ret = wasm.memorystorage_listFragmentDigests(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
|
|
1239
|
-
return ret;
|
|
1240
|
-
}
|
|
1241
|
-
/**
|
|
1242
|
-
* Load all commits for a sedimentree, returning `CommitWithBlob[]`.
|
|
1243
|
-
* @param {SedimentreeId} sedimentree_id
|
|
1244
|
-
* @returns {Promise<any>}
|
|
1245
|
-
*/
|
|
1246
|
-
loadAllCommits(sedimentree_id) {
|
|
1247
|
-
_assertClass(sedimentree_id, SedimentreeId);
|
|
1248
|
-
const ret = wasm.memorystorage_loadAllCommits(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
|
|
1249
|
-
return ret;
|
|
1250
|
-
}
|
|
1251
|
-
/**
|
|
1252
|
-
* Load all fragments for a sedimentree, returning `FragmentWithBlob[]`.
|
|
1253
|
-
* @param {SedimentreeId} sedimentree_id
|
|
1254
|
-
* @returns {Promise<any>}
|
|
1255
|
-
*/
|
|
1256
|
-
loadAllFragments(sedimentree_id) {
|
|
1257
|
-
_assertClass(sedimentree_id, SedimentreeId);
|
|
1258
|
-
const ret = wasm.memorystorage_loadAllFragments(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
|
|
1259
|
-
return ret;
|
|
1260
|
-
}
|
|
1261
|
-
/**
|
|
1262
|
-
* Load all sedimentree IDs.
|
|
1263
|
-
* @returns {Promise<any>}
|
|
1264
|
-
*/
|
|
1265
|
-
loadAllSedimentreeIds() {
|
|
1266
|
-
const ret = wasm.memorystorage_loadAllSedimentreeIds(this.__wbg_ptr);
|
|
1267
|
-
return ret;
|
|
1268
|
-
}
|
|
1269
|
-
/**
|
|
1270
|
-
* Load a commit by digest, returning `CommitWithBlob` or null.
|
|
1271
|
-
* @param {SedimentreeId} sedimentree_id
|
|
1272
|
-
* @param {Digest} digest
|
|
1273
|
-
* @returns {Promise<any>}
|
|
1274
|
-
*/
|
|
1275
|
-
loadCommit(sedimentree_id, digest) {
|
|
1276
|
-
_assertClass(sedimentree_id, SedimentreeId);
|
|
1277
|
-
_assertClass(digest, Digest);
|
|
1278
|
-
const ret = wasm.memorystorage_loadCommit(this.__wbg_ptr, sedimentree_id.__wbg_ptr, digest.__wbg_ptr);
|
|
1279
|
-
return ret;
|
|
1280
|
-
}
|
|
1281
|
-
/**
|
|
1282
|
-
* Load a fragment by digest, returning `FragmentWithBlob` or null.
|
|
1283
|
-
* @param {SedimentreeId} sedimentree_id
|
|
1284
|
-
* @param {Digest} digest
|
|
1285
|
-
* @returns {Promise<any>}
|
|
1286
|
-
*/
|
|
1287
|
-
loadFragment(sedimentree_id, digest) {
|
|
1288
|
-
_assertClass(sedimentree_id, SedimentreeId);
|
|
1289
|
-
_assertClass(digest, Digest);
|
|
1290
|
-
const ret = wasm.memorystorage_loadFragment(this.__wbg_ptr, sedimentree_id.__wbg_ptr, digest.__wbg_ptr);
|
|
1291
|
-
return ret;
|
|
1292
|
-
}
|
|
1293
|
-
/**
|
|
1294
|
-
* Create a new in-memory storage instance.
|
|
1295
|
-
*/
|
|
1296
|
-
constructor() {
|
|
1297
|
-
const ret = wasm.memorystorage_new();
|
|
1298
|
-
this.__wbg_ptr = ret >>> 0;
|
|
1299
|
-
MemoryStorageFinalization.register(this, this.__wbg_ptr, this);
|
|
1300
|
-
return this;
|
|
1301
|
-
}
|
|
1302
|
-
/**
|
|
1303
|
-
* Save a commit with its blob.
|
|
1304
|
-
* @param {SedimentreeId} sedimentree_id
|
|
1305
|
-
* @param {Digest} _digest
|
|
1306
|
-
* @param {SignedLooseCommit} signed_commit
|
|
1307
|
-
* @param {Uint8Array} blob
|
|
1308
|
-
* @returns {Promise<any>}
|
|
1309
|
-
*/
|
|
1310
|
-
saveCommit(sedimentree_id, _digest, signed_commit, blob) {
|
|
1311
|
-
_assertClass(sedimentree_id, SedimentreeId);
|
|
1312
|
-
_assertClass(_digest, Digest);
|
|
1313
|
-
_assertClass(signed_commit, SignedLooseCommit);
|
|
1314
|
-
const ret = wasm.memorystorage_saveCommit(this.__wbg_ptr, sedimentree_id.__wbg_ptr, _digest.__wbg_ptr, signed_commit.__wbg_ptr, blob);
|
|
1315
|
-
return ret;
|
|
1316
|
-
}
|
|
1317
|
-
/**
|
|
1318
|
-
* Save a fragment with its blob.
|
|
1319
|
-
* @param {SedimentreeId} sedimentree_id
|
|
1320
|
-
* @param {Digest} _digest
|
|
1321
|
-
* @param {SignedFragment} signed_fragment
|
|
1322
|
-
* @param {Uint8Array} blob
|
|
1323
|
-
* @returns {Promise<any>}
|
|
1324
|
-
*/
|
|
1325
|
-
saveFragment(sedimentree_id, _digest, signed_fragment, blob) {
|
|
1326
|
-
_assertClass(sedimentree_id, SedimentreeId);
|
|
1327
|
-
_assertClass(_digest, Digest);
|
|
1328
|
-
_assertClass(signed_fragment, SignedFragment);
|
|
1329
|
-
const ret = wasm.memorystorage_saveFragment(this.__wbg_ptr, sedimentree_id.__wbg_ptr, _digest.__wbg_ptr, signed_fragment.__wbg_ptr, blob);
|
|
1330
|
-
return ret;
|
|
1331
|
-
}
|
|
1332
|
-
/**
|
|
1333
|
-
* Save a sedimentree ID.
|
|
1334
|
-
* @param {SedimentreeId} sedimentree_id
|
|
1335
|
-
* @returns {Promise<any>}
|
|
1336
|
-
*/
|
|
1337
|
-
saveSedimentreeId(sedimentree_id) {
|
|
1338
|
-
_assertClass(sedimentree_id, SedimentreeId);
|
|
1339
|
-
const ret = wasm.memorystorage_saveSedimentreeId(this.__wbg_ptr, sedimentree_id.__wbg_ptr);
|
|
1340
|
-
return ret;
|
|
1341
|
-
}
|
|
1342
|
-
}
|
|
1343
|
-
if (Symbol.dispose) MemoryStorage.prototype[Symbol.dispose] = MemoryStorage.prototype.free;
|
|
1344
|
-
|
|
1345
|
-
/**
|
|
1346
|
-
* A `Transport` backed by a `MessagePort` (or any object with
|
|
1347
|
-
* `postMessage` / `onmessage` / `close`).
|
|
1348
|
-
*
|
|
1349
|
-
* Implements the byte-oriented `Transport` interface (`sendBytes`,
|
|
1350
|
-
* `recvBytes`, `disconnect`) using the port as the underlying channel.
|
|
1351
|
-
* After the handshake, the [`Authenticated`] wrapper provides the sync API.
|
|
1352
|
-
*/
|
|
1353
|
-
export class MessagePortTransport {
|
|
1354
|
-
static __wrap(ptr) {
|
|
1355
|
-
ptr = ptr >>> 0;
|
|
1356
|
-
const obj = Object.create(MessagePortTransport.prototype);
|
|
1357
|
-
obj.__wbg_ptr = ptr;
|
|
1358
|
-
MessagePortTransportFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1359
|
-
return obj;
|
|
1360
|
-
}
|
|
1361
|
-
__destroy_into_raw() {
|
|
1362
|
-
const ptr = this.__wbg_ptr;
|
|
1363
|
-
this.__wbg_ptr = 0;
|
|
1364
|
-
MessagePortTransportFinalization.unregister(this);
|
|
1365
|
-
return ptr;
|
|
1366
|
-
}
|
|
1367
|
-
free() {
|
|
1368
|
-
const ptr = this.__destroy_into_raw();
|
|
1369
|
-
wasm.__wbg_messageporttransport_free(ptr, 0);
|
|
1370
|
-
}
|
|
1371
|
-
/**
|
|
1372
|
-
* Disconnect (close the port) and fire the `onDisconnect` callback if registered.
|
|
1373
|
-
* @returns {Promise<any>}
|
|
1374
|
-
*/
|
|
1375
|
-
disconnect() {
|
|
1376
|
-
const ret = wasm.messageporttransport_disconnect(this.__wbg_ptr);
|
|
1377
|
-
return ret;
|
|
1378
|
-
}
|
|
1379
|
-
/**
|
|
1380
|
-
* Create a new connection wrapping the given `MessagePort`.
|
|
1381
|
-
* @param {any} port
|
|
1382
|
-
*/
|
|
1383
|
-
constructor(port) {
|
|
1384
|
-
const ret = wasm.messageporttransport_new(port);
|
|
1385
|
-
this.__wbg_ptr = ret >>> 0;
|
|
1386
|
-
MessagePortTransportFinalization.register(this, this.__wbg_ptr, this);
|
|
1387
|
-
return this;
|
|
1388
|
-
}
|
|
1389
|
-
/**
|
|
1390
|
-
* Register a callback to be invoked when the transport disconnects.
|
|
1391
|
-
*
|
|
1392
|
-
* Part of the [`Transport`](super::JsTransport) interface contract.
|
|
1393
|
-
* Typically called by internal wiring rather than directly by user code.
|
|
1394
|
-
* @param {Function} callback
|
|
1395
|
-
*/
|
|
1396
|
-
onDisconnect(callback) {
|
|
1397
|
-
wasm.messageporttransport_onDisconnect(this.__wbg_ptr, callback);
|
|
1398
|
-
}
|
|
1399
|
-
/**
|
|
1400
|
-
* Receive raw bytes (for the handshake phase).
|
|
1401
|
-
* @returns {Promise<any>}
|
|
1402
|
-
*/
|
|
1403
|
-
recvBytes() {
|
|
1404
|
-
const ret = wasm.messageporttransport_recvBytes(this.__wbg_ptr);
|
|
1405
|
-
return ret;
|
|
1406
|
-
}
|
|
1407
|
-
/**
|
|
1408
|
-
* Send raw bytes (for the handshake phase).
|
|
1409
|
-
* @param {Uint8Array} bytes
|
|
1410
|
-
* @returns {Promise<any>}
|
|
1411
|
-
*/
|
|
1412
|
-
sendBytes(bytes) {
|
|
1413
|
-
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
|
|
1414
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1415
|
-
const ret = wasm.messageporttransport_sendBytes(this.__wbg_ptr, ptr0, len0);
|
|
1416
|
-
return ret;
|
|
1417
|
-
}
|
|
1418
|
-
}
|
|
1419
|
-
if (Symbol.dispose) MessagePortTransport.prototype[Symbol.dispose] = MessagePortTransport.prototype.free;
|
|
1420
|
-
|
|
1421
|
-
/**
|
|
1422
|
-
* A 64-bit nonce represented as big-endian bytes.
|
|
1423
|
-
*/
|
|
1424
|
-
export class Nonce {
|
|
1425
|
-
static __wrap(ptr) {
|
|
1426
|
-
ptr = ptr >>> 0;
|
|
1427
|
-
const obj = Object.create(Nonce.prototype);
|
|
1428
|
-
obj.__wbg_ptr = ptr;
|
|
1429
|
-
NonceFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1430
|
-
return obj;
|
|
1431
|
-
}
|
|
1432
|
-
__destroy_into_raw() {
|
|
1433
|
-
const ptr = this.__wbg_ptr;
|
|
1434
|
-
this.__wbg_ptr = 0;
|
|
1435
|
-
NonceFinalization.unregister(this);
|
|
1436
|
-
return ptr;
|
|
1437
|
-
}
|
|
1438
|
-
free() {
|
|
1439
|
-
const ptr = this.__destroy_into_raw();
|
|
1440
|
-
wasm.__wbg_nonce_free(ptr, 0);
|
|
1441
|
-
}
|
|
1442
|
-
/**
|
|
1443
|
-
* Get the nonce as big-endian bytes.
|
|
1444
|
-
* @returns {Uint8Array}
|
|
1445
|
-
*/
|
|
1446
|
-
get bytes() {
|
|
1447
|
-
const ret = wasm.nonce_bytes(this.__wbg_ptr);
|
|
1448
|
-
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1449
|
-
wasm.__wbindgen_export5(ret[0], ret[1] * 1, 1);
|
|
1450
|
-
return v1;
|
|
1451
|
-
}
|
|
1452
|
-
/**
|
|
1453
|
-
* Create a new [`WasmNonce`] from exactly 8 big-endian bytes.
|
|
1454
|
-
*
|
|
1455
|
-
* # Errors
|
|
1456
|
-
*
|
|
1457
|
-
* Returns [`WasmNonceError`] if the input is not exactly 8 bytes.
|
|
1458
|
-
* @param {Uint8Array} bytes
|
|
1459
|
-
*/
|
|
1460
|
-
constructor(bytes) {
|
|
1461
|
-
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
|
|
1462
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1463
|
-
const ret = wasm.nonce_new(ptr0, len0);
|
|
1464
|
-
if (ret[2]) {
|
|
1465
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
1466
|
-
}
|
|
1467
|
-
this.__wbg_ptr = ret[0] >>> 0;
|
|
1468
|
-
NonceFinalization.register(this, this.__wbg_ptr, this);
|
|
1469
|
-
return this;
|
|
1470
|
-
}
|
|
1471
|
-
/**
|
|
1472
|
-
* Generate a random nonce.
|
|
1473
|
-
*
|
|
1474
|
-
* # Panics
|
|
1475
|
-
*
|
|
1476
|
-
* Panics if the system random number generator fails.
|
|
1477
|
-
* @returns {Nonce}
|
|
1478
|
-
*/
|
|
1479
|
-
static random() {
|
|
1480
|
-
const ret = wasm.nonce_random();
|
|
1481
|
-
return Nonce.__wrap(ret);
|
|
1482
|
-
}
|
|
1483
|
-
}
|
|
1484
|
-
if (Symbol.dispose) Nonce.prototype[Symbol.dispose] = Nonce.prototype.free;
|
|
1485
|
-
|
|
1486
|
-
/**
|
|
1487
|
-
* Result of a peer batch sync request.
|
|
1488
|
-
*/
|
|
1489
|
-
export class PeerBatchSyncResult {
|
|
1490
|
-
static __wrap(ptr) {
|
|
1491
|
-
ptr = ptr >>> 0;
|
|
1492
|
-
const obj = Object.create(PeerBatchSyncResult.prototype);
|
|
1493
|
-
obj.__wbg_ptr = ptr;
|
|
1494
|
-
PeerBatchSyncResultFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1495
|
-
return obj;
|
|
1496
|
-
}
|
|
1497
|
-
__destroy_into_raw() {
|
|
1498
|
-
const ptr = this.__wbg_ptr;
|
|
1499
|
-
this.__wbg_ptr = 0;
|
|
1500
|
-
PeerBatchSyncResultFinalization.unregister(this);
|
|
1501
|
-
return ptr;
|
|
1502
|
-
}
|
|
1503
|
-
free() {
|
|
1504
|
-
const ptr = this.__destroy_into_raw();
|
|
1505
|
-
wasm.__wbg_peerbatchsyncresult_free(ptr, 0);
|
|
1506
|
-
}
|
|
1507
|
-
/**
|
|
1508
|
-
* Statistics about the sync operation.
|
|
1509
|
-
* @returns {SyncStats}
|
|
1510
|
-
*/
|
|
1511
|
-
get stats() {
|
|
1512
|
-
const ret = wasm.peerbatchsyncresult_stats(this.__wbg_ptr);
|
|
1513
|
-
return SyncStats.__wrap(ret);
|
|
1514
|
-
}
|
|
1515
|
-
/**
|
|
1516
|
-
* Whether the batch sync was successful with at least one connection.
|
|
1517
|
-
* @returns {boolean}
|
|
1518
|
-
*/
|
|
1519
|
-
get success() {
|
|
1520
|
-
const ret = wasm.peerbatchsyncresult_success(this.__wbg_ptr);
|
|
1521
|
-
return ret !== 0;
|
|
1522
|
-
}
|
|
1523
|
-
/**
|
|
1524
|
-
* Errors that occurred during the batch sync.
|
|
1525
|
-
* @returns {Error[]}
|
|
1526
|
-
*/
|
|
1527
|
-
get transportErrors() {
|
|
1528
|
-
const ret = wasm.peerbatchsyncresult_transportErrors(this.__wbg_ptr);
|
|
1529
|
-
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
1530
|
-
wasm.__wbindgen_export5(ret[0], ret[1] * 4, 4);
|
|
1531
|
-
return v1;
|
|
1532
|
-
}
|
|
1533
|
-
}
|
|
1534
|
-
if (Symbol.dispose) PeerBatchSyncResult.prototype[Symbol.dispose] = PeerBatchSyncResult.prototype.free;
|
|
1535
|
-
|
|
1536
|
-
/**
|
|
1537
|
-
* A JavaScript-compatible wrapper around the Rust `PeerId` type.
|
|
1538
|
-
*/
|
|
1539
|
-
export class PeerId {
|
|
1540
|
-
static __wrap(ptr) {
|
|
1541
|
-
ptr = ptr >>> 0;
|
|
1542
|
-
const obj = Object.create(PeerId.prototype);
|
|
1543
|
-
obj.__wbg_ptr = ptr;
|
|
1544
|
-
PeerIdFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1545
|
-
return obj;
|
|
1546
|
-
}
|
|
1547
|
-
__destroy_into_raw() {
|
|
1548
|
-
const ptr = this.__wbg_ptr;
|
|
1549
|
-
this.__wbg_ptr = 0;
|
|
1550
|
-
PeerIdFinalization.unregister(this);
|
|
1551
|
-
return ptr;
|
|
1552
|
-
}
|
|
1553
|
-
free() {
|
|
1554
|
-
const ptr = this.__destroy_into_raw();
|
|
1555
|
-
wasm.__wbg_peerid_free(ptr, 0);
|
|
1556
|
-
}
|
|
1557
|
-
/**
|
|
1558
|
-
* Creates a new `WasmPeerId` from a `PeerId`.
|
|
1559
|
-
*
|
|
1560
|
-
* # Errors
|
|
1561
|
-
*
|
|
1562
|
-
* Returns a `WasmInvalidPeerId` if the provided byte slice is not exactly 32 bytes long.
|
|
1563
|
-
* @param {Uint8Array} bytes
|
|
1564
|
-
*/
|
|
1565
|
-
constructor(bytes) {
|
|
1566
|
-
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
|
|
1567
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1568
|
-
const ret = wasm.peerid_new(ptr0, len0);
|
|
1569
|
-
if (ret[2]) {
|
|
1570
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
1571
|
-
}
|
|
1572
|
-
this.__wbg_ptr = ret[0] >>> 0;
|
|
1573
|
-
PeerIdFinalization.register(this, this.__wbg_ptr, this);
|
|
1574
|
-
return this;
|
|
1575
|
-
}
|
|
1576
|
-
/**
|
|
1577
|
-
* Returns the byte representation of the `PeerId`.
|
|
1578
|
-
* @returns {Uint8Array}
|
|
1579
|
-
*/
|
|
1580
|
-
toBytes() {
|
|
1581
|
-
const ret = wasm.peerid_toBytes(this.__wbg_ptr);
|
|
1582
|
-
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1583
|
-
wasm.__wbindgen_export5(ret[0], ret[1] * 1, 1);
|
|
1584
|
-
return v1;
|
|
1585
|
-
}
|
|
1586
|
-
/**
|
|
1587
|
-
* Returns the string representation of the `PeerId`.
|
|
1588
|
-
* @returns {string}
|
|
1589
|
-
*/
|
|
1590
|
-
toString() {
|
|
1591
|
-
let deferred1_0;
|
|
1592
|
-
let deferred1_1;
|
|
1593
|
-
try {
|
|
1594
|
-
const ret = wasm.peerid_toString(this.__wbg_ptr);
|
|
1595
|
-
deferred1_0 = ret[0];
|
|
1596
|
-
deferred1_1 = ret[1];
|
|
1597
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
1598
|
-
} finally {
|
|
1599
|
-
wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
|
|
1600
|
-
}
|
|
1601
|
-
}
|
|
1602
|
-
}
|
|
1603
|
-
if (Symbol.dispose) PeerId.prototype[Symbol.dispose] = PeerId.prototype.free;
|
|
1604
|
-
|
|
1605
|
-
/**
|
|
1606
|
-
* Map of peer IDs to their batch sync results.
|
|
1607
|
-
*/
|
|
1608
|
-
export class PeerResultMap {
|
|
1609
|
-
static __wrap(ptr) {
|
|
1610
|
-
ptr = ptr >>> 0;
|
|
1611
|
-
const obj = Object.create(PeerResultMap.prototype);
|
|
1612
|
-
obj.__wbg_ptr = ptr;
|
|
1613
|
-
PeerResultMapFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1614
|
-
return obj;
|
|
1615
|
-
}
|
|
1616
|
-
__destroy_into_raw() {
|
|
1617
|
-
const ptr = this.__wbg_ptr;
|
|
1618
|
-
this.__wbg_ptr = 0;
|
|
1619
|
-
PeerResultMapFinalization.unregister(this);
|
|
1620
|
-
return ptr;
|
|
1621
|
-
}
|
|
1622
|
-
free() {
|
|
1623
|
-
const ptr = this.__destroy_into_raw();
|
|
1624
|
-
wasm.__wbg_peerresultmap_free(ptr, 0);
|
|
1625
|
-
}
|
|
1626
|
-
/**
|
|
1627
|
-
* Get all entries in the peer result map.
|
|
1628
|
-
* @returns {PeerBatchSyncResult[]}
|
|
1629
|
-
*/
|
|
1630
|
-
entries() {
|
|
1631
|
-
const ret = wasm.peerresultmap_entries(this.__wbg_ptr);
|
|
1632
|
-
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
1633
|
-
wasm.__wbindgen_export5(ret[0], ret[1] * 4, 4);
|
|
1634
|
-
return v1;
|
|
1635
|
-
}
|
|
1636
|
-
/**
|
|
1637
|
-
* Get the result for a specific peer ID.
|
|
1638
|
-
* @param {PeerId} peer_id
|
|
1639
|
-
* @returns {PeerBatchSyncResult | undefined}
|
|
1640
|
-
*/
|
|
1641
|
-
getResult(peer_id) {
|
|
1642
|
-
_assertClass(peer_id, PeerId);
|
|
1643
|
-
const ret = wasm.peerresultmap_getResult(this.__wbg_ptr, peer_id.__wbg_ptr);
|
|
1644
|
-
return ret === 0 ? undefined : PeerBatchSyncResult.__wrap(ret);
|
|
1645
|
-
}
|
|
1646
|
-
}
|
|
1647
|
-
if (Symbol.dispose) PeerResultMap.prototype[Symbol.dispose] = PeerResultMap.prototype.free;
|
|
1648
|
-
|
|
1649
|
-
/**
|
|
1650
|
-
* Wasm wrapper for [`RequestId`].
|
|
1651
|
-
*/
|
|
1652
|
-
export class RequestId {
|
|
1653
|
-
static __wrap(ptr) {
|
|
1654
|
-
ptr = ptr >>> 0;
|
|
1655
|
-
const obj = Object.create(RequestId.prototype);
|
|
1656
|
-
obj.__wbg_ptr = ptr;
|
|
1657
|
-
RequestIdFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1658
|
-
return obj;
|
|
1659
|
-
}
|
|
1660
|
-
__destroy_into_raw() {
|
|
1661
|
-
const ptr = this.__wbg_ptr;
|
|
1662
|
-
this.__wbg_ptr = 0;
|
|
1663
|
-
RequestIdFinalization.unregister(this);
|
|
1664
|
-
return ptr;
|
|
1665
|
-
}
|
|
1666
|
-
free() {
|
|
1667
|
-
const ptr = this.__destroy_into_raw();
|
|
1668
|
-
wasm.__wbg_requestid_free(ptr, 0);
|
|
1669
|
-
}
|
|
1670
|
-
/**
|
|
1671
|
-
* Upcasts; to the JS-import type for [`WasmRequestId`].
|
|
1672
|
-
* @returns {RequestId}
|
|
1673
|
-
*/
|
|
1674
|
-
__wasm_refgen_toWasmRequestId() {
|
|
1675
|
-
const ret = wasm.requestid___wasm_refgen_toWasmRequestId(this.__wbg_ptr);
|
|
1676
|
-
return RequestId.__wrap(ret);
|
|
1677
|
-
}
|
|
1678
|
-
/**
|
|
1679
|
-
* Create a new [`RequestId`] from a requestor peer ID and nonce.
|
|
1680
|
-
* @param {PeerId} requestor
|
|
1681
|
-
* @param {Nonce} nonce
|
|
1682
|
-
*/
|
|
1683
|
-
constructor(requestor, nonce) {
|
|
1684
|
-
_assertClass(requestor, PeerId);
|
|
1685
|
-
_assertClass(nonce, Nonce);
|
|
1686
|
-
const ret = wasm.requestid_new(requestor.__wbg_ptr, nonce.__wbg_ptr);
|
|
1687
|
-
this.__wbg_ptr = ret >>> 0;
|
|
1688
|
-
RequestIdFinalization.register(this, this.__wbg_ptr, this);
|
|
1689
|
-
return this;
|
|
1690
|
-
}
|
|
1691
|
-
/**
|
|
1692
|
-
* The request nonce.
|
|
1693
|
-
* @returns {Nonce}
|
|
1694
|
-
*/
|
|
1695
|
-
get nonce() {
|
|
1696
|
-
const ret = wasm.requestid_nonce(this.__wbg_ptr);
|
|
1697
|
-
return Nonce.__wrap(ret);
|
|
1698
|
-
}
|
|
1699
|
-
/**
|
|
1700
|
-
* The peer ID of the requestor.
|
|
1701
|
-
* @returns {PeerId}
|
|
1702
|
-
*/
|
|
1703
|
-
get requestor() {
|
|
1704
|
-
const ret = wasm.requestid_requestor(this.__wbg_ptr);
|
|
1705
|
-
return PeerId.__wrap(ret);
|
|
1706
|
-
}
|
|
1707
|
-
}
|
|
1708
|
-
if (Symbol.dispose) RequestId.prototype[Symbol.dispose] = RequestId.prototype.free;
|
|
1709
|
-
|
|
1710
|
-
/**
|
|
1711
|
-
* The main Sedimentree data structure.
|
|
1712
|
-
*/
|
|
1713
|
-
export class Sedimentree {
|
|
1714
|
-
static __wrap(ptr) {
|
|
1715
|
-
ptr = ptr >>> 0;
|
|
1716
|
-
const obj = Object.create(Sedimentree.prototype);
|
|
1717
|
-
obj.__wbg_ptr = ptr;
|
|
1718
|
-
SedimentreeFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1719
|
-
return obj;
|
|
1720
|
-
}
|
|
1721
|
-
__destroy_into_raw() {
|
|
1722
|
-
const ptr = this.__wbg_ptr;
|
|
1723
|
-
this.__wbg_ptr = 0;
|
|
1724
|
-
SedimentreeFinalization.unregister(this);
|
|
1725
|
-
return ptr;
|
|
1726
|
-
}
|
|
1727
|
-
free() {
|
|
1728
|
-
const ptr = this.__destroy_into_raw();
|
|
1729
|
-
wasm.__wbg_sedimentree_free(ptr, 0);
|
|
1730
|
-
}
|
|
1731
|
-
/**
|
|
1732
|
-
* Create an empty Sedimentree.
|
|
1733
|
-
* @returns {Sedimentree}
|
|
1734
|
-
*/
|
|
1735
|
-
static empty() {
|
|
1736
|
-
const ret = wasm.sedimentree_empty();
|
|
1737
|
-
return Sedimentree.__wrap(ret);
|
|
1738
|
-
}
|
|
1739
|
-
/**
|
|
1740
|
-
* Create a new Sedimentree from fragments and loose commits.
|
|
1741
|
-
* @param {Fragment[]} fragments
|
|
1742
|
-
* @param {LooseCommit[]} commits
|
|
1743
|
-
*/
|
|
1744
|
-
constructor(fragments, commits) {
|
|
1745
|
-
const ptr0 = passArrayJsValueToWasm0(fragments, wasm.__wbindgen_export);
|
|
1746
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1747
|
-
const ptr1 = passArrayJsValueToWasm0(commits, wasm.__wbindgen_export);
|
|
1748
|
-
const len1 = WASM_VECTOR_LEN;
|
|
1749
|
-
const ret = wasm.sedimentree_new(ptr0, len0, ptr1, len1);
|
|
1750
|
-
this.__wbg_ptr = ret >>> 0;
|
|
1751
|
-
SedimentreeFinalization.register(this, this.__wbg_ptr, this);
|
|
1752
|
-
return this;
|
|
1753
|
-
}
|
|
1754
|
-
}
|
|
1755
|
-
if (Symbol.dispose) Sedimentree.prototype[Symbol.dispose] = Sedimentree.prototype.free;
|
|
1756
|
-
|
|
1757
|
-
/**
|
|
1758
|
-
* A Wasm wrapper around the [`SedimentreeId`] type.
|
|
1759
|
-
*/
|
|
1760
|
-
export class SedimentreeId {
|
|
1761
|
-
static __wrap(ptr) {
|
|
1762
|
-
ptr = ptr >>> 0;
|
|
1763
|
-
const obj = Object.create(SedimentreeId.prototype);
|
|
1764
|
-
obj.__wbg_ptr = ptr;
|
|
1765
|
-
SedimentreeIdFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1766
|
-
return obj;
|
|
1767
|
-
}
|
|
1768
|
-
static __unwrap(jsValue) {
|
|
1769
|
-
if (!(jsValue instanceof SedimentreeId)) {
|
|
1770
|
-
return 0;
|
|
1771
|
-
}
|
|
1772
|
-
return jsValue.__destroy_into_raw();
|
|
1773
|
-
}
|
|
1774
|
-
__destroy_into_raw() {
|
|
1775
|
-
const ptr = this.__wbg_ptr;
|
|
1776
|
-
this.__wbg_ptr = 0;
|
|
1777
|
-
SedimentreeIdFinalization.unregister(this);
|
|
1778
|
-
return ptr;
|
|
1779
|
-
}
|
|
1780
|
-
free() {
|
|
1781
|
-
const ptr = this.__destroy_into_raw();
|
|
1782
|
-
wasm.__wbg_sedimentreeid_free(ptr, 0);
|
|
1783
|
-
}
|
|
1784
|
-
/**
|
|
1785
|
-
* Upcasts; to the JS-import type for [`WasmSedimentreeId`].
|
|
1786
|
-
* @returns {SedimentreeId}
|
|
1787
|
-
*/
|
|
1788
|
-
__wasm_refgen_toWasmSedimentreeId() {
|
|
1789
|
-
const ret = wasm.sedimentreeid___wasm_refgen_toWasmSedimentreeId(this.__wbg_ptr);
|
|
1790
|
-
return SedimentreeId.__wrap(ret);
|
|
1791
|
-
}
|
|
1792
|
-
/**
|
|
1793
|
-
* Create an ID from a byte array.
|
|
1794
|
-
*
|
|
1795
|
-
* # Errors
|
|
1796
|
-
*
|
|
1797
|
-
* Returns `Not32Bytes` if the provided byte array is not exactly 32 bytes long.
|
|
1798
|
-
* @param {Uint8Array} bytes
|
|
1799
|
-
* @returns {SedimentreeId}
|
|
1800
|
-
*/
|
|
1801
|
-
static fromBytes(bytes) {
|
|
1802
|
-
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
|
|
1803
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1804
|
-
const ret = wasm.sedimentreeid_fromBytes(ptr0, len0);
|
|
1805
|
-
if (ret[2]) {
|
|
1806
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
1807
|
-
}
|
|
1808
|
-
return SedimentreeId.__wrap(ret[0]);
|
|
1809
|
-
}
|
|
1810
|
-
/**
|
|
1811
|
-
* Returns the raw bytes of this ID.
|
|
1812
|
-
* @returns {Uint8Array}
|
|
1813
|
-
*/
|
|
1814
|
-
toBytes() {
|
|
1815
|
-
const ret = wasm.sedimentreeid_toBytes(this.__wbg_ptr);
|
|
1816
|
-
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1817
|
-
wasm.__wbindgen_export5(ret[0], ret[1] * 1, 1);
|
|
1818
|
-
return v1;
|
|
1819
|
-
}
|
|
1820
|
-
/**
|
|
1821
|
-
* Returns the string representation of the ID.
|
|
1822
|
-
* @returns {string}
|
|
1823
|
-
*/
|
|
1824
|
-
toString() {
|
|
1825
|
-
let deferred1_0;
|
|
1826
|
-
let deferred1_1;
|
|
1827
|
-
try {
|
|
1828
|
-
const ret = wasm.sedimentreeid_toString(this.__wbg_ptr);
|
|
1829
|
-
deferred1_0 = ret[0];
|
|
1830
|
-
deferred1_1 = ret[1];
|
|
1831
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
1832
|
-
} finally {
|
|
1833
|
-
wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
|
|
1834
|
-
}
|
|
1835
|
-
}
|
|
1836
|
-
}
|
|
1837
|
-
if (Symbol.dispose) SedimentreeId.prototype[Symbol.dispose] = SedimentreeId.prototype.free;
|
|
1838
|
-
|
|
1839
|
-
export class SedimentreeIdsArray {
|
|
1840
|
-
static __wrap(ptr) {
|
|
1841
|
-
ptr = ptr >>> 0;
|
|
1842
|
-
const obj = Object.create(SedimentreeIdsArray.prototype);
|
|
1843
|
-
obj.__wbg_ptr = ptr;
|
|
1844
|
-
SedimentreeIdsArrayFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1845
|
-
return obj;
|
|
1846
|
-
}
|
|
1847
|
-
__destroy_into_raw() {
|
|
1848
|
-
const ptr = this.__wbg_ptr;
|
|
1849
|
-
this.__wbg_ptr = 0;
|
|
1850
|
-
SedimentreeIdsArrayFinalization.unregister(this);
|
|
1851
|
-
return ptr;
|
|
1852
|
-
}
|
|
1853
|
-
free() {
|
|
1854
|
-
const ptr = this.__destroy_into_raw();
|
|
1855
|
-
wasm.__wbg_sedimentreeidsarray_free(ptr, 0);
|
|
1856
|
-
}
|
|
1857
|
-
/**
|
|
1858
|
-
* Upcasts; to the JS-import type for [`WasmSedimentreeIdsArray`].
|
|
1859
|
-
* @returns {SedimentreeIdsArray}
|
|
1860
|
-
*/
|
|
1861
|
-
__wasm_refgen_toWasmSedimentreeIdsArray() {
|
|
1862
|
-
const ret = wasm.sedimentreeidsarray___wasm_refgen_toWasmSedimentreeIdsArray(this.__wbg_ptr);
|
|
1863
|
-
return SedimentreeIdsArray.__wrap(ret);
|
|
1864
|
-
}
|
|
1865
|
-
}
|
|
1866
|
-
if (Symbol.dispose) SedimentreeIdsArray.prototype[Symbol.dispose] = SedimentreeIdsArray.prototype.free;
|
|
1867
|
-
|
|
1868
|
-
/**
|
|
1869
|
-
* A Wasm wrapper around `Signed<Fragment>`.
|
|
1870
|
-
*/
|
|
1871
|
-
export class SignedFragment {
|
|
1872
|
-
static __wrap(ptr) {
|
|
1873
|
-
ptr = ptr >>> 0;
|
|
1874
|
-
const obj = Object.create(SignedFragment.prototype);
|
|
1875
|
-
obj.__wbg_ptr = ptr;
|
|
1876
|
-
SignedFragmentFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1877
|
-
return obj;
|
|
1878
|
-
}
|
|
1879
|
-
__destroy_into_raw() {
|
|
1880
|
-
const ptr = this.__wbg_ptr;
|
|
1881
|
-
this.__wbg_ptr = 0;
|
|
1882
|
-
SignedFragmentFinalization.unregister(this);
|
|
1883
|
-
return ptr;
|
|
1884
|
-
}
|
|
1885
|
-
free() {
|
|
1886
|
-
const ptr = this.__destroy_into_raw();
|
|
1887
|
-
wasm.__wbg_signedfragment_free(ptr, 0);
|
|
1888
|
-
}
|
|
1889
|
-
/**
|
|
1890
|
-
* Upcasts; to the JS-import type for [`WasmSignedFragment`].
|
|
1891
|
-
* @returns {SignedFragment}
|
|
1892
|
-
*/
|
|
1893
|
-
__wasm_refgen_toWasmSignedFragment() {
|
|
1894
|
-
const ret = wasm.signedfragment___wasm_refgen_toWasmSignedFragment(this.__wbg_ptr);
|
|
1895
|
-
return SignedFragment.__wrap(ret);
|
|
1896
|
-
}
|
|
1897
|
-
/**
|
|
1898
|
-
* Encode this signed fragment to raw bytes.
|
|
1899
|
-
* @returns {Uint8Array}
|
|
1900
|
-
*/
|
|
1901
|
-
encode() {
|
|
1902
|
-
const ret = wasm.signedfragment_encode(this.__wbg_ptr);
|
|
1903
|
-
return ret;
|
|
1904
|
-
}
|
|
1905
|
-
/**
|
|
1906
|
-
* Get the unsigned payload without re-verifying the signature.
|
|
1907
|
-
*
|
|
1908
|
-
* # Errors
|
|
1909
|
-
*
|
|
1910
|
-
* Returns an error if the payload cannot be decoded.
|
|
1911
|
-
* @returns {Fragment}
|
|
1912
|
-
*/
|
|
1913
|
-
get payload() {
|
|
1914
|
-
const ret = wasm.signedfragment_payload(this.__wbg_ptr);
|
|
1915
|
-
if (ret[2]) {
|
|
1916
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
1917
|
-
}
|
|
1918
|
-
return Fragment.__wrap(ret[0]);
|
|
1919
|
-
}
|
|
1920
|
-
/**
|
|
1921
|
-
* Decode a `SignedFragment` from raw bytes.
|
|
1922
|
-
*
|
|
1923
|
-
* # Errors
|
|
1924
|
-
*
|
|
1925
|
-
* Returns an error if the bytes are not a valid signed fragment.
|
|
1926
|
-
* @param {Uint8Array} bytes
|
|
1927
|
-
* @returns {SignedFragment}
|
|
1928
|
-
*/
|
|
1929
|
-
static tryDecode(bytes) {
|
|
1930
|
-
const ret = wasm.signedfragment_tryDecode(bytes);
|
|
1931
|
-
if (ret[2]) {
|
|
1932
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
1933
|
-
}
|
|
1934
|
-
return SignedFragment.__wrap(ret[0]);
|
|
1935
|
-
}
|
|
1936
|
-
}
|
|
1937
|
-
if (Symbol.dispose) SignedFragment.prototype[Symbol.dispose] = SignedFragment.prototype.free;
|
|
1938
|
-
|
|
1939
|
-
/**
|
|
1940
|
-
* A Wasm wrapper around `Signed<LooseCommit>`.
|
|
1941
|
-
*/
|
|
1942
|
-
export class SignedLooseCommit {
|
|
1943
|
-
static __wrap(ptr) {
|
|
1944
|
-
ptr = ptr >>> 0;
|
|
1945
|
-
const obj = Object.create(SignedLooseCommit.prototype);
|
|
1946
|
-
obj.__wbg_ptr = ptr;
|
|
1947
|
-
SignedLooseCommitFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1948
|
-
return obj;
|
|
1949
|
-
}
|
|
1950
|
-
__destroy_into_raw() {
|
|
1951
|
-
const ptr = this.__wbg_ptr;
|
|
1952
|
-
this.__wbg_ptr = 0;
|
|
1953
|
-
SignedLooseCommitFinalization.unregister(this);
|
|
1954
|
-
return ptr;
|
|
1955
|
-
}
|
|
1956
|
-
free() {
|
|
1957
|
-
const ptr = this.__destroy_into_raw();
|
|
1958
|
-
wasm.__wbg_signedloosecommit_free(ptr, 0);
|
|
1959
|
-
}
|
|
1960
|
-
/**
|
|
1961
|
-
* Upcasts; to the JS-import type for [`WasmSignedLooseCommit`].
|
|
1962
|
-
* @returns {SignedLooseCommit}
|
|
1963
|
-
*/
|
|
1964
|
-
__wasm_refgen_toWasmSignedLooseCommit() {
|
|
1965
|
-
const ret = wasm.signedloosecommit___wasm_refgen_toWasmSignedLooseCommit(this.__wbg_ptr);
|
|
1966
|
-
return SignedLooseCommit.__wrap(ret);
|
|
1967
|
-
}
|
|
1968
|
-
/**
|
|
1969
|
-
* Encode this signed loose commit to raw bytes.
|
|
1970
|
-
* @returns {Uint8Array}
|
|
1971
|
-
*/
|
|
1972
|
-
encode() {
|
|
1973
|
-
const ret = wasm.signedloosecommit_encode(this.__wbg_ptr);
|
|
1974
|
-
return ret;
|
|
1975
|
-
}
|
|
1976
|
-
/**
|
|
1977
|
-
* Get the unsigned payload without re-verifying the signature.
|
|
1978
|
-
*
|
|
1979
|
-
* # Errors
|
|
1980
|
-
*
|
|
1981
|
-
* Returns an error if the payload cannot be decoded.
|
|
1982
|
-
* @returns {LooseCommit}
|
|
1983
|
-
*/
|
|
1984
|
-
get payload() {
|
|
1985
|
-
const ret = wasm.signedloosecommit_payload(this.__wbg_ptr);
|
|
1986
|
-
if (ret[2]) {
|
|
1987
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
1988
|
-
}
|
|
1989
|
-
return LooseCommit.__wrap(ret[0]);
|
|
1990
|
-
}
|
|
1991
|
-
/**
|
|
1992
|
-
* Decode a `SignedLooseCommit` from raw bytes.
|
|
1993
|
-
*
|
|
1994
|
-
* # Errors
|
|
1995
|
-
*
|
|
1996
|
-
* Returns an error if the bytes are not a valid signed loose commit.
|
|
1997
|
-
* @param {Uint8Array} bytes
|
|
1998
|
-
* @returns {SignedLooseCommit}
|
|
1999
|
-
*/
|
|
2000
|
-
static tryDecode(bytes) {
|
|
2001
|
-
const ret = wasm.signedloosecommit_tryDecode(bytes);
|
|
2002
|
-
if (ret[2]) {
|
|
2003
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
2004
|
-
}
|
|
2005
|
-
return SignedLooseCommit.__wrap(ret[0]);
|
|
2006
|
-
}
|
|
2007
|
-
}
|
|
2008
|
-
if (Symbol.dispose) SignedLooseCommit.prototype[Symbol.dispose] = SignedLooseCommit.prototype.free;
|
|
2009
|
-
|
|
2010
|
-
/**
|
|
2011
|
-
* Wasm bindings for [`Subduction`](subduction_core::Subduction)
|
|
2012
|
-
*/
|
|
2013
|
-
export class Subduction {
|
|
2014
|
-
static __wrap(ptr) {
|
|
2015
|
-
ptr = ptr >>> 0;
|
|
2016
|
-
const obj = Object.create(Subduction.prototype);
|
|
2017
|
-
obj.__wbg_ptr = ptr;
|
|
2018
|
-
SubductionFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
2019
|
-
return obj;
|
|
2020
|
-
}
|
|
2021
|
-
__destroy_into_raw() {
|
|
2022
|
-
const ptr = this.__wbg_ptr;
|
|
2023
|
-
this.__wbg_ptr = 0;
|
|
2024
|
-
SubductionFinalization.unregister(this);
|
|
2025
|
-
return ptr;
|
|
2026
|
-
}
|
|
2027
|
-
free() {
|
|
2028
|
-
const ptr = this.__destroy_into_raw();
|
|
2029
|
-
wasm.__wbg_subduction_free(ptr, 0);
|
|
2030
|
-
}
|
|
2031
|
-
/**
|
|
2032
|
-
* Accept a connection from a peer over any [`Transport`](JsTransport).
|
|
2033
|
-
*
|
|
2034
|
-
* Performs the responder side of the handshake, then adds the authenticated
|
|
2035
|
-
* connection. This is the counterpart to [`connectTransport`](Self::connect_transport).
|
|
2036
|
-
*
|
|
2037
|
-
* # Arguments
|
|
2038
|
-
*
|
|
2039
|
-
* * `transport` - Any JS object with `sendBytes`/`recvBytes`/`disconnect`
|
|
2040
|
-
* * `service_name` - Shared service name for discovery
|
|
2041
|
-
*
|
|
2042
|
-
* # Errors
|
|
2043
|
-
*
|
|
2044
|
-
* Returns an error if the handshake or connection fails.
|
|
2045
|
-
* @param {Transport} transport
|
|
2046
|
-
* @param {string} service_name
|
|
2047
|
-
* @returns {Promise<PeerId>}
|
|
2048
|
-
*/
|
|
2049
|
-
acceptTransport(transport, service_name) {
|
|
2050
|
-
const ptr0 = passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2051
|
-
const len0 = WASM_VECTOR_LEN;
|
|
2052
|
-
const ret = wasm.subduction_acceptTransport(this.__wbg_ptr, transport, ptr0, len0);
|
|
2053
|
-
return ret;
|
|
2054
|
-
}
|
|
2055
|
-
/**
|
|
2056
|
-
* Add a commit with its associated blob to the storage.
|
|
2057
|
-
*
|
|
2058
|
-
* The commit metadata (including `BlobMeta`) is computed internally from
|
|
2059
|
-
* the provided blob, ensuring consistency by construction.
|
|
2060
|
-
*
|
|
2061
|
-
* # Errors
|
|
2062
|
-
*
|
|
2063
|
-
* Returns a [`WasmWriteError`] if storage, networking, or policy fail.
|
|
2064
|
-
* @param {SedimentreeId} id
|
|
2065
|
-
* @param {Digest[]} parents
|
|
2066
|
-
* @param {Uint8Array} blob
|
|
2067
|
-
* @returns {Promise<FragmentRequested | undefined>}
|
|
2068
|
-
*/
|
|
2069
|
-
addCommit(id, parents, blob) {
|
|
2070
|
-
_assertClass(id, SedimentreeId);
|
|
2071
|
-
const ptr0 = passArrayJsValueToWasm0(parents, wasm.__wbindgen_export);
|
|
2072
|
-
const len0 = WASM_VECTOR_LEN;
|
|
2073
|
-
const ret = wasm.subduction_addCommit(this.__wbg_ptr, id.__wbg_ptr, ptr0, len0, blob);
|
|
2074
|
-
return ret;
|
|
2075
|
-
}
|
|
2076
|
-
/**
|
|
2077
|
-
* Onboard an authenticated transport: add it and sync all sedimentrees.
|
|
2078
|
-
*
|
|
2079
|
-
* Accepts an [`AuthenticatedTransport`](WasmAuthenticatedTransport),
|
|
2080
|
-
* obtained via [`AuthenticatedTransport.setup`](WasmAuthenticatedTransport::setup),
|
|
2081
|
-
* [`AuthenticatedWebSocket.toTransport`], or [`AuthenticatedLongPoll.toTransport`].
|
|
2082
|
-
*
|
|
2083
|
-
* Returns `true` if this is a new peer, `false` if already connected.
|
|
2084
|
-
*
|
|
2085
|
-
* Add an authenticated transport to tracking.
|
|
2086
|
-
*
|
|
2087
|
-
* This does not perform any synchronization. To sync after adding,
|
|
2088
|
-
* call [`fullSyncWithPeer`](Self::full_sync_with_peer).
|
|
2089
|
-
*
|
|
2090
|
-
* Returns `true` if this is a new peer, `false` if already connected.
|
|
2091
|
-
*
|
|
2092
|
-
* # Errors
|
|
2093
|
-
*
|
|
2094
|
-
* Returns an error if the connection is rejected by the policy.
|
|
2095
|
-
* @param {AuthenticatedTransport} transport
|
|
2096
|
-
* @returns {Promise<boolean>}
|
|
2097
|
-
*/
|
|
2098
|
-
addConnection(transport) {
|
|
2099
|
-
_assertClass(transport, AuthenticatedTransport);
|
|
2100
|
-
const ret = wasm.subduction_addConnection(this.__wbg_ptr, transport.__wbg_ptr);
|
|
2101
|
-
return ret;
|
|
2102
|
-
}
|
|
2103
|
-
/**
|
|
2104
|
-
* Add a fragment with its associated blob to the storage.
|
|
2105
|
-
*
|
|
2106
|
-
* The fragment metadata (including `BlobMeta`) is computed internally from
|
|
2107
|
-
* the provided blob, ensuring consistency by construction.
|
|
2108
|
-
*
|
|
2109
|
-
* # Errors
|
|
2110
|
-
*
|
|
2111
|
-
* Returns a [`WasmWriteError`] if storage, networking, or policy fail.
|
|
2112
|
-
* @param {SedimentreeId} id
|
|
2113
|
-
* @param {Digest} head
|
|
2114
|
-
* @param {Digest[]} boundary
|
|
2115
|
-
* @param {Digest[]} checkpoints
|
|
2116
|
-
* @param {Uint8Array} blob
|
|
2117
|
-
* @returns {Promise<void>}
|
|
2118
|
-
*/
|
|
2119
|
-
addFragment(id, head, boundary, checkpoints, blob) {
|
|
2120
|
-
_assertClass(id, SedimentreeId);
|
|
2121
|
-
_assertClass(head, Digest);
|
|
2122
|
-
const ptr0 = passArrayJsValueToWasm0(boundary, wasm.__wbindgen_export);
|
|
2123
|
-
const len0 = WASM_VECTOR_LEN;
|
|
2124
|
-
const ptr1 = passArrayJsValueToWasm0(checkpoints, wasm.__wbindgen_export);
|
|
2125
|
-
const len1 = WASM_VECTOR_LEN;
|
|
2126
|
-
const ret = wasm.subduction_addFragment(this.__wbg_ptr, id.__wbg_ptr, head.__wbg_ptr, ptr0, len0, ptr1, len1, blob);
|
|
2127
|
-
return ret;
|
|
2128
|
-
}
|
|
2129
|
-
/**
|
|
2130
|
-
* Add a Sedimentree.
|
|
2131
|
-
*
|
|
2132
|
-
* # Errors
|
|
2133
|
-
*
|
|
2134
|
-
* Returns [`WasmWriteError`] if there is a problem with storage, networking, or policy.
|
|
2135
|
-
* @param {SedimentreeId} id
|
|
2136
|
-
* @param {Sedimentree} sedimentree
|
|
2137
|
-
* @param {Uint8Array[]} blobs
|
|
2138
|
-
* @returns {Promise<void>}
|
|
2139
|
-
*/
|
|
2140
|
-
addSedimentree(id, sedimentree, blobs) {
|
|
2141
|
-
_assertClass(id, SedimentreeId);
|
|
2142
|
-
_assertClass(sedimentree, Sedimentree);
|
|
2143
|
-
const ptr0 = passArrayJsValueToWasm0(blobs, wasm.__wbindgen_export);
|
|
2144
|
-
const len0 = WASM_VECTOR_LEN;
|
|
2145
|
-
const ret = wasm.subduction_addSedimentree(this.__wbg_ptr, id.__wbg_ptr, sedimentree.__wbg_ptr, ptr0, len0);
|
|
2146
|
-
return ret;
|
|
2147
|
-
}
|
|
2148
|
-
/**
|
|
2149
|
-
* Connect to a peer via WebSocket and add the connection.
|
|
2150
|
-
*
|
|
2151
|
-
* This performs the cryptographic handshake, verifies the server's identity,
|
|
2152
|
-
* and adds the authenticated connection for syncing.
|
|
2153
|
-
*
|
|
2154
|
-
* Returns the verified peer ID on success.
|
|
2155
|
-
*
|
|
2156
|
-
* # Arguments
|
|
2157
|
-
*
|
|
2158
|
-
* * `address` - The WebSocket URL to connect to
|
|
2159
|
-
* * `expected_peer_id` - The expected server peer ID (verified during handshake)
|
|
2160
|
-
*
|
|
2161
|
-
* # Errors
|
|
2162
|
-
*
|
|
2163
|
-
* Returns an error if connection, handshake, or adding the connection fails.
|
|
2164
|
-
* @param {URL} address
|
|
2165
|
-
* @param {PeerId} expected_peer_id
|
|
2166
|
-
* @returns {Promise<PeerId>}
|
|
2167
|
-
*/
|
|
2168
|
-
connect(address, expected_peer_id) {
|
|
2169
|
-
_assertClass(expected_peer_id, PeerId);
|
|
2170
|
-
const ret = wasm.subduction_connect(this.__wbg_ptr, address, expected_peer_id.__wbg_ptr);
|
|
2171
|
-
return ret;
|
|
2172
|
-
}
|
|
2173
|
-
/**
|
|
2174
|
-
* Connect to a peer via WebSocket using discovery mode and add the connection.
|
|
2175
|
-
*
|
|
2176
|
-
* Returns the discovered and verified peer ID on success.
|
|
2177
|
-
*
|
|
2178
|
-
* # Arguments
|
|
2179
|
-
*
|
|
2180
|
-
* * `address` - The WebSocket URL to connect to
|
|
2181
|
-
* * `timeout_milliseconds` - Request timeout in milliseconds (defaults to 30000)
|
|
2182
|
-
* * `service_name` - The service name for discovery (defaults to URL host)
|
|
2183
|
-
*
|
|
2184
|
-
* # Errors
|
|
2185
|
-
*
|
|
2186
|
-
* Returns an error if connection, handshake, or adding the connection fails.
|
|
2187
|
-
* @param {URL} address
|
|
2188
|
-
* @param {string | null} [service_name]
|
|
2189
|
-
* @returns {Promise<PeerId>}
|
|
2190
|
-
*/
|
|
2191
|
-
connectDiscover(address, service_name) {
|
|
2192
|
-
var ptr0 = isLikeNone(service_name) ? 0 : passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2193
|
-
var len0 = WASM_VECTOR_LEN;
|
|
2194
|
-
const ret = wasm.subduction_connectDiscover(this.__wbg_ptr, address, ptr0, len0);
|
|
2195
|
-
return ret;
|
|
2196
|
-
}
|
|
2197
|
-
/**
|
|
2198
|
-
* Connect to a peer via HTTP long-poll using discovery mode.
|
|
2199
|
-
*
|
|
2200
|
-
* Returns the discovered and verified peer ID on success.
|
|
2201
|
-
*
|
|
2202
|
-
* # Arguments
|
|
2203
|
-
*
|
|
2204
|
-
* * `base_url` - The server's HTTP base URL (e.g., `http://localhost:8080`)
|
|
2205
|
-
* * `timeout_milliseconds` - Request timeout in milliseconds (default: 30000)
|
|
2206
|
-
* * `service_name` - The service name for discovery (defaults to `base_url`)
|
|
2207
|
-
*
|
|
2208
|
-
* # Errors
|
|
2209
|
-
*
|
|
2210
|
-
* Returns an error if connection, handshake, or adding the connection fails.
|
|
2211
|
-
* @param {string} base_url
|
|
2212
|
-
* @param {string | null} [service_name]
|
|
2213
|
-
* @returns {Promise<PeerId>}
|
|
2214
|
-
*/
|
|
2215
|
-
connectDiscoverLongPoll(base_url, service_name) {
|
|
2216
|
-
const ptr0 = passStringToWasm0(base_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2217
|
-
const len0 = WASM_VECTOR_LEN;
|
|
2218
|
-
var ptr1 = isLikeNone(service_name) ? 0 : passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2219
|
-
var len1 = WASM_VECTOR_LEN;
|
|
2220
|
-
const ret = wasm.subduction_connectDiscoverLongPoll(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
2221
|
-
return ret;
|
|
2222
|
-
}
|
|
2223
|
-
/**
|
|
2224
|
-
* Connect to a peer via HTTP long-poll and add the connection.
|
|
2225
|
-
*
|
|
2226
|
-
* Returns the verified peer ID on success.
|
|
2227
|
-
*
|
|
2228
|
-
* # Arguments
|
|
2229
|
-
*
|
|
2230
|
-
* * `base_url` - The server's HTTP base URL (e.g., `http://localhost:8080`)
|
|
2231
|
-
* * `expected_peer_id` - The expected server peer ID (verified during handshake)
|
|
2232
|
-
* * `timeout_milliseconds` - Request timeout in milliseconds (default: 30000)
|
|
2233
|
-
*
|
|
2234
|
-
* # Errors
|
|
2235
|
-
*
|
|
2236
|
-
* Returns an error if connection, handshake, or adding the connection fails.
|
|
2237
|
-
* @param {string} base_url
|
|
2238
|
-
* @param {PeerId} expected_peer_id
|
|
2239
|
-
* @returns {Promise<PeerId>}
|
|
2240
|
-
*/
|
|
2241
|
-
connectLongPoll(base_url, expected_peer_id) {
|
|
2242
|
-
const ptr0 = passStringToWasm0(base_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2243
|
-
const len0 = WASM_VECTOR_LEN;
|
|
2244
|
-
_assertClass(expected_peer_id, PeerId);
|
|
2245
|
-
const ret = wasm.subduction_connectLongPoll(this.__wbg_ptr, ptr0, len0, expected_peer_id.__wbg_ptr);
|
|
2246
|
-
return ret;
|
|
2247
|
-
}
|
|
2248
|
-
/**
|
|
2249
|
-
* Connect to a peer over any [`Transport`](JsTransport) using discovery mode.
|
|
2250
|
-
*
|
|
2251
|
-
* Performs a discovery handshake, then adds the authenticated connection.
|
|
2252
|
-
* The peer's identity is discovered during the handshake.
|
|
2253
|
-
*
|
|
2254
|
-
* # Arguments
|
|
2255
|
-
*
|
|
2256
|
-
* * `transport` - Any JS object with `sendBytes`/`recvBytes`/`disconnect`
|
|
2257
|
-
* * `service_name` - Shared service name for discovery
|
|
2258
|
-
*
|
|
2259
|
-
* # Errors
|
|
2260
|
-
*
|
|
2261
|
-
* Returns an error if the handshake or connection fails.
|
|
2262
|
-
* @param {Transport} transport
|
|
2263
|
-
* @param {string} service_name
|
|
2264
|
-
* @returns {Promise<PeerId>}
|
|
2265
|
-
*/
|
|
2266
|
-
connectTransport(transport, service_name) {
|
|
2267
|
-
const ptr0 = passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2268
|
-
const len0 = WASM_VECTOR_LEN;
|
|
2269
|
-
const ret = wasm.subduction_connectTransport(this.__wbg_ptr, transport, ptr0, len0);
|
|
2270
|
-
return ret;
|
|
2271
|
-
}
|
|
2272
|
-
/**
|
|
2273
|
-
* Disconnect from all peers.
|
|
2274
|
-
*
|
|
2275
|
-
* # Errors
|
|
2276
|
-
*
|
|
2277
|
-
* Returns a [`WasmDisconnectionError`] if disconnection was not graceful.
|
|
2278
|
-
* @returns {Promise<void>}
|
|
2279
|
-
*/
|
|
2280
|
-
disconnectAll() {
|
|
2281
|
-
const ret = wasm.subduction_disconnectAll(this.__wbg_ptr);
|
|
2282
|
-
return ret;
|
|
2283
|
-
}
|
|
2284
|
-
/**
|
|
2285
|
-
* Disconnect from a peer by its ID.
|
|
2286
|
-
*
|
|
2287
|
-
* # Errors
|
|
2288
|
-
*
|
|
2289
|
-
* Returns a `WasmDisconnectionError` if disconnection fails.
|
|
2290
|
-
* @param {PeerId} peer_id
|
|
2291
|
-
* @returns {Promise<boolean>}
|
|
2292
|
-
*/
|
|
2293
|
-
disconnectFromPeer(peer_id) {
|
|
2294
|
-
_assertClass(peer_id, PeerId);
|
|
2295
|
-
const ret = wasm.subduction_disconnectFromPeer(this.__wbg_ptr, peer_id.__wbg_ptr);
|
|
2296
|
-
return ret;
|
|
2297
|
-
}
|
|
2298
|
-
/**
|
|
2299
|
-
* Fetch blobs by their digests, with an optional timeout in milliseconds.
|
|
2300
|
-
*
|
|
2301
|
-
* # Errors
|
|
2302
|
-
*
|
|
2303
|
-
* Returns a [`WasmIoError`] if storage or networking fail.
|
|
2304
|
-
* @param {SedimentreeId} id
|
|
2305
|
-
* @param {bigint | null} [timeout_milliseconds]
|
|
2306
|
-
* @returns {Promise<Uint8Array[] | undefined>}
|
|
2307
|
-
*/
|
|
2308
|
-
fetchBlobs(id, timeout_milliseconds) {
|
|
2309
|
-
_assertClass(id, SedimentreeId);
|
|
2310
|
-
const ret = wasm.subduction_fetchBlobs(this.__wbg_ptr, id.__wbg_ptr, !isLikeNone(timeout_milliseconds), isLikeNone(timeout_milliseconds) ? BigInt(0) : timeout_milliseconds);
|
|
2311
|
-
return ret;
|
|
2312
|
-
}
|
|
2313
|
-
/**
|
|
2314
|
-
* Sync all known Sedimentree IDs with all connected peers.
|
|
2315
|
-
* @param {bigint | null} [timeout_milliseconds]
|
|
2316
|
-
* @returns {Promise<PeerBatchSyncResult>}
|
|
2317
|
-
*/
|
|
2318
|
-
fullSyncWithAllPeers(timeout_milliseconds) {
|
|
2319
|
-
const ret = wasm.subduction_fullSyncWithAllPeers(this.__wbg_ptr, !isLikeNone(timeout_milliseconds), isLikeNone(timeout_milliseconds) ? BigInt(0) : timeout_milliseconds);
|
|
2320
|
-
return ret;
|
|
2321
|
-
}
|
|
2322
|
-
/**
|
|
2323
|
-
* Sync all known Sedimentree IDs with a single peer.
|
|
2324
|
-
*
|
|
2325
|
-
* # Arguments
|
|
2326
|
-
*
|
|
2327
|
-
* * `peer_id` - The peer to sync with
|
|
2328
|
-
* * `subscribe` - Whether to subscribe to future updates (default: `true`)
|
|
2329
|
-
* * `timeout_milliseconds` - Per-call timeout in milliseconds
|
|
2330
|
-
* @param {PeerId} peer_id
|
|
2331
|
-
* @param {boolean | null} [subscribe]
|
|
2332
|
-
* @param {bigint | null} [timeout_milliseconds]
|
|
2333
|
-
* @returns {Promise<PeerBatchSyncResult>}
|
|
2334
|
-
*/
|
|
2335
|
-
fullSyncWithPeer(peer_id, subscribe, timeout_milliseconds) {
|
|
2336
|
-
_assertClass(peer_id, PeerId);
|
|
2337
|
-
const ret = wasm.subduction_fullSyncWithPeer(this.__wbg_ptr, peer_id.__wbg_ptr, isLikeNone(subscribe) ? 0xFFFFFF : subscribe ? 1 : 0, !isLikeNone(timeout_milliseconds), isLikeNone(timeout_milliseconds) ? BigInt(0) : timeout_milliseconds);
|
|
2338
|
-
return ret;
|
|
2339
|
-
}
|
|
2340
|
-
/**
|
|
2341
|
-
* Get a local blob by its digest.
|
|
2342
|
-
*
|
|
2343
|
-
* # Errors
|
|
2344
|
-
*
|
|
2345
|
-
* Returns a [`JsStorageError`] if JS storage fails.
|
|
2346
|
-
* @param {SedimentreeId} id
|
|
2347
|
-
* @param {Digest} digest
|
|
2348
|
-
* @returns {Promise<Uint8Array | undefined>}
|
|
2349
|
-
*/
|
|
2350
|
-
getBlob(id, digest) {
|
|
2351
|
-
_assertClass(id, SedimentreeId);
|
|
2352
|
-
_assertClass(digest, Digest);
|
|
2353
|
-
const ret = wasm.subduction_getBlob(this.__wbg_ptr, id.__wbg_ptr, digest.__wbg_ptr);
|
|
2354
|
-
return ret;
|
|
2355
|
-
}
|
|
2356
|
-
/**
|
|
2357
|
-
* Get all local blobs for a given Sedimentree ID.
|
|
2358
|
-
*
|
|
2359
|
-
* # Errors
|
|
2360
|
-
*
|
|
2361
|
-
* Returns a [`JsStorageError`] if JS storage fails.
|
|
2362
|
-
* @param {SedimentreeId} id
|
|
2363
|
-
* @returns {Promise<Uint8Array[]>}
|
|
2364
|
-
*/
|
|
2365
|
-
getBlobs(id) {
|
|
2366
|
-
_assertClass(id, SedimentreeId);
|
|
2367
|
-
const ret = wasm.subduction_getBlobs(this.__wbg_ptr, id.__wbg_ptr);
|
|
2368
|
-
return ret;
|
|
2369
|
-
}
|
|
2370
|
-
/**
|
|
2371
|
-
* Get all commits for a given Sedimentree ID
|
|
2372
|
-
* @param {SedimentreeId} id
|
|
2373
|
-
* @returns {Promise<LooseCommit[] | undefined>}
|
|
2374
|
-
*/
|
|
2375
|
-
getCommits(id) {
|
|
2376
|
-
_assertClass(id, SedimentreeId);
|
|
2377
|
-
const ret = wasm.subduction_getCommits(this.__wbg_ptr, id.__wbg_ptr);
|
|
2378
|
-
return ret;
|
|
2379
|
-
}
|
|
2380
|
-
/**
|
|
2381
|
-
* Get the peer IDs of all connected peers.
|
|
2382
|
-
* @returns {Promise<PeerId[]>}
|
|
2383
|
-
*/
|
|
2384
|
-
getConnectedPeerIds() {
|
|
2385
|
-
const ret = wasm.subduction_getConnectedPeerIds(this.__wbg_ptr);
|
|
2386
|
-
return ret;
|
|
2387
|
-
}
|
|
2388
|
-
/**
|
|
2389
|
-
* Get all fragments for a given Sedimentree ID
|
|
2390
|
-
* @param {SedimentreeId} id
|
|
2391
|
-
* @returns {Promise<Fragment[] | undefined>}
|
|
2392
|
-
*/
|
|
2393
|
-
getFragments(id) {
|
|
2394
|
-
_assertClass(id, SedimentreeId);
|
|
2395
|
-
const ret = wasm.subduction_getFragments(this.__wbg_ptr, id.__wbg_ptr);
|
|
2396
|
-
return ret;
|
|
2397
|
-
}
|
|
2398
|
-
/**
|
|
2399
|
-
* Hydrate a [`Subduction`] instance from external storage.
|
|
2400
|
-
*
|
|
2401
|
-
* Loads all sedimentree data from storage and reconstructs the in-memory
|
|
2402
|
-
* state before initializing the sync engine.
|
|
2403
|
-
*
|
|
2404
|
-
* # Arguments
|
|
2405
|
-
*
|
|
2406
|
-
* * `signer` - The cryptographic signer for this node's identity
|
|
2407
|
-
* * `storage` - Storage backend for persisting data
|
|
2408
|
-
* * `service_name` - Optional service identifier for discovery mode (e.g., `sync.example.com`).
|
|
2409
|
-
* When set, clients can connect without knowing the server's peer ID.
|
|
2410
|
-
* * `hash_metric_override` - Optional custom depth metric function
|
|
2411
|
-
* * `max_pending_blob_requests` - Optional maximum number of pending blob requests (default: 10,000)
|
|
2412
|
-
*
|
|
2413
|
-
* # Panics
|
|
2414
|
-
*
|
|
2415
|
-
* Panics if `hash_metric_override` is `Some` but the underlying JS value
|
|
2416
|
-
* cannot be cast to a `Function`.
|
|
2417
|
-
*
|
|
2418
|
-
* # Errors
|
|
2419
|
-
*
|
|
2420
|
-
* Returns [`WasmHydrationError`] if hydration fails.
|
|
2421
|
-
* @param {any} signer
|
|
2422
|
-
* @param {SedimentreeStorage} storage
|
|
2423
|
-
* @param {string | null} [service_name]
|
|
2424
|
-
* @param {(digest: Digest) => Depth | null} [hash_metric_override]
|
|
2425
|
-
* @param {number | null} [max_pending_blob_requests]
|
|
2426
|
-
* @param {any | null} [policy]
|
|
2427
|
-
* @param {Function | null} [on_remote_heads]
|
|
2428
|
-
* @param {Function | null} [on_ephemeral]
|
|
2429
|
-
* @returns {Promise<Subduction>}
|
|
2430
|
-
*/
|
|
2431
|
-
static hydrate(signer, storage, service_name, hash_metric_override, max_pending_blob_requests, policy, on_remote_heads, on_ephemeral) {
|
|
2432
|
-
var ptr0 = isLikeNone(service_name) ? 0 : passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2433
|
-
var len0 = WASM_VECTOR_LEN;
|
|
2434
|
-
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));
|
|
2435
|
-
return ret;
|
|
2436
|
-
}
|
|
2437
|
-
/**
|
|
2438
|
-
* Link two local [`Subduction`](WasmSubduction) instances over a
|
|
2439
|
-
* [`MessageChannel`](web_sys::MessageChannel).
|
|
2440
|
-
*
|
|
2441
|
-
* Creates a `MessageChannel`, performs a discovery handshake between
|
|
2442
|
-
* the two instances, and adds the connections to both. This is the
|
|
2443
|
-
* simplest way to sync two local instances.
|
|
2444
|
-
*
|
|
2445
|
-
* # Errors
|
|
2446
|
-
*
|
|
2447
|
-
* Returns an error if the handshake or connection fails.
|
|
2448
|
-
* @param {Subduction} a
|
|
2449
|
-
* @param {Subduction} b
|
|
2450
|
-
* @returns {Promise<void>}
|
|
2451
|
-
*/
|
|
2452
|
-
static link(a, b) {
|
|
2453
|
-
_assertClass(a, Subduction);
|
|
2454
|
-
_assertClass(b, Subduction);
|
|
2455
|
-
const ret = wasm.subduction_link(a.__wbg_ptr, b.__wbg_ptr);
|
|
2456
|
-
return ret;
|
|
2457
|
-
}
|
|
2458
|
-
/**
|
|
2459
|
-
* Create a new [`Subduction`] instance.
|
|
2460
|
-
*
|
|
2461
|
-
* # Arguments
|
|
2462
|
-
*
|
|
2463
|
-
* * `signer` - The cryptographic signer for this node's identity
|
|
2464
|
-
* * `storage` - Storage backend for persisting data
|
|
2465
|
-
* * `service_name` - Optional service identifier for discovery mode (e.g., `sync.example.com`).
|
|
2466
|
-
* When set, clients can connect without knowing the server's peer ID.
|
|
2467
|
-
* * `hash_metric_override` - Optional custom depth metric function
|
|
2468
|
-
* * `max_pending_blob_requests` - Optional maximum number of pending blob requests (default: 10,000)
|
|
2469
|
-
* * `policy` - Optional JS object implementing authorization.
|
|
2470
|
-
* Must have `authorizeConnect(...)`, `authorizeFetch(...)`, `authorizePut(...)`,
|
|
2471
|
-
* `filterAuthorizedFetch(...)`. Defaults to allow-all.
|
|
2472
|
-
*
|
|
2473
|
-
* # Panics
|
|
2474
|
-
*
|
|
2475
|
-
* Panics if `hash_metric_override` is `Some` but the underlying JS value
|
|
2476
|
-
* cannot be cast to a `Function`.
|
|
2477
|
-
* @param {any} signer
|
|
2478
|
-
* @param {SedimentreeStorage} storage
|
|
2479
|
-
* @param {string | null} [service_name]
|
|
2480
|
-
* @param {(digest: Digest) => Depth | null} [hash_metric_override]
|
|
2481
|
-
* @param {number | null} [max_pending_blob_requests]
|
|
2482
|
-
* @param {any | null} [policy]
|
|
2483
|
-
* @param {Function | null} [on_remote_heads]
|
|
2484
|
-
* @param {Function | null} [on_ephemeral]
|
|
2485
|
-
*/
|
|
2486
|
-
constructor(signer, storage, service_name, hash_metric_override, max_pending_blob_requests, policy, on_remote_heads, on_ephemeral) {
|
|
2487
|
-
var ptr0 = isLikeNone(service_name) ? 0 : passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2488
|
-
var len0 = WASM_VECTOR_LEN;
|
|
2489
|
-
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));
|
|
2490
|
-
this.__wbg_ptr = ret >>> 0;
|
|
2491
|
-
SubductionFinalization.register(this, this.__wbg_ptr, this);
|
|
2492
|
-
return this;
|
|
2493
|
-
}
|
|
2494
|
-
/**
|
|
2495
|
-
* Publish an ephemeral message to all subscribers of a sedimentree.
|
|
2496
|
-
*
|
|
2497
|
-
* The payload is opaque bytes — encoding is the caller's responsibility.
|
|
2498
|
-
* Messages are fire-and-forget; delivery is best-effort.
|
|
2499
|
-
* @param {SedimentreeId} id
|
|
2500
|
-
* @param {Uint8Array} payload
|
|
2501
|
-
* @returns {Promise<void>}
|
|
2502
|
-
*/
|
|
2503
|
-
publishEphemeral(id, payload) {
|
|
2504
|
-
_assertClass(id, SedimentreeId);
|
|
2505
|
-
const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_export);
|
|
2506
|
-
const len0 = WASM_VECTOR_LEN;
|
|
2507
|
-
const ret = wasm.subduction_publishEphemeral(this.__wbg_ptr, id.__wbg_ptr, ptr0, len0);
|
|
2508
|
-
return ret;
|
|
2509
|
-
}
|
|
2510
|
-
/**
|
|
2511
|
-
* Remove a Sedimentree and all associated data.
|
|
2512
|
-
*
|
|
2513
|
-
* # Errors
|
|
2514
|
-
*
|
|
2515
|
-
* Returns a [`WasmIoError`] if storage or networking fail.
|
|
2516
|
-
* @param {SedimentreeId} id
|
|
2517
|
-
* @returns {Promise<void>}
|
|
2518
|
-
*/
|
|
2519
|
-
removeSedimentree(id) {
|
|
2520
|
-
_assertClass(id, SedimentreeId);
|
|
2521
|
-
const ret = wasm.subduction_removeSedimentree(this.__wbg_ptr, id.__wbg_ptr);
|
|
2522
|
-
return ret;
|
|
2523
|
-
}
|
|
2524
|
-
/**
|
|
2525
|
-
* Request blobs by their digests from connected peers for a specific sedimentree.
|
|
2526
|
-
* @param {SedimentreeId} id
|
|
2527
|
-
* @param {Digest[]} digests
|
|
2528
|
-
* @returns {Promise<void>}
|
|
2529
|
-
*/
|
|
2530
|
-
requestBlobs(id, digests) {
|
|
2531
|
-
_assertClass(id, SedimentreeId);
|
|
2532
|
-
const ptr0 = passArrayJsValueToWasm0(digests, wasm.__wbindgen_export);
|
|
2533
|
-
const len0 = WASM_VECTOR_LEN;
|
|
2534
|
-
const ret = wasm.subduction_requestBlobs(this.__wbg_ptr, id.__wbg_ptr, ptr0, len0);
|
|
2535
|
-
return ret;
|
|
2536
|
-
}
|
|
2537
|
-
/**
|
|
2538
|
-
* Get all known Sedimentree IDs
|
|
2539
|
-
* @returns {Promise<SedimentreeId[]>}
|
|
2540
|
-
*/
|
|
2541
|
-
sedimentreeIds() {
|
|
2542
|
-
const ret = wasm.subduction_sedimentreeIds(this.__wbg_ptr);
|
|
2543
|
-
return ret;
|
|
2544
|
-
}
|
|
2545
|
-
/**
|
|
2546
|
-
* Get the backing storage.
|
|
2547
|
-
* @returns {any}
|
|
2548
|
-
*/
|
|
2549
|
-
get storage() {
|
|
2550
|
-
const ret = wasm.subduction_storage(this.__wbg_ptr);
|
|
2551
|
-
return ret;
|
|
2552
|
-
}
|
|
2553
|
-
/**
|
|
2554
|
-
* Subscribe to ephemeral messages for the given sedimentree IDs
|
|
2555
|
-
* from all connected peers.
|
|
2556
|
-
* @param {SedimentreeId[]} ids
|
|
2557
|
-
* @returns {Promise<void>}
|
|
2558
|
-
*/
|
|
2559
|
-
subscribeEphemeral(ids) {
|
|
2560
|
-
const ptr0 = passArrayJsValueToWasm0(ids, wasm.__wbindgen_export);
|
|
2561
|
-
const len0 = WASM_VECTOR_LEN;
|
|
2562
|
-
const ret = wasm.subduction_subscribeEphemeral(this.__wbg_ptr, ptr0, len0);
|
|
2563
|
-
return ret;
|
|
2564
|
-
}
|
|
2565
|
-
/**
|
|
2566
|
-
* Request batch sync for a given Sedimentree ID from all connected peers.
|
|
2567
|
-
*
|
|
2568
|
-
* # Arguments
|
|
2569
|
-
*
|
|
2570
|
-
* * `id` - The sedimentree ID to sync
|
|
2571
|
-
* * `subscribe` - Whether to subscribe for incremental updates
|
|
2572
|
-
* * `timeout_milliseconds` - Optional timeout in milliseconds
|
|
2573
|
-
*
|
|
2574
|
-
* # Errors
|
|
2575
|
-
*
|
|
2576
|
-
* Returns a [`WasmIoError`] if storage or networking fail.
|
|
2577
|
-
* @param {SedimentreeId} id
|
|
2578
|
-
* @param {boolean} subscribe
|
|
2579
|
-
* @param {bigint | null} [timeout_milliseconds]
|
|
2580
|
-
* @returns {Promise<PeerResultMap>}
|
|
2581
|
-
*/
|
|
2582
|
-
syncWithAllPeers(id, subscribe, timeout_milliseconds) {
|
|
2583
|
-
_assertClass(id, SedimentreeId);
|
|
2584
|
-
const ret = wasm.subduction_syncWithAllPeers(this.__wbg_ptr, id.__wbg_ptr, subscribe, !isLikeNone(timeout_milliseconds), isLikeNone(timeout_milliseconds) ? BigInt(0) : timeout_milliseconds);
|
|
2585
|
-
return ret;
|
|
2586
|
-
}
|
|
2587
|
-
/**
|
|
2588
|
-
* Request batch sync for a given Sedimentree ID from a specific peer.
|
|
2589
|
-
*
|
|
2590
|
-
* # Arguments
|
|
2591
|
-
*
|
|
2592
|
-
* * `to_ask` - The peer ID to sync with
|
|
2593
|
-
* * `id` - The sedimentree ID to sync
|
|
2594
|
-
* * `subscribe` - Whether to subscribe for incremental updates
|
|
2595
|
-
* * `timeout_milliseconds` - Optional timeout in milliseconds
|
|
2596
|
-
*
|
|
2597
|
-
* # Errors
|
|
2598
|
-
*
|
|
2599
|
-
* Returns a [`WasmIoError`] if storage or networking fail.
|
|
2600
|
-
* @param {PeerId} to_ask
|
|
2601
|
-
* @param {SedimentreeId} id
|
|
2602
|
-
* @param {boolean} subscribe
|
|
2603
|
-
* @param {bigint | null} [timeout_milliseconds]
|
|
2604
|
-
* @returns {Promise<PeerBatchSyncResult>}
|
|
2605
|
-
*/
|
|
2606
|
-
syncWithPeer(to_ask, id, subscribe, timeout_milliseconds) {
|
|
2607
|
-
_assertClass(to_ask, PeerId);
|
|
2608
|
-
_assertClass(id, SedimentreeId);
|
|
2609
|
-
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);
|
|
2610
|
-
return ret;
|
|
2611
|
-
}
|
|
2612
|
-
/**
|
|
2613
|
-
* Unsubscribe from ephemeral messages for the given sedimentree IDs
|
|
2614
|
-
* from all connected peers.
|
|
2615
|
-
* @param {SedimentreeId[]} ids
|
|
2616
|
-
* @returns {Promise<void>}
|
|
2617
|
-
*/
|
|
2618
|
-
unsubscribeEphemeral(ids) {
|
|
2619
|
-
const ptr0 = passArrayJsValueToWasm0(ids, wasm.__wbindgen_export);
|
|
2620
|
-
const len0 = WASM_VECTOR_LEN;
|
|
2621
|
-
const ret = wasm.subduction_unsubscribeEphemeral(this.__wbg_ptr, ptr0, len0);
|
|
2622
|
-
return ret;
|
|
2623
|
-
}
|
|
2624
|
-
}
|
|
2625
|
-
if (Symbol.dispose) Subduction.prototype[Symbol.dispose] = Subduction.prototype.free;
|
|
2626
|
-
|
|
2627
|
-
/**
|
|
2628
|
-
* JS-facing wrapper around [`HttpLongPollTransport`] that exposes the
|
|
2629
|
-
* byte-oriented [`Transport`](super::JsTransport) interface
|
|
2630
|
-
* (`sendBytes`/`recvBytes`/`disconnect`/`onDisconnect`) so it can be used as a
|
|
2631
|
-
* duck-typed `JsTransport` from JavaScript.
|
|
2632
|
-
*/
|
|
2633
|
-
export class SubductionHttpLongPoll {
|
|
2634
|
-
static __wrap(ptr) {
|
|
2635
|
-
ptr = ptr >>> 0;
|
|
2636
|
-
const obj = Object.create(SubductionHttpLongPoll.prototype);
|
|
2637
|
-
obj.__wbg_ptr = ptr;
|
|
2638
|
-
SubductionHttpLongPollFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
2639
|
-
return obj;
|
|
2640
|
-
}
|
|
2641
|
-
__destroy_into_raw() {
|
|
2642
|
-
const ptr = this.__wbg_ptr;
|
|
2643
|
-
this.__wbg_ptr = 0;
|
|
2644
|
-
SubductionHttpLongPollFinalization.unregister(this);
|
|
2645
|
-
return ptr;
|
|
2646
|
-
}
|
|
2647
|
-
free() {
|
|
2648
|
-
const ptr = this.__destroy_into_raw();
|
|
2649
|
-
wasm.__wbg_subductionhttplongpoll_free(ptr, 0);
|
|
2650
|
-
}
|
|
2651
|
-
/**
|
|
2652
|
-
* Disconnect from the peer gracefully.
|
|
2653
|
-
*
|
|
2654
|
-
* Fires the `onDisconnect` callback if one is registered.
|
|
2655
|
-
*
|
|
2656
|
-
* # Errors
|
|
2657
|
-
*
|
|
2658
|
-
* Returns an error if the disconnect fails.
|
|
2659
|
-
* @returns {Promise<void>}
|
|
2660
|
-
*/
|
|
2661
|
-
disconnect() {
|
|
2662
|
-
const ret = wasm.subductionhttplongpoll_disconnect(this.__wbg_ptr);
|
|
2663
|
-
return ret;
|
|
2664
|
-
}
|
|
2665
|
-
/**
|
|
2666
|
-
* Register a callback to be invoked when the transport disconnects.
|
|
2667
|
-
*
|
|
2668
|
-
* Part of the [`Transport`](super::JsTransport) interface contract.
|
|
2669
|
-
* Typically called by internal wiring rather than directly by user code.
|
|
2670
|
-
* @param {Function} callback
|
|
2671
|
-
*/
|
|
2672
|
-
onDisconnect(callback) {
|
|
2673
|
-
wasm.subductionhttplongpoll_onDisconnect(this.__wbg_ptr, callback);
|
|
2674
|
-
}
|
|
2675
|
-
/**
|
|
2676
|
-
* Receive the next message frame as raw bytes.
|
|
2677
|
-
*
|
|
2678
|
-
* # Errors
|
|
2679
|
-
*
|
|
2680
|
-
* Returns an error if the inbound channel is closed.
|
|
2681
|
-
* @returns {Promise<Uint8Array>}
|
|
2682
|
-
*/
|
|
2683
|
-
recvBytes() {
|
|
2684
|
-
const ret = wasm.subductionhttplongpoll_recvBytes(this.__wbg_ptr);
|
|
2685
|
-
return ret;
|
|
2686
|
-
}
|
|
2687
|
-
/**
|
|
2688
|
-
* Send raw bytes over the transport.
|
|
2689
|
-
*
|
|
2690
|
-
* # Errors
|
|
2691
|
-
*
|
|
2692
|
-
* Returns an error if the outbound channel is closed.
|
|
2693
|
-
* @param {Uint8Array} bytes
|
|
2694
|
-
* @returns {Promise<void>}
|
|
2695
|
-
*/
|
|
2696
|
-
sendBytes(bytes) {
|
|
2697
|
-
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
|
|
2698
|
-
const len0 = WASM_VECTOR_LEN;
|
|
2699
|
-
const ret = wasm.subductionhttplongpoll_sendBytes(this.__wbg_ptr, ptr0, len0);
|
|
2700
|
-
return ret;
|
|
2701
|
-
}
|
|
2702
|
-
}
|
|
2703
|
-
if (Symbol.dispose) SubductionHttpLongPoll.prototype[Symbol.dispose] = SubductionHttpLongPoll.prototype.free;
|
|
2704
|
-
|
|
2705
|
-
/**
|
|
2706
|
-
* HTTP long-poll transport factory for browser/worker environments.
|
|
2707
|
-
*
|
|
2708
|
-
* Analogous to [`SubductionWebSocket`] but uses HTTP long-poll instead of WebSocket.
|
|
2709
|
-
*/
|
|
2710
|
-
export class SubductionLongPoll {
|
|
2711
|
-
__destroy_into_raw() {
|
|
2712
|
-
const ptr = this.__wbg_ptr;
|
|
2713
|
-
this.__wbg_ptr = 0;
|
|
2714
|
-
SubductionLongPollFinalization.unregister(this);
|
|
2715
|
-
return ptr;
|
|
2716
|
-
}
|
|
2717
|
-
free() {
|
|
2718
|
-
const ptr = this.__destroy_into_raw();
|
|
2719
|
-
wasm.__wbg_subductionlongpoll_free(ptr, 0);
|
|
2720
|
-
}
|
|
2721
|
-
/**
|
|
2722
|
-
* Connect to a server with a known peer ID.
|
|
2723
|
-
*
|
|
2724
|
-
* # Arguments
|
|
2725
|
-
*
|
|
2726
|
-
* * `base_url` - The server's HTTP base URL (e.g., `http://localhost:8080`)
|
|
2727
|
-
* * `signer` - The client's signer for authentication
|
|
2728
|
-
* * `expected_peer_id` - The expected server peer ID (verified during handshake)
|
|
2729
|
-
* * `on_disconnect` - Optional callback invoked with the peer's [`PeerId`] when the connection closes
|
|
2730
|
-
*
|
|
2731
|
-
* # Errors
|
|
2732
|
-
*
|
|
2733
|
-
* Returns [`LongPollTransportError`] if connection or handshake fails.
|
|
2734
|
-
* @param {string} base_url
|
|
2735
|
-
* @param {any} signer
|
|
2736
|
-
* @param {PeerId} expected_peer_id
|
|
2737
|
-
* @param {Function | null} [on_disconnect]
|
|
2738
|
-
* @returns {Promise<AuthenticatedLongPoll>}
|
|
2739
|
-
*/
|
|
2740
|
-
static tryConnect(base_url, signer, expected_peer_id, on_disconnect) {
|
|
2741
|
-
const ptr0 = passStringToWasm0(base_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2742
|
-
const len0 = WASM_VECTOR_LEN;
|
|
2743
|
-
_assertClass(expected_peer_id, PeerId);
|
|
2744
|
-
const ret = wasm.subductionlongpoll_tryConnect(ptr0, len0, signer, expected_peer_id.__wbg_ptr, isLikeNone(on_disconnect) ? 0 : addToExternrefTable0(on_disconnect));
|
|
2745
|
-
return ret;
|
|
2746
|
-
}
|
|
2747
|
-
/**
|
|
2748
|
-
* Connect to a server using discovery mode.
|
|
2749
|
-
*
|
|
2750
|
-
* # Arguments
|
|
2751
|
-
*
|
|
2752
|
-
* * `base_url` - The server's HTTP base URL (e.g., `http://localhost:8080`)
|
|
2753
|
-
* * `signer` - The client's signer for authentication
|
|
2754
|
-
* * `service_name` - The service name for discovery. If omitted, the base URL is used.
|
|
2755
|
-
*
|
|
2756
|
-
* # Errors
|
|
2757
|
-
*
|
|
2758
|
-
* Returns [`LongPollTransportError`] if connection or handshake fails.
|
|
2759
|
-
* @param {string} base_url
|
|
2760
|
-
* @param {any} signer
|
|
2761
|
-
* @param {string | null} [service_name]
|
|
2762
|
-
* @param {Function | null} [on_disconnect]
|
|
2763
|
-
* @returns {Promise<AuthenticatedLongPoll>}
|
|
2764
|
-
*/
|
|
2765
|
-
static tryDiscover(base_url, signer, service_name, on_disconnect) {
|
|
2766
|
-
const ptr0 = passStringToWasm0(base_url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2767
|
-
const len0 = WASM_VECTOR_LEN;
|
|
2768
|
-
var ptr1 = isLikeNone(service_name) ? 0 : passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2769
|
-
var len1 = WASM_VECTOR_LEN;
|
|
2770
|
-
const ret = wasm.subductionlongpoll_tryDiscover(ptr0, len0, signer, ptr1, len1, isLikeNone(on_disconnect) ? 0 : addToExternrefTable0(on_disconnect));
|
|
2771
|
-
return ret;
|
|
2772
|
-
}
|
|
2773
|
-
}
|
|
2774
|
-
if (Symbol.dispose) SubductionLongPoll.prototype[Symbol.dispose] = SubductionLongPoll.prototype.free;
|
|
2775
|
-
|
|
2776
|
-
/**
|
|
2777
|
-
* A WebSocket transport exposing the byte-oriented `Transport` interface.
|
|
2778
|
-
*
|
|
2779
|
-
* Raw bytes from the WebSocket's `onmessage` handler are buffered in an
|
|
2780
|
-
* `async_channel` and returned via `recvBytes`. No message decoding or
|
|
2781
|
-
* request-response routing happens here — that's handled by
|
|
2782
|
-
* [`MessageTransport`](subduction_core::transport::message::MessageTransport).
|
|
2783
|
-
*/
|
|
2784
|
-
export class SubductionWebSocket {
|
|
2785
|
-
static __wrap(ptr) {
|
|
2786
|
-
ptr = ptr >>> 0;
|
|
2787
|
-
const obj = Object.create(SubductionWebSocket.prototype);
|
|
2788
|
-
obj.__wbg_ptr = ptr;
|
|
2789
|
-
SubductionWebSocketFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
2790
|
-
return obj;
|
|
2791
|
-
}
|
|
2792
|
-
__destroy_into_raw() {
|
|
2793
|
-
const ptr = this.__wbg_ptr;
|
|
2794
|
-
this.__wbg_ptr = 0;
|
|
2795
|
-
SubductionWebSocketFinalization.unregister(this);
|
|
2796
|
-
return ptr;
|
|
2797
|
-
}
|
|
2798
|
-
free() {
|
|
2799
|
-
const ptr = this.__destroy_into_raw();
|
|
2800
|
-
wasm.__wbg_subductionwebsocket_free(ptr, 0);
|
|
2801
|
-
}
|
|
2802
|
-
/**
|
|
2803
|
-
* Disconnect from the peer gracefully.
|
|
2804
|
-
* @returns {Promise<void>}
|
|
2805
|
-
*/
|
|
2806
|
-
disconnect() {
|
|
2807
|
-
const ret = wasm.subductionwebsocket_disconnect(this.__wbg_ptr);
|
|
2808
|
-
return ret;
|
|
2809
|
-
}
|
|
2810
|
-
/**
|
|
2811
|
-
* Register a callback to be invoked when the WebSocket closes.
|
|
2812
|
-
*
|
|
2813
|
-
* Part of the [`Transport`](super::JsTransport) interface contract.
|
|
2814
|
-
* Typically called by internal wiring (factory methods like `tryConnect`
|
|
2815
|
-
* and `tryDiscover`) rather than directly by user code.
|
|
2816
|
-
*
|
|
2817
|
-
* The callback is fired from the browser WebSocket's `onclose` handler.
|
|
2818
|
-
* @param {Function} callback
|
|
2819
|
-
*/
|
|
2820
|
-
onDisconnect(callback) {
|
|
2821
|
-
wasm.subductionwebsocket_onDisconnect(this.__wbg_ptr, callback);
|
|
2822
|
-
}
|
|
2823
|
-
/**
|
|
2824
|
-
* Receive the next message frame as raw bytes.
|
|
2825
|
-
*
|
|
2826
|
-
* # Errors
|
|
2827
|
-
*
|
|
2828
|
-
* Returns [`ReadFromClosedChannel`] if the channel has been closed.
|
|
2829
|
-
* @returns {Promise<Uint8Array>}
|
|
2830
|
-
*/
|
|
2831
|
-
recvBytes() {
|
|
2832
|
-
const ret = wasm.subductionwebsocket_recvBytes(this.__wbg_ptr);
|
|
2833
|
-
return ret;
|
|
2834
|
-
}
|
|
2835
|
-
/**
|
|
2836
|
-
* Send raw bytes over the WebSocket.
|
|
2837
|
-
*
|
|
2838
|
-
* # Errors
|
|
2839
|
-
*
|
|
2840
|
-
* Returns [`WasmSendError`] if the bytes could not be sent.
|
|
2841
|
-
* @param {Uint8Array} bytes
|
|
2842
|
-
* @returns {Promise<void>}
|
|
2843
|
-
*/
|
|
2844
|
-
sendBytes(bytes) {
|
|
2845
|
-
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
|
|
2846
|
-
const len0 = WASM_VECTOR_LEN;
|
|
2847
|
-
const ret = wasm.subductionwebsocket_sendBytes(this.__wbg_ptr, ptr0, len0);
|
|
2848
|
-
return ret;
|
|
2849
|
-
}
|
|
2850
|
-
/**
|
|
2851
|
-
* Authenticate an existing WebSocket via handshake.
|
|
2852
|
-
*
|
|
2853
|
-
* This performs the Subduction handshake protocol over the provided WebSocket
|
|
2854
|
-
* to establish mutual identity. The WebSocket can be in CONNECTING or OPEN state.
|
|
2855
|
-
*
|
|
2856
|
-
* # Arguments
|
|
2857
|
-
*
|
|
2858
|
-
* * `ws` - An existing WebSocket (CONNECTING or OPEN)
|
|
2859
|
-
* * `signer` - The client's signer for authentication
|
|
2860
|
-
* * `expected_peer_id` - The expected server peer ID (verified during handshake)
|
|
2861
|
-
* * `on_disconnect` - Optional callback invoked with the peer's [`PeerId`] when the connection closes
|
|
2862
|
-
*
|
|
2863
|
-
* # Errors
|
|
2864
|
-
*
|
|
2865
|
-
* Returns an error if the handshake fails (signature invalid, wrong peer, etc.)
|
|
2866
|
-
* @param {WebSocket} ws
|
|
2867
|
-
* @param {any} signer
|
|
2868
|
-
* @param {PeerId} expected_peer_id
|
|
2869
|
-
* @param {Function | null} [on_disconnect]
|
|
2870
|
-
* @returns {Promise<AuthenticatedWebSocket>}
|
|
2871
|
-
*/
|
|
2872
|
-
static setup(ws, signer, expected_peer_id, on_disconnect) {
|
|
2873
|
-
_assertClass(expected_peer_id, PeerId);
|
|
2874
|
-
const ret = wasm.subductionwebsocket_setup(ws, signer, expected_peer_id.__wbg_ptr, isLikeNone(on_disconnect) ? 0 : addToExternrefTable0(on_disconnect));
|
|
2875
|
-
return ret;
|
|
2876
|
-
}
|
|
2877
|
-
/**
|
|
2878
|
-
* Connect to a WebSocket server with mutual authentication via handshake.
|
|
2879
|
-
*
|
|
2880
|
-
* # Arguments
|
|
2881
|
-
*
|
|
2882
|
-
* * `address` - The WebSocket URL to connect to
|
|
2883
|
-
* * `signer` - The client's signer for authentication
|
|
2884
|
-
* * `expected_peer_id` - The expected server peer ID (verified during handshake)
|
|
2885
|
-
* * `on_disconnect` - Optional callback invoked with the peer's [`PeerId`] when the connection closes
|
|
2886
|
-
*
|
|
2887
|
-
* # Errors
|
|
2888
|
-
*
|
|
2889
|
-
* Returns an error if:
|
|
2890
|
-
* - The WebSocket connection could not be established
|
|
2891
|
-
* - The handshake fails (signature invalid, wrong server, clock drift, etc.)
|
|
2892
|
-
* @param {URL} address
|
|
2893
|
-
* @param {any} signer
|
|
2894
|
-
* @param {PeerId} expected_peer_id
|
|
2895
|
-
* @param {Function | null} [on_disconnect]
|
|
2896
|
-
* @returns {Promise<AuthenticatedWebSocket>}
|
|
2897
|
-
*/
|
|
2898
|
-
static tryConnect(address, signer, expected_peer_id, on_disconnect) {
|
|
2899
|
-
_assertClass(expected_peer_id, PeerId);
|
|
2900
|
-
const ret = wasm.subductionwebsocket_tryConnect(address, signer, expected_peer_id.__wbg_ptr, isLikeNone(on_disconnect) ? 0 : addToExternrefTable0(on_disconnect));
|
|
2901
|
-
return ret;
|
|
2902
|
-
}
|
|
2903
|
-
/**
|
|
2904
|
-
* Connect to a WebSocket server using discovery mode.
|
|
2905
|
-
*
|
|
2906
|
-
* This method performs a cryptographic handshake using a service name
|
|
2907
|
-
* instead of a known peer ID. The server's peer ID is discovered during
|
|
2908
|
-
* the handshake and returned.
|
|
2909
|
-
*
|
|
2910
|
-
* # Arguments
|
|
2911
|
-
*
|
|
2912
|
-
* * `address` - The WebSocket URL to connect to
|
|
2913
|
-
* * `signer` - The client's signer for authentication
|
|
2914
|
-
* * `service_name` - The service name for discovery (e.g., `localhost:8080`).
|
|
2915
|
-
* If omitted, the host is extracted from the URL.
|
|
2916
|
-
* * `on_disconnect` - Optional callback invoked with the peer's [`PeerId`] when the connection closes
|
|
2917
|
-
*
|
|
2918
|
-
* # Errors
|
|
2919
|
-
*
|
|
2920
|
-
* Returns an error if:
|
|
2921
|
-
* - The WebSocket connection could not be established
|
|
2922
|
-
* - The handshake fails (signature invalid, clock drift, etc.)
|
|
2923
|
-
* @param {URL} address
|
|
2924
|
-
* @param {any} signer
|
|
2925
|
-
* @param {string | null} [service_name]
|
|
2926
|
-
* @param {Function | null} [on_disconnect]
|
|
2927
|
-
* @returns {Promise<AuthenticatedWebSocket>}
|
|
2928
|
-
*/
|
|
2929
|
-
static tryDiscover(address, signer, service_name, on_disconnect) {
|
|
2930
|
-
var ptr0 = isLikeNone(service_name) ? 0 : passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2931
|
-
var len0 = WASM_VECTOR_LEN;
|
|
2932
|
-
const ret = wasm.subductionwebsocket_tryDiscover(address, signer, ptr0, len0, isLikeNone(on_disconnect) ? 0 : addToExternrefTable0(on_disconnect));
|
|
2933
|
-
return ret;
|
|
2934
|
-
}
|
|
2935
|
-
}
|
|
2936
|
-
if (Symbol.dispose) SubductionWebSocket.prototype[Symbol.dispose] = SubductionWebSocket.prototype.free;
|
|
2937
|
-
|
|
2938
|
-
/**
|
|
2939
|
-
* Wasm wrapper for [`SyncMessage`].
|
|
2940
|
-
*/
|
|
2941
|
-
export class SyncMessage {
|
|
2942
|
-
static __wrap(ptr) {
|
|
2943
|
-
ptr = ptr >>> 0;
|
|
2944
|
-
const obj = Object.create(SyncMessage.prototype);
|
|
2945
|
-
obj.__wbg_ptr = ptr;
|
|
2946
|
-
SyncMessageFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
2947
|
-
return obj;
|
|
2948
|
-
}
|
|
2949
|
-
__destroy_into_raw() {
|
|
2950
|
-
const ptr = this.__wbg_ptr;
|
|
2951
|
-
this.__wbg_ptr = 0;
|
|
2952
|
-
SyncMessageFinalization.unregister(this);
|
|
2953
|
-
return ptr;
|
|
2954
|
-
}
|
|
2955
|
-
free() {
|
|
2956
|
-
const ptr = this.__destroy_into_raw();
|
|
2957
|
-
wasm.__wbg_syncmessage_free(ptr, 0);
|
|
2958
|
-
}
|
|
2959
|
-
/**
|
|
2960
|
-
* Upcasts; to the JS-import type for [`WasmMessage`].
|
|
2961
|
-
* @returns {SyncMessage}
|
|
2962
|
-
*/
|
|
2963
|
-
__wasm_refgen_toWasmMessage() {
|
|
2964
|
-
const ret = wasm.syncmessage___wasm_refgen_toWasmMessage(this.__wbg_ptr);
|
|
2965
|
-
return SyncMessage.__wrap(ret);
|
|
2966
|
-
}
|
|
2967
|
-
/**
|
|
2968
|
-
* Create a [`SyncMessage::BatchSyncRequest`] message.
|
|
2969
|
-
* @param {BatchSyncRequest} request
|
|
2970
|
-
* @returns {SyncMessage}
|
|
2971
|
-
*/
|
|
2972
|
-
static batchSyncRequest(request) {
|
|
2973
|
-
_assertClass(request, BatchSyncRequest);
|
|
2974
|
-
const ret = wasm.syncmessage_batchSyncRequest(request.__wbg_ptr);
|
|
2975
|
-
return SyncMessage.__wrap(ret);
|
|
2976
|
-
}
|
|
2977
|
-
/**
|
|
2978
|
-
* Create a [`SyncMessage::BatchSyncResponse`] message.
|
|
2979
|
-
* @param {BatchSyncResponse} response
|
|
2980
|
-
* @returns {SyncMessage}
|
|
2981
|
-
*/
|
|
2982
|
-
static batchSyncResponse(response) {
|
|
2983
|
-
_assertClass(response, BatchSyncResponse);
|
|
2984
|
-
const ret = wasm.syncmessage_batchSyncResponse(response.__wbg_ptr);
|
|
2985
|
-
return SyncMessage.__wrap(ret);
|
|
2986
|
-
}
|
|
2987
|
-
/**
|
|
2988
|
-
* The [`Blob`] for commit or fragment messages, if applicable.
|
|
2989
|
-
* @returns {Uint8Array | undefined}
|
|
2990
|
-
*/
|
|
2991
|
-
get blob() {
|
|
2992
|
-
const ret = wasm.syncmessage_blob(this.__wbg_ptr);
|
|
2993
|
-
return ret;
|
|
2994
|
-
}
|
|
2995
|
-
/**
|
|
2996
|
-
* The [`Blob`]s for a [`SyncMessage::BlobsResponse`], if applicable.
|
|
2997
|
-
* @returns {Uint8Array[] | undefined}
|
|
2998
|
-
*/
|
|
2999
|
-
get blobs() {
|
|
3000
|
-
const ret = wasm.syncmessage_blobs(this.__wbg_ptr);
|
|
3001
|
-
let v1;
|
|
3002
|
-
if (ret[0] !== 0) {
|
|
3003
|
-
v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
3004
|
-
wasm.__wbindgen_export5(ret[0], ret[1] * 4, 4);
|
|
3005
|
-
}
|
|
3006
|
-
return v1;
|
|
3007
|
-
}
|
|
3008
|
-
/**
|
|
3009
|
-
* Create a [`SyncMessage::BlobsRequest`] message.
|
|
3010
|
-
* @param {SedimentreeId} id
|
|
3011
|
-
* @param {Digest[]} digests
|
|
3012
|
-
* @returns {SyncMessage}
|
|
3013
|
-
*/
|
|
3014
|
-
static blobsRequest(id, digests) {
|
|
3015
|
-
_assertClass(id, SedimentreeId);
|
|
3016
|
-
const ptr0 = passArrayJsValueToWasm0(digests, wasm.__wbindgen_export);
|
|
3017
|
-
const len0 = WASM_VECTOR_LEN;
|
|
3018
|
-
const ret = wasm.syncmessage_blobsRequest(id.__wbg_ptr, ptr0, len0);
|
|
3019
|
-
return SyncMessage.__wrap(ret);
|
|
3020
|
-
}
|
|
3021
|
-
/**
|
|
3022
|
-
* Create a [`SyncMessage::BlobsResponse`] message.
|
|
3023
|
-
* @param {SedimentreeId} id
|
|
3024
|
-
* @param {Uint8Array[]} blobs
|
|
3025
|
-
* @returns {SyncMessage}
|
|
3026
|
-
*/
|
|
3027
|
-
static blobsResponse(id, blobs) {
|
|
3028
|
-
_assertClass(id, SedimentreeId);
|
|
3029
|
-
const ptr0 = passArrayJsValueToWasm0(blobs, wasm.__wbindgen_export);
|
|
3030
|
-
const len0 = WASM_VECTOR_LEN;
|
|
3031
|
-
const ret = wasm.syncmessage_blobsResponse(id.__wbg_ptr, ptr0, len0);
|
|
3032
|
-
return SyncMessage.__wrap(ret);
|
|
3033
|
-
}
|
|
3034
|
-
/**
|
|
3035
|
-
* The [`LooseCommit`] for a [`SyncMessage::LooseCommit`], if applicable.
|
|
3036
|
-
*
|
|
3037
|
-
* Decodes the signed payload to extract the underlying commit.
|
|
3038
|
-
* @returns {LooseCommit | undefined}
|
|
3039
|
-
*/
|
|
3040
|
-
get commit() {
|
|
3041
|
-
const ret = wasm.syncmessage_commit(this.__wbg_ptr);
|
|
3042
|
-
return ret === 0 ? undefined : LooseCommit.__wrap(ret);
|
|
3043
|
-
}
|
|
3044
|
-
/**
|
|
3045
|
-
* The requested [`Digest`]s for a [`SyncMessage::BlobsRequest`], if applicable.
|
|
3046
|
-
* @returns {Digest[] | undefined}
|
|
3047
|
-
*/
|
|
3048
|
-
get digests() {
|
|
3049
|
-
const ret = wasm.syncmessage_digests(this.__wbg_ptr);
|
|
3050
|
-
let v1;
|
|
3051
|
-
if (ret[0] !== 0) {
|
|
3052
|
-
v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
3053
|
-
wasm.__wbindgen_export5(ret[0], ret[1] * 4, 4);
|
|
3054
|
-
}
|
|
3055
|
-
return v1;
|
|
3056
|
-
}
|
|
3057
|
-
/**
|
|
3058
|
-
* The [`Fragment`] for a [`SyncMessage::Fragment`], if applicable.
|
|
3059
|
-
*
|
|
3060
|
-
* Decodes the signed payload to extract the underlying fragment.
|
|
3061
|
-
* @returns {Fragment | undefined}
|
|
3062
|
-
*/
|
|
3063
|
-
get fragment() {
|
|
3064
|
-
const ret = wasm.syncmessage_fragment(this.__wbg_ptr);
|
|
3065
|
-
return ret === 0 ? undefined : Fragment.__wrap(ret);
|
|
3066
|
-
}
|
|
3067
|
-
/**
|
|
3068
|
-
* Deserialize a message from bytes.
|
|
3069
|
-
*
|
|
3070
|
-
* # Errors
|
|
3071
|
-
*
|
|
3072
|
-
* Returns a [`JsMessageDeserializationError`] if deserialization fails.
|
|
3073
|
-
* @param {Uint8Array} bytes
|
|
3074
|
-
* @returns {SyncMessage}
|
|
3075
|
-
*/
|
|
3076
|
-
static fromBytes(bytes) {
|
|
3077
|
-
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
|
|
3078
|
-
const len0 = WASM_VECTOR_LEN;
|
|
3079
|
-
const ret = wasm.syncmessage_fromBytes(ptr0, len0);
|
|
3080
|
-
if (ret[2]) {
|
|
3081
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
3082
|
-
}
|
|
3083
|
-
return SyncMessage.__wrap(ret[0]);
|
|
3084
|
-
}
|
|
3085
|
-
/**
|
|
3086
|
-
* The [`BatchSyncRequest`] for a [`SyncMessage::BatchSyncRequest`], if applicable.
|
|
3087
|
-
* @returns {BatchSyncRequest | undefined}
|
|
3088
|
-
*/
|
|
3089
|
-
get request() {
|
|
3090
|
-
const ret = wasm.syncmessage_request(this.__wbg_ptr);
|
|
3091
|
-
return ret === 0 ? undefined : BatchSyncRequest.__wrap(ret);
|
|
3092
|
-
}
|
|
3093
|
-
/**
|
|
3094
|
-
* The [`BatchSyncResponse`] for a [`SyncMessage::BatchSyncResponse`], if applicable.
|
|
3095
|
-
* @returns {BatchSyncResponse | undefined}
|
|
3096
|
-
*/
|
|
3097
|
-
get response() {
|
|
3098
|
-
const ret = wasm.syncmessage_response(this.__wbg_ptr);
|
|
3099
|
-
return ret === 0 ? undefined : BatchSyncResponse.__wrap(ret);
|
|
3100
|
-
}
|
|
3101
|
-
/**
|
|
3102
|
-
* The [`SedimentreeId`] associated with this message, if any.
|
|
3103
|
-
* @returns {SedimentreeId | undefined}
|
|
3104
|
-
*/
|
|
3105
|
-
get sedimentreeId() {
|
|
3106
|
-
const ret = wasm.syncmessage_sedimentreeId(this.__wbg_ptr);
|
|
3107
|
-
return ret === 0 ? undefined : SedimentreeId.__wrap(ret);
|
|
3108
|
-
}
|
|
3109
|
-
/**
|
|
3110
|
-
* Serialize the message to bytes.
|
|
3111
|
-
* @returns {Uint8Array}
|
|
3112
|
-
*/
|
|
3113
|
-
toBytes() {
|
|
3114
|
-
const ret = wasm.syncmessage_toBytes(this.__wbg_ptr);
|
|
3115
|
-
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
3116
|
-
wasm.__wbindgen_export5(ret[0], ret[1] * 1, 1);
|
|
3117
|
-
return v1;
|
|
3118
|
-
}
|
|
3119
|
-
/**
|
|
3120
|
-
* The message variant name.
|
|
3121
|
-
* @returns {string}
|
|
3122
|
-
*/
|
|
3123
|
-
get type() {
|
|
3124
|
-
let deferred1_0;
|
|
3125
|
-
let deferred1_1;
|
|
3126
|
-
try {
|
|
3127
|
-
const ret = wasm.syncmessage_type(this.__wbg_ptr);
|
|
3128
|
-
deferred1_0 = ret[0];
|
|
3129
|
-
deferred1_1 = ret[1];
|
|
3130
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
3131
|
-
} finally {
|
|
3132
|
-
wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
|
|
3133
|
-
}
|
|
3134
|
-
}
|
|
3135
|
-
}
|
|
3136
|
-
if (Symbol.dispose) SyncMessage.prototype[Symbol.dispose] = SyncMessage.prototype.free;
|
|
3137
|
-
|
|
3138
|
-
/**
|
|
3139
|
-
* Statistics from a sync operation.
|
|
3140
|
-
*
|
|
3141
|
-
* The "sent" counts reflect items that were _successfully_ sent over the wire,
|
|
3142
|
-
* not just items that were requested.
|
|
3143
|
-
*/
|
|
3144
|
-
export class SyncStats {
|
|
3145
|
-
static __wrap(ptr) {
|
|
3146
|
-
ptr = ptr >>> 0;
|
|
3147
|
-
const obj = Object.create(SyncStats.prototype);
|
|
3148
|
-
obj.__wbg_ptr = ptr;
|
|
3149
|
-
SyncStatsFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
3150
|
-
return obj;
|
|
3151
|
-
}
|
|
3152
|
-
__destroy_into_raw() {
|
|
3153
|
-
const ptr = this.__wbg_ptr;
|
|
3154
|
-
this.__wbg_ptr = 0;
|
|
3155
|
-
SyncStatsFinalization.unregister(this);
|
|
3156
|
-
return ptr;
|
|
3157
|
-
}
|
|
3158
|
-
free() {
|
|
3159
|
-
const ptr = this.__destroy_into_raw();
|
|
3160
|
-
wasm.__wbg_syncstats_free(ptr, 0);
|
|
3161
|
-
}
|
|
3162
|
-
/**
|
|
3163
|
-
* Number of commits received from the peer.
|
|
3164
|
-
* @returns {number}
|
|
3165
|
-
*/
|
|
3166
|
-
get commitsReceived() {
|
|
3167
|
-
const ret = wasm.syncstats_commitsReceived(this.__wbg_ptr);
|
|
3168
|
-
return ret >>> 0;
|
|
3169
|
-
}
|
|
3170
|
-
/**
|
|
3171
|
-
* Number of commits successfully sent to the peer.
|
|
3172
|
-
* @returns {number}
|
|
3173
|
-
*/
|
|
3174
|
-
get commitsSent() {
|
|
3175
|
-
const ret = wasm.syncstats_commitsSent(this.__wbg_ptr);
|
|
3176
|
-
return ret >>> 0;
|
|
3177
|
-
}
|
|
3178
|
-
/**
|
|
3179
|
-
* Number of fragments received from the peer.
|
|
3180
|
-
* @returns {number}
|
|
3181
|
-
*/
|
|
3182
|
-
get fragmentsReceived() {
|
|
3183
|
-
const ret = wasm.syncstats_fragmentsReceived(this.__wbg_ptr);
|
|
3184
|
-
return ret >>> 0;
|
|
3185
|
-
}
|
|
3186
|
-
/**
|
|
3187
|
-
* Number of fragments successfully sent to the peer.
|
|
3188
|
-
* @returns {number}
|
|
3189
|
-
*/
|
|
3190
|
-
get fragmentsSent() {
|
|
3191
|
-
const ret = wasm.syncstats_fragmentsSent(this.__wbg_ptr);
|
|
3192
|
-
return ret >>> 0;
|
|
3193
|
-
}
|
|
3194
|
-
/**
|
|
3195
|
-
* Returns true if no commits or fragments were transferred.
|
|
3196
|
-
*
|
|
3197
|
-
* Note: `remoteHeads` may still be non-empty (heads metadata is not
|
|
3198
|
-
* considered "data" for this check).
|
|
3199
|
-
* @returns {boolean}
|
|
3200
|
-
*/
|
|
3201
|
-
get isEmpty() {
|
|
3202
|
-
const ret = wasm.syncstats_isEmpty(this.__wbg_ptr);
|
|
3203
|
-
return ret !== 0;
|
|
3204
|
-
}
|
|
3205
|
-
/**
|
|
3206
|
-
* The remote peer's heads for this sedimentree.
|
|
3207
|
-
* @returns {Digest[]}
|
|
3208
|
-
*/
|
|
3209
|
-
get remoteHeads() {
|
|
3210
|
-
const ret = wasm.syncstats_remoteHeads(this.__wbg_ptr);
|
|
3211
|
-
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
3212
|
-
wasm.__wbindgen_export5(ret[0], ret[1] * 4, 4);
|
|
3213
|
-
return v1;
|
|
3214
|
-
}
|
|
3215
|
-
/**
|
|
3216
|
-
* Total items received (commits + fragments).
|
|
3217
|
-
* @returns {number}
|
|
3218
|
-
*/
|
|
3219
|
-
get totalReceived() {
|
|
3220
|
-
const ret = wasm.syncstats_totalReceived(this.__wbg_ptr);
|
|
3221
|
-
return ret >>> 0;
|
|
3222
|
-
}
|
|
3223
|
-
/**
|
|
3224
|
-
* Total items sent (commits + fragments).
|
|
3225
|
-
* @returns {number}
|
|
3226
|
-
*/
|
|
3227
|
-
get totalSent() {
|
|
3228
|
-
const ret = wasm.syncstats_totalSent(this.__wbg_ptr);
|
|
3229
|
-
return ret >>> 0;
|
|
3230
|
-
}
|
|
3231
|
-
}
|
|
3232
|
-
if (Symbol.dispose) SyncStats.prototype[Symbol.dispose] = SyncStats.prototype.free;
|
|
3233
|
-
|
|
3234
|
-
/**
|
|
3235
|
-
* An Ed25519 signer using the browser's `WebCrypto` API.
|
|
3236
|
-
*
|
|
3237
|
-
* This signer generates and stores Ed25519 keys using `crypto.subtle`,
|
|
3238
|
-
* providing secure key generation and signing operations. The key is
|
|
3239
|
-
* persisted to `IndexedDB` so it survives page reloads.
|
|
3240
|
-
*
|
|
3241
|
-
* # Example
|
|
3242
|
-
*
|
|
3243
|
-
* ```javascript
|
|
3244
|
-
* import { WebCryptoSigner } from "@anthropic/subduction";
|
|
3245
|
-
*
|
|
3246
|
-
* const signer = await WebCryptoSigner.setup();
|
|
3247
|
-
* console.log("Peer ID:", signer.peerId().toString());
|
|
3248
|
-
* ```
|
|
3249
|
-
*/
|
|
3250
|
-
export class WebCryptoSigner {
|
|
3251
|
-
static __wrap(ptr) {
|
|
3252
|
-
ptr = ptr >>> 0;
|
|
3253
|
-
const obj = Object.create(WebCryptoSigner.prototype);
|
|
3254
|
-
obj.__wbg_ptr = ptr;
|
|
3255
|
-
WebCryptoSignerFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
3256
|
-
return obj;
|
|
3257
|
-
}
|
|
3258
|
-
__destroy_into_raw() {
|
|
3259
|
-
const ptr = this.__wbg_ptr;
|
|
3260
|
-
this.__wbg_ptr = 0;
|
|
3261
|
-
WebCryptoSignerFinalization.unregister(this);
|
|
3262
|
-
return ptr;
|
|
3263
|
-
}
|
|
3264
|
-
free() {
|
|
3265
|
-
const ptr = this.__destroy_into_raw();
|
|
3266
|
-
wasm.__wbg_webcryptosigner_free(ptr, 0);
|
|
3267
|
-
}
|
|
3268
|
-
/**
|
|
3269
|
-
* Get the peer ID derived from this signer's verifying key.
|
|
3270
|
-
*
|
|
3271
|
-
* # Panics
|
|
3272
|
-
*
|
|
3273
|
-
* Panics if the stored public key bytes are invalid (should never happen).
|
|
3274
|
-
* @returns {PeerId}
|
|
3275
|
-
*/
|
|
3276
|
-
peerId() {
|
|
3277
|
-
const ret = wasm.webcryptosigner_peerId(this.__wbg_ptr);
|
|
3278
|
-
return PeerId.__wrap(ret);
|
|
3279
|
-
}
|
|
3280
|
-
/**
|
|
3281
|
-
* Set up the signer, loading an existing key from `IndexedDB` or generating a new one.
|
|
3282
|
-
*
|
|
3283
|
-
* # Errors
|
|
3284
|
-
*
|
|
3285
|
-
* Returns an error if `WebCrypto` or `IndexedDB` operations fail.
|
|
3286
|
-
* @returns {Promise<WebCryptoSigner>}
|
|
3287
|
-
*/
|
|
3288
|
-
static setup() {
|
|
3289
|
-
const ret = wasm.webcryptosigner_setup();
|
|
3290
|
-
return ret;
|
|
3291
|
-
}
|
|
3292
|
-
/**
|
|
3293
|
-
* Sign a message and return the 64-byte Ed25519 signature.
|
|
3294
|
-
*
|
|
3295
|
-
* # Errors
|
|
3296
|
-
*
|
|
3297
|
-
* Returns an error if `WebCrypto` signing fails.
|
|
3298
|
-
* @param {Uint8Array} message
|
|
3299
|
-
* @returns {Promise<Uint8Array>}
|
|
3300
|
-
*/
|
|
3301
|
-
sign(message) {
|
|
3302
|
-
const ptr0 = passArray8ToWasm0(message, wasm.__wbindgen_export);
|
|
3303
|
-
const len0 = WASM_VECTOR_LEN;
|
|
3304
|
-
const ret = wasm.webcryptosigner_sign(this.__wbg_ptr, ptr0, len0);
|
|
3305
|
-
return ret;
|
|
3306
|
-
}
|
|
3307
|
-
/**
|
|
3308
|
-
* Get the 32-byte Ed25519 verifying (public) key.
|
|
3309
|
-
* @returns {Uint8Array}
|
|
3310
|
-
*/
|
|
3311
|
-
verifyingKey() {
|
|
3312
|
-
const ret = wasm.webcryptosigner_verifyingKey(this.__wbg_ptr);
|
|
3313
|
-
return ret;
|
|
3314
|
-
}
|
|
3315
|
-
}
|
|
3316
|
-
if (Symbol.dispose) WebCryptoSigner.prototype[Symbol.dispose] = WebCryptoSigner.prototype.free;
|
|
3317
|
-
|
|
3318
|
-
/**
|
|
3319
|
-
* Convenience factory — equivalent to `new MessagePortTransport(port)`.
|
|
3320
|
-
* @param {any} port
|
|
3321
|
-
* @returns {MessagePortTransport}
|
|
3322
|
-
*/
|
|
3323
|
-
export function makeMessagePortTransport(port) {
|
|
3324
|
-
const ret = wasm.makeMessagePortTransport(port);
|
|
3325
|
-
return MessagePortTransport.__wrap(ret);
|
|
3326
|
-
}
|
|
3327
|
-
|
|
3328
|
-
/**
|
|
3329
|
-
* Entry point called when the Wasm module is instantiated.
|
|
3330
|
-
*
|
|
3331
|
-
* Only compiled when the `standalone` feature is active. Downstream cdylib
|
|
3332
|
-
* crates that define their own `#[wasm_bindgen(start)]` should depend on
|
|
3333
|
-
* `subduction_wasm` with `default-features = false` and call
|
|
3334
|
-
* [`set_panic_hook`] from their own start function.
|
|
3335
|
-
*/
|
|
3336
|
-
export function start() {
|
|
3337
|
-
wasm.start();
|
|
3338
|
-
}
|
|
3339
|
-
export function __wbg___wasm_refgen_toWasmCommitWithBlob_4c1dc5cc453af7eb(arg0) {
|
|
3340
|
-
const ret = arg0.__wasm_refgen_toWasmCommitWithBlob();
|
|
3341
|
-
_assertClass(ret, CommitWithBlob);
|
|
3342
|
-
var ptr1 = ret.__destroy_into_raw();
|
|
3343
|
-
return ptr1;
|
|
3344
|
-
}
|
|
3345
|
-
export function __wbg___wasm_refgen_toWasmDepth_e11bce6176c8257e(arg0) {
|
|
3346
|
-
const ret = arg0.__wasm_refgen_toWasmDepth();
|
|
3347
|
-
_assertClass(ret, Depth);
|
|
3348
|
-
var ptr1 = ret.__destroy_into_raw();
|
|
3349
|
-
return ptr1;
|
|
3350
|
-
}
|
|
3351
|
-
export function __wbg___wasm_refgen_toWasmDigest_86d449f5dc99fc6a(arg0) {
|
|
3352
|
-
const ret = arg0.__wasm_refgen_toWasmDigest();
|
|
3353
|
-
_assertClass(ret, Digest);
|
|
3354
|
-
var ptr1 = ret.__destroy_into_raw();
|
|
3355
|
-
return ptr1;
|
|
3356
|
-
}
|
|
3357
|
-
export function __wbg___wasm_refgen_toWasmFragmentWithBlob_d7450dc251166eea(arg0) {
|
|
3358
|
-
const ret = arg0.__wasm_refgen_toWasmFragmentWithBlob();
|
|
3359
|
-
_assertClass(ret, FragmentWithBlob);
|
|
3360
|
-
var ptr1 = ret.__destroy_into_raw();
|
|
3361
|
-
return ptr1;
|
|
3362
|
-
}
|
|
3363
|
-
export function __wbg___wasm_refgen_toWasmFragment_03b5e19d20693b4f(arg0) {
|
|
3364
|
-
const ret = arg0.__wasm_refgen_toWasmFragment();
|
|
3365
|
-
_assertClass(ret, Fragment);
|
|
3366
|
-
var ptr1 = ret.__destroy_into_raw();
|
|
3367
|
-
return ptr1;
|
|
3368
|
-
}
|
|
3369
|
-
export function __wbg___wasm_refgen_toWasmLooseCommit_bc6f015053af2dd7(arg0) {
|
|
3370
|
-
const ret = arg0.__wasm_refgen_toWasmLooseCommit();
|
|
3371
|
-
_assertClass(ret, LooseCommit);
|
|
3372
|
-
var ptr1 = ret.__destroy_into_raw();
|
|
3373
|
-
return ptr1;
|
|
3374
|
-
}
|
|
3375
|
-
export function __wbg___wbindgen_debug_string_5398f5bb970e0daa(arg0, arg1) {
|
|
3376
|
-
const ret = debugString(arg1);
|
|
3377
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
3378
|
-
const len1 = WASM_VECTOR_LEN;
|
|
3379
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
3380
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
3381
|
-
}
|
|
3382
|
-
export function __wbg___wbindgen_is_function_3c846841762788c1(arg0) {
|
|
3383
|
-
const ret = typeof(arg0) === 'function';
|
|
3384
|
-
return ret;
|
|
3385
|
-
}
|
|
3386
|
-
export function __wbg___wbindgen_is_null_0b605fc6b167c56f(arg0) {
|
|
3387
|
-
const ret = arg0 === null;
|
|
3388
|
-
return ret;
|
|
3389
|
-
}
|
|
3390
|
-
export function __wbg___wbindgen_is_object_781bc9f159099513(arg0) {
|
|
3391
|
-
const val = arg0;
|
|
3392
|
-
const ret = typeof(val) === 'object' && val !== null;
|
|
3393
|
-
return ret;
|
|
3394
|
-
}
|
|
3395
|
-
export function __wbg___wbindgen_is_string_7ef6b97b02428fae(arg0) {
|
|
3396
|
-
const ret = typeof(arg0) === 'string';
|
|
3397
|
-
return ret;
|
|
3398
|
-
}
|
|
3399
|
-
export function __wbg___wbindgen_is_undefined_52709e72fb9f179c(arg0) {
|
|
3400
|
-
const ret = arg0 === undefined;
|
|
3401
|
-
return ret;
|
|
3402
|
-
}
|
|
3403
|
-
export function __wbg___wbindgen_jsval_eq_ee31bfad3e536463(arg0, arg1) {
|
|
3404
|
-
const ret = arg0 === arg1;
|
|
3405
|
-
return ret;
|
|
3406
|
-
}
|
|
3407
|
-
export function __wbg___wbindgen_number_get_34bb9d9dcfa21373(arg0, arg1) {
|
|
3408
|
-
const obj = arg1;
|
|
3409
|
-
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
3410
|
-
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
3411
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
3412
|
-
}
|
|
3413
|
-
export function __wbg___wbindgen_string_get_395e606bd0ee4427(arg0, arg1) {
|
|
3414
|
-
const obj = arg1;
|
|
3415
|
-
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
3416
|
-
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
3417
|
-
var len1 = WASM_VECTOR_LEN;
|
|
3418
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
3419
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
3420
|
-
}
|
|
3421
|
-
export function __wbg___wbindgen_throw_6ddd609b62940d55(arg0, arg1) {
|
|
3422
|
-
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
3423
|
-
}
|
|
3424
|
-
export function __wbg__wbg_cb_unref_6b5b6b8576d35cb1(arg0) {
|
|
3425
|
-
arg0._wbg_cb_unref();
|
|
3426
|
-
}
|
|
3427
|
-
export function __wbg_arrayBuffer_eb8e9ca620af2a19() { return handleError(function (arg0) {
|
|
3428
|
-
const ret = arg0.arrayBuffer();
|
|
3429
|
-
return ret;
|
|
3430
|
-
}, arguments); }
|
|
3431
|
-
export function __wbg_authenticatedlongpoll_new(arg0) {
|
|
3432
|
-
const ret = AuthenticatedLongPoll.__wrap(arg0);
|
|
3433
|
-
return ret;
|
|
3434
|
-
}
|
|
3435
|
-
export function __wbg_authenticatedtransport_new(arg0) {
|
|
3436
|
-
const ret = AuthenticatedTransport.__wrap(arg0);
|
|
3437
|
-
return ret;
|
|
3438
|
-
}
|
|
3439
|
-
export function __wbg_authenticatedwebsocket_new(arg0) {
|
|
3440
|
-
const ret = AuthenticatedWebSocket.__wrap(arg0);
|
|
3441
|
-
return ret;
|
|
3442
|
-
}
|
|
3443
|
-
export function __wbg_authorizeConnect_0e61e98d289a37c9() { return handleError(function (arg0, arg1) {
|
|
3444
|
-
const ret = arg0.authorizeConnect(arg1);
|
|
3445
|
-
return ret;
|
|
3446
|
-
}, arguments); }
|
|
3447
|
-
export function __wbg_authorizeFetch_88703389e9c295d0() { return handleError(function (arg0, arg1, arg2) {
|
|
3448
|
-
const ret = arg0.authorizeFetch(arg1, arg2);
|
|
3449
|
-
return ret;
|
|
3450
|
-
}, arguments); }
|
|
3451
|
-
export function __wbg_authorizePut_dab9270462803778() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
3452
|
-
const ret = arg0.authorizePut(arg1, arg2, arg3);
|
|
3453
|
-
return ret;
|
|
3454
|
-
}, arguments); }
|
|
3455
|
-
export function __wbg_buffer_60b8043cd926067d(arg0) {
|
|
3456
|
-
const ret = arg0.buffer;
|
|
3457
|
-
return ret;
|
|
3458
|
-
}
|
|
3459
|
-
export function __wbg_call_2d781c1f4d5c0ef8() { return handleError(function (arg0, arg1, arg2) {
|
|
3460
|
-
const ret = arg0.call(arg1, arg2);
|
|
3461
|
-
return ret;
|
|
3462
|
-
}, arguments); }
|
|
3463
|
-
export function __wbg_call_e133b57c9155d22c() { return handleError(function (arg0, arg1) {
|
|
3464
|
-
const ret = arg0.call(arg1);
|
|
3465
|
-
return ret;
|
|
3466
|
-
}, arguments); }
|
|
3467
|
-
export function __wbg_call_f858478a02f9600f() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
|
3468
|
-
const ret = arg0.call(arg1, arg2, arg3, arg4);
|
|
3469
|
-
return ret;
|
|
3470
|
-
}, arguments); }
|
|
3471
|
-
export function __wbg_close_574e2788efd7bb53(arg0) {
|
|
3472
|
-
arg0.close();
|
|
3473
|
-
}
|
|
3474
|
-
export function __wbg_close_af26905c832a88cb() { return handleError(function (arg0) {
|
|
3475
|
-
arg0.close();
|
|
3476
|
-
}, arguments); }
|
|
3477
|
-
export function __wbg_close_cbf870bdad0aad99(arg0) {
|
|
3478
|
-
arg0.close();
|
|
3479
|
-
}
|
|
3480
|
-
export function __wbg_commitwithblob_new(arg0) {
|
|
3481
|
-
const ret = CommitWithBlob.__wrap(arg0);
|
|
3482
|
-
return ret;
|
|
3483
|
-
}
|
|
3484
|
-
export function __wbg_contains_ef4bfb7fa5a241b7(arg0, arg1, arg2) {
|
|
3485
|
-
const ret = arg0.contains(getStringFromWasm0(arg1, arg2));
|
|
3486
|
-
return ret;
|
|
3487
|
-
}
|
|
3488
|
-
export function __wbg_createObjectStore_92a8aebcc6f9d7e3() { return handleError(function (arg0, arg1, arg2) {
|
|
3489
|
-
const ret = arg0.createObjectStore(getStringFromWasm0(arg1, arg2));
|
|
3490
|
-
return ret;
|
|
3491
|
-
}, arguments); }
|
|
3492
|
-
export function __wbg_crypto_38df2bab126b63dc(arg0) {
|
|
3493
|
-
const ret = arg0.crypto;
|
|
3494
|
-
return ret;
|
|
3495
|
-
}
|
|
3496
|
-
export function __wbg_data_a3d9ff9cdd801002(arg0) {
|
|
3497
|
-
const ret = arg0.data;
|
|
3498
|
-
return ret;
|
|
3499
|
-
}
|
|
3500
|
-
export function __wbg_deleteAllCommits_b0197e590f7fce60(arg0, arg1) {
|
|
3501
|
-
const ret = arg0.deleteAllCommits(arg1);
|
|
3502
|
-
return ret;
|
|
3503
|
-
}
|
|
3504
|
-
export function __wbg_deleteAllFragments_f884845698f5afb7(arg0, arg1) {
|
|
3505
|
-
const ret = arg0.deleteAllFragments(arg1);
|
|
3506
|
-
return ret;
|
|
3507
|
-
}
|
|
3508
|
-
export function __wbg_digest_new(arg0) {
|
|
3509
|
-
const ret = Digest.__wrap(arg0);
|
|
3510
|
-
return ret;
|
|
3511
|
-
}
|
|
3512
|
-
export function __wbg_digest_unwrap(arg0) {
|
|
3513
|
-
const ret = Digest.__unwrap(arg0);
|
|
3514
|
-
return ret;
|
|
3515
|
-
}
|
|
3516
|
-
export function __wbg_disconnect_849aae59f5879e45(arg0) {
|
|
3517
|
-
const ret = arg0.disconnect();
|
|
3518
|
-
return ret;
|
|
3519
|
-
}
|
|
3520
|
-
export function __wbg_error_a6fa202b58aa1cd3(arg0, arg1) {
|
|
3521
|
-
let deferred0_0;
|
|
3522
|
-
let deferred0_1;
|
|
3523
|
-
try {
|
|
3524
|
-
deferred0_0 = arg0;
|
|
3525
|
-
deferred0_1 = arg1;
|
|
3526
|
-
console.error(getStringFromWasm0(arg0, arg1));
|
|
3527
|
-
} finally {
|
|
3528
|
-
wasm.__wbindgen_export5(deferred0_0, deferred0_1, 1);
|
|
3529
|
-
}
|
|
3530
|
-
}
|
|
3531
|
-
export function __wbg_exportKey_c43b919dba5a1db2() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
3532
|
-
const ret = arg0.exportKey(getStringFromWasm0(arg1, arg2), arg3);
|
|
3533
|
-
return ret;
|
|
3534
|
-
}, arguments); }
|
|
3535
|
-
export function __wbg_fetch_5550a88cf343aaa9(arg0, arg1) {
|
|
3536
|
-
const ret = arg0.fetch(arg1);
|
|
3537
|
-
return ret;
|
|
3538
|
-
}
|
|
3539
|
-
export function __wbg_fetch_f8a611684c3b5fe5(arg0, arg1) {
|
|
3540
|
-
const ret = arg0.fetch(arg1);
|
|
3541
|
-
return ret;
|
|
3542
|
-
}
|
|
3543
|
-
export function __wbg_filterAuthorizedFetch_0d6450fa919b271d() { return handleError(function (arg0, arg1, arg2) {
|
|
3544
|
-
const ret = arg0.filterAuthorizedFetch(arg1, arg2);
|
|
3545
|
-
return ret;
|
|
3546
|
-
}, arguments); }
|
|
3547
|
-
export function __wbg_fragment_new(arg0) {
|
|
3548
|
-
const ret = Fragment.__wrap(arg0);
|
|
3549
|
-
return ret;
|
|
3550
|
-
}
|
|
3551
|
-
export function __wbg_fragmentrequested_new(arg0) {
|
|
3552
|
-
const ret = FragmentRequested.__wrap(arg0);
|
|
3553
|
-
return ret;
|
|
3554
|
-
}
|
|
3555
|
-
export function __wbg_fragmentwithblob_new(arg0) {
|
|
3556
|
-
const ret = FragmentWithBlob.__wrap(arg0);
|
|
3557
|
-
return ret;
|
|
3558
|
-
}
|
|
3559
|
-
export function __wbg_from_4bdf88943703fd48(arg0) {
|
|
3560
|
-
const ret = Array.from(arg0);
|
|
3561
|
-
return ret;
|
|
3562
|
-
}
|
|
3563
|
-
export function __wbg_generateKey_2b6cf71e7c9ad526() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
3564
|
-
const ret = arg0.generateKey(arg1, arg2 !== 0, arg3);
|
|
3565
|
-
return ret;
|
|
3566
|
-
}, arguments); }
|
|
3567
|
-
export function __wbg_getRandomValues_c44a50d8cfdaebeb() { return handleError(function (arg0, arg1) {
|
|
3568
|
-
arg0.getRandomValues(arg1);
|
|
3569
|
-
}, arguments); }
|
|
3570
|
-
export function __wbg_get_3ef1eba1850ade27() { return handleError(function (arg0, arg1) {
|
|
3571
|
-
const ret = Reflect.get(arg0, arg1);
|
|
3572
|
-
return ret;
|
|
3573
|
-
}, arguments); }
|
|
3574
|
-
export function __wbg_get_6ac8c8119f577720() { return handleError(function (arg0, arg1) {
|
|
3575
|
-
const ret = arg0.get(arg1);
|
|
3576
|
-
return ret;
|
|
3577
|
-
}, arguments); }
|
|
3578
|
-
export function __wbg_get_a867a94064ecd263() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
3579
|
-
const ret = arg1.get(getStringFromWasm0(arg2, arg3));
|
|
3580
|
-
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
3581
|
-
var len1 = WASM_VECTOR_LEN;
|
|
3582
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
3583
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
3584
|
-
}, arguments); }
|
|
3585
|
-
export function __wbg_get_a8ee5c45dabc1b3b(arg0, arg1) {
|
|
3586
|
-
const ret = arg0[arg1 >>> 0];
|
|
3587
|
-
return ret;
|
|
3588
|
-
}
|
|
3589
|
-
export function __wbg_get_unchecked_329cfe50afab7352(arg0, arg1) {
|
|
3590
|
-
const ret = arg0[arg1 >>> 0];
|
|
3591
|
-
return ret;
|
|
3592
|
-
}
|
|
3593
|
-
export function __wbg_has_926ef2ff40b308cf() { return handleError(function (arg0, arg1) {
|
|
3594
|
-
const ret = Reflect.has(arg0, arg1);
|
|
3595
|
-
return ret;
|
|
3596
|
-
}, arguments); }
|
|
3597
|
-
export function __wbg_headers_eb2234545f9ff993(arg0) {
|
|
3598
|
-
const ret = arg0.headers;
|
|
3599
|
-
return ret;
|
|
3600
|
-
}
|
|
3601
|
-
export function __wbg_host_5b3ec3e9d4d1fc78(arg0, arg1) {
|
|
3602
|
-
const ret = arg1.host;
|
|
3603
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
3604
|
-
const len1 = WASM_VECTOR_LEN;
|
|
3605
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
3606
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
3607
|
-
}
|
|
3608
|
-
export function __wbg_href_da367531ce807a58(arg0, arg1) {
|
|
3609
|
-
const ret = arg1.href;
|
|
3610
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
3611
|
-
const len1 = WASM_VECTOR_LEN;
|
|
3612
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
3613
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
3614
|
-
}
|
|
3615
|
-
export function __wbg_importKey_397406e38b080c57() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
|
|
3616
|
-
const ret = arg0.importKey(getStringFromWasm0(arg1, arg2), arg3, arg4, arg5 !== 0, arg6);
|
|
3617
|
-
return ret;
|
|
3618
|
-
}, arguments); }
|
|
3619
|
-
export function __wbg_instanceof_ArrayBuffer_101e2bf31071a9f6(arg0) {
|
|
3620
|
-
let result;
|
|
3621
|
-
try {
|
|
3622
|
-
result = arg0 instanceof ArrayBuffer;
|
|
3623
|
-
} catch (_) {
|
|
3624
|
-
result = false;
|
|
3625
|
-
}
|
|
3626
|
-
const ret = result;
|
|
3627
|
-
return ret;
|
|
3628
|
-
}
|
|
3629
|
-
export function __wbg_instanceof_Crypto_5c2a4c15287b0332(arg0) {
|
|
3630
|
-
let result;
|
|
3631
|
-
try {
|
|
3632
|
-
result = arg0 instanceof Crypto;
|
|
3633
|
-
} catch (_) {
|
|
3634
|
-
result = false;
|
|
3635
|
-
}
|
|
3636
|
-
const ret = result;
|
|
3637
|
-
return ret;
|
|
3638
|
-
}
|
|
3639
|
-
export function __wbg_instanceof_IdbDatabase_5f436cc89cc07f14(arg0) {
|
|
3640
|
-
let result;
|
|
3641
|
-
try {
|
|
3642
|
-
result = arg0 instanceof IDBDatabase;
|
|
3643
|
-
} catch (_) {
|
|
3644
|
-
result = false;
|
|
3645
|
-
}
|
|
3646
|
-
const ret = result;
|
|
3647
|
-
return ret;
|
|
3648
|
-
}
|
|
3649
|
-
export function __wbg_instanceof_IdbFactory_efcffbfd9020e4ac(arg0) {
|
|
3650
|
-
let result;
|
|
3651
|
-
try {
|
|
3652
|
-
result = arg0 instanceof IDBFactory;
|
|
3653
|
-
} catch (_) {
|
|
3654
|
-
result = false;
|
|
3655
|
-
}
|
|
3656
|
-
const ret = result;
|
|
3657
|
-
return ret;
|
|
3658
|
-
}
|
|
3659
|
-
export function __wbg_instanceof_IdbOpenDbRequest_10c2576001eb6613(arg0) {
|
|
3660
|
-
let result;
|
|
3661
|
-
try {
|
|
3662
|
-
result = arg0 instanceof IDBOpenDBRequest;
|
|
3663
|
-
} catch (_) {
|
|
3664
|
-
result = false;
|
|
3665
|
-
}
|
|
3666
|
-
const ret = result;
|
|
3667
|
-
return ret;
|
|
3668
|
-
}
|
|
3669
|
-
export function __wbg_instanceof_Promise_7c3bdd7805c2c6e6(arg0) {
|
|
3670
|
-
let result;
|
|
3671
|
-
try {
|
|
3672
|
-
result = arg0 instanceof Promise;
|
|
3673
|
-
} catch (_) {
|
|
3674
|
-
result = false;
|
|
3675
|
-
}
|
|
3676
|
-
const ret = result;
|
|
3677
|
-
return ret;
|
|
3678
|
-
}
|
|
3679
|
-
export function __wbg_instanceof_Response_9b4d9fd451e051b1(arg0) {
|
|
3680
|
-
let result;
|
|
3681
|
-
try {
|
|
3682
|
-
result = arg0 instanceof Response;
|
|
3683
|
-
} catch (_) {
|
|
3684
|
-
result = false;
|
|
3685
|
-
}
|
|
3686
|
-
const ret = result;
|
|
3687
|
-
return ret;
|
|
3688
|
-
}
|
|
3689
|
-
export function __wbg_instanceof_Uint8Array_740438561a5b956d(arg0) {
|
|
3690
|
-
let result;
|
|
3691
|
-
try {
|
|
3692
|
-
result = arg0 instanceof Uint8Array;
|
|
3693
|
-
} catch (_) {
|
|
3694
|
-
result = false;
|
|
3695
|
-
}
|
|
3696
|
-
const ret = result;
|
|
3697
|
-
return ret;
|
|
3698
|
-
}
|
|
3699
|
-
export function __wbg_instanceof_Window_23e677d2c6843922(arg0) {
|
|
3700
|
-
let result;
|
|
3701
|
-
try {
|
|
3702
|
-
result = arg0 instanceof Window;
|
|
3703
|
-
} catch (_) {
|
|
3704
|
-
result = false;
|
|
3705
|
-
}
|
|
3706
|
-
const ret = result;
|
|
3707
|
-
return ret;
|
|
3708
|
-
}
|
|
3709
|
-
export function __wbg_instanceof_WorkerGlobalScope_de6976d00cb213c6(arg0) {
|
|
3710
|
-
let result;
|
|
3711
|
-
try {
|
|
3712
|
-
result = arg0 instanceof WorkerGlobalScope;
|
|
3713
|
-
} catch (_) {
|
|
3714
|
-
result = false;
|
|
3715
|
-
}
|
|
3716
|
-
const ret = result;
|
|
3717
|
-
return ret;
|
|
3718
|
-
}
|
|
3719
|
-
export function __wbg_isArray_33b91feb269ff46e(arg0) {
|
|
3720
|
-
const ret = Array.isArray(arg0);
|
|
3721
|
-
return ret;
|
|
3722
|
-
}
|
|
3723
|
-
export function __wbg_isSafeInteger_ecd6a7f9c3e053cd(arg0) {
|
|
3724
|
-
const ret = Number.isSafeInteger(arg0);
|
|
3725
|
-
return ret;
|
|
3726
|
-
}
|
|
3727
|
-
export function __wbg_length_b3416cf66a5452c8(arg0) {
|
|
3728
|
-
const ret = arg0.length;
|
|
3729
|
-
return ret;
|
|
3730
|
-
}
|
|
3731
|
-
export function __wbg_length_ea16607d7b61445b(arg0) {
|
|
3732
|
-
const ret = arg0.length;
|
|
3733
|
-
return ret;
|
|
3734
|
-
}
|
|
3735
|
-
export function __wbg_loadAllCommits_0e97df07ed213aa0(arg0, arg1) {
|
|
3736
|
-
const ret = arg0.loadAllCommits(arg1);
|
|
3737
|
-
return ret;
|
|
3738
|
-
}
|
|
3739
|
-
export function __wbg_loadAllFragments_12ecf8f9bd0e0b58(arg0, arg1) {
|
|
3740
|
-
const ret = arg0.loadAllFragments(arg1);
|
|
3741
|
-
return ret;
|
|
3742
|
-
}
|
|
3743
|
-
export function __wbg_loadAllSedimentreeIds_1a18451ef1f8e795(arg0) {
|
|
3744
|
-
const ret = arg0.loadAllSedimentreeIds();
|
|
3745
|
-
return ret;
|
|
3746
|
-
}
|
|
3747
|
-
export function __wbg_loosecommit_new(arg0) {
|
|
3748
|
-
const ret = LooseCommit.__wrap(arg0);
|
|
3749
|
-
return ret;
|
|
3750
|
-
}
|
|
3751
|
-
export function __wbg_messageporttransport_new(arg0) {
|
|
3752
|
-
const ret = MessagePortTransport.__wrap(arg0);
|
|
3753
|
-
return ret;
|
|
3754
|
-
}
|
|
3755
|
-
export function __wbg_msCrypto_bd5a034af96bcba6(arg0) {
|
|
3756
|
-
const ret = arg0.msCrypto;
|
|
3757
|
-
return ret;
|
|
3758
|
-
}
|
|
3759
|
-
export function __wbg_new_0837727332ac86ba() { return handleError(function () {
|
|
3760
|
-
const ret = new Headers();
|
|
3761
|
-
return ret;
|
|
3762
|
-
}, arguments); }
|
|
3763
|
-
export function __wbg_new_227d7c05414eb861() {
|
|
3764
|
-
const ret = new Error();
|
|
3765
|
-
return ret;
|
|
3766
|
-
}
|
|
3767
|
-
export function __wbg_new_5f486cdf45a04d78(arg0) {
|
|
3768
|
-
const ret = new Uint8Array(arg0);
|
|
3769
|
-
return ret;
|
|
3770
|
-
}
|
|
3771
|
-
export function __wbg_new_a70fbab9066b301f() {
|
|
3772
|
-
const ret = new Array();
|
|
3773
|
-
return ret;
|
|
3774
|
-
}
|
|
3775
|
-
export function __wbg_new_ab79df5bd7c26067() {
|
|
3776
|
-
const ret = new Object();
|
|
3777
|
-
return ret;
|
|
3778
|
-
}
|
|
3779
|
-
export function __wbg_new_d098e265629cd10f(arg0, arg1) {
|
|
3780
|
-
try {
|
|
3781
|
-
var state0 = {a: arg0, b: arg1};
|
|
3782
|
-
var cb0 = (arg0, arg1) => {
|
|
3783
|
-
const a = state0.a;
|
|
3784
|
-
state0.a = 0;
|
|
3785
|
-
try {
|
|
3786
|
-
return __wasm_bindgen_func_elem_1605_191(a, state0.b, arg0, arg1);
|
|
3787
|
-
} finally {
|
|
3788
|
-
state0.a = a;
|
|
3789
|
-
}
|
|
3790
|
-
};
|
|
3791
|
-
const ret = new Promise(cb0);
|
|
3792
|
-
return ret;
|
|
3793
|
-
} finally {
|
|
3794
|
-
state0.a = state0.b = 0;
|
|
3795
|
-
}
|
|
3796
|
-
}
|
|
3797
|
-
export function __wbg_new_d15cb560a6a0e5f0(arg0, arg1) {
|
|
3798
|
-
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
3799
|
-
return ret;
|
|
3800
|
-
}
|
|
3801
|
-
export function __wbg_new_dd50bcc3f60ba434() { return handleError(function (arg0, arg1) {
|
|
3802
|
-
const ret = new WebSocket(getStringFromWasm0(arg0, arg1));
|
|
3803
|
-
return ret;
|
|
3804
|
-
}, arguments); }
|
|
3805
|
-
export function __wbg_new_f7708ba82c4c12f6() { return handleError(function () {
|
|
3806
|
-
const ret = new MessageChannel();
|
|
3807
|
-
return ret;
|
|
3808
|
-
}, arguments); }
|
|
3809
|
-
export function __wbg_new_from_slice_22da9388ac046e50(arg0, arg1) {
|
|
3810
|
-
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
3811
|
-
return ret;
|
|
3812
|
-
}
|
|
3813
|
-
export function __wbg_new_typed_aaaeaf29cf802876(arg0, arg1) {
|
|
3814
|
-
try {
|
|
3815
|
-
var state0 = {a: arg0, b: arg1};
|
|
3816
|
-
var cb0 = (arg0, arg1) => {
|
|
3817
|
-
const a = state0.a;
|
|
3818
|
-
state0.a = 0;
|
|
3819
|
-
try {
|
|
3820
|
-
return __wasm_bindgen_func_elem_1605_192(a, state0.b, arg0, arg1);
|
|
3821
|
-
} finally {
|
|
3822
|
-
state0.a = a;
|
|
3823
|
-
}
|
|
3824
|
-
};
|
|
3825
|
-
const ret = new Promise(cb0);
|
|
3826
|
-
return ret;
|
|
3827
|
-
} finally {
|
|
3828
|
-
state0.a = state0.b = 0;
|
|
3829
|
-
}
|
|
3830
|
-
}
|
|
3831
|
-
export function __wbg_new_typed_bccac67128ed885a() {
|
|
3832
|
-
const ret = new Array();
|
|
3833
|
-
return ret;
|
|
3834
|
-
}
|
|
3835
|
-
export function __wbg_new_with_length_825018a1616e9e55(arg0) {
|
|
3836
|
-
const ret = new Uint8Array(arg0 >>> 0);
|
|
3837
|
-
return ret;
|
|
3838
|
-
}
|
|
3839
|
-
export function __wbg_new_with_str_and_init_b4b54d1a819bc724() { return handleError(function (arg0, arg1, arg2) {
|
|
3840
|
-
const ret = new Request(getStringFromWasm0(arg0, arg1), arg2);
|
|
3841
|
-
return ret;
|
|
3842
|
-
}, arguments); }
|
|
3843
|
-
export function __wbg_node_84ea875411254db1(arg0) {
|
|
3844
|
-
const ret = arg0.node;
|
|
3845
|
-
return ret;
|
|
3846
|
-
}
|
|
3847
|
-
export function __wbg_now_16f0c993d5dd6c27() {
|
|
3848
|
-
const ret = Date.now();
|
|
3849
|
-
return ret;
|
|
3850
|
-
}
|
|
3851
|
-
export function __wbg_objectStoreNames_564985d2e9ae7523(arg0) {
|
|
3852
|
-
const ret = arg0.objectStoreNames;
|
|
3853
|
-
return ret;
|
|
3854
|
-
}
|
|
3855
|
-
export function __wbg_objectStore_f314ab152a5c7bd0() { return handleError(function (arg0, arg1, arg2) {
|
|
3856
|
-
const ret = arg0.objectStore(getStringFromWasm0(arg1, arg2));
|
|
3857
|
-
return ret;
|
|
3858
|
-
}, arguments); }
|
|
3859
|
-
export function __wbg_of_8bf7ed3eca00ea43(arg0) {
|
|
3860
|
-
const ret = Array.of(arg0);
|
|
3861
|
-
return ret;
|
|
3862
|
-
}
|
|
3863
|
-
export function __wbg_of_d6376e3774c51f89(arg0, arg1) {
|
|
3864
|
-
const ret = Array.of(arg0, arg1);
|
|
3865
|
-
return ret;
|
|
3866
|
-
}
|
|
3867
|
-
export function __wbg_onDisconnect_12d6884490508121(arg0, arg1) {
|
|
3868
|
-
arg0.onDisconnect(arg1);
|
|
3869
|
-
}
|
|
3870
|
-
export function __wbg_open_e7a9d3d6344572f6() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
3871
|
-
const ret = arg0.open(getStringFromWasm0(arg1, arg2), arg3 >>> 0);
|
|
3872
|
-
return ret;
|
|
3873
|
-
}, arguments); }
|
|
3874
|
-
export function __wbg_peerbatchsyncresult_new(arg0) {
|
|
3875
|
-
const ret = PeerBatchSyncResult.__wrap(arg0);
|
|
3876
|
-
return ret;
|
|
3877
|
-
}
|
|
3878
|
-
export function __wbg_peerid_new(arg0) {
|
|
3879
|
-
const ret = PeerId.__wrap(arg0);
|
|
3880
|
-
return ret;
|
|
3881
|
-
}
|
|
3882
|
-
export function __wbg_peerresultmap_new(arg0) {
|
|
3883
|
-
const ret = PeerResultMap.__wrap(arg0);
|
|
3884
|
-
return ret;
|
|
3885
|
-
}
|
|
3886
|
-
export function __wbg_port1_869a7ef90538dbdf(arg0) {
|
|
3887
|
-
const ret = arg0.port1;
|
|
3888
|
-
return ret;
|
|
3889
|
-
}
|
|
3890
|
-
export function __wbg_port2_947a51b8ba00adc9(arg0) {
|
|
3891
|
-
const ret = arg0.port2;
|
|
3892
|
-
return ret;
|
|
3893
|
-
}
|
|
3894
|
-
export function __wbg_postMessage_0541d6c31330afe3(arg0, arg1) {
|
|
3895
|
-
arg0.postMessage(arg1);
|
|
3896
|
-
}
|
|
3897
|
-
export function __wbg_process_44c7a14e11e9f69e(arg0) {
|
|
3898
|
-
const ret = arg0.process;
|
|
3899
|
-
return ret;
|
|
3900
|
-
}
|
|
3901
|
-
export function __wbg_prototypesetcall_d62e5099504357e6(arg0, arg1, arg2) {
|
|
3902
|
-
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
3903
|
-
}
|
|
3904
|
-
export function __wbg_push_e87b0e732085a946(arg0, arg1) {
|
|
3905
|
-
const ret = arg0.push(arg1);
|
|
3906
|
-
return ret;
|
|
3907
|
-
}
|
|
3908
|
-
export function __wbg_put_f1673d719f93ce22() { return handleError(function (arg0, arg1, arg2) {
|
|
3909
|
-
const ret = arg0.put(arg1, arg2);
|
|
3910
|
-
return ret;
|
|
3911
|
-
}, arguments); }
|
|
3912
|
-
export function __wbg_queueMicrotask_0c399741342fb10f(arg0) {
|
|
3913
|
-
const ret = arg0.queueMicrotask;
|
|
3914
|
-
return ret;
|
|
3915
|
-
}
|
|
3916
|
-
export function __wbg_queueMicrotask_a082d78ce798393e(arg0) {
|
|
3917
|
-
queueMicrotask(arg0);
|
|
3918
|
-
}
|
|
3919
|
-
export function __wbg_randomFillSync_6c25eac9869eb53c() { return handleError(function (arg0, arg1) {
|
|
3920
|
-
arg0.randomFillSync(arg1);
|
|
3921
|
-
}, arguments); }
|
|
3922
|
-
export function __wbg_readyState_1f1e7f1bdf9f4d42(arg0) {
|
|
3923
|
-
const ret = arg0.readyState;
|
|
3924
|
-
return ret;
|
|
3925
|
-
}
|
|
3926
|
-
export function __wbg_recvBytes_c85b12fb48cd7a35(arg0) {
|
|
3927
|
-
const ret = arg0.recvBytes();
|
|
3928
|
-
return ret;
|
|
3929
|
-
}
|
|
3930
|
-
export function __wbg_require_b4edbdcf3e2a1ef0() { return handleError(function () {
|
|
3931
|
-
const ret = module.require;
|
|
3932
|
-
return ret;
|
|
3933
|
-
}, arguments); }
|
|
3934
|
-
export function __wbg_resolve_ae8d83246e5bcc12(arg0) {
|
|
3935
|
-
const ret = Promise.resolve(arg0);
|
|
3936
|
-
return ret;
|
|
3937
|
-
}
|
|
3938
|
-
export function __wbg_result_c5baa2d3d690a01a() { return handleError(function (arg0) {
|
|
3939
|
-
const ret = arg0.result;
|
|
3940
|
-
return ret;
|
|
3941
|
-
}, arguments); }
|
|
3942
|
-
export function __wbg_saveCommit_02f095436fc502e0(arg0, arg1, arg2, arg3, arg4) {
|
|
3943
|
-
const ret = arg0.saveCommit(arg1, arg2, arg3, arg4);
|
|
3944
|
-
return ret;
|
|
3945
|
-
}
|
|
3946
|
-
export function __wbg_saveFragment_7681b2171b8cfb35(arg0, arg1, arg2, arg3, arg4) {
|
|
3947
|
-
const ret = arg0.saveFragment(arg1, arg2, arg3, arg4);
|
|
3948
|
-
return ret;
|
|
3949
|
-
}
|
|
3950
|
-
export function __wbg_saveSedimentreeId_c265aaeef5af34b6(arg0, arg1) {
|
|
3951
|
-
const ret = arg0.saveSedimentreeId(arg1);
|
|
3952
|
-
return ret;
|
|
3953
|
-
}
|
|
3954
|
-
export function __wbg_sedimentreeid_new(arg0) {
|
|
3955
|
-
const ret = SedimentreeId.__wrap(arg0);
|
|
3956
|
-
return ret;
|
|
3957
|
-
}
|
|
3958
|
-
export function __wbg_sedimentreeid_unwrap(arg0) {
|
|
3959
|
-
const ret = SedimentreeId.__unwrap(arg0);
|
|
3960
|
-
return ret;
|
|
3961
|
-
}
|
|
3962
|
-
export function __wbg_sendBytes_e6262dd74f1c260a(arg0, arg1) {
|
|
3963
|
-
const ret = arg0.sendBytes(arg1);
|
|
3964
|
-
return ret;
|
|
3965
|
-
}
|
|
3966
|
-
export function __wbg_send_d31a693c975dea74() { return handleError(function (arg0, arg1, arg2) {
|
|
3967
|
-
arg0.send(getArrayU8FromWasm0(arg1, arg2));
|
|
3968
|
-
}, arguments); }
|
|
3969
|
-
export function __wbg_setTimeout_7829585928963a1f(arg0, arg1) {
|
|
3970
|
-
const ret = setTimeout(arg0, arg1);
|
|
3971
|
-
return ret;
|
|
3972
|
-
}
|
|
3973
|
-
export function __wbg_set_7eaa4f96924fd6b3() { return handleError(function (arg0, arg1, arg2) {
|
|
3974
|
-
const ret = Reflect.set(arg0, arg1, arg2);
|
|
3975
|
-
return ret;
|
|
3976
|
-
}, arguments); }
|
|
3977
|
-
export function __wbg_set_binaryType_3dcf8281ec100a8f(arg0, arg1) {
|
|
3978
|
-
arg0.binaryType = __wbindgen_enum_BinaryType[arg1];
|
|
3979
|
-
}
|
|
3980
|
-
export function __wbg_set_body_a3d856b097dfda04(arg0, arg1) {
|
|
3981
|
-
arg0.body = arg1;
|
|
3982
|
-
}
|
|
3983
|
-
export function __wbg_set_e09648bea3f1af1e() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
|
3984
|
-
arg0.set(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
|
|
3985
|
-
}, arguments); }
|
|
3986
|
-
export function __wbg_set_headers_3c8fecc693b75327(arg0, arg1) {
|
|
3987
|
-
arg0.headers = arg1;
|
|
3988
|
-
}
|
|
3989
|
-
export function __wbg_set_method_8c015e8bcafd7be1(arg0, arg1, arg2) {
|
|
3990
|
-
arg0.method = getStringFromWasm0(arg1, arg2);
|
|
3991
|
-
}
|
|
3992
|
-
export function __wbg_set_mode_5a87f2c809cf37c2(arg0, arg1) {
|
|
3993
|
-
arg0.mode = __wbindgen_enum_RequestMode[arg1];
|
|
3994
|
-
}
|
|
3995
|
-
export function __wbg_set_name_7ef37fe858379aaf(arg0, arg1, arg2) {
|
|
3996
|
-
arg0.name = getStringFromWasm0(arg1, arg2);
|
|
3997
|
-
}
|
|
3998
|
-
export function __wbg_set_onclose_8da801226bdd7a7b(arg0, arg1) {
|
|
3999
|
-
arg0.onclose = arg1;
|
|
4000
|
-
}
|
|
4001
|
-
export function __wbg_set_onerror_8a268cb237177bba(arg0, arg1) {
|
|
4002
|
-
arg0.onerror = arg1;
|
|
4003
|
-
}
|
|
4004
|
-
export function __wbg_set_onerror_901ca711f94a5bbb(arg0, arg1) {
|
|
4005
|
-
arg0.onerror = arg1;
|
|
4006
|
-
}
|
|
4007
|
-
export function __wbg_set_onmessage_29558b29aee9a78a(arg0, arg1) {
|
|
4008
|
-
arg0.onmessage = arg1;
|
|
4009
|
-
}
|
|
4010
|
-
export function __wbg_set_onmessage_6f80ab771bf151aa(arg0, arg1) {
|
|
4011
|
-
arg0.onmessage = arg1;
|
|
4012
|
-
}
|
|
4013
|
-
export function __wbg_set_onopen_34e3e24cf9337ddd(arg0, arg1) {
|
|
4014
|
-
arg0.onopen = arg1;
|
|
4015
|
-
}
|
|
4016
|
-
export function __wbg_set_onsuccess_fca94ded107b64af(arg0, arg1) {
|
|
4017
|
-
arg0.onsuccess = arg1;
|
|
4018
|
-
}
|
|
4019
|
-
export function __wbg_set_onupgradeneeded_860ce42184f987e7(arg0, arg1) {
|
|
4020
|
-
arg0.onupgradeneeded = arg1;
|
|
4021
|
-
}
|
|
4022
|
-
export function __wbg_sign_a34d057afd14c54d() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
|
4023
|
-
const ret = arg0.sign(arg1, arg2, getArrayU8FromWasm0(arg3, arg4));
|
|
4024
|
-
return ret;
|
|
4025
|
-
}, arguments); }
|
|
4026
|
-
export function __wbg_sign_d03455abc6736428(arg0, arg1) {
|
|
4027
|
-
const ret = arg0.sign(arg1);
|
|
4028
|
-
return ret;
|
|
4029
|
-
}
|
|
4030
|
-
export function __wbg_signedfragment_new(arg0) {
|
|
4031
|
-
const ret = SignedFragment.__wrap(arg0);
|
|
4032
|
-
return ret;
|
|
4033
|
-
}
|
|
4034
|
-
export function __wbg_signedloosecommit_new(arg0) {
|
|
4035
|
-
const ret = SignedLooseCommit.__wrap(arg0);
|
|
4036
|
-
return ret;
|
|
4037
|
-
}
|
|
4038
|
-
export function __wbg_stack_3b0d974bbf31e44f(arg0, arg1) {
|
|
4039
|
-
const ret = arg1.stack;
|
|
4040
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
4041
|
-
const len1 = WASM_VECTOR_LEN;
|
|
4042
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
4043
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
4044
|
-
}
|
|
4045
|
-
export function __wbg_start_f837ba2bac4733b5(arg0) {
|
|
4046
|
-
arg0.start();
|
|
4047
|
-
}
|
|
4048
|
-
export function __wbg_static_accessor_GLOBAL_8adb955bd33fac2f() {
|
|
4049
|
-
const ret = typeof global === 'undefined' ? null : global;
|
|
4050
|
-
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
4051
|
-
}
|
|
4052
|
-
export function __wbg_static_accessor_GLOBAL_THIS_ad356e0db91c7913() {
|
|
4053
|
-
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
4054
|
-
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
4055
|
-
}
|
|
4056
|
-
export function __wbg_static_accessor_SELF_f207c857566db248() {
|
|
4057
|
-
const ret = typeof self === 'undefined' ? null : self;
|
|
4058
|
-
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
4059
|
-
}
|
|
4060
|
-
export function __wbg_static_accessor_WINDOW_bb9f1ba69d61b386() {
|
|
4061
|
-
const ret = typeof window === 'undefined' ? null : window;
|
|
4062
|
-
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
4063
|
-
}
|
|
4064
|
-
export function __wbg_status_318629ab93a22955(arg0) {
|
|
4065
|
-
const ret = arg0.status;
|
|
4066
|
-
return ret;
|
|
4067
|
-
}
|
|
4068
|
-
export function __wbg_subarray_a068d24e39478a8a(arg0, arg1, arg2) {
|
|
4069
|
-
const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
|
|
4070
|
-
return ret;
|
|
4071
|
-
}
|
|
4072
|
-
export function __wbg_subduction_new(arg0) {
|
|
4073
|
-
const ret = Subduction.__wrap(arg0);
|
|
4074
|
-
return ret;
|
|
4075
|
-
}
|
|
4076
|
-
export function __wbg_subductionhttplongpoll_new(arg0) {
|
|
4077
|
-
const ret = SubductionHttpLongPoll.__wrap(arg0);
|
|
4078
|
-
return ret;
|
|
4079
|
-
}
|
|
4080
|
-
export function __wbg_subductionwebsocket_new(arg0) {
|
|
4081
|
-
const ret = SubductionWebSocket.__wrap(arg0);
|
|
4082
|
-
return ret;
|
|
4083
|
-
}
|
|
4084
|
-
export function __wbg_subtle_c060fa3eb5c6248d(arg0) {
|
|
4085
|
-
const ret = arg0.subtle;
|
|
4086
|
-
return ret;
|
|
4087
|
-
}
|
|
4088
|
-
export function __wbg_target_7bc90f314634b37b(arg0) {
|
|
4089
|
-
const ret = arg0.target;
|
|
4090
|
-
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
4091
|
-
}
|
|
4092
|
-
export function __wbg_then_098abe61755d12f6(arg0, arg1) {
|
|
4093
|
-
const ret = arg0.then(arg1);
|
|
4094
|
-
return ret;
|
|
4095
|
-
}
|
|
4096
|
-
export function __wbg_then_9e335f6dd892bc11(arg0, arg1, arg2) {
|
|
4097
|
-
const ret = arg0.then(arg1, arg2);
|
|
4098
|
-
return ret;
|
|
4099
|
-
}
|
|
4100
|
-
export function __wbg_transaction_1309b463c399d2b3() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
4101
|
-
const ret = arg0.transaction(getStringFromWasm0(arg1, arg2), __wbindgen_enum_IdbTransactionMode[arg3]);
|
|
4102
|
-
return ret;
|
|
4103
|
-
}, arguments); }
|
|
4104
|
-
export function __wbg_transaction_2237af0233efbdf3() { return handleError(function (arg0, arg1, arg2) {
|
|
4105
|
-
const ret = arg0.transaction(getStringFromWasm0(arg1, arg2));
|
|
4106
|
-
return ret;
|
|
4107
|
-
}, arguments); }
|
|
4108
|
-
export function __wbg_tryIntoJsSedimentreeIdsArray_d6337c0aa0f28604() { return handleError(function (arg0, arg1) {
|
|
4109
|
-
const ret = tryIntoJsSedimentreeIdsArray(arg1);
|
|
4110
|
-
const ptr1 = passArrayJsValueToWasm0(ret, wasm.__wbindgen_export);
|
|
4111
|
-
const len1 = WASM_VECTOR_LEN;
|
|
4112
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
4113
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
4114
|
-
}, arguments); }
|
|
4115
|
-
export function __wbg_verifyingKey_29533740d75f8cdb(arg0) {
|
|
4116
|
-
const ret = arg0.verifyingKey();
|
|
4117
|
-
return ret;
|
|
4118
|
-
}
|
|
4119
|
-
export function __wbg_versions_276b2795b1c6a219(arg0) {
|
|
4120
|
-
const ret = arg0.versions;
|
|
4121
|
-
return ret;
|
|
4122
|
-
}
|
|
4123
|
-
export function __wbg_webcryptosigner_new(arg0) {
|
|
4124
|
-
const ret = WebCryptoSigner.__wrap(arg0);
|
|
4125
|
-
return ret;
|
|
4126
|
-
}
|
|
4127
|
-
export function __wbindgen_cast_0000000000000001(arg0, arg1) {
|
|
4128
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx: 11, function: Function { arguments: [Externref], shim_idx: 12, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
4129
|
-
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_274, __wasm_bindgen_func_elem_590);
|
|
4130
|
-
return ret;
|
|
4131
|
-
}
|
|
4132
|
-
export function __wbindgen_cast_0000000000000002(arg0, arg1) {
|
|
4133
|
-
// 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`.
|
|
4134
|
-
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_274, __wasm_bindgen_func_elem_590_1);
|
|
4135
|
-
return ret;
|
|
4136
|
-
}
|
|
4137
|
-
export function __wbindgen_cast_0000000000000003(arg0, arg1) {
|
|
4138
|
-
// 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`.
|
|
4139
|
-
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_274, __wasm_bindgen_func_elem_590_2);
|
|
4140
|
-
return ret;
|
|
4141
|
-
}
|
|
4142
|
-
export function __wbindgen_cast_0000000000000004(arg0, arg1) {
|
|
4143
|
-
// 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`.
|
|
4144
|
-
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_274, __wasm_bindgen_func_elem_590_3);
|
|
4145
|
-
return ret;
|
|
4146
|
-
}
|
|
4147
|
-
export function __wbindgen_cast_0000000000000005(arg0, arg1) {
|
|
4148
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx: 11, function: Function { arguments: [], shim_idx: 13, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`.
|
|
4149
|
-
const ret = makeClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_274, __wasm_bindgen_func_elem_589);
|
|
4150
|
-
return ret;
|
|
4151
|
-
}
|
|
4152
|
-
export function __wbindgen_cast_0000000000000006(arg0, arg1) {
|
|
4153
|
-
// 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`.
|
|
4154
|
-
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_274, __wasm_bindgen_func_elem_1605);
|
|
4155
|
-
return ret;
|
|
4156
|
-
}
|
|
4157
|
-
export function __wbindgen_cast_0000000000000007(arg0) {
|
|
4158
|
-
// Cast intrinsic for `F64 -> Externref`.
|
|
4159
|
-
const ret = arg0;
|
|
4160
|
-
return ret;
|
|
4161
|
-
}
|
|
4162
|
-
export function __wbindgen_cast_0000000000000008(arg0, arg1) {
|
|
4163
|
-
// Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
|
|
4164
|
-
const ret = getArrayU8FromWasm0(arg0, arg1);
|
|
4165
|
-
return ret;
|
|
4166
|
-
}
|
|
4167
|
-
export function __wbindgen_cast_0000000000000009(arg0, arg1) {
|
|
4168
|
-
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
4169
|
-
const ret = getStringFromWasm0(arg0, arg1);
|
|
4170
|
-
return ret;
|
|
4171
|
-
}
|
|
4172
|
-
export function __wbindgen_cast_000000000000000a(arg0, arg1) {
|
|
4173
|
-
var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
|
|
4174
|
-
wasm.__wbindgen_export5(arg0, arg1 * 4, 4);
|
|
4175
|
-
// Cast intrinsic for `Vector(NamedExternref("Fragment")) -> Externref`.
|
|
4176
|
-
const ret = v0;
|
|
4177
|
-
return ret;
|
|
4178
|
-
}
|
|
4179
|
-
export function __wbindgen_cast_000000000000000b(arg0, arg1) {
|
|
4180
|
-
var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
|
|
4181
|
-
wasm.__wbindgen_export5(arg0, arg1 * 4, 4);
|
|
4182
|
-
// Cast intrinsic for `Vector(NamedExternref("LooseCommit")) -> Externref`.
|
|
4183
|
-
const ret = v0;
|
|
4184
|
-
return ret;
|
|
4185
|
-
}
|
|
4186
|
-
export function __wbindgen_cast_000000000000000c(arg0, arg1) {
|
|
4187
|
-
var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
|
|
4188
|
-
wasm.__wbindgen_export5(arg0, arg1 * 4, 4);
|
|
4189
|
-
// Cast intrinsic for `Vector(NamedExternref("PeerId")) -> Externref`.
|
|
4190
|
-
const ret = v0;
|
|
4191
|
-
return ret;
|
|
4192
|
-
}
|
|
4193
|
-
export function __wbindgen_cast_000000000000000d(arg0, arg1) {
|
|
4194
|
-
var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
|
|
4195
|
-
wasm.__wbindgen_export5(arg0, arg1 * 4, 4);
|
|
4196
|
-
// Cast intrinsic for `Vector(NamedExternref("SedimentreeId")) -> Externref`.
|
|
4197
|
-
const ret = v0;
|
|
4198
|
-
return ret;
|
|
4199
|
-
}
|
|
4200
|
-
export function __wbindgen_cast_000000000000000e(arg0, arg1) {
|
|
4201
|
-
var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
|
|
4202
|
-
wasm.__wbindgen_export5(arg0, arg1 * 4, 4);
|
|
4203
|
-
// Cast intrinsic for `Vector(NamedExternref("Uint8Array")) -> Externref`.
|
|
4204
|
-
const ret = v0;
|
|
4205
|
-
return ret;
|
|
4206
|
-
}
|
|
4207
|
-
export function __wbindgen_init_externref_table() {
|
|
4208
|
-
const table = wasm.__wbindgen_externrefs;
|
|
4209
|
-
const offset = table.grow(4);
|
|
4210
|
-
table.set(0, undefined);
|
|
4211
|
-
table.set(offset + 0, undefined);
|
|
4212
|
-
table.set(offset + 1, null);
|
|
4213
|
-
table.set(offset + 2, true);
|
|
4214
|
-
table.set(offset + 3, false);
|
|
4215
|
-
}
|
|
4216
|
-
function __wasm_bindgen_func_elem_589(arg0, arg1) {
|
|
4217
|
-
wasm.__wasm_bindgen_func_elem_589(arg0, arg1);
|
|
4218
|
-
}
|
|
4219
|
-
|
|
4220
|
-
function __wasm_bindgen_func_elem_590(arg0, arg1, arg2) {
|
|
4221
|
-
wasm.__wasm_bindgen_func_elem_590(arg0, arg1, arg2);
|
|
4222
|
-
}
|
|
4223
|
-
|
|
4224
|
-
function __wasm_bindgen_func_elem_590_1(arg0, arg1, arg2) {
|
|
4225
|
-
wasm.__wasm_bindgen_func_elem_590_1(arg0, arg1, arg2);
|
|
4226
|
-
}
|
|
4227
|
-
|
|
4228
|
-
function __wasm_bindgen_func_elem_590_2(arg0, arg1, arg2) {
|
|
4229
|
-
wasm.__wasm_bindgen_func_elem_590_2(arg0, arg1, arg2);
|
|
4230
|
-
}
|
|
4231
|
-
|
|
4232
|
-
function __wasm_bindgen_func_elem_590_3(arg0, arg1, arg2) {
|
|
4233
|
-
wasm.__wasm_bindgen_func_elem_590_3(arg0, arg1, arg2);
|
|
4234
|
-
}
|
|
4235
|
-
|
|
4236
|
-
function __wasm_bindgen_func_elem_1605(arg0, arg1, arg2) {
|
|
4237
|
-
const ret = wasm.__wasm_bindgen_func_elem_1605(arg0, arg1, arg2);
|
|
4238
|
-
if (ret[1]) {
|
|
4239
|
-
throw takeFromExternrefTable0(ret[0]);
|
|
4240
|
-
}
|
|
4241
|
-
}
|
|
4242
|
-
|
|
4243
|
-
function __wasm_bindgen_func_elem_1605_191(arg0, arg1, arg2, arg3) {
|
|
4244
|
-
wasm.__wasm_bindgen_func_elem_1605_191(arg0, arg1, arg2, arg3);
|
|
4245
|
-
}
|
|
4246
|
-
|
|
4247
|
-
function __wasm_bindgen_func_elem_1605_192(arg0, arg1, arg2, arg3) {
|
|
4248
|
-
wasm.__wasm_bindgen_func_elem_1605_192(arg0, arg1, arg2, arg3);
|
|
4249
|
-
}
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
const __wbindgen_enum_BinaryType = ["blob", "arraybuffer"];
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
const __wbindgen_enum_IdbTransactionMode = ["readonly", "readwrite", "versionchange", "readwriteflush", "cleanup"];
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
|
|
4259
|
-
const MemorySignerFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4260
|
-
? { register: () => {}, unregister: () => {} }
|
|
4261
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_memorysigner_free(ptr >>> 0, 1));
|
|
4262
|
-
const MemoryStorageFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4263
|
-
? { register: () => {}, unregister: () => {} }
|
|
4264
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_memorystorage_free(ptr >>> 0, 1));
|
|
4265
|
-
const PeerBatchSyncResultFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4266
|
-
? { register: () => {}, unregister: () => {} }
|
|
4267
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_peerbatchsyncresult_free(ptr >>> 0, 1));
|
|
4268
|
-
const AuthenticatedLongPollFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4269
|
-
? { register: () => {}, unregister: () => {} }
|
|
4270
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_authenticatedlongpoll_free(ptr >>> 0, 1));
|
|
4271
|
-
const AuthenticatedTransportFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4272
|
-
? { register: () => {}, unregister: () => {} }
|
|
4273
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_authenticatedtransport_free(ptr >>> 0, 1));
|
|
4274
|
-
const AuthenticatedWebSocketFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4275
|
-
? { register: () => {}, unregister: () => {} }
|
|
4276
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_authenticatedwebsocket_free(ptr >>> 0, 1));
|
|
4277
|
-
const BatchSyncRequestFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4278
|
-
? { register: () => {}, unregister: () => {} }
|
|
4279
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_batchsyncrequest_free(ptr >>> 0, 1));
|
|
4280
|
-
const BatchSyncResponseFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4281
|
-
? { register: () => {}, unregister: () => {} }
|
|
4282
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_batchsyncresponse_free(ptr >>> 0, 1));
|
|
4283
|
-
const BlobMetaFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4284
|
-
? { register: () => {}, unregister: () => {} }
|
|
4285
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_blobmeta_free(ptr >>> 0, 1));
|
|
4286
|
-
const CallErrorFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4287
|
-
? { register: () => {}, unregister: () => {} }
|
|
4288
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_callerror_free(ptr >>> 0, 1));
|
|
4289
|
-
const CommitWithBlobFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4290
|
-
? { register: () => {}, unregister: () => {} }
|
|
4291
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_commitwithblob_free(ptr >>> 0, 1));
|
|
4292
|
-
const DepthFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4293
|
-
? { register: () => {}, unregister: () => {} }
|
|
4294
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_depth_free(ptr >>> 0, 1));
|
|
4295
|
-
const DigestFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4296
|
-
? { register: () => {}, unregister: () => {} }
|
|
4297
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_digest_free(ptr >>> 0, 1));
|
|
4298
|
-
const FragmentFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4299
|
-
? { register: () => {}, unregister: () => {} }
|
|
4300
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_fragment_free(ptr >>> 0, 1));
|
|
4301
|
-
const FragmentRequestedFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4302
|
-
? { register: () => {}, unregister: () => {} }
|
|
4303
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_fragmentrequested_free(ptr >>> 0, 1));
|
|
4304
|
-
const FragmentWithBlobFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4305
|
-
? { register: () => {}, unregister: () => {} }
|
|
4306
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_fragmentwithblob_free(ptr >>> 0, 1));
|
|
4307
|
-
const FragmentsArrayFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4308
|
-
? { register: () => {}, unregister: () => {} }
|
|
4309
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_fragmentsarray_free(ptr >>> 0, 1));
|
|
4310
|
-
const HashMetricFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4311
|
-
? { register: () => {}, unregister: () => {} }
|
|
4312
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_hashmetric_free(ptr >>> 0, 1));
|
|
4313
|
-
const SubductionHttpLongPollFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4314
|
-
? { register: () => {}, unregister: () => {} }
|
|
4315
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_subductionhttplongpoll_free(ptr >>> 0, 1));
|
|
4316
|
-
const SubductionLongPollFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4317
|
-
? { register: () => {}, unregister: () => {} }
|
|
4318
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_subductionlongpoll_free(ptr >>> 0, 1));
|
|
4319
|
-
const LooseCommitFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4320
|
-
? { register: () => {}, unregister: () => {} }
|
|
4321
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_loosecommit_free(ptr >>> 0, 1));
|
|
4322
|
-
const SyncMessageFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4323
|
-
? { register: () => {}, unregister: () => {} }
|
|
4324
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_syncmessage_free(ptr >>> 0, 1));
|
|
4325
|
-
const MessagePortTransportFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4326
|
-
? { register: () => {}, unregister: () => {} }
|
|
4327
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_messageporttransport_free(ptr >>> 0, 1));
|
|
4328
|
-
const NonceFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4329
|
-
? { register: () => {}, unregister: () => {} }
|
|
4330
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_nonce_free(ptr >>> 0, 1));
|
|
4331
|
-
const PeerIdFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4332
|
-
? { register: () => {}, unregister: () => {} }
|
|
4333
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_peerid_free(ptr >>> 0, 1));
|
|
4334
|
-
const PeerResultMapFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4335
|
-
? { register: () => {}, unregister: () => {} }
|
|
4336
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_peerresultmap_free(ptr >>> 0, 1));
|
|
4337
|
-
const RequestIdFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4338
|
-
? { register: () => {}, unregister: () => {} }
|
|
4339
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_requestid_free(ptr >>> 0, 1));
|
|
4340
|
-
const SedimentreeFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4341
|
-
? { register: () => {}, unregister: () => {} }
|
|
4342
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_sedimentree_free(ptr >>> 0, 1));
|
|
4343
|
-
const SedimentreeIdFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4344
|
-
? { register: () => {}, unregister: () => {} }
|
|
4345
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_sedimentreeid_free(ptr >>> 0, 1));
|
|
4346
|
-
const SedimentreeIdsArrayFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4347
|
-
? { register: () => {}, unregister: () => {} }
|
|
4348
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_sedimentreeidsarray_free(ptr >>> 0, 1));
|
|
4349
|
-
const SignedFragmentFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4350
|
-
? { register: () => {}, unregister: () => {} }
|
|
4351
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_signedfragment_free(ptr >>> 0, 1));
|
|
4352
|
-
const SignedLooseCommitFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4353
|
-
? { register: () => {}, unregister: () => {} }
|
|
4354
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_signedloosecommit_free(ptr >>> 0, 1));
|
|
4355
|
-
const SubductionFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4356
|
-
? { register: () => {}, unregister: () => {} }
|
|
4357
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_subduction_free(ptr >>> 0, 1));
|
|
4358
|
-
const SyncStatsFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4359
|
-
? { register: () => {}, unregister: () => {} }
|
|
4360
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_syncstats_free(ptr >>> 0, 1));
|
|
4361
|
-
const SubductionWebSocketFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4362
|
-
? { register: () => {}, unregister: () => {} }
|
|
4363
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_subductionwebsocket_free(ptr >>> 0, 1));
|
|
4364
|
-
const WebCryptoSignerFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4365
|
-
? { register: () => {}, unregister: () => {} }
|
|
4366
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_webcryptosigner_free(ptr >>> 0, 1));
|
|
4367
|
-
|
|
4368
|
-
function addToExternrefTable0(obj) {
|
|
4369
|
-
const idx = wasm.__wbindgen_export4();
|
|
4370
|
-
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
4371
|
-
return idx;
|
|
4372
|
-
}
|
|
4373
|
-
|
|
4374
|
-
function _assertClass(instance, klass) {
|
|
4375
|
-
if (!(instance instanceof klass)) {
|
|
4376
|
-
throw new Error(`expected instance of ${klass.name}`);
|
|
4377
|
-
}
|
|
4378
|
-
}
|
|
4379
|
-
|
|
4380
|
-
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
|
|
4381
|
-
? { register: () => {}, unregister: () => {} }
|
|
4382
|
-
: new FinalizationRegistry(state => state.dtor(state.a, state.b));
|
|
4383
|
-
|
|
4384
|
-
function debugString(val) {
|
|
4385
|
-
// primitive types
|
|
4386
|
-
const type = typeof val;
|
|
4387
|
-
if (type == 'number' || type == 'boolean' || val == null) {
|
|
4388
|
-
return `${val}`;
|
|
4389
|
-
}
|
|
4390
|
-
if (type == 'string') {
|
|
4391
|
-
return `"${val}"`;
|
|
4392
|
-
}
|
|
4393
|
-
if (type == 'symbol') {
|
|
4394
|
-
const description = val.description;
|
|
4395
|
-
if (description == null) {
|
|
4396
|
-
return 'Symbol';
|
|
4397
|
-
} else {
|
|
4398
|
-
return `Symbol(${description})`;
|
|
4399
|
-
}
|
|
4400
|
-
}
|
|
4401
|
-
if (type == 'function') {
|
|
4402
|
-
const name = val.name;
|
|
4403
|
-
if (typeof name == 'string' && name.length > 0) {
|
|
4404
|
-
return `Function(${name})`;
|
|
4405
|
-
} else {
|
|
4406
|
-
return 'Function';
|
|
4407
|
-
}
|
|
4408
|
-
}
|
|
4409
|
-
// objects
|
|
4410
|
-
if (Array.isArray(val)) {
|
|
4411
|
-
const length = val.length;
|
|
4412
|
-
let debug = '[';
|
|
4413
|
-
if (length > 0) {
|
|
4414
|
-
debug += debugString(val[0]);
|
|
4415
|
-
}
|
|
4416
|
-
for(let i = 1; i < length; i++) {
|
|
4417
|
-
debug += ', ' + debugString(val[i]);
|
|
4418
|
-
}
|
|
4419
|
-
debug += ']';
|
|
4420
|
-
return debug;
|
|
4421
|
-
}
|
|
4422
|
-
// Test for built-in
|
|
4423
|
-
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
4424
|
-
let className;
|
|
4425
|
-
if (builtInMatches && builtInMatches.length > 1) {
|
|
4426
|
-
className = builtInMatches[1];
|
|
4427
|
-
} else {
|
|
4428
|
-
// Failed to match the standard '[object ClassName]'
|
|
4429
|
-
return toString.call(val);
|
|
4430
|
-
}
|
|
4431
|
-
if (className == 'Object') {
|
|
4432
|
-
// we're a user defined class or Object
|
|
4433
|
-
// JSON.stringify avoids problems with cycles, and is generally much
|
|
4434
|
-
// easier than looping through ownProperties of `val`.
|
|
4435
|
-
try {
|
|
4436
|
-
return 'Object(' + JSON.stringify(val) + ')';
|
|
4437
|
-
} catch (_) {
|
|
4438
|
-
return 'Object';
|
|
4439
|
-
}
|
|
4440
|
-
}
|
|
4441
|
-
// errors
|
|
4442
|
-
if (val instanceof Error) {
|
|
4443
|
-
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
4444
|
-
}
|
|
4445
|
-
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
4446
|
-
return className;
|
|
4447
|
-
}
|
|
4448
|
-
|
|
4449
|
-
function getArrayJsValueFromWasm0(ptr, len) {
|
|
4450
|
-
ptr = ptr >>> 0;
|
|
4451
|
-
const mem = getDataViewMemory0();
|
|
4452
|
-
const result = [];
|
|
4453
|
-
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
4454
|
-
result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
|
|
4455
|
-
}
|
|
4456
|
-
wasm.__wbindgen_export6(ptr, len);
|
|
4457
|
-
return result;
|
|
4458
|
-
}
|
|
4459
|
-
|
|
4460
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
4461
|
-
ptr = ptr >>> 0;
|
|
4462
|
-
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
4463
|
-
}
|
|
4464
|
-
|
|
4465
|
-
let cachedDataViewMemory0 = null;
|
|
4466
|
-
function getDataViewMemory0() {
|
|
4467
|
-
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
4468
|
-
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
4469
|
-
}
|
|
4470
|
-
return cachedDataViewMemory0;
|
|
4471
|
-
}
|
|
4472
|
-
|
|
4473
|
-
function getStringFromWasm0(ptr, len) {
|
|
4474
|
-
ptr = ptr >>> 0;
|
|
4475
|
-
return decodeText(ptr, len);
|
|
4476
|
-
}
|
|
4477
|
-
|
|
4478
|
-
let cachedUint8ArrayMemory0 = null;
|
|
4479
|
-
function getUint8ArrayMemory0() {
|
|
4480
|
-
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
4481
|
-
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
4482
|
-
}
|
|
4483
|
-
return cachedUint8ArrayMemory0;
|
|
4484
|
-
}
|
|
4485
|
-
|
|
4486
|
-
function handleError(f, args) {
|
|
4487
|
-
try {
|
|
4488
|
-
return f.apply(this, args);
|
|
4489
|
-
} catch (e) {
|
|
4490
|
-
const idx = addToExternrefTable0(e);
|
|
4491
|
-
wasm.__wbindgen_export3(idx);
|
|
4492
|
-
}
|
|
4493
|
-
}
|
|
4494
|
-
|
|
4495
|
-
function isLikeNone(x) {
|
|
4496
|
-
return x === undefined || x === null;
|
|
4497
|
-
}
|
|
4498
|
-
|
|
4499
|
-
function makeClosure(arg0, arg1, dtor, f) {
|
|
4500
|
-
const state = { a: arg0, b: arg1, cnt: 1, dtor };
|
|
4501
|
-
const real = (...args) => {
|
|
4502
|
-
|
|
4503
|
-
// First up with a closure we increment the internal reference
|
|
4504
|
-
// count. This ensures that the Rust closure environment won't
|
|
4505
|
-
// be deallocated while we're invoking it.
|
|
4506
|
-
state.cnt++;
|
|
4507
|
-
try {
|
|
4508
|
-
return f(state.a, state.b, ...args);
|
|
4509
|
-
} finally {
|
|
4510
|
-
real._wbg_cb_unref();
|
|
4511
|
-
}
|
|
4512
|
-
};
|
|
4513
|
-
real._wbg_cb_unref = () => {
|
|
4514
|
-
if (--state.cnt === 0) {
|
|
4515
|
-
state.dtor(state.a, state.b);
|
|
4516
|
-
state.a = 0;
|
|
4517
|
-
CLOSURE_DTORS.unregister(state);
|
|
4518
|
-
}
|
|
4519
|
-
};
|
|
4520
|
-
CLOSURE_DTORS.register(real, state, state);
|
|
4521
|
-
return real;
|
|
4522
|
-
}
|
|
4523
|
-
|
|
4524
|
-
function makeMutClosure(arg0, arg1, dtor, f) {
|
|
4525
|
-
const state = { a: arg0, b: arg1, cnt: 1, dtor };
|
|
4526
|
-
const real = (...args) => {
|
|
4527
|
-
|
|
4528
|
-
// First up with a closure we increment the internal reference
|
|
4529
|
-
// count. This ensures that the Rust closure environment won't
|
|
4530
|
-
// be deallocated while we're invoking it.
|
|
4531
|
-
state.cnt++;
|
|
4532
|
-
const a = state.a;
|
|
4533
|
-
state.a = 0;
|
|
4534
|
-
try {
|
|
4535
|
-
return f(a, state.b, ...args);
|
|
4536
|
-
} finally {
|
|
4537
|
-
state.a = a;
|
|
4538
|
-
real._wbg_cb_unref();
|
|
4539
|
-
}
|
|
4540
|
-
};
|
|
4541
|
-
real._wbg_cb_unref = () => {
|
|
4542
|
-
if (--state.cnt === 0) {
|
|
4543
|
-
state.dtor(state.a, state.b);
|
|
4544
|
-
state.a = 0;
|
|
4545
|
-
CLOSURE_DTORS.unregister(state);
|
|
4546
|
-
}
|
|
4547
|
-
};
|
|
4548
|
-
CLOSURE_DTORS.register(real, state, state);
|
|
4549
|
-
return real;
|
|
4550
|
-
}
|
|
4551
|
-
|
|
4552
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
4553
|
-
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
4554
|
-
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
4555
|
-
WASM_VECTOR_LEN = arg.length;
|
|
4556
|
-
return ptr;
|
|
4557
|
-
}
|
|
4558
|
-
|
|
4559
|
-
function passArrayJsValueToWasm0(array, malloc) {
|
|
4560
|
-
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
4561
|
-
for (let i = 0; i < array.length; i++) {
|
|
4562
|
-
const add = addToExternrefTable0(array[i]);
|
|
4563
|
-
getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
|
|
4564
|
-
}
|
|
4565
|
-
WASM_VECTOR_LEN = array.length;
|
|
4566
|
-
return ptr;
|
|
4567
|
-
}
|
|
4568
|
-
|
|
4569
|
-
function passStringToWasm0(arg, malloc, realloc) {
|
|
4570
|
-
if (realloc === undefined) {
|
|
4571
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
4572
|
-
const ptr = malloc(buf.length, 1) >>> 0;
|
|
4573
|
-
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
4574
|
-
WASM_VECTOR_LEN = buf.length;
|
|
4575
|
-
return ptr;
|
|
4576
|
-
}
|
|
4577
|
-
|
|
4578
|
-
let len = arg.length;
|
|
4579
|
-
let ptr = malloc(len, 1) >>> 0;
|
|
4580
|
-
|
|
4581
|
-
const mem = getUint8ArrayMemory0();
|
|
4582
|
-
|
|
4583
|
-
let offset = 0;
|
|
4584
|
-
|
|
4585
|
-
for (; offset < len; offset++) {
|
|
4586
|
-
const code = arg.charCodeAt(offset);
|
|
4587
|
-
if (code > 0x7F) break;
|
|
4588
|
-
mem[ptr + offset] = code;
|
|
4589
|
-
}
|
|
4590
|
-
if (offset !== len) {
|
|
4591
|
-
if (offset !== 0) {
|
|
4592
|
-
arg = arg.slice(offset);
|
|
4593
|
-
}
|
|
4594
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
4595
|
-
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
4596
|
-
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
4597
|
-
|
|
4598
|
-
offset += ret.written;
|
|
4599
|
-
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
4600
|
-
}
|
|
4601
|
-
|
|
4602
|
-
WASM_VECTOR_LEN = offset;
|
|
4603
|
-
return ptr;
|
|
4604
|
-
}
|
|
4605
|
-
|
|
4606
|
-
function takeFromExternrefTable0(idx) {
|
|
4607
|
-
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
4608
|
-
wasm.__wbindgen_export7(idx);
|
|
4609
|
-
return value;
|
|
4610
|
-
}
|
|
4611
|
-
|
|
4612
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
4613
|
-
cachedTextDecoder.decode();
|
|
4614
|
-
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
4615
|
-
let numBytesDecoded = 0;
|
|
4616
|
-
function decodeText(ptr, len) {
|
|
4617
|
-
numBytesDecoded += len;
|
|
4618
|
-
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
4619
|
-
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
4620
|
-
cachedTextDecoder.decode();
|
|
4621
|
-
numBytesDecoded = len;
|
|
4622
|
-
}
|
|
4623
|
-
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
4624
|
-
}
|
|
4625
|
-
|
|
4626
|
-
const cachedTextEncoder = new TextEncoder();
|
|
4627
|
-
|
|
4628
|
-
if (!('encodeInto' in cachedTextEncoder)) {
|
|
4629
|
-
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
4630
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
4631
|
-
view.set(buf);
|
|
4632
|
-
return {
|
|
4633
|
-
read: arg.length,
|
|
4634
|
-
written: buf.length
|
|
4635
|
-
};
|
|
4636
|
-
};
|
|
4637
|
-
}
|
|
4638
|
-
|
|
4639
|
-
let WASM_VECTOR_LEN = 0;
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
let wasm;
|
|
4643
|
-
export function __wbg_set_wasm(val) {
|
|
4644
|
-
wasm = val;
|
|
4645
|
-
}
|